Enable LESS and SASS @ editor style (#988)

* Enable LESS and SASS @ editor style

에디터 스타일에 LESS 또는 SASS를 사용할 수 없어서 기본 설정을 간결하게 반영하기 어려운 감이 있었습니다.
이를 해결합니다.

* Replace for to foreach

foreach 로 대체 가능한 for 문을 대체합니다.
This commit is contained in:
Min-Soo Kim 2018-01-20 00:20:05 +09:00 committed by GitHub
parent 0dedc76107
commit bafc9005c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -186,30 +186,6 @@ class editorController extends editor
if ($editor_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');
for($i = 0, $c = count($ini); $i < $c; $i++)
{
$file = trim($ini[$i]);
if(!$file) continue;
if(substr_compare($file, '.css', -4) === 0)
{
Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
}
elseif(substr_compare($file, '.js', -3) === 0)
{
Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
}
}
}
}
$default_font_config = $this->default_font_config;
if ($editor_config->content_font) $default_font_config['default_font_family'] = $editor_config->content_font;
if ($editor_config->content_font_size) $default_font_config['default_font_size'] = $editor_config->content_font_size;
@ -218,6 +194,24 @@ class editorController extends editor
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 {';