diff --git a/src/components/ControlPanel.jsx b/src/components/ControlPanel.jsx index 680f1b5..80e99fe 100644 --- a/src/components/ControlPanel.jsx +++ b/src/components/ControlPanel.jsx @@ -666,15 +666,29 @@ export default function ControlPanel({ diagramId, setDiagramId }) { del(); }; const save = () => { - db.diagrams.add({ - name: title, - lastModified: new Date(), - tables: tables, - references: relationships, - types: types, - notes: notes, - areas: areas, - }); + if (diagramId === 0) { + db.diagrams + .add({ + name: title, + lastModified: new Date(), + tables: tables, + references: relationships, + types: types, + notes: notes, + areas: areas, + }) + .then((id) => setDiagramId(id)); + } else { + db.diagrams.update(diagramId, { + name: title, + lastModified: new Date(), + tables: tables, + references: relationships, + types: types, + notes: notes, + areas: areas, + }); + } }; const open = () => setVisible(MODAL.OPEN); const saveDiagramAs = () => setVisible(MODAL.SAVEAS); @@ -1091,7 +1105,7 @@ export default function ControlPanel({ diagramId, setDiagramId }) { case MODAL.IMPORT: return "Import diagram"; case MODAL.CODE: - return "Export diagram"; + return "Export source"; case MODAL.IMG: return "Export image"; case MODAL.RENAME: diff --git a/src/pages/shortcuts.jsx b/src/pages/shortcuts.jsx index 03066a6..f2cffd2 100644 --- a/src/pages/shortcuts.jsx +++ b/src/pages/shortcuts.jsx @@ -5,6 +5,13 @@ import { AutoComplete, Button } from "@douyinfe/semi-ui"; import { IconSearch, IconSun, IconMoon } from "@douyinfe/semi-icons"; const shortcuts = [ + { shortcut: "CTRL+S", title: "Save diagram", description: "" }, + { shortcut: "CTRL+Shift+S", title: "Save diagram as", description: "" }, + { + shortcut: "CTRL+O", + title: "Open a diagram", + description: "Load a saved diagram", + }, { shortcut: "CTRL+C", title: "Copy selected element", description: "" }, { shortcut: "CTRL+V", title: "Paste selected element", description: "" }, { shortcut: "CTRL+X", title: "Cut selected element", description: "" }, @@ -180,6 +187,14 @@ export default function Shortcuts() { ))} +
+
+ © 2024 drawDB - All right reserved. +
); }