refactor: simplify unsetAllMarks

This commit is contained in:
Philipp Kühn 2021-12-06 12:25:00 +01:00
parent 8d7c4e78e7
commit f8ce8942f5

View File

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