Add Tweening to zoom, fix saving canvas.

This commit is contained in:
2025-01-14 00:04:14 +01:00
parent 4433cf0e00
commit 76db788192
9 changed files with 222 additions and 127 deletions

View File

@@ -206,7 +206,7 @@
<script setup lang="ts">
import { Icon } from '@iconify/vue/dist/iconify.js';
import type { Instruction } from '@atlaskit/pragmatic-drag-and-drop-hitbox/dist/types/tree-item';
import { convertContent, parsePath } from '#shared/general.utils';
import { convertContentFromText, convertContentToText, parsePath } from '#shared/general.utils';
import type { CanvasContent, ExploreContent, FileType, TreeItem } from '~/types/content';
import { iconByType } from '#shared/general.utils';
import FakeA from '~/components/prose/FakeA.vue';
@@ -247,7 +247,7 @@ watch(selected, async (value, old) => {
if(storedEdit)
{
selected.value.content = convertContent(selected.value.type, storedEdit);
selected.value.content = convertContentFromText(selected.value.type, storedEdit);
contentStatus.value = 'success';
}
else
@@ -518,11 +518,12 @@ function rebuildPath(tree: TreeItemEditable[] | null | undefined, parentPath: st
}
async function save(redirect: boolean): Promise<void>
{
const map = (e: TreeItemEditable[]): TreeItemEditable[] => e.map(f => ({ ...f, content: f.content ? convertContentToText(f.type, f.content) : undefined, children: f.children ? map(f.children) : undefined }));
saveStatus.value = 'pending';
try {
const result = await $fetch(`/api/project`, {
method: 'post',
body: navigation.value,
body: map(navigation.value),
});
saveStatus.value = 'success';
edited.value = false;
@@ -537,6 +538,7 @@ async function save(redirect: boolean): Promise<void>
toaster.add({
type: 'error', content: e.message, timer: true, duration: 10000
})
console.error(e);
saveStatus.value = 'error';
}
}