fix more commands for cell selections

This commit is contained in:
Philipp Kühn
2021-03-28 21:30:47 +02:00
parent ffde0a382e
commit 4717d7ff9a
4 changed files with 37 additions and 29 deletions

View File

@@ -13,7 +13,7 @@ declare module '@tiptap/core' {
export const unsetAllMarks: RawCommands['unsetAllMarks'] = () => ({ tr, state, dispatch }) => {
const { selection } = tr
const { from, to, empty } = selection
const { empty, ranges } = selection
if (empty) {
return true
@@ -23,7 +23,9 @@ export const unsetAllMarks: RawCommands['unsetAllMarks'] = () => ({ tr, state, d
Object
.entries(state.schema.marks)
.forEach(([, mark]) => {
tr.removeMark(from, to, mark as any)
ranges.forEach(range => {
tr.removeMark(range.$from.pos, range.$to.pos, mark as any)
})
})
}