Improve icon class regex

pull/76/head
Jeroen Akkerman 5 years ago
parent 14bfa678ab
commit dd0e96b204

@ -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);

Loading…
Cancel
Save