Fix for ckeditor
This commit is contained in:
parent
bb1d5daa82
commit
388500794b
@ -192,7 +192,7 @@ if (empty($conf->use_javascript_ajax)) {
|
|||||||
if ($linkstomode) {
|
if ($linkstomode) {
|
||||||
$linkstomode .= ' - ';
|
$linkstomode .= ' - ';
|
||||||
}
|
}
|
||||||
$linkstomode .= '<a href="'.$_SERVER["PHP_SELF"].'?mode='.$newmode.'">';
|
$linkstomode .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?mode='.$newmode.'">';
|
||||||
if ($mode == $newmode) {
|
if ($mode == $newmode) {
|
||||||
$linkstomode .= '<strong>';
|
$linkstomode .= '<strong>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,8 +55,8 @@ class DolEditor
|
|||||||
* @param int $height Height in pixel of edit area (200px by default)
|
* @param int $height Height in pixel of edit area (200px by default)
|
||||||
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly').
|
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly').
|
||||||
* @param string $toolbarlocation Where bar is stored :
|
* @param string $toolbarlocation Where bar is stored :
|
||||||
* 'In' each window has its own toolbar
|
* 'In' = each window has its own toolbar
|
||||||
* 'Out:name' share toolbar into the div called 'name'
|
* 'Out:name' = share toolbar into the div called 'name'
|
||||||
* @param boolean $toolbarstartexpanded Bar is visible or not at start
|
* @param boolean $toolbarstartexpanded Bar is visible or not at start
|
||||||
* @param int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content.
|
* @param int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content.
|
||||||
* @param boolean|string $okforextendededitor True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace.
|
* @param boolean|string $okforextendededitor True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace.
|
||||||
@ -155,10 +155,20 @@ class DolEditor
|
|||||||
} else {
|
} else {
|
||||||
$skin = 'moono-lisa'; // default with ckeditor 4.6 : moono-lisa
|
$skin = 'moono-lisa'; // default with ckeditor 4.6 : moono-lisa
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$pluginstodisable = 'flash';
|
||||||
|
if (!empty($conf->dol_optimize_smallscreen)) {
|
||||||
|
$pluginstodisable .= ',scayt,wsc,find,undo';
|
||||||
|
}
|
||||||
|
if (empty($conf->global->FCKEDITOR_ENABLE_WSC)) { // spellchecker has end of life december 2021
|
||||||
|
$pluginstodisable .= ',wsc';
|
||||||
|
}
|
||||||
|
$scaytautostartup = '';
|
||||||
if (!empty($conf->global->FCKEDITOR_ENABLE_SCAYT_AUTOSTARTUP)) {
|
if (!empty($conf->global->FCKEDITOR_ENABLE_SCAYT_AUTOSTARTUP)) {
|
||||||
$scaytautostartup = 'scayt_autoStartup: true,';
|
$scaytautostartup = 'scayt_autoStartup: true,';
|
||||||
|
$scaytautostartup .= 'scayt_sLang: \''.dol_escape_js($langs->getDefaultLang()).'\',';
|
||||||
} else {
|
} else {
|
||||||
$scaytautostartup = '/*scayt is disable*/'; // Disable by default
|
$pluginstodisable .= ',scayt';
|
||||||
}
|
}
|
||||||
|
|
||||||
$htmlencode_force = preg_match('/_encoded$/', $this->toolbarname) ? 'true' : 'false';
|
$htmlencode_force = preg_match('/_encoded$/', $this->toolbarname) ? 'true' : 'false';
|
||||||
@ -168,11 +178,12 @@ class DolEditor
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
/* console.log("Run ckeditor"); */
|
/* console.log("Run ckeditor"); */
|
||||||
/* if (CKEDITOR.loadFullCore) CKEDITOR.loadFullCore(); */
|
/* if (CKEDITOR.loadFullCore) CKEDITOR.loadFullCore(); */
|
||||||
/* should be editor=CKEDITOR.replace but what if serveral editors ? */
|
/* should be editor=CKEDITOR.replace but what if there is several editors ? */
|
||||||
CKEDITOR.replace(\''.$this->htmlname.'\',
|
tmpeditor = CKEDITOR.replace(\''.$this->htmlname.'\',
|
||||||
{
|
{
|
||||||
/* property:xxx is same than CKEDITOR.config.property = xxx */
|
/* property:xxx is same than CKEDITOR.config.property = xxx */
|
||||||
customConfig : ckeditorConfig,
|
customConfig : ckeditorConfig,
|
||||||
|
removePlugins : \''.$pluginstodisable.'\',
|
||||||
readOnly : '.($this->readonly ? 'true' : 'false').',
|
readOnly : '.($this->readonly ? 'true' : 'false').',
|
||||||
htmlEncodeOutput :'.$htmlencode_force.',
|
htmlEncodeOutput :'.$htmlencode_force.',
|
||||||
allowedContent :'.($disallowAnyContent ? 'false' : 'true').',
|
allowedContent :'.($disallowAnyContent ? 'false' : 'true').',
|
||||||
@ -185,25 +196,22 @@ class DolEditor
|
|||||||
height: '.$this->height.',
|
height: '.$this->height.',
|
||||||
skin: \''.$skin.'\',
|
skin: \''.$skin.'\',
|
||||||
'.$scaytautostartup.'
|
'.$scaytautostartup.'
|
||||||
scayt_sLang: \''.$langs->getDefaultLang().'\',
|
|
||||||
language: \''.$langs->defaultlang.'\',
|
language: \''.$langs->defaultlang.'\',
|
||||||
textDirection: \''.$langs->trans("DIRECTION").'\',
|
textDirection: \''.$langs->trans("DIRECTION").'\',
|
||||||
on :
|
on : {
|
||||||
{
|
|
||||||
instanceReady : function( ev )
|
instanceReady : function( ev )
|
||||||
{
|
{
|
||||||
// Output paragraphs as <p>Text</p>.
|
// Output paragraphs as <p>Text</p>.
|
||||||
this.dataProcessor.writer.setRules( \'p\',
|
this.dataProcessor.writer.setRules( \'p\', {
|
||||||
{
|
indent : false,
|
||||||
indent : false,
|
breakBeforeOpen : true,
|
||||||
breakBeforeOpen : true,
|
breakAfterOpen : false,
|
||||||
breakAfterOpen : false,
|
breakBeforeClose : false,
|
||||||
breakBeforeClose : false,
|
breakAfterClose : true
|
||||||
breakAfterClose : true
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
disableNativeSpellChecker: '.(empty($conf->global->CKEDITOR_NATIVE_SPELLCHECKER) ? 'true' : 'false');
|
disableNativeSpellChecker: '.(empty($conf->global->CKEDITOR_NATIVE_SPELLCHECKER) ? 'true' : 'false');
|
||||||
|
|
||||||
if ($this->uselocalbrowser) {
|
if ($this->uselocalbrowser) {
|
||||||
$out .= ','."\n";
|
$out .= ','."\n";
|
||||||
@ -226,8 +234,10 @@ class DolEditor
|
|||||||
filebrowserImageWindowWidth : \'900\',
|
filebrowserImageWindowWidth : \'900\',
|
||||||
filebrowserImageWindowHeight : \'500\'';
|
filebrowserImageWindowHeight : \'500\'';
|
||||||
}
|
}
|
||||||
$out .= ' })'.$morejs;
|
$out .= ' })'.$morejs; // end CKEditor.replace
|
||||||
$out .= '});'."\n";
|
// Show the CKEditor javascript object once loaded is ready 'For debug)
|
||||||
|
//$out .= '; CKEDITOR.on(\'instanceReady\', function(ck) { ck.editor.removeMenuItem(\'maximize\'); ck.editor.removeMenuItem(\'Undo\'); ck.editor.removeMenuItem(\'undo\'); console.log(ck.editor); console.log(ck.editor.toolbar[0]); }); ';
|
||||||
|
$out .= '});'."\n"; // end document.ready
|
||||||
$out .= '</script>'."\n";
|
$out .= '</script>'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,7 @@ CKEDITOR.editorConfig = function( config )
|
|||||||
['Undo','Redo','-','Find','Replace'],
|
['Undo','Redo','-','Find','Replace'],
|
||||||
['CreateDiv','ShowBlocks'],
|
['CreateDiv','ShowBlocks'],
|
||||||
['Format','Font','FontSize'],
|
['Format','Font','FontSize'],
|
||||||
['Bold','Italic','Underline','Strike','Superscript','-','TextColor','RemoveFormat'],
|
['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'],
|
||||||
['NumberedList','BulletedList','Outdent','Indent'],
|
['NumberedList','BulletedList','Outdent','Indent'],
|
||||||
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
||||||
['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'],
|
['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'],
|
||||||
@ -75,7 +75,7 @@ CKEDITOR.editorConfig = function( config )
|
|||||||
['SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone
|
['SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone
|
||||||
['Undo','Redo','-','Find','Replace'],
|
['Undo','Redo','-','Find','Replace'],
|
||||||
['Font','FontSize'],
|
['Font','FontSize'],
|
||||||
['Bold','Italic','Underline','Strike','Superscript','-','TextColor','RemoveFormat'],
|
['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'],
|
||||||
['NumberedList','BulletedList','Outdent','Indent'],
|
['NumberedList','BulletedList','Outdent','Indent'],
|
||||||
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
||||||
['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'],
|
['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'],
|
||||||
|
|||||||
@ -61,7 +61,7 @@ CKEDITOR.editorConfig = function( config )
|
|||||||
['Undo','Redo','-','Find','Replace'],
|
['Undo','Redo','-','Find','Replace'],
|
||||||
['CreateDiv','ShowBlocks'],
|
['CreateDiv','ShowBlocks'],
|
||||||
['Format','Font','FontSize'],
|
['Format','Font','FontSize'],
|
||||||
['Bold','Italic','Underline','Strike','Superscript','-','TextColor','RemoveFormat'],
|
['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'],
|
||||||
['NumberedList','BulletedList','Outdent','Indent'],
|
['NumberedList','BulletedList','Outdent','Indent'],
|
||||||
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
||||||
['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'],
|
['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'],
|
||||||
@ -75,7 +75,7 @@ CKEDITOR.editorConfig = function( config )
|
|||||||
['SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone
|
['SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone
|
||||||
['Undo','Redo','-','Find','Replace'],
|
['Undo','Redo','-','Find','Replace'],
|
||||||
['Format','Font','FontSize'],
|
['Format','Font','FontSize'],
|
||||||
['Bold','Italic','Underline','Strike','Superscript','-','TextColor','RemoveFormat'],
|
['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'],
|
||||||
['NumberedList','BulletedList','Outdent','Indent'],
|
['NumberedList','BulletedList','Outdent','Indent'],
|
||||||
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
||||||
['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'],
|
['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user