| 9 | import { GrapesPlugins, PluginToLoad, PluginTypeToLoad, initPlugins } from './utils/plugins'; |
| 10 | |
| 11 | export interface EditorProps extends HTMLProps<HTMLDivElement> { |
| 12 | grapesjs: string | typeof gjs; |
| 13 | /** |
| 14 | * GrapesJS options. |
| 15 | */ |
| 16 | options?: EditorConfig; |
| 17 | |
| 18 | /** |
| 19 | * Load GrapesJS CSS file asynchronously from URL. |
| 20 | * @example 'https://unpkg.com/grapesjs/dist/css/grapes.min.css' |
| 21 | */ |
| 22 | grapesjsCss?: string; |
| 23 | |
| 24 | /** |
| 25 | * Array of plugins. |
| 26 | * Differently from the GrapesJS `plugins` option, this one allows also you to load plugins |
| 27 | * asynchronously from a CDN URL. |
| 28 | * @example |
| 29 | * plugins: [ |
| 30 | * { |
| 31 | * // The id should be name of the plugin that will be actually loaded |
| 32 | * id: 'gjs-blocks-basic', |
| 33 | * src: 'https://unpkg.com/grapesjs-blocks-basic', |
| 34 | * options: {} |
| 35 | * } |
| 36 | * // plugin already loaded in the global scope (eg. loaded via CND in HTML) |
| 37 | * 'grapesjs-plugin-forms', |
| 38 | * // plugin as a function |
| 39 | * myPlugin, |
| 40 | * ] |
| 41 | */ |
| 42 | plugins?: PluginTypeToLoad[]; |
| 43 | |
| 44 | /** |
| 45 | * Callback triggered once the editor instance is created. |
| 46 | */ |
| 47 | onEditor?: (editor: Editor) => void; |
| 48 | |
| 49 | /** |
| 50 | * Callback triggered once the editor is ready (mounted and loaded data from the Storage). |
| 51 | */ |
| 52 | onReady?: (editor: Editor) => void; |
| 53 | |
| 54 | /** |
| 55 | * Callback triggered on each update in the editor project. |
| 56 | * The updated ProjectData (JSON) is passed as a first argument. |
| 57 | */ |
| 58 | onUpdate?: (projectData: ProjectData, editor: Editor) => void; |
| 59 | |
| 60 | /** |
| 61 | * Avoid showing children of the editor until the editor is ready (mounted and loaded data from the Storage). |
| 62 | */ |
| 63 | waitReady?: boolean | ReactNode; |
| 64 | } |
| 65 | |
| 66 | const EditorInstance = memo(function ({ |
| 67 | children, |
nothing calls this directly
no outgoing calls
no test coverage detected