From 93e4c1207da2d8bce9a2391497d0d26b692e9342 Mon Sep 17 00:00:00 2001 From: Drew Johnson Date: Mon, 21 Apr 2025 20:21:47 -0400 Subject: [PATCH 1/9] Adding H4/H5 blocks --- .../HeadingBlockContent.ts | 102 ++++++------------ packages/core/src/editor/Block.css | 12 +++ packages/core/src/editor/editor.css | 2 + 3 files changed, 44 insertions(+), 72 deletions(-) diff --git a/packages/core/src/blocks/HeadingBlockContent/HeadingBlockContent.ts b/packages/core/src/blocks/HeadingBlockContent/HeadingBlockContent.ts index 2b95fbf5a..a0b070623 100644 --- a/packages/core/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +++ b/packages/core/src/blocks/HeadingBlockContent/HeadingBlockContent.ts @@ -10,9 +10,11 @@ import { import { createDefaultBlockDOMOutputSpec } from "../defaultBlockHelpers.js"; import { defaultProps } from "../defaultProps.js"; +const HEADING_LEVELS = [1, 2, 3, 4, 5] as const; + export const headingPropSchema = { ...defaultProps, - level: { default: 1, values: [1, 2, 3] as const }, + level: { default: 1, values: HEADING_LEVELS }, } satisfies PropSchema; const HeadingBlockContent = createStronglyTypedTiptapNode({ @@ -26,7 +28,7 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({ addInputRules() { return [ - ...[1, 2, 3].map((level) => { + ...HEADING_LEVELS.map((level) => { // Creates a heading of appropriate level when starting with "#", "##", or "###". return new InputRule({ find: new RegExp(`^(#{${level}})\\s$`), @@ -58,84 +60,40 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({ }, addKeyboardShortcuts() { - return { - "Mod-Alt-1": () => { - const blockInfo = getBlockInfoFromSelection(this.editor.state); - if ( - !blockInfo.isBlockContainer || - blockInfo.blockContent.node.type.spec.content !== "inline*" - ) { - return true; - } - - // call updateBlockCommand - return this.editor.commands.command( - updateBlockCommand(blockInfo.bnBlock.beforePos, { - type: "heading", - props: { - level: 1 as any, - }, - }) - ); - }, - "Mod-Alt-2": () => { - const blockInfo = getBlockInfoFromSelection(this.editor.state); - if ( - !blockInfo.isBlockContainer || - blockInfo.blockContent.node.type.spec.content !== "inline*" - ) { - return true; - } - - return this.editor.commands.command( - updateBlockCommand(blockInfo.bnBlock.beforePos, { - type: "heading", - props: { - level: 2 as any, - }, - }) - ); - }, - "Mod-Alt-3": () => { - const blockInfo = getBlockInfoFromSelection(this.editor.state); - if ( - !blockInfo.isBlockContainer || - blockInfo.blockContent.node.type.spec.content !== "inline*" - ) { - return true; - } + return Object.fromEntries( + HEADING_LEVELS.map((level) => [ + `Mod-Alt-${level}`, + () => { + const blockInfo = getBlockInfoFromSelection(this.editor.state); + if ( + !blockInfo.isBlockContainer || + blockInfo.blockContent.node.type.spec.content !== "inline*" + ) { + return true; + } - return this.editor.commands.command( - updateBlockCommand(blockInfo.bnBlock.beforePos, { - type: "heading", - props: { - level: 3 as any, - }, - }) - ); - }, - }; + return this.editor.commands.command( + updateBlockCommand(blockInfo.bnBlock.beforePos, { + type: "heading", + props: { + level: level as any, + }, + }) + ); + }, + ]) + ); }, parseHTML() { return [ { tag: "div[data-content-type=" + this.name + "]", }, - { - tag: "h1", - attrs: { level: 1 }, + ...HEADING_LEVELS.map((level) => ({ + tag: `h${level}`, + attrs: { level }, node: "heading", - }, - { - tag: "h2", - attrs: { level: 2 }, - node: "heading", - }, - { - tag: "h3", - attrs: { level: 3 }, - node: "heading", - }, + })), ]; }, diff --git a/packages/core/src/editor/Block.css b/packages/core/src/editor/Block.css index 2bff2395b..69844b5a3 100644 --- a/packages/core/src/editor/Block.css +++ b/packages/core/src/editor/Block.css @@ -127,6 +127,12 @@ NESTED BLOCKS [data-content-type="heading"][data-level="3"] { --level: 1.3em; } +[data-content-type="heading"][data-level="4"] { + --level: 1em; +} +[data-content-type="heading"][data-level="5"] { + --level: 0.8em; +} [data-prev-level="1"] { --prev-level: 3em; @@ -137,6 +143,12 @@ NESTED BLOCKS [data-prev-level="3"] { --prev-level: 1.3em; } +[data-prev-level="4"] { + --prev-level: 1em; +} +[data-prev-level="5"] { + --prev-level: 0.9em; +} .bn-block-outer[data-prev-type="heading"] > .bn-block > .bn-block-content { font-size: var(--prev-level); diff --git a/packages/core/src/editor/editor.css b/packages/core/src/editor/editor.css index 0f5c48633..76bfd253a 100644 --- a/packages/core/src/editor/editor.css +++ b/packages/core/src/editor/editor.css @@ -44,6 +44,8 @@ Tippy popups that are appended to document.body directly .bn-default-styles h1, .bn-default-styles h2, .bn-default-styles h3, +.bn-default-styles h4, +.bn-default-styles h5, .bn-default-styles li { margin: 0; padding: 0; From 4c893f5d70d9fe3ebefaafce8ba539fe8cfee458 Mon Sep 17 00:00:00 2001 From: Drew Johnson Date: Mon, 21 Apr 2025 20:22:04 -0400 Subject: [PATCH 2/9] Adding translations for h4/h5 --- packages/core/src/i18n/locales/ar.ts | 12 ++++++++++++ packages/core/src/i18n/locales/de.ts | 12 ++++++++++++ packages/core/src/i18n/locales/en.ts | 12 ++++++++++++ packages/core/src/i18n/locales/es.ts | 12 ++++++++++++ packages/core/src/i18n/locales/fr.ts | 12 ++++++++++++ packages/core/src/i18n/locales/hr.ts | 12 ++++++++++++ packages/core/src/i18n/locales/is.ts | 12 ++++++++++++ packages/core/src/i18n/locales/it.ts | 12 ++++++++++++ packages/core/src/i18n/locales/ja.ts | 12 ++++++++++++ packages/core/src/i18n/locales/ko.ts | 12 ++++++++++++ packages/core/src/i18n/locales/nl.ts | 12 ++++++++++++ packages/core/src/i18n/locales/no.ts | 12 ++++++++++++ packages/core/src/i18n/locales/pl.ts | 12 ++++++++++++ packages/core/src/i18n/locales/pt.ts | 12 ++++++++++++ packages/core/src/i18n/locales/ru.ts | 12 ++++++++++++ packages/core/src/i18n/locales/uk.ts | 12 ++++++++++++ packages/core/src/i18n/locales/vi.ts | 12 ++++++++++++ packages/core/src/i18n/locales/zh.ts | 12 ++++++++++++ 18 files changed, 216 insertions(+) diff --git a/packages/core/src/i18n/locales/ar.ts b/packages/core/src/i18n/locales/ar.ts index eff1bbed3..ecc9bf988 100644 --- a/packages/core/src/i18n/locales/ar.ts +++ b/packages/core/src/i18n/locales/ar.ts @@ -20,6 +20,18 @@ export const ar: Dictionary = { aliases: ["ع3", "عنوان3", "عنوان فرعي"], group: "العناوين", }, + heading_4: { + title: "عنوان 4", + subtext: "عنوان فرعي ثانوي صغير", + aliases: ["ع4", "عنوان4", "عنوان فرعي صغير"], + group: "العناوين", + }, + heading_5: { + title: "عنوان 5", + subtext: "أدنى مستوى للعناوين", + aliases: ["ع5", "عنوان5", "العنوان الفرعي الأدنى"], + group: "العناوين", + }, quote: { title: "اقتباس", subtext: "اقتباس أو مقتطف", diff --git a/packages/core/src/i18n/locales/de.ts b/packages/core/src/i18n/locales/de.ts index 6d66713e2..d2208f6d8 100644 --- a/packages/core/src/i18n/locales/de.ts +++ b/packages/core/src/i18n/locales/de.ts @@ -20,6 +20,18 @@ export const de: Dictionary = { aliases: ["h3", "überschrift3", "unterüberschrift"], group: "Überschriften", }, + heading_4: { + title: "Überschrift 4", + subtext: "Überschrift für kleinere Unterabschnitte", + aliases: ["h4", "überschrift4", "unterüberschrift4"], + group: "Überschriften", + }, + heading_5: { + title: "Überschrift 5", + subtext: "Überschrift auf der untersten Ebene", + aliases: ["h5", "überschrift5", "unterüberschrift5"], + group: "Überschriften", + }, quote: { title: "Zitat", subtext: "Zitat oder Auszug", diff --git a/packages/core/src/i18n/locales/en.ts b/packages/core/src/i18n/locales/en.ts index c705fae41..d2fc8dc63 100644 --- a/packages/core/src/i18n/locales/en.ts +++ b/packages/core/src/i18n/locales/en.ts @@ -18,6 +18,18 @@ export const en = { aliases: ["h3", "heading3", "subheading"], group: "Headings", }, + heading_4: { + title: "Heading 4", + subtext: "Minor subsection heading", + aliases: ["h4", "heading4", "subheading4"], + group: "Headings", + }, + heading_5: { + title: "Heading 5", + subtext: "Lowest‑level heading", + aliases: ["h5", "heading5", "subheading5"], + group: "Headings", + }, quote: { title: "Quote", subtext: "Quote or excerpt", diff --git a/packages/core/src/i18n/locales/es.ts b/packages/core/src/i18n/locales/es.ts index 4f23dc027..aa93ab350 100644 --- a/packages/core/src/i18n/locales/es.ts +++ b/packages/core/src/i18n/locales/es.ts @@ -20,6 +20,18 @@ export const es: Dictionary = { aliases: ["h3", "encabezado3", "subencabezado"], group: "Encabezados", }, + heading_4: { + title: "Encabezado 4", + subtext: "Encabezado de subsección menor", + aliases: ["h4", "encabezado4", "subencabezado4"], + group: "Encabezados", + }, + heading_5: { + title: "Encabezado 5", + subtext: "Encabezado de nivel más bajo", + aliases: ["h5", "encabezado5", "subencabezado5"], + group: "Encabezados", + }, quote: { title: "Cita", subtext: "Cita o extracto", diff --git a/packages/core/src/i18n/locales/fr.ts b/packages/core/src/i18n/locales/fr.ts index ba24ee859..a5d6d927b 100644 --- a/packages/core/src/i18n/locales/fr.ts +++ b/packages/core/src/i18n/locales/fr.ts @@ -21,6 +21,18 @@ export const fr: Dictionary = { aliases: ["h3", "titre3", "sous-titre"], group: "Titres", }, + heading_4: { + title: "Titre 4", + subtext: "Titre de sous‑section mineure", + aliases: ["h4", "titre4", "sous‑titre4"], + group: "Titres", + }, + heading_5: { + title: "Titre 5", + subtext: "Titre de niveau le plus bas", + aliases: ["h5", "titre5", "sous‑titre5"], + group: "Titres", + }, quote: { title: "Citation", subtext: "Citation ou extrait", diff --git a/packages/core/src/i18n/locales/hr.ts b/packages/core/src/i18n/locales/hr.ts index d099696d8..43c607f4f 100644 --- a/packages/core/src/i18n/locales/hr.ts +++ b/packages/core/src/i18n/locales/hr.ts @@ -20,6 +20,18 @@ export const hr: Dictionary = { aliases: ["h3", "naslov3", "podnaslov"], group: "Naslovi", }, + heading_4: { + title: "Naslov 4", + subtext: "Manji naslov podpoglavlja", + aliases: ["h4", "naslov4", "podnaslov4"], + group: "Naslovi", + }, + heading_5: { + title: "Naslov 5", + subtext: "Naslov najniže razine", + aliases: ["h5", "naslov5", "podnaslov5"], + group: "Naslovi", + }, quote: { title: "Citat", subtext: "Citat ili izvadak", diff --git a/packages/core/src/i18n/locales/is.ts b/packages/core/src/i18n/locales/is.ts index f30717101..1c62786f9 100644 --- a/packages/core/src/i18n/locales/is.ts +++ b/packages/core/src/i18n/locales/is.ts @@ -20,6 +20,18 @@ export const is: Dictionary = { aliases: ["h3", "fyrirsogn3", "undirfyrirsogn"], group: "Fyrirsagnir", }, + heading_4: { + title: "Fyrirsögn 4", + subtext: "Titill fyrir minni undirhluta", + aliases: ["h4", "fyrirsogn4", "undirfyrirsogn4"], + group: "Fyrirsagnir", + }, + heading_5: { + title: "Fyrirsögn 5", + subtext: "Titill á lægsta stigi", + aliases: ["h5", "fyrirsogn5", "undirfyrirsogn5"], + group: "Fyrirsagnir", + }, quote: { title: "Tilvitnun", subtext: "Tilvitnun eða útdráttur", diff --git a/packages/core/src/i18n/locales/it.ts b/packages/core/src/i18n/locales/it.ts index 5554317dd..a98d9f7aa 100644 --- a/packages/core/src/i18n/locales/it.ts +++ b/packages/core/src/i18n/locales/it.ts @@ -20,6 +20,18 @@ export const it: Dictionary = { aliases: ["h3", "intestazione3", "sottotitolo"], group: "Intestazioni", }, + heading_4: { + title: "Intestazione 4", + subtext: "Intestazione di sottosezione minore", + aliases: ["h4", "intestazione4", "sottotitolo4"], + group: "Intestazioni", + }, + heading_5: { + title: "Intestazione 5", + subtext: "Intestazione di livello più basso", + aliases: ["h5", "intestazione5", "sottotitolo5"], + group: "Intestazioni", + }, quote: { title: "Citazione", subtext: "Citazione o estratto", diff --git a/packages/core/src/i18n/locales/ja.ts b/packages/core/src/i18n/locales/ja.ts index 0d359a07c..c5fd7229a 100644 --- a/packages/core/src/i18n/locales/ja.ts +++ b/packages/core/src/i18n/locales/ja.ts @@ -20,6 +20,18 @@ export const ja: Dictionary = { aliases: ["h3", "見出し3", "subheading", "小見出し"], group: "見出し", }, + heading_4: { + title: "見出し4", + subtext: "小さなサブセクションの見出しに使用", + aliases: ["h4", "見出し4", "subheading4", "小見出し4"], + group: "見出し", + }, + heading_5: { + title: "見出し5", + subtext: "最下位レベルの見出しに使用", + aliases: ["h5", "見出し5", "subheading5", "小見出し5"], + group: "見出し", + }, quote: { title: "引用", subtext: "引用または抜粋", diff --git a/packages/core/src/i18n/locales/ko.ts b/packages/core/src/i18n/locales/ko.ts index f647d9d01..a31a75a78 100644 --- a/packages/core/src/i18n/locales/ko.ts +++ b/packages/core/src/i18n/locales/ko.ts @@ -20,6 +20,18 @@ export const ko: Dictionary = { aliases: ["h3", "제목3", "subheading"], group: "제목", }, + heading_4: { + title: "제목4", + subtext: "하위 소단락 제목", + aliases: ["h4", "제목4", "소제목4"], + group: "제목", + }, + heading_5: { + title: "제목5", + subtext: "가장 하위 수준 제목", + aliases: ["h5", "제목5", "소제목5"], + group: "제목", + }, quote: { title: "인용", subtext: "인용문 또는 발췌", diff --git a/packages/core/src/i18n/locales/nl.ts b/packages/core/src/i18n/locales/nl.ts index 9e6f8d34b..aceb12fde 100644 --- a/packages/core/src/i18n/locales/nl.ts +++ b/packages/core/src/i18n/locales/nl.ts @@ -20,6 +20,18 @@ export const nl: Dictionary = { aliases: ["h3", "kop3", "subkop"], group: "Koppen", }, + heading_4: { + title: "Kop 4", + subtext: "Gebruikt voor kleinere subsecties", + aliases: ["h4", "kop4", "subkop4"], + group: "Koppen", + }, + heading_5: { + title: "Kop 5", + subtext: "Gebruikt voor de laagste niveau koppen", + aliases: ["h5", "kop5", "subkop5"], + group: "Koppen", + }, quote: { title: "Citaat", subtext: "Citaat of uittreksel", diff --git a/packages/core/src/i18n/locales/no.ts b/packages/core/src/i18n/locales/no.ts index 5eddd8705..f201028cb 100644 --- a/packages/core/src/i18n/locales/no.ts +++ b/packages/core/src/i18n/locales/no.ts @@ -20,6 +20,18 @@ export const no: Dictionary = { aliases: ["h3", "overskrift3", "underoverskrift"], group: "Overskrifter", }, + heading_4: { + title: "Overskrift 4", + subtext: "Underoverskrift for mindre underseksjoner", + aliases: ["h4", "overskrift4", "underoverskrift4"], + group: "Overskrifter", + }, + heading_5: { + title: "Overskrift 5", + subtext: "Overskrift på laveste nivå", + aliases: ["h5", "overskrift5", "underoverskrift5"], + group: "Overskrifter", + }, quote: { title: "Sitat", subtext: "Sitat eller utdrag", diff --git a/packages/core/src/i18n/locales/pl.ts b/packages/core/src/i18n/locales/pl.ts index 490de484e..24639da25 100644 --- a/packages/core/src/i18n/locales/pl.ts +++ b/packages/core/src/i18n/locales/pl.ts @@ -20,6 +20,18 @@ export const pl: Dictionary = { aliases: ["h3", "naglowek3", "podnaglowek"], group: "Nagłówki", }, + heading_4: { + title: "Nagłówek 4", + subtext: "Nagłówek mniejszej podsekcji", + aliases: ["h4", "naglowek4", "podnaglowek4"], + group: "Nagłówki", + }, + heading_5: { + title: "Nagłówek 5", + subtext: "Nagłówek najniższego poziomu", + aliases: ["h5", "naglowek5", "podnaglowek5"], + group: "Nagłówki", + }, quote: { title: "Cytat", subtext: "Cytat lub fragment", diff --git a/packages/core/src/i18n/locales/pt.ts b/packages/core/src/i18n/locales/pt.ts index 1272700eb..0cb558ceb 100644 --- a/packages/core/src/i18n/locales/pt.ts +++ b/packages/core/src/i18n/locales/pt.ts @@ -20,6 +20,18 @@ export const pt: Dictionary = { aliases: ["h3", "titulo3", "subtitulo"], group: "Títulos", }, + heading_4: { + title: "Título 4", + subtext: "Usado para subseções menores", + aliases: ["h4", "titulo4", "subtitulo4"], + group: "Títulos", + }, + heading_5: { + title: "Título 5", + subtext: "Usado para títulos de nível mais baixo", + aliases: ["h5", "titulo5", "subtitulo5"], + group: "Títulos", + }, quote: { title: "Citação", subtext: "Citação ou trecho", diff --git a/packages/core/src/i18n/locales/ru.ts b/packages/core/src/i18n/locales/ru.ts index 045980cf5..11b91fe66 100644 --- a/packages/core/src/i18n/locales/ru.ts +++ b/packages/core/src/i18n/locales/ru.ts @@ -20,6 +20,18 @@ export const ru: Dictionary = { aliases: ["h3", "heading3", "subheading", "заголовок3", "подзаголовок"], group: "Заголовки", }, + heading_4: { + title: "Заголовок 4 уровня", + subtext: "Используется для более мелких подразделов", + aliases: ["h4", "heading4", "subheading4", "заголовок4", "подзаголовок4"], + group: "Заголовки", + }, + heading_5: { + title: "Заголовок 5 уровня", + subtext: "Используется для заголовков самого низкого уровня", + aliases: ["h5", "heading5", "subheading5", "заголовок5", "подзаголовок5"], + group: "Заголовки", + }, quote: { title: "Цитата", subtext: "Цитата или отрывок", diff --git a/packages/core/src/i18n/locales/uk.ts b/packages/core/src/i18n/locales/uk.ts index 5592d752c..8a990ee6f 100644 --- a/packages/core/src/i18n/locales/uk.ts +++ b/packages/core/src/i18n/locales/uk.ts @@ -20,6 +20,18 @@ export const uk: Dictionary = { aliases: ["h3", "heading3", "subheading", "заголовок3"], group: "Заголовки", }, + heading_4: { + title: "Заголовок 4", + subtext: "Використовується для менших підрозділів", + aliases: ["h4", "heading4", "subheading4", "заголовок4"], + group: "Заголовки", + }, + heading_5: { + title: "Заголовок 5", + subtext: "Використовується для заголовків найнижчого рівня", + aliases: ["h5", "heading5", "subheading5", "заголовок5"], + group: "Заголовки", + }, quote: { title: "Цитата", subtext: "Цитата або уривок", diff --git a/packages/core/src/i18n/locales/vi.ts b/packages/core/src/i18n/locales/vi.ts index afe16fd2c..afcb3d20c 100644 --- a/packages/core/src/i18n/locales/vi.ts +++ b/packages/core/src/i18n/locales/vi.ts @@ -20,6 +20,18 @@ export const vi: Dictionary = { aliases: ["h3", "tieude3", "tieudephu"], group: "Tiêu đề", }, + heading_4: { + title: "Tiêu đề H4", + subtext: "Sử dụng cho tiêu đề phụ nhỏ hơn", + aliases: ["h4", "tieude4", "tieudephu4"], + group: "Tiêu đề", + }, + heading_5: { + title: "Tiêu đề H5", + subtext: "Sử dụng cho tiêu đề cấp thấp nhất", + aliases: ["h5", "tieude5", "tieudephu5"], + group: "Tiêu đề", + }, quote: { title: "Trích dẫn", subtext: "Trích dẫn hoặc đoạn trích", diff --git a/packages/core/src/i18n/locales/zh.ts b/packages/core/src/i18n/locales/zh.ts index fff54c314..84f36c580 100644 --- a/packages/core/src/i18n/locales/zh.ts +++ b/packages/core/src/i18n/locales/zh.ts @@ -20,6 +20,18 @@ export const zh: Dictionary = { aliases: ["h3", "heading3", "subheading", "标题", "三级标题"], group: "标题", }, + heading_4: { + title: "四级标题", + subtext: "用于较小的子节标题", + aliases: ["h4", "heading4", "subheading4", "四级标题"], + group: "标题", + }, + heading_5: { + title: "五级标题", + subtext: "用于最低层级的标题", + aliases: ["h5", "heading5", "subheading5", "五级标题"], + group: "标题", + }, quote: { title: "引用", subtext: "引用或摘录", From 285c6001e1465d3d7de4a8739af65f8e0d99df59 Mon Sep 17 00:00:00 2001 From: Drew Johnson Date: Mon, 21 Apr 2025 20:22:08 -0400 Subject: [PATCH 3/9] Styles --- .../DefaultSelects/BlockTypeSelect.tsx | 22 ++++++++ .../getDefaultReactSlashMenuItems.tsx | 8 ++- packages/shadcn/src/tailwindStyles.css | 50 +++++++++---------- 3 files changed, 53 insertions(+), 27 deletions(-) diff --git a/packages/react/src/components/FormattingToolbar/DefaultSelects/BlockTypeSelect.tsx b/packages/react/src/components/FormattingToolbar/DefaultSelects/BlockTypeSelect.tsx index c37e27b96..111f1c5d9 100644 --- a/packages/react/src/components/FormattingToolbar/DefaultSelects/BlockTypeSelect.tsx +++ b/packages/react/src/components/FormattingToolbar/DefaultSelects/BlockTypeSelect.tsx @@ -11,6 +11,8 @@ import { RiH1, RiH2, RiH3, + RiH4, + RiH5, RiListCheck3, RiListOrdered, RiListUnordered, @@ -76,6 +78,26 @@ export const blockTypeSelectItems = ( "level" in block.props && block.props.level === 3, }, + { + name: dict.slash_menu.heading_4.title, + type: "heading", + props: { level: 4 }, + icon: RiH4, + isSelected: (block) => + block.type === "heading" && + "level" in block.props && + block.props.level === 4, + }, + { + name: dict.slash_menu.heading_5.title, + type: "heading", + props: { level: 5 }, + icon: RiH5, + isSelected: (block) => + block.type === "heading" && + "level" in block.props && + block.props.level === 5, + }, { name: dict.slash_menu.quote.title, type: "quote", diff --git a/packages/react/src/components/SuggestionMenu/getDefaultReactSlashMenuItems.tsx b/packages/react/src/components/SuggestionMenu/getDefaultReactSlashMenuItems.tsx index 9e970a2da..979e82f98 100644 --- a/packages/react/src/components/SuggestionMenu/getDefaultReactSlashMenuItems.tsx +++ b/packages/react/src/components/SuggestionMenu/getDefaultReactSlashMenuItems.tsx @@ -6,21 +6,23 @@ import { StyleSchema, } from "@blocknote/core"; import { + RiCodeBlock, RiEmotionFill, RiFile2Line, RiFilmLine, RiH1, RiH2, RiH3, + RiH4, + RiH5, RiImage2Fill, RiListCheck3, RiListOrdered, RiListUnordered, + RiQuoteText, RiTable2, RiText, RiVolumeUpFill, - RiCodeBlock, - RiQuoteText, } from "react-icons/ri"; import { DefaultReactSuggestionItem } from "./types.js"; @@ -28,6 +30,8 @@ const icons = { heading: RiH1, heading_2: RiH2, heading_3: RiH3, + heading_4: RiH4, + heading_5: RiH5, quote: RiQuoteText, numbered_list: RiListOrdered, bullet_list: RiListUnordered, diff --git a/packages/shadcn/src/tailwindStyles.css b/packages/shadcn/src/tailwindStyles.css index 16d69c033..71a0d4544 100644 --- a/packages/shadcn/src/tailwindStyles.css +++ b/packages/shadcn/src/tailwindStyles.css @@ -37,22 +37,22 @@ -moz-tab-size: 4; /* 3 */ tab-size: 4; /* 3 */ font-family: theme( - "fontFamily.sans", - ui-sans-serif, - system-ui, - sans-serif, - "Apple Color Emoji", - "Segoe UI Emoji", - "Segoe UI Symbol", - "Noto Color Emoji" + "fontFamily.sans", + ui-sans-serif, + system-ui, + sans-serif, + "Apple Color Emoji", + "Segoe UI Emoji", + "Segoe UI Symbol", + "Noto Color Emoji" ); /* 4 */ font-feature-settings: theme( - "fontFamily.sans[1].fontFeatureSettings", - normal + "fontFamily.sans[1].fontFeatureSettings", + normal ); /* 5 */ font-variation-settings: theme( - "fontFamily.sans[1].fontVariationSettings", - normal + "fontFamily.sans[1].fontVariationSettings", + normal ); /* 6 */ -webkit-tap-highlight-color: transparent; /* 7 */ } @@ -131,23 +131,23 @@ samp, pre { font-family: theme( - "fontFamily.mono", - ui-monospace, - SFMono-Regular, - Menlo, - Monaco, - Consolas, - "Liberation Mono", - "Courier New", - monospace + "fontFamily.mono", + ui-monospace, + SFMono-Regular, + Menlo, + Monaco, + Consolas, + "Liberation Mono", + "Courier New", + monospace ); /* 1 */ font-feature-settings: theme( - "fontFamily.mono[1].fontFeatureSettings", - normal + "fontFamily.mono[1].fontFeatureSettings", + normal ); /* 2 */ font-variation-settings: theme( - "fontFamily.mono[1].fontVariationSettings", - normal + "fontFamily.mono[1].fontVariationSettings", + normal ); /* 3 */ font-size: 1em; /* 4 */ } From 75c144e25265ef4e8fb7b5d303215ba9ea6bbc2c Mon Sep 17 00:00:00 2001 From: Drew Johnson Date: Mon, 21 Apr 2025 20:30:14 -0400 Subject: [PATCH 4/9] Font size and test --- packages/core/src/editor/Block.css | 2 +- .../formatConversion/parse/parseTestInstances.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/core/src/editor/Block.css b/packages/core/src/editor/Block.css index 69844b5a3..a9f793896 100644 --- a/packages/core/src/editor/Block.css +++ b/packages/core/src/editor/Block.css @@ -131,7 +131,7 @@ NESTED BLOCKS --level: 1em; } [data-content-type="heading"][data-level="5"] { - --level: 0.8em; + --level: 0.9em; } [data-prev-level="1"] { diff --git a/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts b/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts index 1953d1ca7..f5d0744bd 100644 --- a/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts +++ b/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts @@ -22,6 +22,8 @@ export const parseTestInstancesHTML: TestInstance< content: `

Heading 1

Heading 2

Heading 3

+

Heading 4

+
Heading 5

Paragraph

Image Caption

None Bold Italic Underline Strikethrough All

`, @@ -286,6 +288,8 @@ export const parseTestInstancesHTML: TestInstance<

Heading 1

Heading 2

Heading 3

+

Heading 4

+
Heading 5

Paragraph

Image Caption

Bold Italic Underline Strikethrough All

@@ -352,6 +356,8 @@ export const parseTestInstancesHTML: TestInstance< content: `

Heading 1

Heading 2

Heading 3

+

Heading 4

+
Heading 5

Paragraph 1

Nested Paragraph 1

Nested Paragraph 2

@@ -413,6 +419,8 @@ With Hard Break

Heading 1

Heading 2

Heading 3

+

Heading 4

+
Heading 5

Paragraph 1

Paragraph 2

Paragraph 3

@@ -564,6 +572,10 @@ Paragraph ### Heading 3 +#### Heading 4 + +##### Heading 5 + Paragraph P**ara***grap*h From a9691730233b1a9ee52a62cf52630de1ef888f1a Mon Sep 17 00:00:00 2001 From: Drew Johnson Date: Mon, 21 Apr 2025 20:51:15 -0400 Subject: [PATCH 5/9] Update snapshot tests --- .../__snapshots__/html/basicBlockTypes.json | 42 +++++++++- .../__snapshots__/html/deepNestedContent.json | 44 ++++++++++- .../parse/__snapshots__/html/googleDocs.json | 76 ++++++++++++++----- .../parse/__snapshots__/html/notion.json | 70 ++++++++++++----- .../parse/__snapshots__/markdown/complex.json | 66 ++++++++++++---- 5 files changed, 241 insertions(+), 57 deletions(-) diff --git a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/basicBlockTypes.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/basicBlockTypes.json index 1a9bd562f..e11339eae 100644 --- a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/basicBlockTypes.json +++ b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/basicBlockTypes.json @@ -58,11 +58,47 @@ "content": [ { "styles": {}, - "text": "Paragraph", + "text": "Heading 4", "type": "text", }, ], "id": "4", + "props": { + "backgroundColor": "default", + "level": 4, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 5", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "level": 5, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "6", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -73,7 +109,7 @@ { "children": [], "content": undefined, - "id": "5", + "id": "7", "props": { "backgroundColor": "default", "caption": "Image Caption", @@ -132,7 +168,7 @@ "type": "text", }, ], - "id": "6", + "id": "8", "props": { "backgroundColor": "default", "textAlignment": "left", diff --git a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/deepNestedContent.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/deepNestedContent.json index 959dbbcd5..fac0b8365 100644 --- a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/deepNestedContent.json +++ b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/deepNestedContent.json @@ -126,11 +126,47 @@ "content": [ { "styles": {}, - "text": "Paragraph", + "text": "Heading 4", "type": "text", }, ], "id": "8", + "props": { + "backgroundColor": "default", + "level": 4, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 5", + "type": "text", + }, + ], + "id": "9", + "props": { + "backgroundColor": "default", + "level": 5, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "10", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -141,7 +177,7 @@ { "children": [], "content": undefined, - "id": "9", + "id": "11", "props": { "backgroundColor": "default", "caption": "Image Caption", @@ -215,7 +251,7 @@ "type": "text", }, ], - "id": "10", + "id": "12", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -232,7 +268,7 @@ "type": "text", }, ], - "id": "11", + "id": "13", "props": { "backgroundColor": "default", "textAlignment": "left", diff --git a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/googleDocs.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/googleDocs.json index 5a7912dcd..a5e2dc0b1 100644 --- a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/googleDocs.json +++ b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/googleDocs.json @@ -59,6 +59,46 @@ }, "type": "heading", }, + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Heading 4", + "type": "text", + }, + ], + "id": "4", + "props": { + "backgroundColor": "default", + "level": 4, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Heading 5", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "level": 5, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, { "children": [], "content": [ @@ -68,7 +108,7 @@ "type": "text", }, ], - "id": "4", + "id": "6", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -85,7 +125,7 @@ "type": "text", }, ], - "id": "5", + "id": "7", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -102,7 +142,7 @@ "type": "text", }, ], - "id": "6", + "id": "8", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -120,7 +160,7 @@ Hard Break", "type": "text", }, ], - "id": "7", + "id": "9", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -177,7 +217,7 @@ Hard Break", "type": "text", }, ], - "id": "8", + "id": "10", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -198,7 +238,7 @@ Hard Break", "type": "text", }, ], - "id": "11", + "id": "13", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -215,7 +255,7 @@ Hard Break", "type": "text", }, ], - "id": "12", + "id": "14", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -231,7 +271,7 @@ Hard Break", "type": "text", }, ], - "id": "10", + "id": "12", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -248,7 +288,7 @@ Hard Break", "type": "text", }, ], - "id": "13", + "id": "15", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -264,7 +304,7 @@ Hard Break", "type": "text", }, ], - "id": "9", + "id": "11", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -281,7 +321,7 @@ Hard Break", "type": "text", }, ], - "id": "14", + "id": "16", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -298,7 +338,7 @@ Hard Break", "type": "text", }, ], - "id": "15", + "id": "17", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -315,7 +355,7 @@ Hard Break", "type": "text", }, ], - "id": "16", + "id": "18", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -326,7 +366,7 @@ Hard Break", { "children": [], "content": undefined, - "id": "17", + "id": "19", "props": { "backgroundColor": "default", "caption": "", @@ -348,7 +388,7 @@ Hard Break", "type": "text", }, ], - "id": "18", + "id": "20", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -535,7 +575,7 @@ Hard Break", ], "type": "tableContent", }, - "id": "19", + "id": "21", "props": { "textColor": "default", }, @@ -550,7 +590,7 @@ Hard Break", "type": "text", }, ], - "id": "20", + "id": "22", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -568,7 +608,7 @@ Hard Break", "type": "text", }, ], - "id": "21", + "id": "23", "props": { "backgroundColor": "default", "textAlignment": "left", diff --git a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/notion.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/notion.json index b1eb97dd2..84a9766da 100644 --- a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/notion.json +++ b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/notion.json @@ -58,11 +58,47 @@ "content": [ { "styles": {}, - "text": "Paragraph 1", + "text": "Heading 4", "type": "text", }, ], "id": "4", + "props": { + "backgroundColor": "default", + "level": 4, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 5", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "level": 5, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph 1", + "type": "text", + }, + ], + "id": "6", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -79,7 +115,7 @@ "type": "text", }, ], - "id": "5", + "id": "7", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -96,7 +132,7 @@ "type": "text", }, ], - "id": "6", + "id": "8", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -113,7 +149,7 @@ "type": "text", }, ], - "id": "7", + "id": "9", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -170,7 +206,7 @@ "type": "text", }, ], - "id": "8", + "id": "10", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -191,7 +227,7 @@ "type": "text", }, ], - "id": "11", + "id": "13", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -208,7 +244,7 @@ "type": "text", }, ], - "id": "12", + "id": "14", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -224,7 +260,7 @@ "type": "text", }, ], - "id": "10", + "id": "12", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -241,7 +277,7 @@ "type": "text", }, ], - "id": "13", + "id": "15", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -257,7 +293,7 @@ "type": "text", }, ], - "id": "9", + "id": "11", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -274,7 +310,7 @@ "type": "text", }, ], - "id": "14", + "id": "16", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -291,7 +327,7 @@ "type": "text", }, ], - "id": "15", + "id": "17", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -308,7 +344,7 @@ "type": "text", }, ], - "id": "16", + "id": "18", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -325,7 +361,7 @@ "type": "text", }, ], - "id": "17", + "id": "19", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -353,7 +389,7 @@ "type": "link", }, ], - "id": "18", + "id": "20", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -540,7 +576,7 @@ ], "type": "tableContent", }, - "id": "19", + "id": "21", "props": { "textColor": "default", }, @@ -555,7 +591,7 @@ "type": "text", }, ], - "id": "20", + "id": "22", "props": { "backgroundColor": "default", "textAlignment": "left", diff --git a/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/complex.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/complex.json index 81ac21d79..3db20d42b 100644 --- a/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/complex.json +++ b/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/complex.json @@ -58,11 +58,47 @@ "content": [ { "styles": {}, - "text": "Paragraph", + "text": "Heading 4", "type": "text", }, ], "id": "4", + "props": { + "backgroundColor": "default", + "level": 4, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Heading 5", + "type": "text", + }, + ], + "id": "5", + "props": { + "backgroundColor": "default", + "level": 5, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "6", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -98,7 +134,7 @@ "type": "text", }, ], - "id": "5", + "id": "7", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -134,7 +170,7 @@ "type": "text", }, ], - "id": "6", + "id": "8", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -151,7 +187,7 @@ "type": "text", }, ], - "id": "7", + "id": "9", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -172,7 +208,7 @@ "type": "text", }, ], - "id": "10", + "id": "12", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -188,7 +224,7 @@ "type": "text", }, ], - "id": "9", + "id": "11", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -207,7 +243,7 @@ "type": "text", }, ], - "id": "12", + "id": "14", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -224,7 +260,7 @@ "type": "text", }, ], - "id": "13", + "id": "15", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -243,7 +279,7 @@ "type": "text", }, ], - "id": "15", + "id": "17", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -259,7 +295,7 @@ "type": "text", }, ], - "id": "14", + "id": "16", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -276,7 +312,7 @@ "type": "text", }, ], - "id": "16", + "id": "18", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -292,7 +328,7 @@ "type": "text", }, ], - "id": "11", + "id": "13", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -309,7 +345,7 @@ "type": "text", }, ], - "id": "17", + "id": "19", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -325,7 +361,7 @@ "type": "text", }, ], - "id": "8", + "id": "10", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -342,7 +378,7 @@ "type": "text", }, ], - "id": "18", + "id": "20", "props": { "backgroundColor": "default", "textAlignment": "left", From 86da278913875aa2e2c6213c9110aed112f02e1d Mon Sep 17 00:00:00 2001 From: Drew Johnson Date: Wed, 23 Apr 2025 13:35:55 -0400 Subject: [PATCH 6/9] locales and other h6 support updates --- .../blocks/HeadingBlockContent/HeadingBlockContent.ts | 2 +- packages/core/src/editor/Block.css | 6 ++++++ packages/core/src/editor/editor.css | 1 + packages/core/src/i18n/locales/ar.ts | 8 +++++++- packages/core/src/i18n/locales/de.ts | 8 +++++++- packages/core/src/i18n/locales/en.ts | 8 +++++++- packages/core/src/i18n/locales/es.ts | 8 +++++++- packages/core/src/i18n/locales/fr.ts | 8 +++++++- packages/core/src/i18n/locales/hr.ts | 8 +++++++- packages/core/src/i18n/locales/is.ts | 8 +++++++- packages/core/src/i18n/locales/it.ts | 8 +++++++- packages/core/src/i18n/locales/ja.ts | 8 +++++++- packages/core/src/i18n/locales/ko.ts | 8 +++++++- packages/core/src/i18n/locales/nl.ts | 8 +++++++- packages/core/src/i18n/locales/no.ts | 8 +++++++- packages/core/src/i18n/locales/pl.ts | 8 +++++++- packages/core/src/i18n/locales/pt.ts | 8 +++++++- packages/core/src/i18n/locales/ru.ts | 8 +++++++- packages/core/src/i18n/locales/uk.ts | 8 +++++++- packages/core/src/i18n/locales/vi.ts | 8 +++++++- packages/core/src/i18n/locales/zh.ts | 8 +++++++- .../DefaultSelects/BlockTypeSelect.tsx | 11 +++++++++++ 22 files changed, 145 insertions(+), 19 deletions(-) diff --git a/packages/core/src/blocks/HeadingBlockContent/HeadingBlockContent.ts b/packages/core/src/blocks/HeadingBlockContent/HeadingBlockContent.ts index a0b070623..248c292a7 100644 --- a/packages/core/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +++ b/packages/core/src/blocks/HeadingBlockContent/HeadingBlockContent.ts @@ -10,7 +10,7 @@ import { import { createDefaultBlockDOMOutputSpec } from "../defaultBlockHelpers.js"; import { defaultProps } from "../defaultProps.js"; -const HEADING_LEVELS = [1, 2, 3, 4, 5] as const; +const HEADING_LEVELS = [1, 2, 3, 4, 5, 6] as const; export const headingPropSchema = { ...defaultProps, diff --git a/packages/core/src/editor/Block.css b/packages/core/src/editor/Block.css index a9f793896..5f0dfa942 100644 --- a/packages/core/src/editor/Block.css +++ b/packages/core/src/editor/Block.css @@ -133,6 +133,9 @@ NESTED BLOCKS [data-content-type="heading"][data-level="5"] { --level: 0.9em; } +[data-content-type="heading"][data-level="6"] { + --level: 0.8em; +} [data-prev-level="1"] { --prev-level: 3em; @@ -149,6 +152,9 @@ NESTED BLOCKS [data-prev-level="5"] { --prev-level: 0.9em; } +[data-prev-level="6"] { + --prev-level: 0.8em; +} .bn-block-outer[data-prev-type="heading"] > .bn-block > .bn-block-content { font-size: var(--prev-level); diff --git a/packages/core/src/editor/editor.css b/packages/core/src/editor/editor.css index 76bfd253a..6e6bc34f6 100644 --- a/packages/core/src/editor/editor.css +++ b/packages/core/src/editor/editor.css @@ -46,6 +46,7 @@ Tippy popups that are appended to document.body directly .bn-default-styles h3, .bn-default-styles h4, .bn-default-styles h5, +.bn-default-styles h6, .bn-default-styles li { margin: 0; padding: 0; diff --git a/packages/core/src/i18n/locales/ar.ts b/packages/core/src/i18n/locales/ar.ts index ecc9bf988..6c08718d7 100644 --- a/packages/core/src/i18n/locales/ar.ts +++ b/packages/core/src/i18n/locales/ar.ts @@ -28,8 +28,14 @@ export const ar: Dictionary = { }, heading_5: { title: "عنوان 5", + subtext: "عنوان فرعي صغير", + aliases: ["ع5", "عنوان5", "عنوان فرعي صغير"], + group: "العناوين", + }, + heading_6: { + title: "عنوان 6", subtext: "أدنى مستوى للعناوين", - aliases: ["ع5", "عنوان5", "العنوان الفرعي الأدنى"], + aliases: ["ع6", "عنوان6", "العنوان الفرعي الأدنى"], group: "العناوين", }, quote: { diff --git a/packages/core/src/i18n/locales/de.ts b/packages/core/src/i18n/locales/de.ts index d2208f6d8..cb0506ff4 100644 --- a/packages/core/src/i18n/locales/de.ts +++ b/packages/core/src/i18n/locales/de.ts @@ -28,10 +28,16 @@ export const de: Dictionary = { }, heading_5: { title: "Überschrift 5", - subtext: "Überschrift auf der untersten Ebene", + subtext: "Überschrift für tiefere Unterabschnitte", aliases: ["h5", "überschrift5", "unterüberschrift5"], group: "Überschriften", }, + heading_6: { + title: "Überschrift 6", + subtext: "Überschrift auf der untersten Ebene", + aliases: ["h6", "überschrift6", "unterüberschrift6"], + group: "Überschriften", + }, quote: { title: "Zitat", subtext: "Zitat oder Auszug", diff --git a/packages/core/src/i18n/locales/en.ts b/packages/core/src/i18n/locales/en.ts index d2fc8dc63..3b6a96aa8 100644 --- a/packages/core/src/i18n/locales/en.ts +++ b/packages/core/src/i18n/locales/en.ts @@ -26,10 +26,16 @@ export const en = { }, heading_5: { title: "Heading 5", - subtext: "Lowest‑level heading", + subtext: "Small subsection heading", aliases: ["h5", "heading5", "subheading5"], group: "Headings", }, + heading_6: { + title: "Heading 6", + subtext: "Lowest-level heading", + aliases: ["h6", "heading6", "subheading6"], + group: "Headings", + }, quote: { title: "Quote", subtext: "Quote or excerpt", diff --git a/packages/core/src/i18n/locales/es.ts b/packages/core/src/i18n/locales/es.ts index aa93ab350..b9756bf85 100644 --- a/packages/core/src/i18n/locales/es.ts +++ b/packages/core/src/i18n/locales/es.ts @@ -28,10 +28,16 @@ export const es: Dictionary = { }, heading_5: { title: "Encabezado 5", - subtext: "Encabezado de nivel más bajo", + subtext: "Encabezado de subsección pequeña", aliases: ["h5", "encabezado5", "subencabezado5"], group: "Encabezados", }, + heading_6: { + title: "Encabezado 6", + subtext: "Encabezado de nivel más bajo", + aliases: ["h6", "encabezado6", "subencabezado6"], + group: "Encabezados", + }, quote: { title: "Cita", subtext: "Cita o extracto", diff --git a/packages/core/src/i18n/locales/fr.ts b/packages/core/src/i18n/locales/fr.ts index a5d6d927b..372226074 100644 --- a/packages/core/src/i18n/locales/fr.ts +++ b/packages/core/src/i18n/locales/fr.ts @@ -29,8 +29,14 @@ export const fr: Dictionary = { }, heading_5: { title: "Titre 5", + subtext: "Titre de sous-section mineure", + aliases: ["h5", "titre5", "sous-titre5"], + group: "Titres", + }, + heading_6: { + title: "Titre 6", subtext: "Titre de niveau le plus bas", - aliases: ["h5", "titre5", "sous‑titre5"], + aliases: ["h6", "titre6", "sous-titre6"], group: "Titres", }, quote: { diff --git a/packages/core/src/i18n/locales/hr.ts b/packages/core/src/i18n/locales/hr.ts index 43c607f4f..a71ae02ab 100644 --- a/packages/core/src/i18n/locales/hr.ts +++ b/packages/core/src/i18n/locales/hr.ts @@ -28,10 +28,16 @@ export const hr: Dictionary = { }, heading_5: { title: "Naslov 5", - subtext: "Naslov najniže razine", + subtext: "Mali naslov podpoglavlja", aliases: ["h5", "naslov5", "podnaslov5"], group: "Naslovi", }, + heading_6: { + title: "Naslov 6", + subtext: "Naslov najniže razine", + aliases: ["h6", "naslov6", "podnaslov6"], + group: "Naslovi", + }, quote: { title: "Citat", subtext: "Citat ili izvadak", diff --git a/packages/core/src/i18n/locales/is.ts b/packages/core/src/i18n/locales/is.ts index 1c62786f9..b185cd42e 100644 --- a/packages/core/src/i18n/locales/is.ts +++ b/packages/core/src/i18n/locales/is.ts @@ -28,10 +28,16 @@ export const is: Dictionary = { }, heading_5: { title: "Fyrirsögn 5", - subtext: "Titill á lægsta stigi", + subtext: "Titill fyrir litla undirkafla", aliases: ["h5", "fyrirsogn5", "undirfyrirsogn5"], group: "Fyrirsagnir", }, + heading_6: { + title: "Fyrirsögn 6", + subtext: "Titill á lægsta stigi", + aliases: ["h6", "fyrirsogn6", "undirfyrirsogn6"], + group: "Fyrirsagnir", + }, quote: { title: "Tilvitnun", subtext: "Tilvitnun eða útdráttur", diff --git a/packages/core/src/i18n/locales/it.ts b/packages/core/src/i18n/locales/it.ts index a98d9f7aa..7771d3744 100644 --- a/packages/core/src/i18n/locales/it.ts +++ b/packages/core/src/i18n/locales/it.ts @@ -28,10 +28,16 @@ export const it: Dictionary = { }, heading_5: { title: "Intestazione 5", - subtext: "Intestazione di livello più basso", + subtext: "Intestazione di sottosezione minore", aliases: ["h5", "intestazione5", "sottotitolo5"], group: "Intestazioni", }, + heading_6: { + title: "Intestazione 6", + subtext: "Intestazione di livello più basso", + aliases: ["h6", "intestazione6", "sottotitolo6"], + group: "Intestazioni", + }, quote: { title: "Citazione", subtext: "Citazione o estratto", diff --git a/packages/core/src/i18n/locales/ja.ts b/packages/core/src/i18n/locales/ja.ts index c5fd7229a..e969c6ea1 100644 --- a/packages/core/src/i18n/locales/ja.ts +++ b/packages/core/src/i18n/locales/ja.ts @@ -28,10 +28,16 @@ export const ja: Dictionary = { }, heading_5: { title: "見出し5", - subtext: "最下位レベルの見出しに使用", + subtext: "小さなサブセクションの見出しに使用", aliases: ["h5", "見出し5", "subheading5", "小見出し5"], group: "見出し", }, + heading_6: { + title: "見出し6", + subtext: "最下位レベルの見出しに使用", + aliases: ["h6", "見出し6", "subheading6", "小見出し6"], + group: "見出し", + }, quote: { title: "引用", subtext: "引用または抜粋", diff --git a/packages/core/src/i18n/locales/ko.ts b/packages/core/src/i18n/locales/ko.ts index a31a75a78..754de605e 100644 --- a/packages/core/src/i18n/locales/ko.ts +++ b/packages/core/src/i18n/locales/ko.ts @@ -28,10 +28,16 @@ export const ko: Dictionary = { }, heading_5: { title: "제목5", - subtext: "가장 하위 수준 제목", + subtext: "작은 하위 섹션 제목", aliases: ["h5", "제목5", "소제목5"], group: "제목", }, + heading_6: { + title: "제목6", + subtext: "가장 하위 수준 제목", + aliases: ["h6", "제목6", "소제목6"], + group: "제목", + }, quote: { title: "인용", subtext: "인용문 또는 발췌", diff --git a/packages/core/src/i18n/locales/nl.ts b/packages/core/src/i18n/locales/nl.ts index aceb12fde..9f03ed2c8 100644 --- a/packages/core/src/i18n/locales/nl.ts +++ b/packages/core/src/i18n/locales/nl.ts @@ -28,10 +28,16 @@ export const nl: Dictionary = { }, heading_5: { title: "Kop 5", - subtext: "Gebruikt voor de laagste niveau koppen", + subtext: "Gebruikt voor kleinere subsecties", aliases: ["h5", "kop5", "subkop5"], group: "Koppen", }, + heading_6: { + title: "Kop 6", + subtext: "Gebruikt voor koppen op het laagste niveau", + aliases: ["h6", "kop6", "subkop6"], + group: "Koppen", + }, quote: { title: "Citaat", subtext: "Citaat of uittreksel", diff --git a/packages/core/src/i18n/locales/no.ts b/packages/core/src/i18n/locales/no.ts index f201028cb..aac7ed66d 100644 --- a/packages/core/src/i18n/locales/no.ts +++ b/packages/core/src/i18n/locales/no.ts @@ -28,10 +28,16 @@ export const no: Dictionary = { }, heading_5: { title: "Overskrift 5", - subtext: "Overskrift på laveste nivå", + subtext: "Overskrift for mindre underseksjoner", aliases: ["h5", "overskrift5", "underoverskrift5"], group: "Overskrifter", }, + heading_6: { + title: "Overskrift 6", + subtext: "Overskrift på laveste nivå", + aliases: ["h6", "overskrift6", "underoverskrift6"], + group: "Overskrifter", + }, quote: { title: "Sitat", subtext: "Sitat eller utdrag", diff --git a/packages/core/src/i18n/locales/pl.ts b/packages/core/src/i18n/locales/pl.ts index 24639da25..65ddb9a01 100644 --- a/packages/core/src/i18n/locales/pl.ts +++ b/packages/core/src/i18n/locales/pl.ts @@ -28,10 +28,16 @@ export const pl: Dictionary = { }, heading_5: { title: "Nagłówek 5", - subtext: "Nagłówek najniższego poziomu", + subtext: "Nagłówek mniejszej podsekcji", aliases: ["h5", "naglowek5", "podnaglowek5"], group: "Nagłówki", }, + heading_6: { + title: "Nagłówek 6", + subtext: "Nagłówek najniższego poziomu", + aliases: ["h6", "naglowek6", "podnaglowek6"], + group: "Nagłówki", + }, quote: { title: "Cytat", subtext: "Cytat lub fragment", diff --git a/packages/core/src/i18n/locales/pt.ts b/packages/core/src/i18n/locales/pt.ts index 0cb558ceb..849eaa976 100644 --- a/packages/core/src/i18n/locales/pt.ts +++ b/packages/core/src/i18n/locales/pt.ts @@ -28,10 +28,16 @@ export const pt: Dictionary = { }, heading_5: { title: "Título 5", - subtext: "Usado para títulos de nível mais baixo", + subtext: "Usado para títulos de subseções pequenas", aliases: ["h5", "titulo5", "subtitulo5"], group: "Títulos", }, + heading_6: { + title: "Título 6", + subtext: "Usado para títulos de nível mais baixo", + aliases: ["h6", "titulo6", "subtitulo6"], + group: "Títulos", + }, quote: { title: "Citação", subtext: "Citação ou trecho", diff --git a/packages/core/src/i18n/locales/ru.ts b/packages/core/src/i18n/locales/ru.ts index 11b91fe66..5772dc80d 100644 --- a/packages/core/src/i18n/locales/ru.ts +++ b/packages/core/src/i18n/locales/ru.ts @@ -28,10 +28,16 @@ export const ru: Dictionary = { }, heading_5: { title: "Заголовок 5 уровня", - subtext: "Используется для заголовков самого низкого уровня", + subtext: "Используется для заголовков небольших подразделов", aliases: ["h5", "heading5", "subheading5", "заголовок5", "подзаголовок5"], group: "Заголовки", }, + heading_6: { + title: "Заголовок 6 уровня", + subtext: "Используется для заголовков самого низкого уровня", + aliases: ["h6", "heading6", "subheading6", "заголовок6", "подзаголовок6"], + group: "Заголовки", + }, quote: { title: "Цитата", subtext: "Цитата или отрывок", diff --git a/packages/core/src/i18n/locales/uk.ts b/packages/core/src/i18n/locales/uk.ts index 8a990ee6f..e6344ac65 100644 --- a/packages/core/src/i18n/locales/uk.ts +++ b/packages/core/src/i18n/locales/uk.ts @@ -28,8 +28,14 @@ export const uk: Dictionary = { }, heading_5: { title: "Заголовок 5", + subtext: "Використовується для заголовків менших підрозділів", + aliases: ["h5", "heading5", "subheading5", "заголовок5", "підзаголовок5"], + group: "Заголовки", + }, + heading_6: { + title: "Заголовок 6", subtext: "Використовується для заголовків найнижчого рівня", - aliases: ["h5", "heading5", "subheading5", "заголовок5"], + aliases: ["h6", "heading6", "subheading6", "заголовок6", "підзаголовок6"], group: "Заголовки", }, quote: { diff --git a/packages/core/src/i18n/locales/vi.ts b/packages/core/src/i18n/locales/vi.ts index afcb3d20c..9a69b2078 100644 --- a/packages/core/src/i18n/locales/vi.ts +++ b/packages/core/src/i18n/locales/vi.ts @@ -28,10 +28,16 @@ export const vi: Dictionary = { }, heading_5: { title: "Tiêu đề H5", - subtext: "Sử dụng cho tiêu đề cấp thấp nhất", + subtext: "Sử dụng cho tiêu đề phụ nhỏ hơn", aliases: ["h5", "tieude5", "tieudephu5"], group: "Tiêu đề", }, + heading_6: { + title: "Tiêu đề H6", + subtext: "Sử dụng cho tiêu đề cấp thấp nhất", + aliases: ["h6", "tieude6", "tieudephu6"], + group: "Tiêu đề", + }, quote: { title: "Trích dẫn", subtext: "Trích dẫn hoặc đoạn trích", diff --git a/packages/core/src/i18n/locales/zh.ts b/packages/core/src/i18n/locales/zh.ts index 84f36c580..5ca8516de 100644 --- a/packages/core/src/i18n/locales/zh.ts +++ b/packages/core/src/i18n/locales/zh.ts @@ -28,10 +28,16 @@ export const zh: Dictionary = { }, heading_5: { title: "五级标题", - subtext: "用于最低层级的标题", + subtext: "用于较小的子节标题", aliases: ["h5", "heading5", "subheading5", "五级标题"], group: "标题", }, + heading_6: { + title: "六级标题", + subtext: "用于最低层级的标题", + aliases: ["h6", "heading6", "subheading6", "六级标题"], + group: "标题", + }, quote: { title: "引用", subtext: "引用或摘录", diff --git a/packages/react/src/components/FormattingToolbar/DefaultSelects/BlockTypeSelect.tsx b/packages/react/src/components/FormattingToolbar/DefaultSelects/BlockTypeSelect.tsx index 111f1c5d9..6fbb39451 100644 --- a/packages/react/src/components/FormattingToolbar/DefaultSelects/BlockTypeSelect.tsx +++ b/packages/react/src/components/FormattingToolbar/DefaultSelects/BlockTypeSelect.tsx @@ -13,6 +13,7 @@ import { RiH3, RiH4, RiH5, + RiH6, RiListCheck3, RiListOrdered, RiListUnordered, @@ -98,6 +99,16 @@ export const blockTypeSelectItems = ( "level" in block.props && block.props.level === 5, }, + { + name: dict.slash_menu.heading_6.title, + type: "heading", + props: { level: 6 }, + icon: RiH6, + isSelected: (block) => + block.type === "heading" && + "level" in block.props && + block.props.level === 6, + }, { name: dict.slash_menu.quote.title, type: "quote", From 3eb5a97367c4e75cd48ba274574f5ca53160d205 Mon Sep 17 00:00:00 2001 From: Drew Johnson Date: Wed, 23 Apr 2025 13:44:01 -0400 Subject: [PATCH 7/9] Update snapshot tests with h6 --- .../__snapshots__/html/basicBlockTypes.json | 24 +++++++- .../__snapshots__/html/deepNestedContent.json | 26 +++++++-- .../parse/__snapshots__/html/googleDocs.json | 56 +++++++++++++------ .../parse/__snapshots__/html/notion.json | 52 +++++++++++------ .../parse/__snapshots__/markdown/complex.json | 48 +++++++++++----- .../parse/parseTestInstances.ts | 5 ++ 6 files changed, 154 insertions(+), 57 deletions(-) diff --git a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/basicBlockTypes.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/basicBlockTypes.json index e11339eae..6f7b646d3 100644 --- a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/basicBlockTypes.json +++ b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/basicBlockTypes.json @@ -94,11 +94,29 @@ "content": [ { "styles": {}, - "text": "Paragraph", + "text": "Heading 6", "type": "text", }, ], "id": "6", + "props": { + "backgroundColor": "default", + "level": 6, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "7", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -109,7 +127,7 @@ { "children": [], "content": undefined, - "id": "7", + "id": "8", "props": { "backgroundColor": "default", "caption": "Image Caption", @@ -168,7 +186,7 @@ "type": "text", }, ], - "id": "8", + "id": "9", "props": { "backgroundColor": "default", "textAlignment": "left", diff --git a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/deepNestedContent.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/deepNestedContent.json index fac0b8365..b693d91e7 100644 --- a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/deepNestedContent.json +++ b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/deepNestedContent.json @@ -162,11 +162,29 @@ "content": [ { "styles": {}, - "text": "Paragraph", + "text": "Heading 6", "type": "text", }, ], "id": "10", + "props": { + "backgroundColor": "default", + "level": 5, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "11", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -177,7 +195,7 @@ { "children": [], "content": undefined, - "id": "11", + "id": "12", "props": { "backgroundColor": "default", "caption": "Image Caption", @@ -251,7 +269,7 @@ "type": "text", }, ], - "id": "12", + "id": "13", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -268,7 +286,7 @@ "type": "text", }, ], - "id": "13", + "id": "14", "props": { "backgroundColor": "default", "textAlignment": "left", diff --git a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/googleDocs.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/googleDocs.json index a5e2dc0b1..385df9d2a 100644 --- a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/googleDocs.json +++ b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/googleDocs.json @@ -99,6 +99,26 @@ }, "type": "heading", }, + { + "children": [], + "content": [ + { + "styles": { + "bold": true, + }, + "text": "Heading 6", + "type": "text", + }, + ], + "id": "6", + "props": { + "backgroundColor": "default", + "level": 6, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, { "children": [], "content": [ @@ -108,7 +128,7 @@ "type": "text", }, ], - "id": "6", + "id": "7", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -125,7 +145,7 @@ "type": "text", }, ], - "id": "7", + "id": "8", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -142,7 +162,7 @@ "type": "text", }, ], - "id": "8", + "id": "9", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -160,7 +180,7 @@ Hard Break", "type": "text", }, ], - "id": "9", + "id": "10", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -217,7 +237,7 @@ Hard Break", "type": "text", }, ], - "id": "10", + "id": "11", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -238,7 +258,7 @@ Hard Break", "type": "text", }, ], - "id": "13", + "id": "14", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -255,7 +275,7 @@ Hard Break", "type": "text", }, ], - "id": "14", + "id": "15", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -271,7 +291,7 @@ Hard Break", "type": "text", }, ], - "id": "12", + "id": "13", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -288,7 +308,7 @@ Hard Break", "type": "text", }, ], - "id": "15", + "id": "16", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -304,7 +324,7 @@ Hard Break", "type": "text", }, ], - "id": "11", + "id": "12", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -321,7 +341,7 @@ Hard Break", "type": "text", }, ], - "id": "16", + "id": "17", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -338,7 +358,7 @@ Hard Break", "type": "text", }, ], - "id": "17", + "id": "18", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -355,7 +375,7 @@ Hard Break", "type": "text", }, ], - "id": "18", + "id": "19", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -366,7 +386,7 @@ Hard Break", { "children": [], "content": undefined, - "id": "19", + "id": "20", "props": { "backgroundColor": "default", "caption": "", @@ -388,7 +408,7 @@ Hard Break", "type": "text", }, ], - "id": "20", + "id": "21", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -575,7 +595,7 @@ Hard Break", ], "type": "tableContent", }, - "id": "21", + "id": "22", "props": { "textColor": "default", }, @@ -590,7 +610,7 @@ Hard Break", "type": "text", }, ], - "id": "22", + "id": "23", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -608,7 +628,7 @@ Hard Break", "type": "text", }, ], - "id": "23", + "id": "24", "props": { "backgroundColor": "default", "textAlignment": "left", diff --git a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/notion.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/notion.json index 84a9766da..d95864ff7 100644 --- a/tests/src/unit/core/formatConversion/parse/__snapshots__/html/notion.json +++ b/tests/src/unit/core/formatConversion/parse/__snapshots__/html/notion.json @@ -94,11 +94,29 @@ "content": [ { "styles": {}, - "text": "Paragraph 1", + "text": "Heading 6", "type": "text", }, ], "id": "6", + "props": { + "backgroundColor": "default", + "level": 6, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph 1", + "type": "text", + }, + ], + "id": "7", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -115,7 +133,7 @@ "type": "text", }, ], - "id": "7", + "id": "8", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -132,7 +150,7 @@ "type": "text", }, ], - "id": "8", + "id": "9", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -149,7 +167,7 @@ "type": "text", }, ], - "id": "9", + "id": "10", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -206,7 +224,7 @@ "type": "text", }, ], - "id": "10", + "id": "11", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -227,7 +245,7 @@ "type": "text", }, ], - "id": "13", + "id": "14", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -244,7 +262,7 @@ "type": "text", }, ], - "id": "14", + "id": "15", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -260,7 +278,7 @@ "type": "text", }, ], - "id": "12", + "id": "13", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -277,7 +295,7 @@ "type": "text", }, ], - "id": "15", + "id": "16", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -293,7 +311,7 @@ "type": "text", }, ], - "id": "11", + "id": "12", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -310,7 +328,7 @@ "type": "text", }, ], - "id": "16", + "id": "17", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -327,7 +345,7 @@ "type": "text", }, ], - "id": "17", + "id": "18", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -344,7 +362,7 @@ "type": "text", }, ], - "id": "18", + "id": "19", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -361,7 +379,7 @@ "type": "text", }, ], - "id": "19", + "id": "20", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -389,7 +407,7 @@ "type": "link", }, ], - "id": "20", + "id": "21", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -576,7 +594,7 @@ ], "type": "tableContent", }, - "id": "21", + "id": "22", "props": { "textColor": "default", }, @@ -591,7 +609,7 @@ "type": "text", }, ], - "id": "22", + "id": "23", "props": { "backgroundColor": "default", "textAlignment": "left", diff --git a/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/complex.json b/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/complex.json index 3db20d42b..08b5c1208 100644 --- a/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/complex.json +++ b/tests/src/unit/core/formatConversion/parse/__snapshots__/markdown/complex.json @@ -94,11 +94,29 @@ "content": [ { "styles": {}, - "text": "Paragraph", + "text": "Heading 6", "type": "text", }, ], "id": "6", + "props": { + "backgroundColor": "default", + "level": 6, + "textAlignment": "left", + "textColor": "default", + }, + "type": "heading", + }, + { + "children": [], + "content": [ + { + "styles": {}, + "text": "Paragraph", + "type": "text", + }, + ], + "id": "7", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -134,7 +152,7 @@ "type": "text", }, ], - "id": "7", + "id": "8", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -170,7 +188,7 @@ "type": "text", }, ], - "id": "8", + "id": "9", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -187,7 +205,7 @@ "type": "text", }, ], - "id": "9", + "id": "10", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -208,7 +226,7 @@ "type": "text", }, ], - "id": "12", + "id": "13", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -224,7 +242,7 @@ "type": "text", }, ], - "id": "11", + "id": "12", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -243,7 +261,7 @@ "type": "text", }, ], - "id": "14", + "id": "15", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -260,7 +278,7 @@ "type": "text", }, ], - "id": "15", + "id": "16", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -279,7 +297,7 @@ "type": "text", }, ], - "id": "17", + "id": "18", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -295,7 +313,7 @@ "type": "text", }, ], - "id": "16", + "id": "17", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -312,7 +330,7 @@ "type": "text", }, ], - "id": "18", + "id": "19", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -328,7 +346,7 @@ "type": "text", }, ], - "id": "13", + "id": "14", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -345,7 +363,7 @@ "type": "text", }, ], - "id": "19", + "id": "20", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -361,7 +379,7 @@ "type": "text", }, ], - "id": "10", + "id": "11", "props": { "backgroundColor": "default", "textAlignment": "left", @@ -378,7 +396,7 @@ "type": "text", }, ], - "id": "20", + "id": "21", "props": { "backgroundColor": "default", "textAlignment": "left", diff --git a/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts b/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts index f5d0744bd..5d8494fe7 100644 --- a/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts +++ b/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts @@ -24,6 +24,7 @@ export const parseTestInstancesHTML: TestInstance<

Heading 3

Heading 4

Heading 5
+
Heading 6

Paragraph

Image Caption

None Bold Italic Underline Strikethrough All

`, @@ -290,6 +291,7 @@ export const parseTestInstancesHTML: TestInstance<

Heading 3

Heading 4

Heading 5
+
Heading 6

Paragraph

Image Caption

Bold Italic Underline Strikethrough All

@@ -421,6 +423,7 @@ With Hard Break

Heading 3

Heading 4

Heading 5
+
Heading 6

Paragraph 1

Paragraph 2

Paragraph 3

@@ -576,6 +579,8 @@ Paragraph ##### Heading 5 +###### Heading 6 + Paragraph P**ara***grap*h From 9f47f75122733947ef1fd7f7fe36849b31b7bf8c Mon Sep 17 00:00:00 2001 From: Drew Johnson Date: Wed, 23 Apr 2025 13:45:24 -0400 Subject: [PATCH 8/9] Add the h6 icon for slash menu item --- .../components/SuggestionMenu/getDefaultReactSlashMenuItems.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react/src/components/SuggestionMenu/getDefaultReactSlashMenuItems.tsx b/packages/react/src/components/SuggestionMenu/getDefaultReactSlashMenuItems.tsx index 979e82f98..c97b50b8e 100644 --- a/packages/react/src/components/SuggestionMenu/getDefaultReactSlashMenuItems.tsx +++ b/packages/react/src/components/SuggestionMenu/getDefaultReactSlashMenuItems.tsx @@ -15,6 +15,7 @@ import { RiH3, RiH4, RiH5, + RiH6, RiImage2Fill, RiListCheck3, RiListOrdered, @@ -32,6 +33,7 @@ const icons = { heading_3: RiH3, heading_4: RiH4, heading_5: RiH5, + heading_6: RiH6, quote: RiQuoteText, numbered_list: RiListOrdered, bullet_list: RiListUnordered, From 0cf25c0fb11fd58182a75edf8f0776cf7ab57844 Mon Sep 17 00:00:00 2001 From: Drew Johnson Date: Wed, 23 Apr 2025 13:47:46 -0400 Subject: [PATCH 9/9] Test H6 notion snapshot --- tests/src/unit/core/formatConversion/parse/parseTestInstances.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts b/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts index 5d8494fe7..76c3fa602 100644 --- a/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts +++ b/tests/src/unit/core/formatConversion/parse/parseTestInstances.ts @@ -360,6 +360,7 @@ export const parseTestInstancesHTML: TestInstance<

Heading 3

Heading 4

Heading 5
+
Heading 6

Paragraph 1

Nested Paragraph 1

Nested Paragraph 2