diff --git a/edit/editor-worker.js b/edit/editor-worker.js index a84bb939..62ef380c 100644 --- a/edit/editor-worker.js +++ b/edit/editor-worker.js @@ -1,5 +1,4 @@ /* global importScripts workerUtil CSSLint require metaParser */ -/* exported editorWorker */ 'use strict'; importScripts('/js/worker-util.js'); diff --git a/edit/reroute-hotkeys.js b/edit/reroute-hotkeys.js index 5ca2f149..83f57720 100644 --- a/edit/reroute-hotkeys.js +++ b/edit/reroute-hotkeys.js @@ -14,10 +14,10 @@ const rerouteHotkeys = (() => { 'colorpicker', ]); - rerouteHotkeys(true); - return rerouteHotkeys; + // note that this function relies on `editor`. Calling this function before + // the editor is initialized may throw an error. function rerouteHotkeys(enable, immediately) { if (!immediately) { debounce(rerouteHotkeys, 0, enable, true); @@ -29,9 +29,6 @@ const rerouteHotkeys = (() => { } function rerouteHandler(event) { - if (typeof editor === 'undefined') { - return; - } const keyName = CodeMirror.keyName(event); if (!keyName) { return; diff --git a/edit/sections-editor-section.js b/edit/sections-editor-section.js index cf29822f..2c566f87 100644 --- a/edit/sections-editor-section.js +++ b/edit/sections-editor-section.js @@ -70,17 +70,21 @@ function createResizeGrip(cm) { } function createSection({ + // data model originalSection, - genId, dirty, + // util + nextEditor, + prevEditor, + genId, + // emit events + // TODO: better names like `onRemoved`? Or make a real event emitter. showMozillaFormatImport, removeSection, insertSectionAfter, moveSectionUp, moveSectionDown, restoreSection, - nextEditor, - prevEditor }) { const sectionId = genId(); const el = template.section.cloneNode(true);