Tinymce editor styling and toolbar responsive

This commit is contained in:
Diego Najar 2018-10-09 16:30:16 +02:00
parent 5ee5fd5981
commit 303ba21240
3 changed files with 10 additions and 25 deletions

View File

@ -8,6 +8,10 @@ body {
height: auto; height: auto;
} }
.mce-content-body .mce-pagebreak {
height: 5px !important;
}
.mce-content-body a { .mce-content-body a {
color: #4a90e2; color: #4a90e2;
text-decoration: none; text-decoration: none;

View File

@ -10,9 +10,8 @@ class pluginTinymce extends Plugin {
public function init() public function init()
{ {
$this->dbFields = array( $this->dbFields = array(
'toolbar1'=>'formatselect bold italic bullist numlist blockquote alignleft aligncenter alignright link unlink pagebreak image removeformat code', 'toolbar1'=>'formatselect bold italic bullist numlist | blockquote alignleft aligncenter alignright | link unlink pagebreak image removeformat code',
'toolbar2'=>'', 'toolbar2'=>'',
'mobileToolbar'=>'bold italic bullist formatselect',
'plugins'=>'code autolink image link pagebreak advlist lists textcolor colorpicker textpattern' 'plugins'=>'code autolink image link pagebreak advlist lists textcolor colorpicker textpattern'
); );
} }
@ -31,11 +30,6 @@ class pluginTinymce extends Plugin {
$html .= '<input name="toolbar2" id="jstoolbar2" type="text" value="'.$this->getValue('toolbar2').'">'; $html .= '<input name="toolbar2" id="jstoolbar2" type="text" value="'.$this->getValue('toolbar2').'">';
$html .= '</div>'; $html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$L->get('Mobile toolbar').'</label>';
$html .= '<input name="mobileToolbar" id="jsmobileToolbar" type="text" value="'.$this->getValue('mobileToolbar').'">';
$html .= '</div>';
$html .= '<div>'; $html .= '<div>';
$html .= '<label>'.$L->get('Plugins').'</label>'; $html .= '<label>'.$L->get('Plugins').'</label>';
$html .= '<input name="plugins" id="jsplugins" type="text" value="'.$this->getValue('plugins').'">'; $html .= '<input name="plugins" id="jsplugins" type="text" value="'.$this->getValue('plugins').'">';
@ -61,19 +55,10 @@ class pluginTinymce extends Plugin {
return false; return false;
} }
// Detect if the user is browsing in a mobile $toolbar1 = $this->getValue('toolbar1');
if ($this->isMobile()) { $toolbar2 = $this->getValue('toolbar2');
$toolbar1 = $this->getValue('mobileToolbar'); $min_height = '500';
$toolbar2 = ''; $content_css = $this->htmlPath().'css/bludit.css';
$min_height = '320';
$content_css = $this->htmlPath().'css/bludit.css';
} else {
$toolbar1 = $this->getValue('toolbar1');
$toolbar2 = $this->getValue('toolbar2');
$min_height = '500';
$content_css = $this->htmlPath().'css/bludit.css';
}
$plugins = $this->getValue('plugins'); $plugins = $this->getValue('plugins');
$lang = 'en'; $lang = 'en';
@ -139,7 +124,4 @@ EOF;
return $script; return $script;
} }
private function isMobile() {
return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
}
} }

View File

@ -515,9 +515,8 @@ function install($adminPassword, $timezone)
$dataHead.json_encode( $dataHead.json_encode(
array( array(
'position'=>1, 'position'=>1,
'toolbar1'=>'formatselect bold italic bullist numlist blockquote alignleft aligncenter alignright link unlink pagebreak image removeformat code', 'toolbar1'=>'formatselect bold italic bullist numlist | blockquote alignleft aligncenter alignright | link unlink pagebreak image removeformat code',
'toolbar2'=>'', 'toolbar2'=>'',
'mobileToolbar'=>'bold italic bullist formatselect',
'plugins'=>'code autolink image link pagebreak advlist lists textcolor colorpicker textpattern' 'plugins'=>'code autolink image link pagebreak advlist lists textcolor colorpicker textpattern'
), ),
JSON_PRETTY_PRINT), JSON_PRETTY_PRINT),