From ec47cda91c2530085f567547f5477e468f904c2d Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Wed, 21 Dec 2016 21:16:07 +0100 Subject: [PATCH] Add the return state to the .runCommand and .stopCommand methods --- src/editor/main.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/editor/main.js b/src/editor/main.js index f13ae3d94..fd0746395 100644 --- a/src/editor/main.js +++ b/src/editor/main.js @@ -297,32 +297,38 @@ define(function (require){ * Execute command * @param {string} id Command ID * @param {Object} options Custom options + * @return {*} The return is defined by the command * @example * editor.runCommand('myCommand', {someValue: 1}); */ runCommand: function(id, options) { + var result; var command = em.get('Commands').get(id); if(command){ - command.run(this, this, options); + result = command.run(this, this, options); this.trigger('run:' + id); } + return result; }, /** * Stop the command if stop method was provided * @param {string} id Command ID * @param {Object} options Custom options + * @return {*} The return is defined by the command * @example * editor.stopCommand('myCommand', {someValue: 1}); */ stopCommand: function(id, options) { + var result; var command = em.get('Commands').get(id); if(command){ - command.stop(this, this, options); + result = command.stop(this, this, options); this.trigger('stop:' + id); } + return result; }, /**