Roslovets-Inc/strapi-plugin-ckeditor5

How to use RegExp in htmlSupport

Opened this issue · 1 comments

Hello. Thank you for the useful plugin.

I having one problem.
Trying to use regular expressions in htmlSupport but it is not working.
I'm trying to use Strapi as a CMS for my site.
The site uses an existing CSS framework and I want to write the classes provided by the CSS framework within CKEditor.

So far I have tried the following specifications, but none of them work: the class specification is removed.
How can I help...

Flow at build

  1. Edit plugin.js
  2. rm -rdf .cache ( in container )
  3. rm -rdf build ( in container )
  4. yarn cache clear --all ( in container )
  5. yarn build ( in container )
  6. docker-compose down
  7. docker-compose up -d

Try. 1

// config/plugins.js
module.exports = () => {
    return {
        ckeditor: {
            enabled: true,
            plugin: {
                generalHtmlSupport: true,
            },
            config: {
                editor: {
                    htmlSupport: {
                        allow: [{
                            name: /.*/,
                            classes: true,
                        }]
                    }
                }
            }
        }
    }
}

Try. 2

// config/plugins.js
module.exports = () => {
    return {
        ckeditor: {
            enabled: true,
            plugin: {
                generalHtmlSupport: true,
            },
            config: {
                editor: {
                    htmlSupport: {
                        allow: [{
                            name: '/.*/',
                            classes: true,
                        }]
                    }
                }
            }
        }
    }
}

Try. 3

// config/plugins.js
module.exports = () => {
    return {
        ckeditor: {
            enabled: true,
            plugin: {
                generalHtmlSupport: true,
            },
            config: {
                editor: {
                    htmlSupport: {
                        allow: [{
                            name: "/.*/",
                            classes: true,
                        }]
                    }
                }
            }
        }
    }
}

Any updates on this? I got this issue too.