에디터 스타일과 기본 스타일의 합병

* 기본 에디터 스타일과 기본 스타일 설정이 충돌하는 경우가 많았습니다.
 - 기본 스타일을 지정했는데, 기본 에디터 스타일 내의 스타일 지정이 있는 경우 반영이 안되는 경우, 또는 기본 에디터 스타일을 변경했는데 기본 스타일 설정 때문에 반영이 적절하게 되지 않는 경우 등.
* 기본 에디터 스타일에서도 less 또는 sass를 사용하도록 하고 싶었지만, 위지윅 에디터에서 본문에 나타날 스타일을 그대로 보여주는데 한계가 있었습니다.
 - 기본 에디터 스타일을 위지윅 에디터 내에서 나타내기 위해서 변칙적인 방법이 많이 활용되었습니다. 때문에 실제 본문에서 적용되는 스타일 시트의 우선순위와 위지윅 에디터 내에서 적용되는 스타일 시트의 우선순위에 차이가 있었습니다. 이 차이는 실제 보여지는 스타일과 작성하는 에디터 내의 스타일 차이를 크게 만들 가능성이 있었습니다.
* 기능의 의미가 많이 퇴색되었고, 의미 전달이 명확하지 않은 기능이었습니다.
 - 기능상 기본 에디터 스타일과 기본 스타일은 서로 겹치는 영역의 기능입니다. 기본으로 포함된 두 에디터 스타일 간에 차이가 크지 않기도 해서 어떤 기능인지 사용자가 알아채기도 어려웠습니다. 자료실에 배포되고 있는 에디터 스타일도 대단히 적었습니다.
* 게시판이나 각 글의 모듈 스킨에서 지정하는 스타일과 충돌할 가능성도 있습니다.

따라서, 에디터 스타일이 의도한 것 처럼 글의 스타일에 대한 관리자 통제 기능은 유지하면서, 다른 기능과 중복되거나 충돌할 수 있는 기능을 정리합니다.
가능한 많은 환경에서 테스트 하였으나, 추가로 이와 관련한 의견이 있을 경우 merge 후에도 계속 반영 해나가겠습니다.
This commit is contained in:
Min-Soo Kim 2020-06-16 00:33:19 +09:00 committed by GitHub
parent 9b95ae0134
commit e7cb5ede82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 212 additions and 339 deletions

View file

@ -115,8 +115,6 @@ class editorController extends editor
if($editor_config->default_editor_settings !== 'Y') $editor_config->default_editor_settings = 'N';
$editor_config->editor_skin = Context::get('editor_skin');
$editor_config->comment_editor_skin = Context::get('comment_editor_skin');
$editor_config->content_style = Context::get('content_style');
$editor_config->comment_content_style = Context::get('comment_content_style');
$editor_config->content_font = Context::get('content_font');
if($editor_config->content_font)
{
@ -171,13 +169,12 @@ class editorController extends editor
$this->setRedirectUrl($returnUrl);
}
/**
* @brief convert editor component codes to be returned and specify content style.
*/
function triggerEditorComponentCompile(&$content)
{
if(Context::getResponseMethod() !== 'HTML') return;
/**
* @brief Load editor style
*/
function procLoadEditorStyle()
{
$module_info = Context::get('module_info');
$module_srl = $module_info->module_srl;
if($module_srl)
@ -188,7 +185,7 @@ class editorController extends editor
{
$editor_config = getModel('module')->getModuleConfig('editor');
}
if ($editor_config)
{
$default_font_config = $this->default_font_config;
@ -198,58 +195,22 @@ class editorController extends editor
if ($editor_config->content_paragraph_spacing) $default_font_config['default_paragraph_spacing'] = $editor_config->content_paragraph_spacing;
if ($editor_config->content_word_break) $default_font_config['default_word_break'] = $editor_config->content_word_break;
Context::set('default_font_config', $default_font_config);
$content_style = $editor_config->content_style;
if($content_style)
{
$path = _XE_PATH_ . 'modules/editor/styles/'.$content_style.'/';
if(is_dir($path) && file_exists($path . 'style.ini'))
{
$ini = file($path.'style.ini');
foreach($ini as $file)
{
$file = trim($file);
if(!$file) continue;
$args = array('./modules/editor/styles/'.$content_style.'/'.$file);
Context::loadFile($args);
}
}
}
/*
$buff = array();
$buff[] = '<style> .xe_content {';
if ($content_font)
{
$buff[] = "font-family: $content_font;";
}
if ($content_font_size)
{
$buff[] = "font-size: $content_font_size;";
}
if ($content_line_height)
{
$buff[] = "line-height: $content_line_height;";
}
if ($content_word_break === 'none')
{
$buff[] = 'white-space: nowrap;';
}
else
{
$buff[] = 'word-break: ' . ($content_word_break ?: 'normal') . '; word-wrap: break-word;';
}
$buff[] = '}';
$buff[] = '.xe_content p { margin: 0 0 ' . ($content_paragraph_spacing ?: 0) . ' 0; }';
$buff[] = '</style>';
Context::addHtmlHeader(implode(' ', $buff));
*/
}
else
{
Context::set('default_font_config', $this->default_font_config);
}
}
/**
* @brief convert editor component codes to be returned and specify content style.
*/
function triggerEditorComponentCompile(&$content)
{
if(Context::getResponseMethod() !== 'HTML') return;
$this->procLoadEditorStyle();
$content = $this->transComponent($content);
}