Update CKEditor timestamp if editor module config is updated #2173

This commit is contained in:
Kijin Sung 2023-09-12 23:03:12 +09:00
parent ec674dc25f
commit 68ee78f1f8
4 changed files with 19 additions and 10 deletions

View file

@ -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'));

View file

@ -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,
);
/**

View file

@ -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');

View file

@ -137,7 +137,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}";
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.
<!--@if($enable_component)-->