From 175b25ae51a75357f1655ff27478df5295588bfe Mon Sep 17 00:00:00 2001 From: Alan Christopher Thomas Date: Sat, 20 Oct 2018 02:05:53 -0500 Subject: [PATCH] Fix docs on queries to show editor argument (#2285) --- docs/guides/commands-and-queries.md | 4 ++-- docs/reference/slate/plugins.md | 4 ++-- packages/slate/Changelog.md | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/guides/commands-and-queries.md b/docs/guides/commands-and-queries.md index a1b9b919f..b8597c451 100644 --- a/docs/guides/commands-and-queries.md +++ b/docs/guides/commands-and-queries.md @@ -207,7 +207,7 @@ The same thing goes for queries, which can be defined in plugins and re-used acr ```js const yourPlugin = { queries: { - getActiveListItem(value) { + getActiveListItem(editor) { ... } } @@ -217,7 +217,7 @@ const yourPlugin = { And then you can use them: ```js -change.getActiveListItem(change.value) +change.getActiveListItem() ``` This reusability is key to being able to organize your commands and queries, and compose them together to create more advanced behaviors. diff --git a/docs/reference/slate/plugins.md b/docs/reference/slate/plugins.md index f982fd991..634724951 100644 --- a/docs/reference/slate/plugins.md +++ b/docs/reference/slate/plugins.md @@ -160,7 +160,7 @@ Each command has a signature of `(change, ...args)`. ```js { queries: { - getActiveList(value) { + getActiveList(editor) { ... } } @@ -169,7 +169,7 @@ Each command has a signature of `(change, ...args)`. The `queries` shorthand defines a set of custom queries that are made available in the editor, and as first-class methods on the `change` objects created by the editor. -Each query has a signature of `(...args)`. +Each query has a signature of `(editor, ...args)`. ### `schema` diff --git a/packages/slate/Changelog.md b/packages/slate/Changelog.md index c683691ec..578e76886 100644 --- a/packages/slate/Changelog.md +++ b/packages/slate/Changelog.md @@ -65,7 +65,7 @@ For example, you might define an `getActiveList` query: ```js const plugin = { queries: { - getActiveList(value) {}, + getActiveList(editor) {}, }, } ``` @@ -73,8 +73,7 @@ const plugin = { And then be able to re-use that logic easily in different places in your codebase, or pass in the query name to a plugin that can use your custom logic itself: ```js -const { value } = change -const list = change.getActiveList(value) +const list = change.getActiveList() if (list) { ...