Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new plugin configuration method #191

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

nshenderov
Copy link
Owner

@nshenderov nshenderov commented Dec 5, 2024

What does it do?

Introduces a new setPluginConfig method to configure the plugin in the front-end environment. This method must be invoked before the admin panel's bootstrap lifecycle function.

function setPluginConfig(pluginConfig: PluginConfig): void

Example:

// src/admin/app.tsx
import { type PluginConfig, setPluginConfig } from '@_sh/strapi-plugin-ckeditor';

const pluginConfig: PluginConfig = {
  presets: [
  {
    //The `field` property has been replaced by `name` and `description` properties.
    name: 'default',
    description: 'Default editor',
    editorConfig: {...}
  },
  ...
  ],
  // theme: {...},
}

export default {
  register() {
    setPluginConfig(pluginConfig);
  },
};

Why is it needed?

Configuring CKEditor (a front-end plugin) directly in the front-end environment makes it easier to handle non serializable data types. This approach eliminates crutches such as: the need to write configurations in the Node.js environment, convert them to text, and expose them as global variables. With this update, all editor plugins can be imported directly alongside their configuration objects as expected, without the need to expose them to the global object.

Breaking Changes

  • ckeditor.js|ts file is no longer supported for plugin configuration. The plugin now requires using the setPluginConfig method for configuration. Existing setups must be updated to call this method before the admin panel's bootstrap lifecycle.
  • The plugin doesn't expose any ckeditor packages to the global object anymore.
  • The field property has been replaced by name and description properties.
  • dontMergePresets and dontMergeTheme options have been removed. User-provided configuration objects now completely overwrite the default ones.

@nshenderov nshenderov changed the title new plugin configuration method initial feat: new plugin configuration method Dec 5, 2024
@nshenderov nshenderov merged commit 3aa1ebf into dev Dec 5, 2024
nshenderov added a commit that referenced this pull request Dec 10, 2024
BREAKING CHANGE: ckeditor.js|ts file is no longer supported for plugin configuration. The plugin now requires using the setPluginConfig method for configuration. Existing setups must be updated to call this method before the admin panel's bootstrap lifecycle. dontMergePresets and dontMergeTheme options have been removed. User-provided configuration objects now completely overwrite the default ones.
nshenderov added a commit that referenced this pull request Dec 11, 2024
BREAKING CHANGE: ckeditor.js|ts file is no longer supported for plugin configuration. The plugin now requires using the setPluginConfig method for configuration. Existing setups must be updated to call this method before the admin panel's bootstrap lifecycle. dontMergePresets and dontMergeTheme options have been removed. User-provided configuration objects now completely overwrite the default ones.
nshenderov added a commit that referenced this pull request Dec 12, 2024
BREAKING CHANGE: ckeditor.js|ts file is no longer supported for plugin configuration. The plugin now requires using the setPluginConfig method for configuration. Existing setups must be updated to call this method before the admin panel's bootstrap lifecycle. dontMergePresets and dontMergeTheme options have been removed. User-provided configuration objects now completely overwrite the default ones.
@nshenderov nshenderov deleted the feat/new-plugin-configuration-method branch December 12, 2024 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant