Issue #5357Opened September 3, 2023by peters-ben-00070 reactions

BUG: (type issue) cannot pass HTMLElement as icon when adding new rte action

Question

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

Chrome

Reproducible demo link

https://jsfiddle.net/vmeywbk8/11/

Describe the bug

Just a small type issue we came across - when adding an action to the RichTextEditor, the "icon" property of RichTextEditorAction is marked as string. But in addAction (https://github.com/GrapesJS/grapesjs/blob/793599cbd5493c0104db1134bd4b1684341274a7/src/rich_text_editor/model/RichTextEditor.ts#L363) if we pass in a HTMLElement, it will be appended to the button. This still works fine at runtime, but you will get a type mismatch error from TypeScript if you try to pass anything other than a string.

the "icon" property should probably be marked as "string | HTMLElement" to resolve this - I'd like to fix this as my first contribution

Code of Conduct

  • I agree to follow this project's Code of Conduct

Answers (0)

No answers yet.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.