thanhtunguet / grapesjs-react

A React wrapper for GrapesJS library
https://thanhtunguet.github.io/grapesjs-react
194 stars 58 forks source link

How to load data on load of editor? #37

Closed ArchanaSharma95 closed 4 years ago

ArchanaSharma95 commented 4 years ago

I want to load data from html file on editor load, please tell me the event and prop to load data when the editor initialised. Also needs an event to export html from editor. Basically I want to add "Import" and "Export HTML" button at the top of editor.

thanhtunguet commented 4 years ago

I want to load data from html file on editor load, please tell me the event and prop to load data when the editor initialised. Also needs an event to export html from editor. Basically I want to add "Import" and "Export HTML" button at the top of editor.

Please see Editor component's props interface:

export interface EditorProps {
  id?: string;

  presetType?: SupportedPresetType;

  plugins?: string[];

  storageManager?: any;

  blockManager?: any;

  styleManager?: {};

  width?: string | number;

  height?: string | number;

  components?: object[];

  blocks?: object[];

  onInit?(editor: IEditor): void;

  onDestroy?(editor: IEditor): void;
}

Using onInit prop. You might want to read Grapesjs official documentation for editor api references.