fix: Enter in empty heading (#10194)

This commit is contained in:
Tom Moor
2025-09-17 03:36:07 +02:00
committed by GitHub
parent 07694e06ff
commit fc6d1a9be4

View File

@@ -23,8 +23,9 @@ export default function splitHeading(type: NodeType): Command {
const previousBlockIsCollapsed = !!collapsedNodes.find(
(a) => a.pos === previousBlock?.pos
);
const isEmpty = $from.parent.content.size === 0;
if (previousBlockIsCollapsed) {
if (previousBlockIsCollapsed && !isEmpty) {
// Insert a new heading directly before this one
const transaction = state.tr.insert(
$from.before(),