MCPcopy Index your code
hub / github.com/GrapesJS/react / useEditor

Function useEditor

packages/grapesjs-react/src/context/EditorInstance.tsx:38–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36 * @returns Editor
37 */
38export const useEditor = (): Editor => {
39 const { editor } = useEditorInstance();
40
41 if (!editor) {
42 throw new Error(
43 'useEditor used before the load of the editor instance. You can wrap your component in `<WithEditor>` or make use of `useEditorMaybe` hook and ensure the `editor` exists.'
44 );
45 }
46
47 return editor;
48};
49
50/**
51 * Similar to useEditor, but in this case, the editor might be undefined.

Callers 12

CustomLayerManagerFunction · 0.90
TopbarButtonsFunction · 0.90
StylePropertyFieldFunction · 0.90
TraitPropertyFieldFunction · 0.90
LayerItemFunction · 0.90
CustomAssetManagerFunction · 0.90
CustomLayerManagerFunction · 0.90
TopbarButtonsFunction · 0.90
StylePropertyFieldFunction · 0.90
TraitPropertyFieldFunction · 0.90
LayerItemFunction · 0.90
CustomAssetManagerFunction · 0.90

Calls 1

useEditorInstanceFunction · 0.85

Tested by

no test coverage detected