From 411ab6b7853c6f62f878fad459836e083a70acd4 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 14 Sep 2023 22:19:27 -0400 Subject: [PATCH] fix: Backspace emoji as first character in heading converts to paragraph --- shared/editor/commands/backspaceToParagraph.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shared/editor/commands/backspaceToParagraph.ts b/shared/editor/commands/backspaceToParagraph.ts index 4b794226b..8f5bf8afa 100644 --- a/shared/editor/commands/backspaceToParagraph.ts +++ b/shared/editor/commands/backspaceToParagraph.ts @@ -9,7 +9,7 @@ import { Command } from "prosemirror-state"; * @returns A prosemirror command. */ export default function backspaceToParagraph(type: NodeType): Command { - return (state, dispatch) => { + return (state, dispatch, view) => { const { $from, from, to, empty } = state.selection; // if the selection has anything in it then use standard delete behavior @@ -23,8 +23,7 @@ export default function backspaceToParagraph(type: NodeType): Command { } // check if we're at the beginning of the heading - const $pos = state.doc.resolve(from - 1); - if ($pos.parent === $from.parent) { + if (!view?.endOfTextblock("backward", state)) { return false; }