MDL-76562 editor_tiny: Added functions to remove button/menu/submenu.
Added a few functions to remove the toolbar button, menubar and sub-menu items. One of the implementations is to remove the justify alignment in the toolbar and the sub-menu items to aid the accessibility aspect of the TinyMCE editor.
This commit is contained in:
@@ -26,7 +26,8 @@ import Pending from 'core/pending';
|
||||
import {getDefaultConfiguration} from './defaults';
|
||||
import {getTinyMCE, baseUrl} from './loader';
|
||||
import * as Options from './options';
|
||||
import {addToolbarButton, addToolbarButtons, addToolbarSection} from './utils';
|
||||
import {addToolbarButton, addToolbarButtons, addToolbarSection,
|
||||
removeToolbarButton, removeSubmenuItem} from './utils';
|
||||
|
||||
/**
|
||||
* Storage for the TinyMCE instances on the page.
|
||||
@@ -245,6 +246,11 @@ const getStandardConfig = (target, tinyMCE, options, plugins) => {
|
||||
|
||||
setup: (editor) => {
|
||||
Options.register(editor, options);
|
||||
|
||||
editor.on('init', function() {
|
||||
// Hide justify alignment sub-menu.
|
||||
removeSubmenuItem(editor, 'align', 'tiny:justify');
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -255,6 +261,9 @@ const getStandardConfig = (target, tinyMCE, options, plugins) => {
|
||||
config.toolbar = addToolbarSection(config.toolbar, 'directionality', 'alignment', true);
|
||||
config.toolbar = addToolbarButtons(config.toolbar, 'directionality', ['ltr', 'rtl']);
|
||||
|
||||
// Remove the align justify button from the toolbar.
|
||||
config.toolbar = removeToolbarButton(config.toolbar, 'alignment', 'alignjustify');
|
||||
|
||||
return config;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user