diff --git a/edit/base.js b/edit/base.js index b5d54726..c52ef1f7 100644 --- a/edit/base.js +++ b/edit/base.js @@ -363,14 +363,12 @@ function DirtyReporter() { } function LivePreview() { + let el; let data; let port; let preprocess; let enabled = prefs.get('editor.livePreview'); - const el = $('#preview-errors'); - el.onclick = () => messageBoxProxy.alert(el.title, 'pre'); - prefs.subscribe('editor.livePreview', (key, value) => { if (!value) { if (port) { @@ -410,6 +408,8 @@ function LivePreview() { port.onDisconnect.addListener(err => { throw err; }); + el = $('#preview-errors'); + el.onclick = () => messageBoxProxy.alert(el.title, 'pre'); } async function updatePreviewer(data) {