add commands experiment
This commit is contained in:
14
packages/core/src/commands/deleteRange.ts
Normal file
14
packages/core/src/commands/deleteRange.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user