-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Tiptap RTE: Cascading Style Select Menu #18364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Example with a Style Select menu, with default (hard coded) options, similar to TinyMCE's unconfigured Style Select menu.
@@ -48,7 +48,7 @@ export class UmbTiptapToolbarButtonElement extends UmbLitElement { | |||
@click=${() => (this.api && this.editor ? this.api.execute(this.editor) : null)}> | |||
${when( | |||
this.manifest?.meta.icon, | |||
() => html`<umb-icon name=${this.manifest!.meta.icon}></umb-icon>`, | |||
(icon) => html`<umb-icon name=${icon}></umb-icon>`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, did not know you could do this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know! I only recently found out. Saves us putting !
bangs in there. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very interesting work and I don't see why we cannot merge this now as it works. We still need to add to the feature, of course. I wonder how we can make the active selection cascade back to the menu to highlight the option with a checkmark...
label=${ifDefined(this.manifest?.meta.label)} | ||
popovertarget="style-select" | ||
title=${this.manifest?.meta.label ? this.localize.string(this.manifest.meta.label) : ''}> | ||
<span>Style select</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are going to need a translation here in the future
|
||
@customElement('umb-tiptap-style-select-toolbar-element') | ||
export class UmbTiptapToolbarStyleSelectToolbarElement extends UmbLitElement { | ||
#menu: Array<UmbCascadingMenuItem> = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is interesting to think how we can plug this from outside. Maybe another manifest type or allow existing tiptap extensions to add to it?
We will also need a translator from the rte stylesheets feature over to "tiptap commands".
The failing e2e test is due to something else, so I will merge even though it did not pass the e2e. |
Description
Introduces a reusable cascading menu (popover) for the Tiptap toolbar items.
Adds a Style Select toolbar menu, with default options - to match TinyMCE's unconfigured Style Select menu.
To note: this is an initial step in a larger feature, development to add custom style rules (CSS) to Tiptap is actively underway.
The
<umb-cascading-menu-popover>
component is currently located within the internal "tiptap" package, as this is the initial scope. It can be relocated to "core" package if other packages require its functionality, e.g. potential nested entity action menus.Recording.2025-02-18.103710.mp4