Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow passing command parameters to wysihtml5.Commands.prototype.exec

  • Loading branch information...
commit 800f28b07e7ed5772f3f03e27f0179096d25861a 1 parent e5e5af3
Christopher Blum authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/commands.js
View
8 src/commands.js
@@ -33,12 +33,14 @@ wysihtml5.Commands = Base.extend(
*/
exec: function(command, value) {
var obj = wysihtml5.commands[command],
+ args = wysihtml5.lang.array(arguments).get(),
method = obj && obj.exec;
this.editor.fire("beforecommand:composer");
if (method) {
- return method.call(obj, this.composer, command, value);
+ args.unshift(this.composer);
+ return method.apply(obj, args);
} else {
try {
// try/catch for buggy firefox
@@ -61,9 +63,11 @@ wysihtml5.Commands = Base.extend(
*/
state: function(command, commandValue) {
var obj = wysihtml5.commands[command],
+ args = wysihtml5.lang.array(arguments).get(),
method = obj && obj.state;
if (method) {
- return method.call(obj, this.composer, command, commandValue);
+ args.unshift(this.composer);
+ return method.apply(obj, args);
} else {
try {
// try/catch for buggy firefox
Please sign in to comment.
Something went wrong with that request. Please try again.