Add custom toolbar for ckeditor inline

This commit is contained in:
Laurent Destailleur 2023-08-02 16:04:13 +02:00
parent a8ef7cdd12
commit b6f66058c3

View File

@ -3321,17 +3321,46 @@ if (!GETPOST('hide_websitemenu')) {
if (! isEditingEnabled || forceenable)
{
console.log("Enable inline edit");
jQuery(\'section[contenteditable="true"],div[contenteditable="true"]\').each(function(idx){
var idtouse = $(this).attr(\'id\');
console.log("Enable inline edit for "+idtouse);
CKEDITOR.inline(idtouse, {
// Allow some non-standard markup that we used in the introduction.
extraAllowedContent: \'span(*);cite(*);q(*);dl(*);dt(*);dd(*);ul(*);li(*);header(*);button(*);h1(*);h2(*);\',
//extraPlugins: \'sourcedialog\',
removePlugins: \'flash,stylescombo,exportpdf,scayt,wsc,pagebreak,iframe,smiley\',
// Show toolbar on startup (optional).
// startupFocus: true
});
if (idtouse !== undefined) {
var inlineditor = CKEDITOR.inline(idtouse, {
// Allow some non-standard markup that we used in the introduction.
// + a[target];div{float,display} ?
extraAllowedContent: \'span(*);cite(*);q(*);dl(*);dt(*);dd(*);ul(*);li(*);header(*);button(*);h1(*);h2(*);\',
//extraPlugins: \'sourcedialog\',
removePlugins: \'flash,stylescombo,exportpdf,scayt,wsc,pagebreak,iframe,smiley\',
// Show toolbar on startup (optional).
// startupFocus: true
});
// Custom bar tool
// Note the Source tool does not work on inline
inlineditor.config.toolbar = [
[\'Templates\',\'NewPage\'],
[\'Save\'],
[\'Maximize\',\'Preview\'],
[\'PasteText\'],
[\'Undo\',\'Redo\',\'-\',\'Find\',\'Replace\',\'-\',\'SelectAll\',\'RemoveFormat\'],
[\'CreateDiv\',\'ShowBlocks\'],
[\'Form\', \'Checkbox\', \'Radio\', \'TextField\', \'Textarea\', \'Select\', \'Button\', \'ImageButton\', \'HiddenField\'],
[\'Bold\',\'Italic\',\'Underline\',\'Strike\',\'Superscript\'],
[\'NumberedList\',\'BulletedList\',\'-\',\'Outdent\',\'Indent\',\'Blockquote\'],
[\'JustifyLeft\',\'JustifyCenter\',\'JustifyRight\',\'JustifyBlock\'],
[\'Link\',\'Unlink\'],
[\'Image\',\'Table\',\'HorizontalRule\'],
[\'Styles\',\'Format\',\'Font\',\'FontSize\'],
[\'TextColor\',\'BGColor\']
];
// Start editor
//inlineditor.on(\'instanceReady\', function () {
// ...
//});
}
})
isEditingEnabled = true;