Last active
June 10, 2024 17:16
-
-
Save 0b1kn00b/e8dbc67d841f8fb2cdadb4d9fd3eaa08 to your computer and use it in GitHub Desktop.
#Strapi #React customField
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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