improve type handling for commands

This commit is contained in:
Philipp Kühn
2020-04-21 23:22:27 +02:00
parent 3deae61a15
commit 91d4aa7e39
13 changed files with 45 additions and 35 deletions

View File

@@ -1,12 +1,14 @@
import { Editor } from '../Editor'
type RemoveMarks = () => any
declare module '../Editor' {
interface Editor {
removeMarks(): Editor,
removeMarks: RemoveMarks,
}
}
export default function removeMarks(next: Function, editor: Editor): void {
export default (next: Function, editor: Editor): RemoveMarks => () => {
const { state, view, schema } = editor
const { selection, tr } = state
const { from, to, empty } = selection