feat: single model export

This commit is contained in:
Timothy J. Baek
2024-06-02 13:53:02 -07:00
parent 2e24c2d4d3
commit 0a9f41a044
3 changed files with 43 additions and 0 deletions

View File

@@ -126,6 +126,13 @@
saveAs(blob, `models-export-${Date.now()}.json`);
};
const exportModelHandler = async (model) => {
let blob = new Blob([JSON.stringify([model])], {
type: 'application/json'
});
saveAs(blob, `${model.id}-${Date.now()}.json`);
};
const positionChangeHanlder = async () => {
// Get the new order of the models
const modelIds = Array.from(document.getElementById('model-list').children).map((child) =>
@@ -322,6 +329,9 @@
cloneHandler={() => {
cloneModelHandler(model);
}}
exportHandler={() => {
exportModelHandler(model);
}}
hideHandler={() => {
hideModelHandler(model);
}}