© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•5mo ago•
3 replies
Roland Barkóczi

Richeditor tiptap allow html attributes

I have a html formatted text in database, eg:
<img src="..." width="100%" alt="XY" style="border:red 1px solid"/>

If I load this into the richeditor, the width and style tags will be removed.

And vica versa:
- I built an extension which allows to edit class, style, width, height, alt and title tag.
- the alt and title tag will be in the saved html code, but the class, style, widht and height will be removed.

How can I allow html attributes?

I have this code in my image-editor.js, but still not allow these attributes in saved html:

addGlobalAttributes() {
        return [
            {
                types: ["image"],
                attributes: {
                    style: {
                        default: null,
                        parseHTML: (element) => element.getAttribute("style"),
                        renderHTML: (attributes) => {
                            if (!attributes.style) {
                                return null;
                            }
                            return {
                                style: attributes.style,
                            };
                        },
                        keepOnSplit: false,
                    }, .... 
addGlobalAttributes() {
        return [
            {
                types: ["image"],
                attributes: {
                    style: {
                        default: null,
                        parseHTML: (element) => element.getAttribute("style"),
                        renderHTML: (attributes) => {
                            if (!attributes.style) {
                                return null;
                            }
                            return {
                                style: attributes.style,
                            };
                        },
                        keepOnSplit: false,
                    }, .... 
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

RichEditor - TipTap - Custom Block for embedding HTML
FilamentFFilament / ❓┊help
5mo ago
TipTap RichEditor: trouble with lists
FilamentFFilament / ❓┊help
6mo ago
TipTap merge tags with HTML
FilamentFFilament / ❓┊help
6mo ago
RichEditor Tiptap-php extensions vs Js extensions ?
FilamentFFilament / ❓┊help
5w ago