From 4adf2235242da40bfe30215c8bb3efc98783cf25 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 27 Jun 2017 18:04:26 +0900 Subject: [PATCH] Implement control of whether to hide the editor toolbar --- modules/editor/editor.admin.controller.php | 8 ++++ modules/editor/editor.class.php | 8 ++++ modules/editor/editor.model.php | 8 ++++ modules/editor/lang/en.php | 2 + modules/editor/lang/ko.php | 5 +++ modules/editor/skins/ckeditor/editor.html | 4 +- modules/editor/tpl/admin_index.html | 39 +++++++++++++++++-- .../editor/tpl/css/editor_module_config.css | 4 ++ 8 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 modules/editor/tpl/css/editor_module_config.css diff --git a/modules/editor/editor.admin.controller.php b/modules/editor/editor.admin.controller.php index 5d41ca194..b8d33da7e 100644 --- a/modules/editor/editor.admin.controller.php +++ b/modules/editor/editor.admin.controller.php @@ -149,9 +149,17 @@ class editorAdminController extends editor $config->editor_skin = $configVars->editor_skin; $config->editor_height = $configVars->editor_height; $config->mobile_editor_height = $configVars->mobile_editor_height; + $config->editor_toolbar = $configVars->editor_toolbar; + $config->editor_toolbar_hide = $configVars->editor_toolbar_hide === 'Y' ? 'Y' : 'N'; + $config->mobile_editor_toolbar = $configVars->mobile_editor_toolbar; + $config->mobile_editor_toolbar_hide = $configVars->mobile_editor_toolbar_hide === 'Y' ? 'Y' : 'N'; $config->comment_editor_skin = $configVars->comment_editor_skin; $config->comment_editor_height = $configVars->comment_editor_height; $config->mobile_comment_editor_height = $configVars->mobile_comment_editor_height; + $config->comment_editor_toolbar = $configVars->comment_editor_toolbar; + $config->comment_editor_toolbar_hide = $configVars->comment_editor_toolbar_hide === 'Y' ? 'Y' : 'N'; + $config->mobile_comment_editor_toolbar = $configVars->mobile_comment_editor_toolbar; + $config->mobile_comment_editor_toolbar_hide = $configVars->mobile_comment_editor_toolbar_hide === 'Y' ? 'Y' : 'N'; $config->content_style = $configVars->content_style; $config->sel_editor_colorset= $configVars->sel_editor_colorset; $config->sel_comment_editor_colorset= $configVars->sel_comment_editor_colorset; diff --git a/modules/editor/editor.class.php b/modules/editor/editor.class.php index 1a3102451..da9cdbc51 100644 --- a/modules/editor/editor.class.php +++ b/modules/editor/editor.class.php @@ -24,12 +24,20 @@ class editor extends ModuleObject public $default_editor_config = array( 'editor_skin' => 'ckeditor', 'editor_height' => 300, + 'editor_toolbar' => 'default', + 'editor_toolbar_hide' => 'N', 'mobile_editor_height' => 200, + 'mobile_editor_toolbar' => 'simple', + 'mobile_editor_toolbar_hide' => 'Y', 'sel_editor_colorset' => 'moono-lisa', 'content_style' => 'ckeditor_light', 'comment_editor_skin' => 'ckeditor', 'comment_editor_height' => 100, + 'comment_editor_toolbar' => 'simple', + 'comment_editor_toolbar_hide' => 'Y', 'mobile_comment_editor_height' => 100, + 'mobile_comment_editor_toolbar' => 'simple', + 'mobile_comment_editor_toolbar_hide' => 'Y', 'sel_comment_editor_colorset' => 'moono-lisa', 'comment_content_style' => 'ckeditor_light', 'content_font' => '', diff --git a/modules/editor/editor.model.php b/modules/editor/editor.model.php index bd9e4fbce..51d4fd507 100644 --- a/modules/editor/editor.model.php +++ b/modules/editor/editor.model.php @@ -223,6 +223,8 @@ class editorModel extends editor Context::set('content_style_path', $this->module_path . 'styles/' . $option->content_style); Context::set('colorset', $option->sel_editor_colorset); Context::set('editor_height', $option->editor_height); + Context::set('editor_toolbar', $option->editor_toolbar); + Context::set('editor_toolbar_hide', toBool($option->editor_toolbar_hide)); Context::set('module_type', $option->module_type); // Default font setting @@ -359,6 +361,8 @@ class editorModel extends editor if ($is_mobile) { $option->editor_height = $option->mobile_editor_height; + $option->editor_toolbar = $option->mobile_editor_toolbar; + $option->editor_toolbar_hide = $option->mobile_editor_toolbar_hide; } } else @@ -375,10 +379,14 @@ class editorModel extends editor $option->enable_component_grant = $option->enable_comment_component_grant; $option->enable_html_grant = $option->enable_comment_html_grant; $option->editor_height = $option->comment_editor_height; + $option->editor_toolbar = $option->comment_editor_toolbar; + $option->editor_toolbar_hide = $option->comment_editor_toolbar_hide; $option->enable_autosave = 'N'; if ($is_mobile) { $option->editor_height = $option->mobile_comment_editor_height; + $option->editor_toolbar = $option->mobile_comment_editor_toolbar; + $option->editor_toolbar_hide = $option->mobile_comment_editor_toolbar_hide; } } diff --git a/modules/editor/lang/en.php b/modules/editor/lang/en.php index 9aeba9a20..fb7f2a644 100644 --- a/modules/editor/lang/en.php +++ b/modules/editor/lang/en.php @@ -5,8 +5,10 @@ $lang->comment_editor = 'Comment editor'; $lang->editor_option = 'Editor Options'; $lang->guide_choose_main_editor = 'Main editor'; $lang->guide_set_height_main_editor = 'Main editor height'; +$lang->guide_set_main_editor_toolbar = 'Main editor toolbar'; $lang->guide_choose_comment_editor = 'Comment editor'; $lang->guide_set_height_comment_editor = 'Comment editor height'; +$lang->guide_set_comment_editor_toolbar = 'Comment editor toolbar'; $lang->guide_additional_css = 'Additional CSS Files'; $lang->about_additional_css = 'To load additional CSS files inside the editor, such as web fonts, please enter one URL per line.'; $lang->guide_additional_mobile_css = 'Additional CSS Files for Mobile'; diff --git a/modules/editor/lang/ko.php b/modules/editor/lang/ko.php index 44e343574..c9ff005ce 100644 --- a/modules/editor/lang/ko.php +++ b/modules/editor/lang/ko.php @@ -6,8 +6,13 @@ $lang->comment_editor = '댓글 에디터'; $lang->editor_option = '에디터 옵션'; $lang->guide_choose_main_editor = '본문 에디터'; $lang->guide_set_height_main_editor = '본문 에디터 높이'; +$lang->guide_set_main_editor_toolbar = '본문 에디터 도구상자'; $lang->guide_choose_comment_editor = '댓글 에디터'; $lang->guide_set_height_comment_editor = '댓글 에디터 높이'; +$lang->guide_set_comment_editor_toolbar = '댓글 에디터 도구상자'; +$lang->editor_toolbar_default = '기본'; +$lang->editor_toolbar_simple = '간단'; +$lang->editor_toolbar_hide = '숨김'; $lang->guide_additional_css = 'CSS 파일 추가'; $lang->about_additional_css = '웹폰트 등의 CSS를 에디터 내부에서 추가로 로딩하려면 한 줄에 하나씩 URL을 입력해 주십시오.'; $lang->guide_additional_mobile_css = '모바일 CSS 파일 추가'; diff --git a/modules/editor/skins/ckeditor/editor.html b/modules/editor/skins/ckeditor/editor.html index ba4a1a2fa..c93a95a98 100644 --- a/modules/editor/skins/ckeditor/editor.html +++ b/modules/editor/skins/ckeditor/editor.html @@ -134,9 +134,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}"; settings.loadXeComponent = false; - - settings.ckeconfig.toolbarStartupExpanded = false; - + settings.ckeconfig.toolbarStartupExpanded = {$editor_toolbar_hide ? 'false' : 'true'}; settings.ckeconfig.removeButtons = 'Save,Preview,Print,Cut,Copy,Paste,Source'; diff --git a/modules/editor/tpl/admin_index.html b/modules/editor/tpl/admin_index.html index f77dd2da8..f30d6d0b4 100644 --- a/modules/editor/tpl/admin_index.html +++ b/modules/editor/tpl/admin_index.html @@ -1,3 +1,4 @@ +

{$lang->editor} {$lang->help}

@@ -51,8 +52,23 @@
-

{$lang->pc}: px

-

{$lang->mobile}: px

+

{$lang->pc} px

+

{$lang->mobile} px

+
+
+
+ +
+

{$lang->pc} + + + +

+

{$lang->mobile} + + + +

@@ -75,8 +91,23 @@
-

{$lang->pc}: px

-

{$lang->mobile}: px  

+

{$lang->pc} px

+

{$lang->mobile} px  

+
+
+
+ +
+

{$lang->pc} + + + +

+

{$lang->mobile} + + + +

diff --git a/modules/editor/tpl/css/editor_module_config.css b/modules/editor/tpl/css/editor_module_config.css new file mode 100644 index 000000000..1b4be12f7 --- /dev/null +++ b/modules/editor/tpl/css/editor_module_config.css @@ -0,0 +1,4 @@ +.editor_type { + display: inline-block; + min-width: 60px; +} \ No newline at end of file