diff --git a/docs/src/docPages/api/commands/clear-content.md b/docs/src/docPages/api/commands/clear-content.md index 678ba1bd..14a2f3f0 100644 --- a/docs/src/docPages/api/commands/clear-content.md +++ b/docs/src/docPages/api/commands/clear-content.md @@ -6,7 +6,7 @@ Keep in mind that the editor will enforce the configured schema, and the documen See also: [setContent](/api/commands/set-content), [insertContent](/api/commands/insert-content) ## Parameters -`emitUpdate: Boolean (false)` +`emitUpdate: boolean (false)` By default, it doesn’t trigger the update event. Passing `true` doesn’t prevent triggering the update event. diff --git a/docs/src/docPages/api/commands/focus.md b/docs/src/docPages/api/commands/focus.md index 6d6c6719..e91292d5 100644 --- a/docs/src/docPages/api/commands/focus.md +++ b/docs/src/docPages/api/commands/focus.md @@ -1,6 +1,14 @@ # focus +This command sets the focus back to the editor. - +When a user clicks on a button outside the editor, the browser sets the focus to that button. In most scenarios you want to focus the editor then again. That’s why you’ll see that in basically every demo here. + +See also: [setTextSelection](/api/commands/set-text-selection) + +## Parameters +`position: 'start' | 'end' | number | boolean | null (false)` + +By default, it’s restoring the cursor position (and text selection). Pass a position to move the cursor too. ## Usage ```js @@ -12,4 +20,7 @@ editor.commands.focus('start') // Set the cursor to the last position editor.commands.focus('end') + +// Set the cursor to position 10 +editor.commands.focus(10) ``` diff --git a/docs/src/docPages/api/commands/insert-content.md b/docs/src/docPages/api/commands/insert-content.md index cb1253af..147230a8 100644 --- a/docs/src/docPages/api/commands/insert-content.md +++ b/docs/src/docPages/api/commands/insert-content.md @@ -1,5 +1,5 @@ # insertContent -The `insertContent` command adds a passed value to the document. +The `insertContent` command adds the passed value to the document. See also: [setContent](/api/commands/set-content), [clearContent](/api/commands/clear-content) diff --git a/docs/src/docPages/api/commands/set-text-selection.md b/docs/src/docPages/api/commands/set-text-selection.md index b579e2ec..ab53d5cf 100644 --- a/docs/src/docPages/api/commands/set-text-selection.md +++ b/docs/src/docPages/api/commands/set-text-selection.md @@ -1,11 +1,12 @@ # setTextSelection +If you think of selection in the context of an editor, you’ll probably think of a text selection. With `setTextSelection` you can control that text selection and set it to a specified range or position. - +See also: [focus](/api/commands/focus), [setNodeSelection](/api/commands/set-node-selection), [deleteSelection](/api/commands/delete-selection) ## Parameters `position: number | Range` -TODO +Pass a number, or a Range, for example `{ from: 5, to: 10 }`. ## Usage ```js diff --git a/docs/src/links.yaml b/docs/src/links.yaml index 4dc19c42..6c73949d 100644 --- a/docs/src/links.yaml +++ b/docs/src/links.yaml @@ -155,7 +155,7 @@ link: /api/commands/extend-mark-range - title: focus link: /api/commands/focus - type: draft + type: new - title: insertContent link: /api/commands/insert-content - title: insertContentAt @@ -213,7 +213,7 @@ type: draft - title: setTextSelection link: /api/commands/set-text-selection - type: draft + type: new - title: sinkListItem link: /api/commands/sink-list-item type: draft