MCPcopy
hub / github.com/ianstormtaylor/slate / command

Method command

packages/slate/src/controllers/editor.js:158–172  ·  view source on GitHub ↗

* Trigger a command by `type` with `...args`. * * @param {String|Function} type * @param {Any} ...args * @return {Editor}

(type, ...args)

Source from the content-addressed store, hash-verified

156 */
157
158 command(type, ...args) {
159 const { controller } = this
160
161 if (typeof type === 'function') {
162 type(controller, ...args)
163 normalizeDirtyPaths(this)
164 return controller
165 }
166
167 debug('command', { type, args })
168 const obj = { type, args }
169 this.run('onCommand', obj)
170 normalizeDirtyPaths(this)
171 return controller
172 }
173
174 /**
175 * Checks if a command by `type` has been registered.

Callers 8

methodMethod · 0.95
on-selection.jsFile · 0.45
pointWordBackwardFunction · 0.45
pointWordForwardFunction · 0.45
onCommandFunction · 0.45
LinksClass · 0.45
ImagesClass · 0.45

Calls 2

runMethod · 0.95
normalizeDirtyPathsFunction · 0.85

Tested by

no test coverage detected