mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-13 05:11:04 +08:00
parent
ec8d654dc8
commit
722ec00fb2
5
.changeset/six-islands-breathe.md
Normal file
5
.changeset/six-islands-breathe.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@tiptap/core": patch
|
||||
---
|
||||
|
||||
Use an AllSelection for the selectAll command #5516
|
@ -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' {
|
||||
}
|
||||
}
|
||||
|
||||
export const selectAll: RawCommands['selectAll'] = () => ({ tr, commands }) => {
|
||||
return commands.setTextSelection({
|
||||
from: 0,
|
||||
to: tr.doc.content.size,
|
||||
})
|
||||
export const selectAll: RawCommands['selectAll'] = () => ({ tr, dispatch }) => {
|
||||
if (dispatch) {
|
||||
const selection = new AllSelection(tr.doc)
|
||||
|
||||
tr.setSelection(selection)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user