diff --git a/modules/editor/editor.admin.controller.php b/modules/editor/editor.admin.controller.php index 8f79978bf..aa440f1c0 100644 --- a/modules/editor/editor.admin.controller.php +++ b/modules/editor/editor.admin.controller.php @@ -44,6 +44,10 @@ class editorAdminController extends editor $output = $this->editorCheckUse($componentList,$site_module_info->site_srl); if(!$output->toBool()) return new BaseObject(); + $config = ModuleModel::getModuleConfig('editor') ?: new stdClass; + $config->timestamp = time(); + ModuleController::getInstance()->insertModuleConfig('editor', $config); + $oEditorController = getController('editor'); $oEditorController->removeCache($site_module_info->site_srl); $this->setRedirectUrl(Context::get('error_return_url')); @@ -239,6 +243,7 @@ class editorAdminController extends editor $config->autoinsert_types[$type] = true; } $config->autoinsert_position = in_array($configVars->autoinsert_position, array('paragraph', 'inline')) ? $configVars->autoinsert_position : 'paragraph'; + $config->timestamp = time(); $oModuleController->insertModuleConfig('editor', $config); $this->setRedirectUrl(Context::get('error_return_url')); diff --git a/modules/editor/editor.class.php b/modules/editor/editor.class.php index d3fffadd0..972be1421 100644 --- a/modules/editor/editor.class.php +++ b/modules/editor/editor.class.php @@ -57,6 +57,7 @@ class editor extends ModuleObject 'additional_mobile_css' => array(), 'additional_plugins' => array(), 'remove_plugins' => array('liststyle', 'tabletools', 'tableselection', 'contextmenu', 'exportpdf'), + 'timestamp' => 0, ); /** diff --git a/modules/editor/editor.model.php b/modules/editor/editor.model.php index 115ce5ec8..4720faa6d 100644 --- a/modules/editor/editor.model.php +++ b/modules/editor/editor.model.php @@ -265,6 +265,9 @@ class editorModel extends editor // Check an option whether to start the editor manually. Context::set('editor_manual_start', $option->manual_start ?? null); + // Add the timestamp for the editor module config. + Context::set('editor_config_timestamp', $option->timestamp ?? 0); + // Compile and return the editor skin template. $tpl_path = Context::get('editor_path'); Context::loadLang($tpl_path.'lang'); diff --git a/modules/editor/skins/ckeditor/editor.html b/modules/editor/skins/ckeditor/editor.html index 5c2bc8a51..be1ab6665 100644 --- a/modules/editor/skins/ckeditor/editor.html +++ b/modules/editor/skins/ckeditor/editor.html @@ -51,10 +51,10 @@ var auto_saved_msg = "{$lang->msg_auto_saved}"; jQuery(function($){ "use strict"; CKEDITOR.config.customConfig = ''; - + // Import CSS content from PHP. var css_content = {json_encode($css_content)}; - + // Get default font name and list of other supported fonts. var default_font_name = {json_encode($content_font ? trim(array_first(explode(',', $content_font)), '\'" ') : null)}; var default_font_fullname = {json_encode($content_font ?: null)}; @@ -79,7 +79,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}"; font_list = $.map(font_list, function(val) { return $.trim(val.split(",")[0]) + "/" + val; }).join(";"); - + // Get default font size and list of other supported sizes. var default_font_size = {json_encode(strval($content_font_size ?: '13'))}; default_font_size = parseInt(default_font_size.replace(/\D/, ''), 10); @@ -91,7 +91,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}"; font_sizes = $.map(font_sizes, function(val) { return val + "/" + val + "px"; }).join(";"); - + // Apply auto dark mode. var editor_skin = '{$colorset}'; var editor_color = null; @@ -103,7 +103,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}"; } } - + // Initialize CKEditor settings. var settings = { ckeconfig: { @@ -124,7 +124,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}"; enableToolbar: true, content_field: jQuery('[name={$editor_content_key_name}]') }; - + // Add style-sheet for the WYSIWYG $(document.getElementsByTagName('link')).each(function() { if ($(this).attr('rel') == 'stylesheet') { @@ -135,9 +135,9 @@ var auto_saved_msg = "{$lang->msg_auto_saved}"; // Prevent removal of icon fonts and Google code. CKEDITOR.dtd.$removeEmpty.i = 0; CKEDITOR.dtd.$removeEmpty.ins = 0; - + // Set the timestamp for plugins. - CKEDITOR.timestamp = '{strtoupper(dechex(max($ckeditor_main_filemtime, $ckeditor_config_filemtime)))}'; + CKEDITOR.timestamp = '{strtoupper(dechex(max($ckeditor_main_filemtime, $ckeditor_config_filemtime, $editor_config_timestamp ?? 0)))}'; // Add editor components. @@ -170,7 +170,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}"; settings.ckeconfig.removePlugins = {json_encode(implode(',', $editor_remove_plugins))}; - + // https://github.com/rhymix/rhymix/issues/932 if (CKEDITOR.env.iOS) { settings.ckeconfig.extraPlugins = (settings.ckeconfig.extraPlugins ? (settings.ckeconfig.extraPlugins + ',') : '') + 'divarea,ios_enterkey'; @@ -203,7 +203,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}"; // Initialize CKEditor. var ckeApp = $('#ckeditor_instance_{$editor_sequence}').XeCkEditor(settings); - + // Add use_editor and use_html fields to parent form. var parentform = $('#ckeditor_instance_{$editor_sequence}').parents('form'); var use_editor = parentform.find("input[name='use_editor']");