Skip to content

Commit

Permalink
Fix aftercommand callback
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic committed May 14, 2012
1 parent 239b508 commit 6504d2f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/commands.js
Expand Up @@ -34,21 +34,23 @@ wysihtml5.Commands = Base.extend(
exec: function(command, value) {
var obj = wysihtml5.commands[command],
args = wysihtml5.lang.array(arguments).get(),
method = obj && obj.exec;
method = obj && obj.exec,
result = null;

this.editor.fire("beforecommand:composer");

if (method) {
args.unshift(this.composer);
return method.apply(obj, args);
result = method.apply(obj, args);
} else {
try {
// try/catch for buggy firefox
return this.doc.execCommand(command, false, value);
result = this.doc.execCommand(command, false, value);
} catch(e) {}
}

this.editor.fire("aftercommand:composer");
return result;
},

/**
Expand Down Expand Up @@ -100,4 +102,4 @@ wysihtml5.Commands = Base.extend(
}
}
}
});
});

0 comments on commit 6504d2f

Please sign in to comment.