Fix: minor

This commit is contained in:
eight 2018-10-14 16:17:45 +08:00
parent 05a87ed00f
commit 05a6208f5c
3 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,4 @@
/* global importScripts workerUtil CSSLint require metaParser */
/* exported editorWorker */
'use strict';
importScripts('/js/worker-util.js');

View File

@ -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;

View File

@ -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);