diff --git a/README.md b/README.md index d0e11af..d1ca65d 100644 --- a/README.md +++ b/README.md @@ -64,19 +64,61 @@ yarn build ``` > 💡 `sizes` and `loading` attributes for image can be set in source mode. -> If you use default upload provider and you want prefix img url with api path you need to add `baseURL` in `api.js` file `(config/api.js)` ## ⚙️ Configuration CKEditor config should be defined in `config.editor` field in `plugins.js` file. +> ⚠️ Regex patterns and callback functions (/.*/ /^(p|h[2-4])$/' | match => {..} etc) are not allowed in plugins.js config + +>According to [this PR](https://github.com/nshenderov/strapi-plugin-ckeditor/pull/54), you can create ckeditor.js file in your /config directory and define editor's config in there. This way you can specify all regex patterns, functions, and so on. (plugin's config still should be placed in plugins.js) + +
+ (spoiler) Example of /config/ckeditor.js: + +```js +globalThis.ckEditorConfig = { + toolbar: { + items: [ ] + }, + mediaEmbed: { + previewsInData: true, + + providers: [ + { + name: 'youtube', + url: [ + /^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/, + /^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/, + /^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/, + /^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/ + ], + html: match => { + const id = match[1]; + + return (`