修改功能
This commit is contained in:
@@ -31,6 +31,24 @@
|
||||
instance.textarea.value = fieldValue(instance.editor);
|
||||
}
|
||||
|
||||
function makeToolbarAccessible(toolbar) {
|
||||
var labelButtons = function () {
|
||||
Array.prototype.forEach.call(toolbar.querySelectorAll('button[data-tooltip]'), function (button) {
|
||||
if (!button.getAttribute('aria-label')) button.setAttribute('aria-label', button.getAttribute('data-tooltip'));
|
||||
});
|
||||
};
|
||||
|
||||
labelButtons();
|
||||
if (root.MutationObserver) {
|
||||
new root.MutationObserver(labelButtons).observe(toolbar, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
attributes: true,
|
||||
attributeFilter: ['data-tooltip']
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function createRichEditor(target, options) {
|
||||
var textarea = findTextarea(target);
|
||||
var settings = options || {};
|
||||
@@ -79,6 +97,7 @@
|
||||
config: Object.assign({ toolbarKeys: toolbarKeys }, settings.toolbarConfig || {}),
|
||||
mode: settings.mode || 'default'
|
||||
});
|
||||
makeToolbarAccessible(toolbar);
|
||||
} catch (error) {
|
||||
host.remove();
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user