mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Fix missing default font config under some circumstances
This commit is contained in:
parent
24b8cf81ad
commit
1233919dba
3 changed files with 22 additions and 19 deletions
|
|
@ -270,11 +270,9 @@ class FrontEndFileHandler extends Handler
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ($default_font_config = Context::get('default_font_config'))
|
||||
{
|
||||
$file->vars = array_merge($file->vars, $default_font_config);
|
||||
}
|
||||
|
||||
$default_font_config = Context::get('default_font_config') ?: getController('editor')->default_font_config;
|
||||
$file->vars = array_merge($file->vars, $default_font_config);
|
||||
if ($file->fileExtension === 'less')
|
||||
{
|
||||
$file->vars = array_map(function($str) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,17 @@
|
|||
*/
|
||||
class editor extends ModuleObject
|
||||
{
|
||||
/**
|
||||
* @brief Default font config
|
||||
*/
|
||||
public $default_font_config = array(
|
||||
'default_font_family' => 'inherit',
|
||||
'default_font_size' => '13px',
|
||||
'default_line_height' => '160%',
|
||||
'default_paragraph_spacing' => '0',
|
||||
'default_word_break' => 'normal',
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Implement if additional tasks are necessary when installing
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -210,13 +210,13 @@ class editorController extends editor
|
|||
}
|
||||
}
|
||||
|
||||
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',
|
||||
));
|
||||
$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;
|
||||
if ($editor_config->content_line_height) $default_font_config['default_line_height'] = $editor_config->content_line_height;
|
||||
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);
|
||||
|
||||
/*
|
||||
$buff = array();
|
||||
|
|
@ -249,13 +249,7 @@ class editorController extends editor
|
|||
}
|
||||
else
|
||||
{
|
||||
Context::set('default_font_config', array(
|
||||
'default_font_family' => 'inherit',
|
||||
'default_font_size' => '13px',
|
||||
'default_line_height' => '160%',
|
||||
'default_paragraph_spacing' => '0',
|
||||
'default_word_break' => 'normal',
|
||||
));
|
||||
Context::set('default_font_config', $this->default_font_config);
|
||||
}
|
||||
|
||||
$content = $this->transComponent($content);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue