Add format block as preference for pre-selecting block on editor initialization

This commit is contained in:
Hadi Nategh 2019-10-09 16:22:23 +02:00
parent 56989f338b
commit 74100f53ae
2 changed files with 20 additions and 0 deletions

View File

@ -198,6 +198,7 @@ var et2_htmlarea = (function(){ "use strict"; return et2_editableWidget.extend([
self.set_value(self.htmlNode.val()); self.set_value(self.htmlNode.val());
if (self.editor && self.editor.editorContainer) if (self.editor && self.editor.editorContainer)
{ {
self.editor.formatter.toggle(egw.preference('rte_formatblock', 'common'));
jQuery(self.editor.editorContainer).height(self.options.height); jQuery(self.editor.editorContainer).height(self.options.height);
jQuery(self.editor.iframeElement.contentWindow.document).on('dragenter', function(){ jQuery(self.editor.iframeElement.contentWindow.document).on('dragenter', function(){
if (jQuery('#dragover-tinymce').length < 1) jQuery("<style id='dragover-tinymce'>.dragover:after {height:calc(100% - "+jQuery(this).height()+"px) !important;}</style>").appendTo('head'); if (jQuery('#dragover-tinymce').length < 1) jQuery("<style id='dragover-tinymce'>.dragover:after {height:calc(100% - "+jQuery(this).height()+"px) !important;}</style>").appendTo('head');

View File

@ -417,6 +417,25 @@ class preferences_hooks
'admin' => false, 'admin' => false,
'default' => '10' 'default' => '10'
), ),
'rte_formatblock' => array(
'type' => 'select',
'label' => 'Default format block',
'name' => 'rte_formatblock',
'values' => array(
'p' => lang("Paragraph"),
'h1' => lang("Heading 1"),
'h2' => lang("Heading 2"),
'h3' => lang("Heading 3"),
'h4' => lang("Heading 4"),
'h5' => lang("Heading 5"),
'h6' => lang("Heading 6"),
'pre' => lang("Preformatted")
),
'help' => 'Automatically start with this format block',
'xmlrpc' => True,
'admin' => false,
'default' => 'p'
),
'rte_menubar' => array( 'rte_menubar' => array(
'type' => 'select', 'type' => 'select',
'label' => 'Enable menubar', 'label' => 'Enable menubar',