()
| 36 | * @returns Editor |
| 37 | */ |
| 38 | export 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. |
no test coverage detected