this.button.addCallback(this.button.get('image'), $.proxy(this.wbutton.insertImage, this));
},
+ /**
+ * Modifies an existing button belonging to Redactor.
+ *
+ * @param string buttonName
+ * @param string buttonTitle
+ * @param string faIcon
+ * @param string insertAfter
+ */
_addCoreButton: function(buttonName, buttonTitle, faIcon, insertAfter) {
var $buttonObj = { title: (buttonTitle === null ? buttonName : buttonTitle) };
if (buttonName === 'subscript' || buttonName === 'superscript') {
}
}
else {
+ this.buffer.set();
this.insert.html('[' + $bbcode + ']' + $selectedHtml + this.selection.getMarkerAsHtml() + '[/' + $bbcode + ']', false);
this.selection.restore();
}
this.$editor.on('keyup.redactor', $.proxy(this.keyup.init, this));
}
- this.$editor.on('mousedown.wmonkeypatch mouseup.wmonkeypatch', (function() {
- this.wutil.saveSelection();
+ var $saveSelection = false;
+ this.$editor.on('mousedown.wmonkeypatch', (function() {
+ $saveSelection = true;
+ }).bind(this));
+
+ $(document).on('mouseup.wmonkeypatch', (function() {
+ if ($saveSelection) {
+ $saveSelection = false;
+
+ this.wutil.saveSelection();
+ }
}).bind(this));
},