Changeset 3980:df625feec28c for plugins
- Timestamp:
- 06/24/19 14:29:57 (6 years ago)
- Branch:
- default
- Location:
- plugins/themeEditor
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/themeEditor/_admin.php
r3874 r3980 70 70 form::combo('colorsyntax_theme', $themes_combo, 71 71 [ 72 'default' => $core->auth->user_prefs->interface->colorsyntax_theme,73 'extra_html' => 'onchange="selectTheme()"']) .72 'default' => $core->auth->user_prefs->interface->colorsyntax_theme 73 ]) . 74 74 '</p>'; 75 75 } else { … … 97 97 }</textarea>'; 98 98 echo 99 '<script> 100 var input = document.getElementById("colorsyntax_theme"); 101 var theme = input.options[input.selectedIndex].textContent; 102 var editor = CodeMirror.fromTextArea(document.getElementById("codemirror"), { 103 mode: "javascript", 104 tabMode: "indent", 105 lineWrapping: 1, 106 lineNumbers: 1, 107 matchBrackets: 1, 108 autoCloseBrackets: 1, 109 theme: "' . ($core->auth->user_prefs->interface->colorsyntax_theme != '' ? $core->auth->user_prefs->interface->colorsyntax_theme : 'default') . '" 110 }); 111 function selectTheme() { 112 var input = document.getElementById("colorsyntax_theme"); 113 var theme = input.options[input.selectedIndex].value; 114 if (theme == "") theme = "default"; 115 editor.setOption("theme", theme); 116 editor.refresh(); 117 } 118 </script>'; 99 dcPage::jsJson('theme_editor_current', ['theme' => $core->auth->user_prefs->interface->colorsyntax_theme != '' ? $core->auth->user_prefs->interface->colorsyntax_theme : 'default']) . 100 dcPage::jsLoad(dcPage::getPF('themeEditor/js/theme.js')); 119 101 echo '</div>'; 120 102 echo '</div>'; -
plugins/themeEditor/index.php
r3874 r3980 66 66 <title><?php echo __('Edit theme files'); ?></title> 67 67 <?php 68 echo dcPage::jsVars([ 69 'dotclear.msg.saving_document' => __("Saving document..."), 70 'dotclear.msg.document_saved' => __("Document saved"), 71 'dotclear.msg.error_occurred' => __("An error occurred:"), 72 'dotclear.msg.confirm_reset_file' => __("Are you sure you want to reset this file?") 68 if ($user_ui_colorsyntax) { 69 echo dcPage::jsJson('dotclear_colorsyntax', ['colorsyntax' => $user_ui_colorsyntax]); 70 } 71 echo dcPage::jsJson('theme_editor_msg', [ 72 'saving_document' => __("Saving document..."), 73 'document_saved' => __("Document saved"), 74 'error_occurred' => __("An error occurred:"), 75 'confirm_reset_file' => __("Are you sure you want to reset this file?") 73 76 ]) . 74 dcPage::js ConfirmClose('file-form') .75 dcPage::js Load(dcPage::getPF('themeEditor/js/script.js'));77 dcPage::jsLoad(dcPage::getPF('themeEditor/js/script.js')) . 78 dcPage::jsConfirmClose('file-form') ; 76 79 if ($user_ui_colorsyntax) { 77 echo dcPage::jsVars(['dotclear.colorsyntax' => $user_ui_colorsyntax]);78 80 echo dcPage::jsLoadCodeMirror($user_ui_colorsyntax_theme); 79 81 } … … 135 137 (!empty($_REQUEST['js']) ? "javascript" : 136 138 (!empty($_REQUEST['po']) ? "text/plain" : "text/html"))); 137 echo 138 '<script type="text/javascript"> 139 window.CodeMirror.defineMode("dotclear", function(config) { 140 return CodeMirror.multiplexingMode( 141 CodeMirror.getMode(config, "' . $editorMode . '"), 142 {open: "{{tpl:", close: "}}", 143 mode: CodeMirror.getMode(config, "text/plain"), 144 delimStyle: "delimit"}, 145 {open: "<tpl:", close: ">", 146 mode: CodeMirror.getMode(config, "text/plain"), 147 delimStyle: "delimit"}, 148 {open: "</tpl:", close: ">", 149 mode: CodeMirror.getMode(config, "text/plain"), 150 delimStyle: "delimit"} 151 ); 152 }); 153 </script>'; 139 echo dcPage::jsJson('theme_editor_mode', ['mode' => $editorMode]); 140 echo dcPage::jsLoad(dcPage::getPF('themeEditor/js/mode.js')); 154 141 echo dcPage::jsRunCodeMirror('editor', 'file_content', 'dotclear', $user_ui_colorsyntax_theme); 155 142 } -
plugins/themeEditor/js/script.js
r3880 r3980 1 /*global $, dotclear, editor, confirmClosePage */1 /*global $, dotclear, editor, confirmClosePage, getData */ 2 2 'use strict'; 3 4 // Get locales and setting 5 Object.assign(dotclear.msg, getData('theme_editor_msg')); 6 Object.assign(dotclear, getData('dotclear_colorsyntax')); 3 7 4 8 $(function() {
Note: See TracChangeset
for help on using the changeset viewer.