System Information
- Strapi Version v4.9.0:
Title: How to pass custom configuration from plugins.js
to a Strapi plugin file
I’m trying to customize a Strapi plugin that allows users to configure the plugin’s behavior through the config\plugins.js
file.
Here’s an overview of my current setup:
Folder structure:
luaCopy code
src
|-- plugins
|-- strapi-plugin-editorjs
|-- admin
|-- src
|-- components
|-- config
|-- customTools.js
|-- pluginId.js
|-- index.js
config
|-- plugins.js
config\plugins.js:
javascriptCopy code
editorjs: {
enabled: true,
resolve: "./src/plugins/strapi-plugin-editorjs",
config: {
customTools: { superscript: true, otherProperties: true, paragraph: false },
},
},
src\plugins\strapi-plugin-editorjs\admin\src\index.js:
javascriptCopy code
import pluginPkg from "../../package.json";
import Wysiwyg from "./components/Wysiwyg";
import pluginId from "./pluginId";
export default {
register(app) {
const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
app.registerComponent(pluginId, "wysiwyg", Wysiwyg);
app.registerField(pluginId, "wysiwyg", Wysiwyg);
},
};
src\plugins\strapi-plugin-editorjs\admin\src\components\Wysiwyg\index.js:
javascriptCopy code
// I want to access customTools from config\plugins.js here
const Wysiwyg = ({
name,
className,
error,
description,
intlLabel,
required,
onChange,
style,
value,
disabled,
}) => {
const { formatMessage } = useIntl();
...
Any help or guidance would be appreciated.