Skip to content

Remove list format and convert to heading when Header button pressed on list item#62

Draft
MartinDejmal with Copilot wants to merge 2 commits into
mainfrom
copilot/remove-list-format-set-to-heading
Draft

Remove list format and convert to heading when Header button pressed on list item#62
MartinDejmal with Copilot wants to merge 2 commits into
mainfrom
copilot/remove-list-format-set-to-heading

Conversation

Copilot AI commented May 8, 2026

Copy link
Copy Markdown
Contributor

Pressing the Heading button while the cursor was inside a list item did nothing useful — headings can't exist inside list nodes in Tiptap, so the command silently failed.

Changes

editorCommands.tscycleHeading()

Added list-type detection before the normal heading cycle. When the cursor is in a list item, the list is unwrapped first, then H1 is applied:

  • bulletList / orderedList: uses toggleBulletList() / toggleOrderedList() to lift the item to a paragraph, then chains setHeading({ level: 1 })
  • taskList: uses liftListItem("taskItem") directly (no built-in toggle command for custom task list nodes), then chains setHeading({ level: 1 })
if (editor.isActive("bulletList")) {
  editor.chain().focus().toggleBulletList().setHeading({ level: 1 }).run();
  return;
}
// orderedList and taskList handled similarly…

Toolbar.tsx — Heading button tooltip

Added a "Heading: List → H1" tooltip state for when the cursor is inside any list, consistent with the existing H1→H2→H3→Normal tooltip progression.

…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>
Copilot AI changed the title [WIP] Fix header button behavior to remove list format and set to heading Remove list format and convert to heading when Header button pressed on list item May 8, 2026
Copilot AI requested a review from MartinDejmal May 8, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

If "Header" button pressed on a list item, remove list format and set to heading

2 participants