diff --git a/src/lib/components/icons/ArrowDownTray.svelte b/src/lib/components/icons/ArrowDownTray.svelte new file mode 100644 index 000000000..55620e9fe --- /dev/null +++ b/src/lib/components/icons/ArrowDownTray.svelte @@ -0,0 +1,19 @@ + + + diff --git a/src/lib/components/workspace/Models.svelte b/src/lib/components/workspace/Models.svelte index dcecef819..43ef1fa82 100644 --- a/src/lib/components/workspace/Models.svelte +++ b/src/lib/components/workspace/Models.svelte @@ -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); }} diff --git a/src/lib/components/workspace/Models/ModelMenu.svelte b/src/lib/components/workspace/Models/ModelMenu.svelte index bde54e709..7d4650e66 100644 --- a/src/lib/components/workspace/Models/ModelMenu.svelte +++ b/src/lib/components/workspace/Models/ModelMenu.svelte @@ -11,6 +11,7 @@ import Share from '$lib/components/icons/Share.svelte'; import ArchiveBox from '$lib/components/icons/ArchiveBox.svelte'; import DocumentDuplicate from '$lib/components/icons/DocumentDuplicate.svelte'; + import ArrowDownTray from '$lib/components/icons/ArrowDownTray.svelte'; const i18n = getContext('i18n'); @@ -18,6 +19,8 @@ export let shareHandler: Function; export let cloneHandler: Function; + export let exportHandler: Function; + export let hideHandler: Function; export let deleteHandler: Function; export let onClose: Function; @@ -66,6 +69,17 @@