修改功能

This commit is contained in:
2026-08-29 19:06:07 +08:00
parent f94c652c7c
commit aaed0584b1
142 changed files with 6176 additions and 869 deletions
+19
View File
@@ -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;