From d96a39e5d3f2fd7ad35ead96ac7ed46c9b299d91 Mon Sep 17 00:00:00 2001 From: mulgyeol Date: Fri, 30 May 2025 16:27:47 +0900 Subject: [PATCH 1/3] fix: restrict auto-numbered list conversion to paragraph blocks Previously, typing "1." would convert any block with inline content into a numbered list, which was disruptive when users wanted to start headings or other blocks with numbers. Now, the auto-conversion to numbered list only triggers in paragraph blocks, preserving numerical inputs in other block types as plain text. --- .../NumberedListItemBlockContent.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/core/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts b/packages/core/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts index 4e271bae1..0b9ca1ecf 100644 --- a/packages/core/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +++ b/packages/core/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts @@ -47,11 +47,7 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({ find: new RegExp(`^(\\d+)\\.\\s$`), handler: ({ state, chain, range, match }) => { const blockInfo = getBlockInfoFromSelection(state); - if ( - !blockInfo.isBlockContainer || - blockInfo.blockContent.node.type.spec.content !== "inline*" || - blockInfo.blockNoteType === "numberedListItem" - ) { + if (blockInfo.blockNoteType !== "paragraph") { return; } const startIndex = parseInt(match[1]); From 3bc49bca131a49794352f0565e946cd4646d228e Mon Sep 17 00:00:00 2001 From: mulgyeol Date: Fri, 30 May 2025 17:45:24 +0900 Subject: [PATCH 2/3] fix: restrict auto-bullet-list conversion to paragraph blocks Previously, typing list markers (-/+/*) would convert any block with inline content into a bullet list, which was disruptive when users wanted to start headings or other blocks with these markers. Now, the auto-conversion to bullet list only triggers in paragraph blocks, preserving list markers in other block types as plain text. --- .../BulletListItemBlockContent/BulletListItemBlockContent.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/core/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts b/packages/core/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts index e6412633c..ac0ee8b6d 100644 --- a/packages/core/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +++ b/packages/core/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts @@ -29,10 +29,7 @@ const BulletListItemBlockContent = createStronglyTypedTiptapNode({ find: new RegExp(`^[-+*]\\s$`), handler: ({ state, chain, range }) => { const blockInfo = getBlockInfoFromSelection(state); - if ( - !blockInfo.isBlockContainer || - blockInfo.blockContent.node.type.spec.content !== "inline*" - ) { + if (blockInfo.blockNoteType !== "paragraph") { return; } From ef5c4b0690799f2a61489ea8c2c1daff9e726ef5 Mon Sep 17 00:00:00 2001 From: mulgyeol Date: Sun, 1 Jun 2025 02:05:38 +0900 Subject: [PATCH 3/3] fix: prevent auto list conversion in heading blocks Instead of restricting auto list conversion to paragraph blocks only, revert to allowing it in all blocks except headings. This provides better flexibility while still preventing unwanted conversions in heading blocks where users often need to start with numbers. Future improvements: - Add configurable flags for controlling auto list conversion behavior - Allow users to customize this behavior for their custom blocks - Consider adding a more generic solution for controlling input rule behaviors --- .../BulletListItemBlockContent.ts | 7 ++++++- .../NumberedListItemBlockContent.ts | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/core/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts b/packages/core/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts index ac0ee8b6d..978c7cfc4 100644 --- a/packages/core/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +++ b/packages/core/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts @@ -29,7 +29,12 @@ const BulletListItemBlockContent = createStronglyTypedTiptapNode({ find: new RegExp(`^[-+*]\\s$`), handler: ({ state, chain, range }) => { const blockInfo = getBlockInfoFromSelection(state); - if (blockInfo.blockNoteType !== "paragraph") { + if ( + !blockInfo.isBlockContainer || + blockInfo.blockContent.node.type.spec.content !== "inline*" || + blockInfo.blockNoteType === "bulletListItem" || + blockInfo.blockNoteType === "heading" + ) { return; } diff --git a/packages/core/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts b/packages/core/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts index 0b9ca1ecf..5499ac297 100644 --- a/packages/core/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +++ b/packages/core/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts @@ -47,7 +47,12 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({ find: new RegExp(`^(\\d+)\\.\\s$`), handler: ({ state, chain, range, match }) => { const blockInfo = getBlockInfoFromSelection(state); - if (blockInfo.blockNoteType !== "paragraph") { + if ( + !blockInfo.isBlockContainer || + blockInfo.blockContent.node.type.spec.content !== "inline*" || + blockInfo.blockNoteType === "numberedListItem" || + blockInfo.blockNoteType === "heading" + ) { return; } const startIndex = parseInt(match[1]);