From 4534663ec0efde808021bb04185e1d68522aa50f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anna=20=C5=81ysiuk?= Date: Tue, 6 Feb 2024 13:50:29 +0100 Subject: [PATCH] disable import export (#593) --- packages/editor/src/editor/Editor.tsx | 6 +++++ packages/editor/src/editor/menu/Menu.tsx | 32 ++++++++++++++---------- packages/sandbox/apps/Pure.tsx | 2 ++ 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/packages/editor/src/editor/Editor.tsx b/packages/editor/src/editor/Editor.tsx index 49f420f8..5f3749c8 100644 --- a/packages/editor/src/editor/Editor.tsx +++ b/packages/editor/src/editor/Editor.tsx @@ -93,6 +93,8 @@ export interface EditorProps // Editor custom fonts without whole theme needed to be passed fontFamily?: string; fontFamilySans?: string; + disableExport?: boolean; + disableImport?: boolean; } export interface ExternalEditorAPI { @@ -120,6 +122,8 @@ export const Editor = React.forwardRef( onNodeSelect, onContentChange, title, + disableExport, + disableImport, onEditorMount, }, ref @@ -296,6 +300,8 @@ export const Editor = React.forwardRef( const newState: typeof routes = { ...routes, pane: p }; set(newState, "internal"); }} + disableExport={disableExport} + disableImport={disableImport} /> {routes.pane !== "diff" && ( void; path: string; + disableImport?: boolean; + disableExport?: boolean; } export const Menu = ({ @@ -112,6 +114,8 @@ export const Menu = ({ libraries, readOnly, excludePanes = [], + disableImport, + disableExport, }: MenuProps) => { const [importOpen, setImportOpen] = useState(false); const { saveToFile } = useFileOperations(); @@ -201,19 +205,21 @@ export const Menu = ({ )} - - - - - - - - {!readOnly && ( + {!disableExport && ( + + + + + + + + )} + {!readOnly && !disableImport && ( { }); }} schema={mySchema} + disableImport + disableExport /> );