mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-10-15 15:03:53 +00:00
Add Save as template
This commit is contained in:
@@ -729,6 +729,23 @@ export default function ControlPanel({
|
||||
function: saveDiagramAs,
|
||||
shortcut: "Ctrl+Shift+S",
|
||||
},
|
||||
"Save as template": {
|
||||
function: () => {
|
||||
db.templates
|
||||
.add({
|
||||
title: title,
|
||||
tables: tables,
|
||||
relationships: relationships,
|
||||
types: types,
|
||||
notes: notes,
|
||||
subjectAreas: areas,
|
||||
custom: 1,
|
||||
})
|
||||
.then(() => {
|
||||
Toast.success("Template saved!");
|
||||
});
|
||||
},
|
||||
},
|
||||
Share: {
|
||||
function: () => {},
|
||||
},
|
||||
@@ -756,18 +773,6 @@ export default function ControlPanel({
|
||||
.catch(() => Toast.error("Oops! Something went wrong."));
|
||||
},
|
||||
},
|
||||
"Flush storage": {
|
||||
function: async () => {
|
||||
db.delete()
|
||||
.then(() => {
|
||||
Toast.success("Storage flushed");
|
||||
window.location.reload(false);
|
||||
})
|
||||
.catch(() => {
|
||||
Toast.error("Oops! Something went wrong.");
|
||||
});
|
||||
},
|
||||
},
|
||||
Import: {
|
||||
function: fileImport,
|
||||
shortcut: "Ctrl+I",
|
||||
@@ -935,6 +940,18 @@ export default function ControlPanel({
|
||||
return { ...prev, panning: !prev.panning };
|
||||
}),
|
||||
},
|
||||
{
|
||||
"Flush storage": async () => {
|
||||
db.delete()
|
||||
.then(() => {
|
||||
Toast.success("Storage flushed");
|
||||
window.location.reload(false);
|
||||
})
|
||||
.catch(() => {
|
||||
Toast.error("Oops! Something went wrong.");
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
Exit: {
|
||||
|
Reference in New Issue
Block a user