Skip to content

Commit

Permalink
fix multi-character insertion
Browse files Browse the repository at this point in the history
When multiple characters are inserted atomically (eg in a paste),
Prosemirror generates a step with a single insertion string.
But Automerge expects us to give it one character at a time,
so we need to split the character up ourselves.

See for more context:
automerge/automerge#326
  • Loading branch information
geoffreylitt committed Jun 10, 2021
1 parent f64b467 commit b0b75a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function applyTransaction(
if (doc.content.insertAt) {
doc.content.insertAt(
contentPosFromProsemirrorPos(step.from),
insertedContent,
...insertedContent.split(""),
)
}
})
Expand Down

0 comments on commit b0b75a1

Please sign in to comment.