We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
selectAll
1 parent ec8d654 commit 722ec00Copy full SHA for 722ec00
2 files changed
.changeset/six-islands-breathe.md
@@ -0,0 +1,5 @@
1
+---
2
+"@tiptap/core": patch
3
4
+
5
+Use an AllSelection for the selectAll command #5516
packages/core/src/commands/selectAll.ts
@@ -1,3 +1,5 @@
+import { AllSelection } from '@tiptap/pm/state'
import { RawCommands } from '../types.js'
declare module '@tiptap/core' {
@@ -12,9 +14,12 @@ declare module '@tiptap/core' {
12
14
}
13
15
16
-export const selectAll: RawCommands['selectAll'] = () => ({ tr, commands }) => {
- return commands.setTextSelection({
17
- from: 0,
18
- to: tr.doc.content.size,
19
- })
+export const selectAll: RawCommands['selectAll'] = () => ({ tr, dispatch }) => {
+ if (dispatch) {
+ const selection = new AllSelection(tr.doc)
20
21
+ tr.setSelection(selection)
22
+ }
23
24
+ return true
25
0 commit comments