Roslovets-Inc / strapi-plugin-ckeditor5

Replace Strapi default WYSIWYG editor with enhanced build of CKEditor 5
https://www.npmjs.com/package/strapi-plugin-ckeditor5
247 stars 59 forks source link

How to use RegExp in htmlSupport #55

Open reinsp5 opened 2 years ago

reinsp5 commented 2 years ago

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,
                        }]
                    }
                }
            }
        }
    }
}
AliceRossa commented 2 years ago

Any updates on this? I got this issue too.