From cb1db7fca914854a61c8f05dca416500d18ce7d3 Mon Sep 17 00:00:00 2001 From: Sunny Hirai Date: Fri, 14 May 2021 21:29:34 -0700 Subject: [PATCH] Add getFragment to the API docs --- docs/api/nodes/editor.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/api/nodes/editor.md b/docs/api/nodes/editor.md index 661c4b083..da97db8d2 100644 --- a/docs/api/nodes/editor.md +++ b/docs/api/nodes/editor.md @@ -369,16 +369,22 @@ Check if a value is a void `Element` object. Called when there is a change in the editor. -### Override mark methods +### Mark methods #### `addMark(key: string, value: any)` -Add a custom property to the leaf text nodes in the current selection. If the selection is currently collapsed, the marks will be added to the `editor.marks` property instead, and applied when text is inserted next. +Add a custom property to the leaf text nodes in the currentk selection. If the selection is currently collapsed, the marks will be added to the `editor.marks` property instead, and applied when text is inserted next. #### `removeMark(key: string)` Remove a custom property from the leaf text nodes in the current selection. +### getFragment method + +#### `getFragment(): Descendant` + +Returns the fragment at the current selection. Used when cutting or copying, as an example, to get the fragment at the current selection. + ### Delete methods When a user presses backspace or delete, it invokes the method based on the selection. For example, if the selection is expanded over some text and the user presses the backspace key, `deleteFragment` will be called but if the selecttion is collapsed, `deleteBackward` will be called.