2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-06-30 06:31:01 -06:00

Improve icon class regex

This commit is contained in:
Jeroen Akkerman 2019-03-04 17:45:52 +01:00
parent 14bfa678ab
commit dd0e96b204

View File

@ -145,8 +145,8 @@ function createToolbarButton(options, enableTooltips, shortcuts) {
for (var classNameIndex = 0; classNameIndex < classNameParts.length; classNameIndex++) {
var classNamePart = classNameParts[classNameIndex];
// Split icon classes from the button.
// Regex will detect "fa" and "fa-something", but not "fanfare".
if (classNamePart.match(/^fa((-.*)|$)/)) {
// Regex will detect "fa", "fas", "fa-something" and "fa-some-icon-1", but not "fanfare".
if (classNamePart.match(/^fa([srlb]|(-[\w-]*)|$)/)) {
iconClasses.push(classNamePart);
} else {
el.classList.add(classNamePart);