refactoring

This commit is contained in:
Philipp Kühn
2020-03-04 21:27:22 +01:00
parent 8633404cc3
commit 4981571c20
2 changed files with 4 additions and 2 deletions

View File

@@ -8,7 +8,8 @@ declare module '../Editor' {
}
}
export default function insertHTML(next: Function, { state, view }: Editor, value: string): void {
export default function insertHTML(next: Function, editor: Editor, value: string): void {
const { view, state } = editor
const { selection } = state
const element = elementFromString(value)
const slice = DOMParser.fromSchema(state.schema).parseSlice(element)

View File

@@ -6,7 +6,8 @@ declare module '../Editor' {
}
}
export default function insertText(next: Function, { state, view }: Editor, value: string): void {
export default function insertText(next: Function, editor: Editor, value: string): void {
const { view, state } = editor
const transaction = state.tr.insertText(value)
view.dispatch(transaction)