89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
if(this.response.isError){
preTgt.innerHTML = this.response.raw;
D.addClass(preTgt, 'error');
this.e.previewModeLabel.innerText = "Error";
return;
}
D.removeClass(preTgt, 'error');
D.removeClass(this.e.btnTogglePreviewMode, 'hidden');
let label;
switch(this.previewMode){
case 0:
label = "Rendered SVG";
preTgt.innerHTML = this.response.raw;
this.e.taPreviewText.value = this.response.raw.replace(f.rxNonce, '')/*for copy button*/;
break;
|
|
|
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
if(this.response.isError){
preTgt.innerHTML = this.response.raw;
D.addClass(preTgt, 'error');
this.e.previewModeLabel.innerText = "Error";
return;
}
D.removeClass(preTgt, 'error');
D.enable(this.e.btnTogglePreviewMode);
let label;
switch(this.previewMode){
case 0:
label = "Rendered SVG";
preTgt.innerHTML = this.response.raw;
this.e.taPreviewText.value = this.response.raw.replace(f.rxNonce, '')/*for copy button*/;
break;
|
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
label, this.e.btnCopy);
};
/** Fetches the preview from the server and updates the preview to
the rendered SVG content or error report. */
P.preview = function fp(){
if(!fp.hasOwnProperty('toDisable')){
fp.toDisable = [ /* elements to disable during ajax operations */
this.e.btnSubmit, this.e.taContent,
this.e.btnTogglePreviewMode, this.e.selectMarkupAlignment,
];
fp.target = this.e.previewTarget;
fp.updateView = function(c,isError){
P.previewMode = 0;
P.response.raw = c;
P.response.isError = isError;
D.enable(fp.toDisable);
P.renderPreview();
};
}
D.disable(fp.toDisable);
D.addClass(this.e.btnTogglePreviewMode, 'hidden');
const content = this.e.taContent.value.trim();
this.response.raw = undefined;
this.response.inputText = content;
if(!content){
fp.updateView("No pikchr content!",true);
return this;
}
|
>
|
|
>
|
<
|
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
label, this.e.btnCopy);
};
/** Fetches the preview from the server and updates the preview to
the rendered SVG content or error report. */
P.preview = function fp(){
if(!fp.hasOwnProperty('toDisable')){
fp.toDisable = [
/* input elements to disable during ajax operations */
this.e.btnSubmit, this.e.taContent,
this.e.selectMarkupAlignment
/* this.e.btnTogglePreviewMode is handled separately */
];
fp.target = this.e.previewTarget;
fp.updateView = function(c,isError){
P.previewMode = 0;
P.response.raw = c;
P.response.isError = isError;
D.enable(fp.toDisable);
P.renderPreview();
};
}
D.disable(fp.toDisable, this.e.btnTogglePreviewMode);
const content = this.e.taContent.value.trim();
this.response.raw = undefined;
this.response.inputText = content;
if(!content){
fp.updateView("No pikchr content!",true);
return this;
}
|