fixup 1c68ac1a: init the find hook after the original one

This commit is contained in:
tophf 2017-12-14 09:27:46 +03:00
parent 6f81544ebe
commit 49a995afae

View File

@ -22,24 +22,12 @@ onDOMscriptReady('/codemirror.js').then(() => {
...Object.keys(COMMANDS), ...Object.keys(COMMANDS),
'colorpicker', 'colorpicker',
]); ]);
const ORIGINAL_COMMAND = {};
const ORIGINAL_COMMAND = { const ORIGINAL_METHOD = {};
find: CodeMirror.commands.find,
findNext: CodeMirror.commands.findNext,
findPrev: CodeMirror.commands.findPrev,
replace: CodeMirror.commands.replace
};
const ORIGINAL_METHOD = {
openDialog: CodeMirror.prototype.openDialog,
openConfirm: CodeMirror.prototype.openConfirm,
};
Object.assign(CodeMirror, { Object.assign(CodeMirror, {
getOption, getOption,
setOption, setOption,
}); });
Object.assign(CodeMirror.commands,
COMMANDS);
Object.assign(CodeMirror.prototype, { Object.assign(CodeMirror.prototype, {
getSection, getSection,
rerouteHotkeys, rerouteHotkeys,
@ -63,6 +51,14 @@ onDOMscriptReady('/codemirror.js').then(() => {
setupLivePrefs(); setupLivePrefs();
rerouteHotkeys(true); rerouteHotkeys(true);
for (const name of ['find', 'findNext', 'findPrev', 'replace']) {
ORIGINAL_COMMAND[name] = CodeMirror.commands[name];
}
for (const name of ['openDialog', 'openConfirm']) {
ORIGINAL_METHOD[name] = CodeMirror.prototype[name];
}
Object.assign(CodeMirror.commands, COMMANDS);
}).observe(document, {childList: true, subtree: true}); }).observe(document, {childList: true, subtree: true});
return; return;