Fix for issue #380 Custom attributes for toolbar buttons

Added "attributes" option to custom toolbar button
pull/388/head
Zignature 2 years ago
parent 59a676bc8a
commit a9d9993dae

@ -377,6 +377,10 @@ const easyMDE = new EasyMDE({
},
className: "fa fa-star",
title: "Custom Button",
attributes: { // for custom attributes
id: "custom-id",
"data-value": "custom value" // HTML5 data-* attributes need to be enclosed in quotation marks ("") because of the dash (-) in its name.
}
},
"|" // Separator
// [, ...]

@ -231,6 +231,12 @@ function createToolbarButton(options, enableActions, enableTooltips, shortcuts,
}
}
if (options.attributes) {
for (var attribute in options.attributes) {
el.setAttribute(attribute, options.attributes[attribute]);
}
}
if (options.noDisable) {
el.classList.add('no-disable');
}

Loading…
Cancel
Save