mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Update CKEditor timestamp if editor module config is updated #2173
This commit is contained in:
parent
ec674dc25f
commit
68ee78f1f8
4 changed files with 19 additions and 10 deletions
|
|
@ -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'));
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -51,10 +51,10 @@ var auto_saved_msg = "{$lang->msg_auto_saved}";
|
|||
jQuery(function($){
|
||||
"use strict";
|
||||
<!--@if(!$ckeditor_config_filemtime)-->CKEDITOR.config.customConfig = '';<!--@endif-->
|
||||
|
||||
|
||||
// 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}";
|
|||
}
|
||||
}
|
||||
<!--@endif-->
|
||||
|
||||
|
||||
// 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.
|
||||
<!--@if($enable_component)-->
|
||||
|
|
@ -170,7 +170,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}";
|
|||
<!--@if($editor_remove_plugins)-->
|
||||
settings.ckeconfig.removePlugins = {json_encode(implode(',', $editor_remove_plugins))};
|
||||
<!--@endif-->
|
||||
|
||||
|
||||
// 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']");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue