Skip to content

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

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

leekelleher
Copy link
Member

@leekelleher leekelleher commented Feb 18, 2025

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

Example with a Style Select menu, with default (hard coded) options,
similar to TinyMCE's unconfigured Style Select menu.
@leekelleher leekelleher changed the title Tiptap: Cascading Style Select Menu Tiptap RTE: Cascading Style Select Menu Feb 18, 2025
@@ -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>`,
Copy link
Contributor

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!

Copy link
Member Author

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. 😅

Copy link
Contributor

@iOvergaard iOvergaard left a 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>
Copy link
Contributor

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> = [
Copy link
Contributor

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".

@iOvergaard
Copy link
Contributor

The failing e2e test is due to something else, so I will merge even though it did not pass the e2e.

@iOvergaard iOvergaard merged commit b3b85b8 into v15/dev Feb 18, 2025
22 of 24 checks passed
@iOvergaard iOvergaard deleted the v15/feature/cascading-menu-popover branch February 18, 2025 15:07
@iOvergaard iOvergaard added the category/ux User experience label Feb 18, 2025
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.

2 participants