279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
-
+
+
+
+
|
};
/**
Submits the current input text to pikchr and renders the
result. */
PS.render = function f(txt){
preStartWork();
this.wMsg('pikchr',txt);
this.wMsg('pikchr',{
pikchr: txt,
darkMode: !!window.fossil.config.skin.isDark
});
};
const eOut = E('#pikchr-output');
const eOutWrapper = E('#pikchr-output-wrapper');
PS.addMsgHandler('pikchr', function(ev){
const m = ev.data;
eOut.classList[m.isError ? 'add' : 'remove']('error');
|
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
|
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
|
-
+
|
return;
}
f._ = text;
PS._isDirty = false;
PS.render(text || '');
}, 800, false);
taInput.addEventListener('keyup',function f(ev){
taInput.addEventListener('keydown',function f(ev){
if((ev.ctrlKey || ev.shiftKey) && 13 === ev.keyCode){
// Ctrl-enter and shift-enter both run the current input
PS._isDirty = false/*prevent a pending debounce from re-rendering*/;
ev.preventDefault();
ev.stopPropagation();
renderCurrentText();
return;
|