diff --git a/inc/config.class.php b/inc/config.class.php index 23512bb..e880234 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -3,7 +3,6 @@ class PluginButterflyConfig extends CommonDBTM { private static $_cache = null; - private static $_i = 1; static function getConfig($name, $defaultValue = null) { @@ -241,32 +240,13 @@ class PluginButterflyConfig extends CommonDBTM { Html::parseAttributes([ 'id' => $fullName . '_' . $rand, 'name' => $fullName, - 'class' => 'butterfly-codemirror', + 'class' => 'butterfly-css-editor', + 'rows' => 15, + 'spellcheck' => 'false', ]) ); echo rtrim($this->fields[$fullName]); - echo str_repeat("\n", 10); echo ''; - - echo Html::scriptBlock(' - $(function() { - var textarea = document.getElementById("' . $fullName . '_' . $rand . '"); - var editorCode = CodeMirror.fromTextArea(textarea, { - mode: "text/x-scss", - lineNumbers: true, - viewportMargin: Infinity, - extraKeys: { - "Ctrl-Space": "autocomplete" - }, - foldGutter: true, - gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"] - }); - $("#' . $fullName . '_' . $rand . '").data("CodeMirrorInstance", editorCode); - - // Fix bad display of gutter (see https://github.com/codemirror/CodeMirror/issues/3098 ) - setTimeout(function () {editorCode.refresh();}, ' . (500 + self::$_i++ * 100) . '); - }); - '); echo ""; echo "\n"; } @@ -311,9 +291,10 @@ class PluginButterflyConfig extends CommonDBTM { #tabs$rand .ui-tabs-panel { margin-left: 0; } - .CodeMirror { + .butterfly-css-editor { + width: 100%; border: 1px solid #eee; - height: auto; + font-family: monospace; } .butterfly-themeselect-container .select2-selection__rendered, .butterfly-themeselect-dropdown .select2-results__option { @@ -598,17 +579,6 @@ class PluginButterflyConfig extends CommonDBTM { // echo ""; - echo Html::scriptBlock("$('#tabs$rand').tabs({ - activate: function(event, ui) { - localStorage['butterfly_last_tab'] = $('#tabs$rand').tabs('option', 'active'); - var editor = ui.newPanel.find('.butterfly-codemirror').data('CodeMirrorInstance'); - if (editor) { - editor.refresh(); - } - }, - active: localStorage['butterfly_last_tab'] - });"); - if ($canedit) { echo "