mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-19 16:04:28 -06:00
Fix for issue #380 Custom attributes for toolbar buttons
Added "attributes" option to custom toolbar button
This commit is contained in:
parent
59a676bc8a
commit
a9d9993dae
@ -377,6 +377,10 @@ const easyMDE = new EasyMDE({
|
|||||||
},
|
},
|
||||||
className: "fa fa-star",
|
className: "fa fa-star",
|
||||||
title: "Custom Button",
|
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
|
"|" // 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) {
|
if (options.noDisable) {
|
||||||
el.classList.add('no-disable');
|
el.classList.add('no-disable');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user