Files
outline/app/components/DocumentContext.ts
Tom Moor c97110e72b Upgrade MermaidJS (#5043
* Upgrade MermaidJS

* fix: Flashing of diagrams while editing another

* Upgrade vite

* type imports
2023-04-08 06:20:42 -07:00

20 lines
576 B
TypeScript

import * as React from "react";
import type { Editor } from "~/editor";
export type DocumentContextValue = {
/** The current editor instance for this document. */
editor: Editor | null;
/** Set the current editor instance for this document. */
setEditor: (editor: Editor) => void;
};
const DocumentContext = React.createContext<DocumentContextValue>({
editor: null,
// eslint-disable-next-line @typescript-eslint/no-empty-function
setEditor() {},
});
export const useDocumentContext = () => React.useContext(DocumentContext);
export default DocumentContext;