How to use the grapesjs.editors function in grapesjs

To help you get started, we’ve selected a few grapesjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thanhtunguet / grapesjs-react / src / Editor / Editor.tsx View on Github external
() => {
        if (editor) {
          if (onDestroy) {
            onDestroy(editor);
          }
          GrapesJS.editors = GrapesJS.editors.filter((e: any) => e !== editor);
          editor.destroy();
          if (document) {
            const container: HTMLDivElement = document.getElementById(id) as HTMLDivElement;
            if (container) {
              container.innerHTML = '';
            }
          }
        }
      },
      [editor, id, onDestroy],
github thanhtunguet / grapesjs-react / src / components / GEditor.tsx View on Github external
return function cleanup() {
        if (editor) {
          editor.destroy();
          GrapesJS.editors = GrapesJS.editors.filter((e) => e !== editor);
        }
      };
    },
github thanhtunguet / grapesjs-react / src / Editor / Editor.tsx View on Github external
(props: IEditorProps, ref: React.Ref) => {
    const {
      id,
      onInit,
      onDestroy,
      presetType,
      blockManager,
      storageManager,
      styleManager,
      width,
      height,
      children,
      plugins: propPlugins,
    } = props;

    const [editor, setEditor] = React.useState(GrapesJS.editors.find((e: any) => {
      return e.getContainer().id === id;
    }));

    const handleCleanup = React.useCallback(
      () => {
        if (editor) {
          if (onDestroy) {
            onDestroy(editor);
          }
          GrapesJS.editors = GrapesJS.editors.filter((e: any) => e !== editor);
          editor.destroy();
          if (document) {
            const container: HTMLDivElement = document.getElementById(id) as HTMLDivElement;
            if (container) {
              container.innerHTML = '';
            }

grapesjs

Free and Open Source Web Builder Framework

BSD-3-Clause
Latest version published 4 days ago

Package Health Score

92 / 100
Full package analysis