TinyMCE Can’t add tags into tag a

— Update ….


It’s hereĀ https://github.com/betagento/Editor

  • I changed the schema validation to html5, by default is html5-strict.
  • In the Class Betagento\Editor\Model\WysiwygConfig, use can add more TinyMCE settings if you want. [see https://www.tiny.cloud/docs-4x/]

Issue is that I tried to add tag <span> and <i> to tag </a>, but it does not work.

This is solution to resolve it.

Issue link : https://github.com/magento/magento2/issues/4536

Magento 2.4, TinyCME 4.0

Fixing lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js.
Function : getSettings, variable settings, add new config value : 'valid_elements': '*[*]'

`getSettings: function () {
var settings,
eventBus = this.eventBus;

        settings = {
            selector: '#' + this.getId(),
            theme: 'modern',
            skin: 'magento',
            'entity_encoding': 'raw',
            'convert_urls': false,
            'content_css': this.config.tinymce4['content_css'],
            'relative_urls': true,
            'valid_elements': '*[*]',
            'valid_children': '+body[style]',


`
Then it works.

Leave a Reply

Your email address will not be published. Required fields are marked *