add more commands

This commit is contained in:
Philipp Kühn
2020-09-20 23:44:38 +02:00
parent fbdc156981
commit f6270c0e0c
6 changed files with 27 additions and 27 deletions

View File

@@ -25,14 +25,12 @@ function selectionToInsertionEnd(tr, startLen, bias) {
}
export const insertHTML: InsertHTMLCommand = value => ({ tr, editor }) => {
console.log({tr })
const { state } = editor
const { selection } = tr
const element = elementFromString(value)
const slice = DOMParser.fromSchema(state.schema).parseSlice(element)
tr.insert(selection.anchor, slice.content)
// TODO: set correct bias by content
selectionToInsertionEnd(tr, tr.steps.length - 1, -1)
return true