mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-14 22:32:24 +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'
|
import { RawCommands } from '../types.js'
|
||||||
|
|
||||||
declare module '@tiptap/core' {
|
declare module '@tiptap/core' {
|
||||||
@ -12,9 +14,12 @@ declare module '@tiptap/core' {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const selectAll: RawCommands['selectAll'] = () => ({ tr, commands }) => {
|
export const selectAll: RawCommands['selectAll'] = () => ({ tr, dispatch }) => {
|
||||||
return commands.setTextSelection({
|
if (dispatch) {
|
||||||
from: 0,
|
const selection = new AllSelection(tr.doc)
|
||||||
to: tr.doc.content.size,
|
|
||||||
})
|
tr.setSelection(selection)
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user