Skip to content

Instantly share code, notes, and snippets.

@0b1kn00b
Last active June 10, 2024 17:16
Show Gist options
  • Save 0b1kn00b/e8dbc67d841f8fb2cdadb4d9fd3eaa08 to your computer and use it in GitHub Desktop.
Save 0b1kn00b/e8dbc67d841f8fb2cdadb4d9fd3eaa08 to your computer and use it in GitHub Desktop.
#Strapi #React customField
app.customFields.register({
"name" : "editorjs-field",
"pluginId" : pluginId,
"type" : "json",
"components" : {
Input: async () => {
const Module = (await import ('./components/Editor'));
const Component = Module.default;
const inst : React.FC<any> = ( ({...props}) => {
return (
<ThemeContext.Provider value={app.configurations.theme} >
<Component {...props}></Component>
</ThemeContext.Provider>)
});
return { default : inst } ;
}
},
intlLabel: {
id: `${pluginId}.plugin.customField.name`,
defaultMessage: 'editorJs',
},
intlDescription: {
id: `${pluginId}.plugin.customField.description`,
defaultMessage: "editorjs custom field",
},
validator : () => yup.mixed().nullable()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment