1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-27 09:04:31 +02:00

Fix onCommand docs that referenced query instead of command (#2625)

This commit is contained in:
Brendan
2019-03-06 15:44:41 -06:00
committed by GitHub
parent e5e1e570b8
commit 646ff2a80f

View File

@@ -52,7 +52,7 @@ The `onChange` hook is called whenever a new change is about to be applied to an
const { type, args } = command const { type, args } = command
if (type === 'wrapQuote') { if (type === 'wrapQuote') {
change.wrapBlock('quote') editor.wrapBlock('quote')
} else { } else {
return next() return next()
} }
@@ -67,9 +67,9 @@ The `onChange` hook is called whenever a new change is about to be applied to an
} }
``` ```
The `onQuery` hook is called with a `query` object resulting from an `editor.query(type, ...args)` or a `change[query](...args)` call: The `onCommand` hook is called with a `command` object resulting from an `editor.command(type, ...args)` or a `change[command](...args)` call:
The `onQuery` hook is a low-level way to have access to all of the queries passing through the editor. Most of the time you should use the `queries` shorthand instead. The `onCommand` hook is a low-level way to have access to all of the commands passing through the editor. Most of the time you should use the `commands` shorthand instead.
### `onConstruct` ### `onConstruct`