Skip to content

Commit

Permalink
Merge branch 'fix-multiple-instances' of github.com:brutuscat/bootstr…
Browse files Browse the repository at this point in the history
…ap-wysiwyg

This combines the #68 change where FF throws an error and #103 where it supports multiple instances thanks to @brutuscat

# By Mauro Asprea
# Via Mauro Asprea
* 'fix-multiple-instances' of github.com:brutuscat/bootstrap-wysiwyg:
  Fix to support multiple instances adding a wrapper context for toolbar's bindings

Conflicts:
	bootstrap-wysiwyg.js
  • Loading branch information
Steve King committed Apr 27, 2014
2 parents 3d8530b + 26f89d5 commit ed95965
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bootstrap-wysiwyg.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
};
$.fn.wysiwyg = function (userOptions) {
var editor = this,
wrapper = $(editor).parent(),
selectedRange,
options,
toolbarBtnSelector,
updateToolbar = function () {
if (options.activeToolbarClass) {
$(options.toolbarSelector).find(toolbarBtnSelector).each(function () {
$(options.toolbarSelector,wrapper).find(toolbarBtnSelector).each(function () {
var commandArr = $(this).data(options.commandRole).split(' '),
command = commandArr[0];

Expand Down Expand Up @@ -110,7 +111,7 @@
input.data(options.selectionMarker, color);
},
bindToolbar = function (toolbar, options) {
toolbar.find(toolbarBtnSelector).click(function () {
toolbar.find(toolbarBtnSelector, wrapper).click(function () {
restoreSelection();
editor.focus();
execCommand($(this).data(options.commandRole));
Expand Down

0 comments on commit ed95965

Please sign in to comment.