浏览代码

Add example to MultiCommand.

Maciej Gołaszewski 6 年之前
父节点
当前提交
1fb89ec195
共有 1 个文件被更改,包括 14 次插入0 次删除
  1. 14 0
      packages/ckeditor5-core/src/multicommand.js

+ 14 - 0
packages/ckeditor5-core/src/multicommand.js

@@ -16,6 +16,20 @@ import Collection from '@ckeditor/ckeditor5-utils/src/collection';
  * This command is used to proxy multiple commands. The multi command is enabled when one of its registered child commands is enabled.
  * Whe executing multi command the first command that is enabled will be executed.
  *
+ *		const multiCommand = new MultiCommand( editor );
+ *
+ *		const commandFoo = new Command( editor );
+ *		const commandBar = new Command( editor );
+ *
+ *		// Register child commands.
+ *		multiCommand.registerChildCommand( commandFoo );
+ *		multiCommand.registerChildCommand( commandBar );
+ *
+ *		// Enable one of commands
+ *		commandBar.isEnabled = true;
+ *
+ *		multiCommand.execute(); // Will execute commandBar.
+ *
  * @extends module:core/command~Command
  */
 export default class MultiCommand extends Command {