mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-08 12:27:59 +08:00
15 lines
247 B
TypeScript
15 lines
247 B
TypeScript
|
import { Command, Range } from '../types'
|
||
|
|
||
|
/**
|
||
|
* Delete a given range.
|
||
|
*/
|
||
|
export const deleteRange = (range: Range): Command => ({ tr, dispatch }) => {
|
||
|
const { from, to } = range
|
||
|
|
||
|
if (dispatch) {
|
||
|
tr.delete(from, to)
|
||
|
}
|
||
|
|
||
|
return true
|
||
|
}
|