MCPcopy
hub / github.com/GrapesJS/grapesjs / stopCommand

Method stopCommand

packages/core/src/commands/index.ts:478–494  ·  view source on GitHub ↗

* Stop the command * @param {Object} command * @param {Object} options * @return {*} Result of the command * @private

(command?: CommandAbstract, options: CommandOptions = {})

Source from the content-addressed store, hash-verified

476 * @private
477 */
478 stopCommand(command?: CommandAbstract, options: CommandOptions = {}) {
479 let result;
480
481 if (command?.run) {
482 const { em, config } = this;
483 const id = command.id as string;
484 const editor = em.Editor;
485
486 if (this.isActive(id) || options.force || !config.strict) {
487 const defaultOptionsStopFn = config.defaultOptions?.[id]?.stop;
488 isFunction(defaultOptionsStopFn) && (options = defaultOptionsStopFn(options));
489 result = (command as any).callStop(editor, options);
490 }
491 }
492
493 return result;
494 }
495
496 /**
497 * Create anonymous Command instance

Callers 2

removeMethod · 0.95
stopMethod · 0.95

Calls 3

isActiveMethod · 0.95
callStopMethod · 0.80
isFunctionFunction · 0.50

Tested by

no test coverage detected