From b40f6c321c26bfb21ed40abb5f24244f41a7f991 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sun, 1 Jul 2018 09:15:20 +0000 Subject: [PATCH] fhem_codemirror.js: Fix FireFox 58+ problems with lineNumbers (Forum #87740) git-svn-id: https://svn.fhem.de/fhem/trunk@16926 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/www/codemirror/fhem_codemirror.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/fhem/www/codemirror/fhem_codemirror.js b/fhem/www/codemirror/fhem_codemirror.js index 8b3cbd8da..a09d8c07d 100644 --- a/fhem/www/codemirror/fhem_codemirror.js +++ b/fhem/www/codemirror/fhem_codemirror.js @@ -162,16 +162,21 @@ function cm_wait(cm_editor, callback, recursions) { return; } - var cm = CodeMirror.fromTextArea(cm_editor, cm_attr); + // setTimeout needed for FireFox 58+, Forum #87740 + setTimeout(function(){ + var cm = CodeMirror.fromTextArea(cm_editor, cm_attr); - if (cm_attr.autocomplete && cm_attr.autocompleteAlways) { - cm.on("keyup", function (cm, event) { - if ( !cm.state.completionActive && String.fromCharCode(event.keyCode).match(/\w/) ) { - CodeMirror.commands.autocomplete(cm, null, {completeSingle: false}); - } - }); - } + if (cm_attr.autocomplete && cm_attr.autocompleteAlways) { + cm.on("keyup", function (cm, event) { + if ( !cm.state.completionActive && + String.fromCharCode(event.keyCode).match(/\w/) ) { + CodeMirror.commands.autocomplete(cm, null, + {completeSingle: false}); + } + }); + } - if(callback) - callback(cm); + if(callback) + callback(cm); + }, 10); }