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,12 +20,8 @@ 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)
})
tr.removeMark(range.$from.pos, range.$to.pos)
})
}