editorjs-php icon indicating copy to clipboard operation
editorjs-php copied to clipboard

Support custom html tags and attributes

Open mauritskorse opened this issue 10 months ago • 0 comments

This PR is for allowing custom tags and attributes to be configured such that they will not be removed by HTMLPurifier. Also see request: https://github.com/editor-js/editorjs-php/issues/29 My personal use case is that I Laravel Blade components or Livewire components to be generated.

This can be done by adding the custom tags/attributes to the config like so:

// config/editorjs.php
return [
     //...
    'validationSettings' => [
        'tools' => [
            //...
        ],
        'customTags' => [
            // allow <dfn type="" slug="" class="" description=""></dfn>
            'dfn' => [
                'type' => 'Inline',
                'contents' => 'Inline',
                'collection' => 'Common',
                'attributes' => [
                    'type' => 'CDATA',
                    'slug' => 'CDATA',
                    'class' => 'CDATA',
                    'description' => 'CDATA',
                ],
            ],
        ],
    ],
];

mauritskorse avatar Apr 17 '24 19:04 mauritskorse