Skip to content

Conversation

@leekelleher
Copy link
Member

Description

Fixes #19752.

Updated Tiptap RTE's Clear Formatting toolbar button feature to reset any nodes (e.g. headings) back to the default paragraph.

How to test?

In a Tiptap RTE, (with Clear Formatting toolbar button added), enter a variety of rich-text, (e.g. headings, bold, italic, etc.); press the Clear Formatting button, the formatting of the text should be removed, leaved plain-text paragraphs.

Copilot AI review requested due to automatic review settings July 23, 2025 17:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the Tiptap RTE's Clear Formatting functionality to reset node types (like headings) to paragraphs in addition to clearing text formatting. The change ensures that the Clear Formatting button provides more comprehensive formatting removal by addressing both node-level formatting (headings, lists, etc.) and inline formatting (bold, italic, etc.).

  • Adds clearNodes() method to the clear formatting chain to reset node types to paragraphs
  • Maintains existing functionality for clearing marks, classes, and styles
Comments suppressed due to low confidence (1)

src/Umbraco.Web.UI.Client/src/packages/tiptap/extensions/toolbar/clear-formatting.tiptap-toolbar-api.ts:6

  • The addition of clearNodes() introduces new behavior that should be covered by tests to verify that node types (headings, lists, etc.) are properly reset to paragraphs when clear formatting is executed.
		editor?.chain().focus().clearNodes().unsetAllMarks().unsetClassName().unsetStyles().run();

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as described - thanks.

@AndyButland AndyButland merged commit 12141d2 into main Jul 24, 2025
28 checks passed
@AndyButland AndyButland deleted the v16/bugfix/19752-tiptap-clear-formatting branch July 24, 2025 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TipTap doesn't remove style attributes when pasting or with clear formatting button

3 participants