Skip to content

Commit bd295a5

Browse files
committed
fix load external dialog
1 parent 543d224 commit bd295a5

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

packages/learningmap/src/EditorDialogs.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { memo } from "react";
1+
import React, { memo, useEffect } from "react";
22
import { X } from "lucide-react";
33
import { useEditorStore } from "./editorStore";
44
import { ShareDialog } from "./ShareDialog";
@@ -39,6 +39,17 @@ export const EditorDialogs = memo(({ defaultLanguage = "en", jsonStore = "https:
3939
downloadAnchorNode.remove();
4040
};
4141

42+
useEffect(() => {
43+
const hash = window.location.hash;
44+
if (hash.startsWith("#json=")) {
45+
const id = hash.replace("#json=", "");
46+
if (id && id !== pendingExternalId) {
47+
setPendingExternalId(id);
48+
setLoadExternalDialogOpen(true);
49+
}
50+
}
51+
}, [setLoadExternalDialogOpen, setPendingExternalId, pendingExternalId]);
52+
4253
const keyboardShortcuts = [
4354
{ action: t.shortcuts.undo, shortcut: "Ctrl+Z" },
4455
{ action: t.shortcuts.redo, shortcut: "Ctrl+Y or Ctrl+Shift+Z" },

0 commit comments

Comments
 (0)