Tiptap RTE: Fix Clear Formatting errors when HTML attribute extensions aren't enabled (closes #22502)#22509
Merged
leekelleher merged 2 commits intomainfrom Apr 17, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a TipTap RTE runtime error by declaring the extension dependencies for the “Clear Formatting” toolbar button so it is disabled/hidden when the required HTML-attribute extensions are not enabled on the data type.
Changes:
- Add
forExtensionsdependency declarations to the Clear Formatting toolbar manifest to requireUmb.Tiptap.HtmlAttributeClassandUmb.Tiptap.HtmlAttributeStyle.
on the `class` and `style` attribute extensions
leekelleher
approved these changes
Apr 17, 2026
Member
leekelleher
left a comment
There was a problem hiding this comment.
Thanks @AndyButland. I reworked the Clear Formatting code to conditionally call the unset class and style attribute methods. This way we can avoid the hard dependency on those 2 extensions in the UI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
Fixes #22502
Description
The "Clear Formatting" toolbar button in the TipTap RTE throws a TypeError on click when the
HtmlAttributeClassorHtmlAttributeStyleextensions are not enabled on the data type:Root cause
The "Clear Formatting" toolbar API calls
.unsetClassName()and.unsetStyles()— custom chain commands provided byUmb.Tiptap.HtmlAttributeClassandUmb.Tiptap.HtmlAttributeStylerespectively. These extensions used to be bundled into "Rich Text Essentials" (guaranteed to be present) but were unbundled into separate opt-in extensions in #20042 (Sep 2025). Users whose saved toolbar still contains "Clear Formatting" after the upgrade — but whose data type doesn''t opt into both underlying extensions — hit the TypeError because the chain commands simply don''t exist.Fix
Invoke
unsetClassNameandunsetStylesvia a custom Tiptap command using optional chaining oncommands.*. When the HTML-attribute extensions aren''t registered, those calls silently no-op, whileclearNodes()andunsetAllMarks()(core commands) always run. No manifest dependency is declared — the button stays available regardless of which HTML-attribute extensions are opted into, and degrades gracefully.Behaviour after the fix
Testing
`class` attributesor`style` attributesextensions, add "Clear Formatting" to the toolbar.`class` attributesand`style` attributesextensions, add classes/inline styles to content → click Clear Formatting → classes and inline styles are also cleared.