Skip to content

Commit 9daf497

Browse files
author
Steve King
committed
@beatnbite authored 6 months ago
I've updated this now with the changes submitted by @beanbrite in Merge #118 and cleaned up the merge.
2 parents 611f216 + 1aaab1d commit 9daf497

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

bootstrap-wysiwyg.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@
2626
updateToolbar = function () {
2727
if (options.activeToolbarClass) {
2828
$(options.toolbarSelector).find(toolbarBtnSelector).each(function () {
29-
var command = $(this).data(options.commandRole).split(' ')[0];
30-
if (document.queryCommandSupported(command)) {
31-
if (document.queryCommandState(command)) {
32-
$(this).addClass(options.activeToolbarClass);
33-
} else {
34-
$(this).removeClass(options.activeToolbarClass);
35-
}
29+
var command = $(this).data(options.commandRole),
30+
format = command.match(/formatBlock (.+)/);
31+
if (document.queryCommandState(command) || (format && (format[1] == document.queryCommandValue("formatBlock")))) {
32+
$(this).addClass(options.activeToolbarClass);
33+
} else {
34+
$(this).removeClass(options.activeToolbarClass);
3635
}
3736
});
3837
}

0 commit comments

Comments
 (0)