TinyMCE: How to enable self-closing tags? (custom tags)

12 Views Asked by At

I can't get self-closing tags to work at all in the latest TinyMCE (6). This may be a duplicate of this question: Custom self closing tag in Tinymce

I'm trying to enter the tag <x-button/>, but TinyMCE is converting it to <x-button></x-button>.

I have in my config:

tinymce.init({
                selector: 'textarea.tinymce',
                skin: false,
                content_css: false,

                extended_valid_elements: 'x-*[*]',
                custom_elements : 'x-*[*]',
    

I've tried adding schema: 'html5', self_closing_elements : 'x-*' and `self_closing_elements : 'x-[]', but these options seem to have no effect.

I found this old fiddle, but editor.schema.getShortEndedElements() no longer exists in TinyMCE 6.

Does anybody know if this is possible?

0

There are 0 best solutions below