From 8b85aeb205896146027be5372bb949a067f24f09 Mon Sep 17 00:00:00 2001 From: Doug Reeder Date: Fri, 10 Sep 2021 20:49:13 -0400 Subject: [PATCH] Adds an example to the docs for Transforms.select (#4507) --- docs/api/transforms.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/api/transforms.md b/docs/api/transforms.md index 2ce61b614..284a62b51 100644 --- a/docs/api/transforms.md +++ b/docs/api/transforms.md @@ -115,6 +115,15 @@ Options: `{edge?: 'anchor' | 'focus' | 'start' | 'end'}` Set the selection to a new value specified by `target`. When a selection already exists, this method is just a proxy for `setSelection` and will update the existing value. +For example, to set the selection to the entire contents of the editor: + +```javascript +Transforms.select(editor, { + anchor: Editor.start(editor, []), + focus: Editor.end(editor, []), +}) +``` + #### `Transforms.deselect(editor: Editor)` Unset the selection.