Skip to content

Commit

Permalink
Merge branch 'toolbar' of github.com:jordandh/bootstrap-wysiwyg
Browse files Browse the repository at this point in the history
Conflicts:
	bootstrap-wysiwyg.js

Fixed for #68 with update to @jordanh version.
  • Loading branch information
Steve King committed Apr 27, 2014
2 parents 14fb645 + 55d8008 commit 3d8530b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bootstrap-wysiwyg.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@
updateToolbar = function () {
if (options.activeToolbarClass) {
$(options.toolbarSelector).find(toolbarBtnSelector).each(function () {
var command = $(this).data(options.commandRole),
format = command.match(/formatBlock (.+)/);
if (document.queryCommandState(command) || (format && (format[1] == document.queryCommandValue("formatBlock")))) {
var commandArr = $(this).data(options.commandRole).split(' '),
command = commandArr[0];

// If the command has an argument and its value matches this button. == used for string/number comparison
if (commandArr.length > 1 && document.queryCommandEnabled(command) && document.queryCommandValue(command) == commandArr[1]) {
$(this).addClass(options.activeToolbarClass);
// Else if the command has no arguments and it is active
} else if (commandArr.length === 1 && document.queryCommandEnabled(command) && document.queryCommandState(command)) {
$(this).addClass(options.activeToolbarClass);
// Else the command is not active
} else {
$(this).removeClass(options.activeToolbarClass);
}
Expand Down

0 comments on commit 3d8530b

Please sign in to comment.