From 4f9a2dc7c38e6abc56a76490ee77d728d5abb452 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Fri, 6 Mar 2026 15:10:57 -0500 Subject: [PATCH] support h4 --- components/Blocks/TextBlock/index.tsx | 2 ++ components/Blocks/TextBlock/inputRules.ts | 2 +- components/Blocks/TextBlock/useHandlePaste.ts | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/components/Blocks/TextBlock/index.tsx b/components/Blocks/TextBlock/index.tsx index 4fe6db4f..71574e9a 100644 --- a/components/Blocks/TextBlock/index.tsx +++ b/components/Blocks/TextBlock/index.tsx @@ -34,12 +34,14 @@ const HeadingStyle = { 1: "font-bold [font-family:var(--theme-heading-font)]", 2: "font-bold [font-family:var(--theme-heading-font)]", 3: "font-bold text-secondary [font-family:var(--theme-heading-font)]", + 4: "font-bold text-secondary [font-family:var(--theme-heading-font)]", } as { [level: number]: string }; const headingFontSize = { 1: blockTextSize.h1, 2: blockTextSize.h2, 3: blockTextSize.h3, + 4: blockTextSize.h4, } as { [level: number]: string }; export function TextBlock( diff --git a/components/Blocks/TextBlock/inputRules.ts b/components/Blocks/TextBlock/inputRules.ts index 9dbbd8c6..90673c91 100644 --- a/components/Blocks/TextBlock/inputRules.ts +++ b/components/Blocks/TextBlock/inputRules.ts @@ -210,7 +210,7 @@ export const inputrules = ( }), //Header - new InputRule(/^([#]{1,3})\s$/, (state, match) => { + new InputRule(/^([#]{1,4})\s$/, (state, match) => { let tr = state.tr; tr.delete(0, match[0].length); let headingLevel = match[1].length; diff --git a/components/Blocks/TextBlock/useHandlePaste.ts b/components/Blocks/TextBlock/useHandlePaste.ts index f3bad456..5a4e021a 100644 --- a/components/Blocks/TextBlock/useHandlePaste.ts +++ b/components/Blocks/TextBlock/useHandlePaste.ts @@ -244,6 +244,11 @@ const createBlockFromHTML = ( type = "heading"; break; } + case "H4": { + headingLevel = 4; + type = "heading"; + break; + } case "DIV": { type = "card"; break; -- 2.51.2