Skip to content

Commit

Permalink
fix: prevent dispatch empty fragment when parsing content with insert…
Browse files Browse the repository at this point in the history
…Content
  • Loading branch information
philippkuehn committed Jun 1, 2021
1 parent f5febda commit 2a4e02a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/core/src/commands/insertContentAt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ export const insertContentAt: RawCommands['insertContentAt'] = (position, value)
preserveWhitespace: 'full',
},
})

// don’t dispatch an empty fragment because this can lead to strange errors
if (content.toString() === '<>') {
return true
}

const { from, to } = typeof position === 'number'
? { from: position, to: position }
: position
Expand Down

0 comments on commit 2a4e02a

Please sign in to comment.