{title: "Tiny Header", format: "h5"},
{title: "Paragraph", format: "p", exact: true, classes: ''},
{title: "Blockquote", format: "blockquote"},
- {title: "Inline Code", inline: "code"},
{
title: "Callouts", items: [
{title: "Information", format: 'calloutinfo'},
/**
* @param {WysiwygConfigOptions} options
- * @return {string}
+ * @return {{toolbar: string, groupButtons: Object<string, Object>}}
*/
function buildToolbar(options) {
const textDirPlugins = options.textDirection === 'rtl' ? 'ltr rtl' : '';
+ const groupButtons = {
+ formatoverflow: {
+ icon: 'more-drawer',
+ tooltip: 'More',
+ items: 'strikethrough superscript subscript inlinecode removeformat'
+ },
+ listoverflow: {
+ icon: 'more-drawer',
+ tooltip: 'More',
+ items: 'outdent indent'
+ },
+ insertoverflow: {
+ icon: 'more-drawer',
+ tooltip: 'More',
+ items: 'hr codeeditor drawio media'
+ }
+ };
+
const toolbar = [
'undo redo',
'styleselect',
- 'bold italic underline strikethrough superscript subscript',
+ 'bold italic underline formatoverflow',
'forecolor backcolor',
'alignleft aligncenter alignright alignjustify',
- 'bullist numlist outdent indent',
+ 'bullist numlist listoverflow',
textDirPlugins,
- 'table imagemanager-insert link hr codeeditor drawio media',
- 'removeformat code about fullscreen'
+ 'link table imagemanager-insert insertoverflow',
+ 'code about fullscreen'
];
- return toolbar.filter(row => Boolean(row)).join(' | ');
+ return {
+ toolbar: toolbar.filter(row => Boolean(row)).join(' | '),
+ groupButtons,
+ };
}
/**
// Custom handler hook
window.$events.emitPublic(options.containerElement, 'editor-tinymce::setup', {editor});
+
+ // Inline code format button
+ editor.ui.registry.addButton('inlinecode', {
+ tooltip: 'Inline code',
+ icon: 'sourcecode',
+ onAction() {
+ editor.execCommand('mceToggleFormat', false, 'code');
+ }
+ })
}
}
// Set language
window.tinymce.addI18n(options.language, options.translationMap);
+ const {toolbar, groupButtons: toolBarGroupButtons} = buildToolbar(options);
+
// Return config object
return {
width: '100%',
plugins: gatherPlugins(options),
imagetools_toolbar: 'imageoptions',
contextmenu: false,
- toolbar: buildToolbar(options),
+ toolbar: toolbar,
content_style: `html, body, html.dark-mode {background: ${options.darkMode ? '#222' : '#fff'};} body {padding-left: 15px !important; padding-right: 15px !important; margin:0!important; margin-left:auto!important;margin-right:auto!important;}`,
style_formats,
style_formats_merge: false,
init_instance_callback(editor) {
loadCustomHeadContent(editor);
},
- setup: getSetupCallback(options),
+ setup(editor) {
+ for (const [key, config] of Object.entries(toolBarGroupButtons)) {
+ editor.ui.registry.addGroupToolbarButton(key, config);
+ }
+ getSetupCallback(options)(editor);
+ },
};
}
'bottom' => 'Bottom',
'width' => 'Width',
'height' => 'Height',
+ 'More' => 'More',
// Toolbar
'formats' => 'Formats',
'header_tiny' => 'Tiny Header',
'paragraph' => 'Paragraph',
'blockquote' => 'Blockquote',
- 'inline_code' => 'Inline Code',
+ 'inline_code' => 'Inline code',
'callouts' => 'Callouts',
'callout_information' => 'Information',
'callout_success' => 'Success',
'open_link_new' => 'New window',
// About view
+ 'about_title' => 'About the WYSIWYG Editor',
'editor_license' => 'Editor License & Copyright',
'editor_tiny_license' => 'This editor is built using :tinyLink which is provided under an LGPLv2.1 license.',
'editor_tiny_license_link' => 'The copyright and license details of TinyMCE can be found here.',