tiptap/packages/core/src/commands/deleteRange.ts

15 lines
247 B
TypeScript
Raw Normal View History

2021-01-21 19:13:20 +08:00
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
}