tinymce / tinymce

The world's #1 JavaScript library for rich text editing. Available for React, Vue and Angular
https://www.tiny.cloud
Other
14.68k stars 2.21k forks source link

How to allow custom attributes to be empty? #8858

Open landg-lance opened 1 year ago

landg-lance commented 1 year ago

What is the current behavior? Describe the bug Adding custom attributes via extended_valid_elements works. However, it doesn't seem possible to declare an attribute to be a valid 'empty attribute'. eg: I want to add 'lg-table' as a valid attribute of the Table element. AND I'd like it to not have a value. So in the html, this should be ok: <table lg-table>

Please provide the steps to reproduce and if possible a minimal demo of the problem via fiddle.tiny.cloud or similar.

However, if I paste <table lg-table> into the source view and save it, when I return to the source view, it's been transformed into <table lg-table="">

The extended_valid_elements value for table that I am using is: table[lg-table|border|style]

What is the expected behavior? I'd like to be able to declare some custom attributes to allow no value. ie - 'empty attributes'

Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE? TinyMCE 6, it's not browser-specific. I'm using the TinyMCE plugin for EPiServer (v4.4.0)

Note that these custom attributes are used by us in our Angular app, in order to hook in the Angular functionality to the table when it's rendered to the client.

tiny-stale-bot commented 3 weeks ago

This issue is stale because it has been open 365 days with no activity. Please comment if you wish to keep this issue open or it will be closed in 30 days.