From 32dee45f9ca181e770830cf07574b8912572f0df Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 8 May 2026 11:21:50 +0000 Subject: [PATCH 1/2] Initial plan From d79ea3185ab5e7a29c07e0a49515d48d20ab3011 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 8 May 2026 11:25:00 +0000 Subject: [PATCH 2/2] Remove list format and convert to heading when Header button pressed on list item Agent-Logs-Url: https://github.com/MartinDejmal/mdedit/sessions/f86e3fe7-3aaf-41ca-94ee-572e15ac2d5b Co-authored-by: MartinDejmal <18679101+MartinDejmal@users.noreply.github.com> --- src/components/Toolbar.tsx | 4 +++- src/features/editor/editorCommands.ts | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/components/Toolbar.tsx b/src/components/Toolbar.tsx index d5de7b9..c869d08 100644 --- a/src/components/Toolbar.tsx +++ b/src/components/Toolbar.tsx @@ -173,7 +173,9 @@ export default function Toolbar({ ? "Heading: H2 → H3" : editor?.isActive("heading", { level: 3 }) ? "Heading: H3 → Normal" - : "Heading: Normal → H1" + : editor?.isActive("bulletList") || editor?.isActive("orderedList") || editor?.isActive("taskList") + ? "Heading: List → H1" + : "Heading: Normal → H1" } icon={} /> diff --git a/src/features/editor/editorCommands.ts b/src/features/editor/editorCommands.ts index 0121abe..ec921be 100644 --- a/src/features/editor/editorCommands.ts +++ b/src/features/editor/editorCommands.ts @@ -169,6 +169,22 @@ export function setCodeBlockLanguage(editor: Editor, language: string): void { } export function cycleHeading(editor: Editor): void { + // If the cursor is inside a list item, first remove the list formatting, + // then convert the lifted paragraph to H1. + if (editor.isActive("bulletList")) { + editor.chain().focus().toggleBulletList().setHeading({ level: 1 }).run(); + return; + } + if (editor.isActive("orderedList")) { + editor.chain().focus().toggleOrderedList().setHeading({ level: 1 }).run(); + return; + } + if (editor.isActive("taskList")) { + // taskList has no built-in toggle command, so we use liftListItem directly. + editor.chain().focus().liftListItem("taskItem").setHeading({ level: 1 }).run(); + return; + } + if (editor.isActive("heading", { level: 1 })) { editor.chain().focus().setHeading({ level: 2 }).run(); } else if (editor.isActive("heading", { level: 2 })) {