* Stop the command * @param {Object} command * @param {Object} options * @return {*} Result of the command * @private
(command?: CommandAbstract, options: CommandOptions = {})
| 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 |
no test coverage detected