From c05d4c4e55344e778d481c94791226991813bcb3 Mon Sep 17 00:00:00 2001 From: Sunny Hirai Date: Sun, 6 Jun 2021 12:28:48 -0700 Subject: [PATCH] docs: Add detail to how the Editor.nodes method works --- docs/api/nodes/editor.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/api/nodes/editor.md b/docs/api/nodes/editor.md index 3f452dcb6..93b6b7941 100644 --- a/docs/api/nodes/editor.md +++ b/docs/api/nodes/editor.md @@ -118,13 +118,15 @@ Options: `depth?: number, edge?: 'start' | 'end'` #### `Editor.nodes(editor: Editor, options?) => Generator, void, undefined>` -Iterate through all of the nodes in the Editor. +At any given `Location` or `Span` in the editor provided by `at` (default is the current selection), the method returns a Generator of `NodeEntry` objects that represent the nodes that include `at`. At the top of the hierarchy is the `Editor` object itself. Options: `{at?: Location | Span, match?: NodeMatch, mode?: 'all' | 'highest' | 'lowest', universal?: boolean, reverse?: boolean, voids?: boolean}` +`options.match`: Provide a value to the `match?` option to limit the `NodeEntry` objects that are returned. + `options.mode`: -- `'all'` (default): all matching nodes +- `'all'` (default): Return all matching nodes - `'highest'`: in a hierarchy of nodes, only return the highest level matching nodes - `'lowest'`: in a hierarchy of nodes, only return the lowest level matching nodes