Skip to content

Tiptap RTE: Cascading Style Select Menu#18364

Merged
iOvergaard merged 1 commit into
v15/devfrom
v15/feature/cascading-menu-popover
Feb 18, 2025
Merged

Tiptap RTE: Cascading Style Select Menu#18364
iOvergaard merged 1 commit into
v15/devfrom
v15/feature/cascading-menu-popover

Conversation

@leekelleher

@leekelleher leekelleher commented Feb 18, 2025

Copy link
Copy Markdown
Member

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
${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
Copy Markdown
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
Copy Markdown
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. 😅

@iOvergaard iOvergaard left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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

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