Fix: minor
This commit is contained in:
parent
05a87ed00f
commit
05a6208f5c
|
@ -1,5 +1,4 @@
|
||||||
/* global importScripts workerUtil CSSLint require metaParser */
|
/* global importScripts workerUtil CSSLint require metaParser */
|
||||||
/* exported editorWorker */
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
importScripts('/js/worker-util.js');
|
importScripts('/js/worker-util.js');
|
||||||
|
|
|
@ -14,10 +14,10 @@ const rerouteHotkeys = (() => {
|
||||||
'colorpicker',
|
'colorpicker',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
rerouteHotkeys(true);
|
|
||||||
|
|
||||||
return rerouteHotkeys;
|
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) {
|
function rerouteHotkeys(enable, immediately) {
|
||||||
if (!immediately) {
|
if (!immediately) {
|
||||||
debounce(rerouteHotkeys, 0, enable, true);
|
debounce(rerouteHotkeys, 0, enable, true);
|
||||||
|
@ -29,9 +29,6 @@ const rerouteHotkeys = (() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
function rerouteHandler(event) {
|
function rerouteHandler(event) {
|
||||||
if (typeof editor === 'undefined') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const keyName = CodeMirror.keyName(event);
|
const keyName = CodeMirror.keyName(event);
|
||||||
if (!keyName) {
|
if (!keyName) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -70,17 +70,21 @@ function createResizeGrip(cm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createSection({
|
function createSection({
|
||||||
|
// data model
|
||||||
originalSection,
|
originalSection,
|
||||||
genId,
|
|
||||||
dirty,
|
dirty,
|
||||||
|
// util
|
||||||
|
nextEditor,
|
||||||
|
prevEditor,
|
||||||
|
genId,
|
||||||
|
// emit events
|
||||||
|
// TODO: better names like `onRemoved`? Or make a real event emitter.
|
||||||
showMozillaFormatImport,
|
showMozillaFormatImport,
|
||||||
removeSection,
|
removeSection,
|
||||||
insertSectionAfter,
|
insertSectionAfter,
|
||||||
moveSectionUp,
|
moveSectionUp,
|
||||||
moveSectionDown,
|
moveSectionDown,
|
||||||
restoreSection,
|
restoreSection,
|
||||||
nextEditor,
|
|
||||||
prevEditor
|
|
||||||
}) {
|
}) {
|
||||||
const sectionId = genId();
|
const sectionId = genId();
|
||||||
const el = template.section.cloneNode(true);
|
const el = template.section.cloneNode(true);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user