From 6bdb0516b270aace85d79b9b2e189320c47754bd Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Tue, 24 Mar 2026 21:46:34 +0000 Subject: [PATCH] loader --- .../features/editor/components/drawio/drawio-menu.tsx | 11 ++++++++++- .../features/editor/components/drawio/drawio-view.tsx | 7 ++++++- .../editor/components/excalidraw/excalidraw-menu.tsx | 9 ++++++++- .../editor/components/excalidraw/excalidraw-view.tsx | 5 ++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/apps/client/src/features/editor/components/drawio/drawio-menu.tsx b/apps/client/src/features/editor/components/drawio/drawio-menu.tsx index 8cda0348..869decd7 100644 --- a/apps/client/src/features/editor/components/drawio/drawio-menu.tsx +++ b/apps/client/src/features/editor/components/drawio/drawio-menu.tsx @@ -8,6 +8,7 @@ import { } from "@/features/editor/components/table/types/types.ts"; import { ActionIcon, + LoadingOverlay, Modal, Text, Tooltip, @@ -46,6 +47,8 @@ export function DrawioMenu({ editor }: EditorMenuProps) { const computedColorScheme = useComputedColorScheme(); const isDirtyRef = useRef(false); const isSavingRef = useRef(false); + const [isSaving, setIsSaving] = useState(false); + const [isLoading, setIsLoading] = useState(false); const editorState = useEditorState({ editor, @@ -140,6 +143,7 @@ export function DrawioMenu({ editor }: EditorMenuProps) { if (isSavingRef.current) return; isSavingRef.current = true; + setIsSaving(true); try { const svgString = decodeBase64ToSvgString(svgXml); @@ -167,6 +171,7 @@ export function DrawioMenu({ editor }: EditorMenuProps) { isDirtyRef.current = false; } finally { isSavingRef.current = false; + setIsSaving(false); } }, [editor, editorState?.attachmentId]); @@ -196,6 +201,7 @@ export function DrawioMenu({ editor }: EditorMenuProps) { const handleOpen = useCallback(async () => { if (!editorState?.src) return; + setIsLoading(true); try { const url = getFileUrl(editorState.src); const request = await fetch(url, { @@ -213,6 +219,7 @@ export function DrawioMenu({ editor }: EditorMenuProps) { } catch (err) { console.error(err); } finally { + setIsLoading(false); isDirtyRef.current = false; open(); } @@ -307,6 +314,7 @@ export function DrawioMenu({ editor }: EditorMenuProps) { size="lg" aria-label={t("Edit")} variant="subtle" + loading={isLoading} > @@ -339,7 +347,8 @@ export function DrawioMenu({ editor }: EditorMenuProps) { - + +
{ if (!editor.isEditable) { @@ -47,6 +49,7 @@ export default function DrawioView(props: NodeViewProps) { if (isSavingRef.current) return; isSavingRef.current = true; + setIsSaving(true); try { const svgString = decodeBase64ToSvgString(svgXml); @@ -79,6 +82,7 @@ export default function DrawioView(props: NodeViewProps) { isDirtyRef.current = false; } finally { isSavingRef.current = false; + setIsSaving(false); } }; @@ -136,7 +140,8 @@ export default function DrawioView(props: NodeViewProps) { - + +
{ if (!editorState?.src) return; + setIsLoading(true); try { const url = getFileUrl(editorState.src); const request = await fetch(url, { @@ -166,6 +169,7 @@ export function ExcalidrawMenu({ editor }: EditorMenuProps) { } catch (err) { console.error(err); } finally { + setIsLoading(false); isDirtyRef.current = false; isInitialLoadRef.current = true; open(); @@ -178,6 +182,7 @@ export function ExcalidrawMenu({ editor }: EditorMenuProps) { } isSavingRef.current = true; + setIsSaving(true); try { const { exportToSvg } = await import("@excalidraw/excalidraw"); @@ -223,6 +228,7 @@ export function ExcalidrawMenu({ editor }: EditorMenuProps) { isDirtyRef.current = false; } finally { isSavingRef.current = false; + setIsSaving(false); } }, [editor, excalidrawAPI, editorState?.attachmentId]); @@ -339,6 +345,7 @@ export function ExcalidrawMenu({ editor }: EditorMenuProps) { size="lg" aria-label={t("Edit")} variant="subtle" + loading={isLoading} > @@ -390,7 +397,7 @@ export function ExcalidrawMenu({ editor }: EditorMenuProps) { bg="var(--mantine-color-body)" p="xs" > -