Add editor config for mobile height and additional CSS

This commit is contained in:
Kijin Sung 2017-06-27 16:10:01 +09:00
parent f8cb162186
commit 8b9f6fb230
7 changed files with 46 additions and 10 deletions

View file

@ -328,6 +328,7 @@ $lang->captcha = 'Spam Check';
$lang->reload = 'reload';
$lang->play = 'play';
$lang->use_and_display = 'Use and Display Vote List';
$lang->pc = 'PC';
$lang->mobile = 'Mobile';
$lang->mobile_view = 'Mobile View';
$lang->about_mobile_view = 'Mobile View will display the best layout when you access the website with your smart phone.';

View file

@ -329,6 +329,7 @@ $lang->captcha = '스팸 방지 기능';
$lang->reload = '새로고침';
$lang->play = '음성재생';
$lang->use_and_display = '사용 + 추천내역 공개';
$lang->pc = 'PC';
$lang->mobile = '모바일';
$lang->mobile_view = '모바일 뷰 사용';
$lang->about_mobile_view = '스마트폰 등을 이용하여 접속할 때 모바일 화면에 최적화된 레이아웃을 이용하도록 합니다.';

View file

@ -148,8 +148,10 @@ class editorAdminController extends editor
$config = new stdClass;
$config->editor_skin = $configVars->editor_skin;
$config->editor_height = $configVars->editor_height;
$config->mobile_editor_height = $configVars->mobile_editor_height;
$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->content_style = $configVars->content_style;
$config->sel_editor_colorset= $configVars->sel_editor_colorset;
$config->sel_comment_editor_colorset= $configVars->sel_comment_editor_colorset;
@ -176,6 +178,17 @@ class editorAdminController extends editor
$config->additional_css = array();
}
if ($configVars->additional_mobile_css)
{
$additional_mobile_css = array_map('trim', explode("\n", $configVars->additional_mobile_css));
$additional_mobile_css = array_filter($additional_mobile_css, function($str) { return !empty($str); });
$config->additional_mobile_css = $additional_mobile_css;
}
else
{
$config->additional_mobile_css = array();
}
$config->content_font_size = trim($configVars->content_font_size);
$config->content_font_size = ctype_digit($config->content_font_size) ? ($config->content_font_size . 'px') : $config->content_font_size;
$config->content_line_height = trim($configVars->content_line_height);

View file

@ -34,13 +34,24 @@ class editorAdminView extends editor
$editor_config = new stdClass();
}
//editor_config init
if(!$editor_config->editor_height) $editor_config->editor_height = 300;
if(!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 100;
if(!$editor_config->editor_skin) $editor_config->editor_skin = 'ckeditor';
if(!$editor_config->comment_editor_skin) $editor_config->comment_editor_skin = 'ckeditor';
if(!$editor_config->sel_editor_colorset) $editor_config->sel_editor_colorset= 'moono-lisa';
if(!$editor_config->sel_comment_editor_colorset) $editor_config->sel_comment_editor_colorset= 'moono-lisa';
// Use default config for missing values.
$editor_config_default = array(
'editor_skin' => 'ckeditor',
'editor_height' => 300,
'mobile_editor_height' => 200,
'sel_editor_colorset' => 'moono-lisa',
'comment_editor_skin' => 'ckeditor',
'comment_editor_height' => 100,
'mobile_comment_editor_height' => 100,
'sel_comment_editor_colorset' => 'moono-lisa',
);
foreach ($editor_config_default as $key => $val)
{
if (!$editor_config->$key)
{
$editor_config->$key = $val;
}
}
$component_list = $oEditorModel->getComponentList(false, $site_srl, true);
$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
@ -75,7 +86,6 @@ class editorAdminView extends editor
{
if($packages[$xml_info->package_srl]) $xml_info->need_update = $packages[$xml_info->package_srl]->need_update;
}
$editor_config_default = array('editor_height' => 300, 'comment_editor_height' => 100);
//editor preview
$config = $oEditorModel->getEditorConfig();

View file

@ -9,6 +9,7 @@ $lang->guide_choose_comment_editor = 'Comment editor';
$lang->guide_set_height_comment_editor = 'Comment editor height';
$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';
$lang->guide_choose_text_formatting = 'Text formatting style';
$lang->guide_choose_font_preview = 'Preview';
$lang->guide_choose_font_body = 'Default font';

View file

@ -10,6 +10,7 @@ $lang->guide_choose_comment_editor = '댓글 에디터';
$lang->guide_set_height_comment_editor = '댓글 에디터 높이';
$lang->guide_additional_css = 'CSS 파일 추가';
$lang->about_additional_css = '웹폰트 등의 CSS를 에디터 내부에서 추가로 로딩하려면 한 줄에 하나씩 URL을 입력해 주십시오.';
$lang->guide_additional_mobile_css = '모바일 CSS 파일 추가';
$lang->guide_choose_text_formatting = '본문 서식';
$lang->guide_choose_font_preview = '미리보기';
$lang->guide_choose_font_body = '본문 글꼴';

View file

@ -51,7 +51,8 @@
<div class="x_control-group">
<label for="editor_height" class="x_control-label">{$lang->guide_set_height_main_editor}</label>
<div class="x_controls">
<input type="number" name="editor_height" id="editor_height" value="{$editor_config->editor_height}"|cond="$editor_config->editor_height" value="{$editor_config_default['editor_height']}"|cond="!$editor_config->editor_height" /> px
<p>{$lang->pc}: <input type="number" name="editor_height" id="editor_height" value="{$editor_config->editor_height}" /> px</p>
<p>{$lang->mobile}: <input type="number" name="mobile_editor_height" id="mobile_editor_height" value="{$editor_config->mobile_editor_height}" /> px</p>
</div>
</div>
<div class="x_control-group">
@ -74,7 +75,8 @@
<div class="x_control-group">
<label for="comment_editor_height" class="x_control-label">{$lang->guide_set_height_comment_editor}</label>
<div class="x_controls">
<input type="number" name="comment_editor_height" id="comment_editor_height" value="{$editor_config->comment_editor_height}"|cond="$editor_config->comment_editor_height" value="{$editor_config_default['comment_editor_height']}"|cond="!$editor_config->comment_editor_height" /> px
<p>{$lang->pc}: <input type="number" name="comment_editor_height" id="comment_editor_height" value="{$editor_config->comment_editor_height}" /> px</p>
<p>{$lang->mobile}: <input type="number" name="mobile_comment_editor_height" id="mobile_comment_editor_height" value="{$editor_config->mobile_comment_editor_height}" /> px &nbsp;</p>
</div>
</div>
<div class="x_control-group">
@ -120,6 +122,13 @@
<p class="x_help-block">{$lang->about_additional_css}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->guide_additional_mobile_css}</label>
<div class="x_controls">
<textarea id="additional_css" name="additional_mobile_css" style="width:90%" rows="4" cols="42">{escape(implode("\n", $editor_config->additional_mobile_css ?: array()))}</textarea>
<p class="x_help-block">{$lang->about_additional_css}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="font_size">{$lang->guide_choose_font_size_body}</label>
<div class="x_controls">