From 2a4e02ade3b74999a9632673a607568644d6d26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Tue, 1 Jun 2021 18:20:01 +0200 Subject: [PATCH] fix: prevent dispatch empty fragment when parsing content with insertContent --- packages/core/src/commands/insertContentAt.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/core/src/commands/insertContentAt.ts b/packages/core/src/commands/insertContentAt.ts index f346bfb7..829ec1bc 100644 --- a/packages/core/src/commands/insertContentAt.ts +++ b/packages/core/src/commands/insertContentAt.ts @@ -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