Add option to control focus on CKEditor

https://www.xetown.com/qna/801549
This commit is contained in:
Kijin Sung 2017-11-21 15:33:24 +09:00
parent cb2920bc99
commit 9ba0b1e3e6
4 changed files with 5 additions and 1 deletions

View file

@ -253,6 +253,7 @@ class communicationView extends communication
$option->height = 300; $option->height = 300;
$option->skin = $this->config->editor_skin; $option->skin = $this->config->editor_skin;
$option->colorset = $this->config->editor_colorset; $option->colorset = $this->config->editor_colorset;
$option->editor_focus = Context::get('source_message') ? 'Y' : 'N';
$editor = $oEditorModel->getEditor($logged_info->member_srl, $option); $editor = $oEditorModel->getEditor($logged_info->member_srl, $option);
Context::set('editor', $editor); Context::set('editor', $editor);

View file

@ -47,6 +47,7 @@ class editor extends ModuleObject
'content_word_break' => 'normal', 'content_word_break' => 'normal',
'enable_autosave' => 'Y', 'enable_autosave' => 'Y',
'allow_html' => 'Y', 'allow_html' => 'Y',
'editor_focus' => 'N',
'autoinsert_image' => 'paragraph', 'autoinsert_image' => 'paragraph',
'additional_css' => array(), 'additional_css' => array(),
'additional_mobile_css' => array(), 'additional_mobile_css' => array(),

View file

@ -169,8 +169,9 @@ class editorModel extends editor
} }
Context::set('enable_autosave', $option->enable_autosave); Context::set('enable_autosave', $option->enable_autosave);
// Set allow html // Set allow html and focus
Context::set('allow_html', ($option->allow_html === false || $option->allow_html === 'N') ? false : true); Context::set('allow_html', ($option->allow_html === false || $option->allow_html === 'N') ? false : true);
Context::set('editor_focus', toBool($option->editor_focus));
// Load editor components. // Load editor components.
$site_srl = Context::get('site_module_info')->site_srl ?: 0; $site_srl = Context::get('site_module_info')->site_srl ?: 0;

View file

@ -104,6 +104,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}";
fontSize_sizes: font_sizes, fontSize_sizes: font_sizes,
toolbarCanCollapse: true, toolbarCanCollapse: true,
allowedContent: true, allowedContent: true,
startupFocus: {json_encode($editor_focus)},
language: "{str_replace('jp','ja',$lang_type)}" language: "{str_replace('jp','ja',$lang_type)}"
}, },
loadXeComponent: true, loadXeComponent: true,