Use font config in rhymix.scss to set defaults

This commit is contained in:
Kijin Sung 2016-05-05 11:05:06 +09:00
parent 67cc7d3d00
commit 398c36885a
3 changed files with 29 additions and 10 deletions

View file

@ -267,18 +267,19 @@ class FrontEndFileHandler extends Handler
return;
}
if ($default_font_config = Context::get('default_font_config'))
{
$file->vars = array_merge($file->vars, $default_font_config);
}
$compiledFileName = $file->fileName . ($minify ? '.min' : '') . '.css';
$compiledFileHash = sha1($file->fileRealPath . ':' . serialize($vars));
$compiledFileHash = sha1($file->fileRealPath . ':' . serialize($file->vars));
$compiledFilePath = \RX_BASEDIR . self::$assetdir . '/compiled/' . $compiledFileHash . '.' . $compiledFileName;
if (!file_exists($compiledFilePath) || filemtime($compiledFilePath) < filemtime($file->fileFullPath))
{
$method_name = 'compile' . $file->fileExtension;
$success = Rhymix\Framework\Formatter::$method_name($file->fileFullPath, $compiledFilePath, $file->vars, $minify);
if ($success === false)
{
return;
}
}
$file->fileName = $compiledFileHash . '.' . $compiledFileName;

View file

@ -17,6 +17,18 @@ a img {
[hidden] {
display: none;
}
.xe_content {
font-family: $default_font_family;
font-size: $default_font_size;
line-height: $default_line_height;
word-break: $default_word_break;
@if $default_word_break == 'none' {
white-space: nowrap;
}
}
.xe_content p {
margin: 0 0 $default_paragraph_spacing 0;
}
.xe_content img {
max-width: 100%;
height: auto;

View file

@ -184,11 +184,16 @@ class editorController extends editor
}
}
}
$content_font = $editor_config->content_font;
$content_font_size = $editor_config->content_font_size;
$content_line_height = $editor_config->content_line_height;
$content_paragraph_spacing = $editor_config->content_paragraph_spacing;
$content_word_break = $editor_config->content_word_break;
Context::set('default_font_config', array(
'default_font_family' => $editor_config->content_font ?: 'inherit',
'default_font_size' => $editor_config->content_font_size ?: '13px',
'default_line_height' => $editor_config->content_line_height ?: '160%',
'default_paragraph_spacing' => $editor_config->content_paragraph_spacing ?: '0',
'default_word_break' => $editor_config->content_word_break ?: 'normal',
));
/*
$buff = array();
$buff[] = '<style> .xe_content {';
if ($content_font)
@ -215,6 +220,7 @@ class editorController extends editor
$buff[] = '.xe_content p { margin: 0 0 ' . ($content_paragraph_spacing ?: 0) . ' 0; }';
$buff[] = '</style>';
Context::addHtmlHeader(implode(' ', $buff));
*/
}
$content = $this->transComponent($content);