Rework the project editor to include file edition and display the file sorter in the sidebar.
This commit is contained in:
parent
602b0af212
commit
fd951c294f
|
|
@ -3,11 +3,11 @@ const External = Annotation.define<boolean>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { dropCursor, crosshairCursor, keymap, EditorView, ViewUpdate } from '@codemirror/view';
|
import { dropCursor, crosshairCursor, keymap, EditorView, ViewUpdate, placeholder as placeholderExtension } from '@codemirror/view';
|
||||||
import { Annotation, EditorState } from '@codemirror/state';
|
import { Annotation, EditorState } from '@codemirror/state';
|
||||||
import { indentOnInput, syntaxHighlighting, defaultHighlightStyle, bracketMatching, foldKeymap } from '@codemirror/language';
|
import { indentOnInput, syntaxHighlighting, defaultHighlightStyle, bracketMatching, foldKeymap } from '@codemirror/language';
|
||||||
import { history, defaultKeymap, historyKeymap } from '@codemirror/commands';
|
import { history, defaultKeymap, historyKeymap } from '@codemirror/commands';
|
||||||
import { searchKeymap } from '@codemirror/search';
|
import { search, searchKeymap } from '@codemirror/search';
|
||||||
import { closeBrackets, closeBracketsKeymap, completionKeymap } from '@codemirror/autocomplete';
|
import { closeBrackets, closeBracketsKeymap, completionKeymap } from '@codemirror/autocomplete';
|
||||||
import { lintKeymap } from '@codemirror/lint';
|
import { lintKeymap } from '@codemirror/lint';
|
||||||
|
|
||||||
|
|
@ -15,6 +15,9 @@ const editor = useTemplateRef('editor');
|
||||||
const view = ref<EditorView>();
|
const view = ref<EditorView>();
|
||||||
const state = ref<EditorState>();
|
const state = ref<EditorState>();
|
||||||
|
|
||||||
|
const { placeholder } = defineProps<{
|
||||||
|
placeholder?: string
|
||||||
|
}>();
|
||||||
const model = defineModel<string>();
|
const model = defineModel<string>();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
@ -24,6 +27,7 @@ onMounted(() => {
|
||||||
doc: model.value,
|
doc: model.value,
|
||||||
extensions: [
|
extensions: [
|
||||||
history(),
|
history(),
|
||||||
|
search(),
|
||||||
dropCursor(),
|
dropCursor(),
|
||||||
EditorState.allowMultipleSelections.of(true),
|
EditorState.allowMultipleSelections.of(true),
|
||||||
indentOnInput(),
|
indentOnInput(),
|
||||||
|
|
@ -31,6 +35,7 @@ onMounted(() => {
|
||||||
bracketMatching(),
|
bracketMatching(),
|
||||||
closeBrackets(),
|
closeBrackets(),
|
||||||
crosshairCursor(),
|
crosshairCursor(),
|
||||||
|
placeholderExtension(placeholder ?? ''),
|
||||||
EditorView.lineWrapping,
|
EditorView.lineWrapping,
|
||||||
keymap.of([
|
keymap.of([
|
||||||
...closeBracketsKeymap,
|
...closeBracketsKeymap,
|
||||||
|
|
@ -46,7 +51,8 @@ onMounted(() => {
|
||||||
{
|
{
|
||||||
model.value = viewUpdate.state.doc.toString();
|
model.value = viewUpdate.state.doc.toString();
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
|
EditorView.contentAttributes.of({spellcheck: "true"}),
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
view.value = new EditorView({
|
view.value = new EditorView({
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<TreeRoot v-bind="forward" v-slot="{ flattenItems }" class="list-none select-none border border-light-35 dark:border-dark-35 text-light-100 dark:text-dark-100 p-2 xl:text-base text-sm overflow-auto w-[450px] max-h-full">
|
<TreeRoot v-bind="forward" v-slot="{ flattenItems }" class="list-none select-none text-light-100 dark:text-dark-100 p-2 xl:text-base text-sm overflow-auto max-h-full">
|
||||||
<DraggableTreeItem v-for="item in flattenItems" :key="item._id" v-bind="item" class="flex items-center outline-none relative cursor-pointer hover:bg-light-20 dark:hover:bg-dark-20 data-[selected]:bg-light-35 dark:data-[selected]:bg-dark-35" @select.prevent @toggle.prevent>
|
<DraggableTreeItem v-for="item in flattenItems" :key="item._id" v-bind="item" class="flex items-center outline-none relative cursor-pointer hover:bg-light-20 dark:hover:bg-dark-20 data-[selected]:bg-light-35 dark:data-[selected]:bg-dark-35" @select.prevent @toggle.prevent>
|
||||||
<template #default="{ handleToggle, handleSelect, isExpanded, isSelected, isDragging, isDraggedOver }">
|
<template #default="{ handleToggle, handleSelect, isExpanded, isSelected, isDragging, isDraggedOver }">
|
||||||
<slot :handleToggle="handleToggle"
|
<slot :handleToggle="handleToggle"
|
||||||
|
|
|
||||||
BIN
db.sqlite-shm
BIN
db.sqlite-shm
Binary file not shown.
BIN
db.sqlite-wal
BIN
db.sqlite-wal
Binary file not shown.
|
|
@ -55,9 +55,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 xl:px-6 px-3 max-w-full max-h-full overflow-y-auto overflow-x-hidden">
|
<div class="flex-1 xl:px-6 px-3 max-w-full max-h-full overflow-y-auto overflow-x-hidden">
|
||||||
|
<div class="flex flex-row flex-1 justify-between items-center">
|
||||||
<NuxtLink :href="{ name: 'explore-path', params: { path: 'index' } }" class="flex flex-1 font-bold text-lg items-center border-light-35 dark:border-dark-35 hover:border-accent-blue" active-class="text-accent-blue border-s-2 !border-accent-blue">
|
<NuxtLink :href="{ name: 'explore-path', params: { path: 'index' } }" class="flex flex-1 font-bold text-lg items-center border-light-35 dark:border-dark-35 hover:border-accent-blue" active-class="text-accent-blue border-s-2 !border-accent-blue">
|
||||||
<div class="pl-3 py-1 flex-1 truncate">Projet</div>
|
<span class="pl-3 py-1 flex-1 truncate">Projet</span>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
|
<NuxtLink v-if="user && hasPermissions(user.permissions, ['admin', 'editor'])" :to="{ name: 'explore-edit' }"><Button icon><Icon icon="radix-icons:pencil-2" /></Button></NuxtLink>
|
||||||
|
</div>
|
||||||
<Tree v-if="pages" v-model="pages" :getKey="(item) => item.path">
|
<Tree v-if="pages" v-model="pages" :getKey="(item) => item.path">
|
||||||
<template #default="{ item, isExpanded }">
|
<template #default="{ item, isExpanded }">
|
||||||
<NuxtLink :href="item.value.path && !item.hasChildren ? { name: 'explore-path', params: { path: item.value.path } } : undefined" class="flex flex-1 items-center hover:border-accent-blue hover:text-accent-purple" :class="{ 'font-medium': item.hasChildren }" active-class="text-accent-blue" :data-private="item.value.private">
|
<NuxtLink :href="item.value.path && !item.hasChildren ? { name: 'explore-path', params: { path: item.value.path } } : undefined" class="flex flex-1 items-center hover:border-accent-blue hover:text-accent-purple" :class="{ 'font-medium': item.hasChildren }" active-class="text-accent-blue" :data-private="item.value.private">
|
||||||
|
|
@ -87,6 +90,7 @@ import { Icon } from '@iconify/vue/dist/iconify.js';
|
||||||
import type { NavigationTreeItem } from '~/server/api/navigation.get';
|
import type { NavigationTreeItem } from '~/server/api/navigation.get';
|
||||||
import { iconByType } from '#shared/general.utils';
|
import { iconByType } from '#shared/general.utils';
|
||||||
import type { DropdownOption } from '~/components/base/DropdownMenu.vue';
|
import type { DropdownOption } from '~/components/base/DropdownMenu.vue';
|
||||||
|
import { hasPermissions } from '~/shared/auth.util';
|
||||||
|
|
||||||
const options = ref<DropdownOption[]>([{
|
const options = ref<DropdownOption[]>([{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<template>
|
||||||
|
<slot></slot>
|
||||||
|
</template>
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||||
import vuePlugin from 'rollup-plugin-vue'
|
import vuePlugin from 'rollup-plugin-vue'
|
||||||
import postcssPlugin from 'rollup-plugin-postcss'
|
|
||||||
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
compatibilityDate: '2024-04-03',
|
compatibilityDate: '2024-04-03',
|
||||||
|
|
@ -118,21 +117,9 @@ export default defineNuxtConfig({
|
||||||
path: '~/components',
|
path: '~/components',
|
||||||
pathPrefix: false,
|
pathPrefix: false,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: '~/server/components',
|
|
||||||
pathPrefix: true,
|
|
||||||
global: true,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
nitro: {
|
nitro: {
|
||||||
alias: {
|
preset: 'node',
|
||||||
'public': '//public',
|
|
||||||
},
|
|
||||||
publicAssets: [{
|
|
||||||
baseURL: 'public',
|
|
||||||
dir: 'public',
|
|
||||||
}],
|
|
||||||
preset: 'bun',
|
|
||||||
experimental: {
|
experimental: {
|
||||||
tasks: true,
|
tasks: true,
|
||||||
},
|
},
|
||||||
|
|
@ -166,7 +153,7 @@ export default defineNuxtConfig({
|
||||||
xssValidator: false,
|
xssValidator: false,
|
||||||
},
|
},
|
||||||
sitemap: {
|
sitemap: {
|
||||||
exclude: ['/admin/**', '/explore/edit/**', '/user/mailvalidated'],
|
exclude: ['/admin/**', '/explore/edit', '/user/mailvalidated'],
|
||||||
sources: ['/api/__sitemap__/urls']
|
sources: ['/api/__sitemap__/urls']
|
||||||
},
|
},
|
||||||
experimental: {
|
experimental: {
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,7 @@
|
||||||
<div class="flex flex-1 flex-row justify-between items-center">
|
<div class="flex flex-1 flex-row justify-between items-center">
|
||||||
<ProseH1>{{ overview.title }}</ProseH1>
|
<ProseH1>{{ overview.title }}</ProseH1>
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
<NuxtLink :href="{ name: 'explore-edit-path', params: { path: path } }" v-if="isOwner"><Button>Modifier</Button></NuxtLink>
|
<NuxtLink :href="{ name: 'explore-edit', hash: '#' + overview.path }" v-if="isOwner"><Button>Modifier</Button></NuxtLink>
|
||||||
<NuxtLink :href="{ name: 'explore-edit' }" v-if="isOwner && path === 'index'"><Button>Configurer le projet</Button></NuxtLink>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Markdown v-if="content" :content="content.content" />
|
<Markdown v-if="content" :content="content.content" />
|
||||||
|
|
|
||||||
|
|
@ -1,124 +0,0 @@
|
||||||
<template>
|
|
||||||
<div v-if="overview" class="xl:p-12 lg:p-8 py-4 flex flex-1 flex-col items-start justify-start max-h-full">
|
|
||||||
<Head>
|
|
||||||
<Title>d[any] - Modification de {{ overview.title }}</Title>
|
|
||||||
</Head>
|
|
||||||
<div class="flex flex-col xl:flex-row xl:justify-between justify-center items-center w-full px-4 pb-4 border-b border-light-35 dark:border-dark-35 bg-light-0 dark:bg-dark-0">
|
|
||||||
<input type="text" v-model="overview.title" placeholder="Titre" class="flex-1 mx-4 h-16 w-full caret-light-50 dark:caret-dark-50 text-light-100 dark:text-dark-100 placeholder:text-light-50 dark:placeholder:text-dark-50 appearance-none outline-none px-3 py-1 text-5xl font-thin bg-transparent" />
|
|
||||||
<div class="flex gap-4 self-end xl:self-auto flex-wrap">
|
|
||||||
<div class="flex gap-4">
|
|
||||||
<Tooltip message="Consultable uniquement par le propriétaire" side="bottom"><Switch label="Privé" v-model="overview.private" /></Tooltip>
|
|
||||||
<Tooltip message="Afficher dans le menu de navigation" side="bottom"><Switch label="Navigable" v-model="overview.navigable" /></Tooltip>
|
|
||||||
</div>
|
|
||||||
<div class="flex gap-4">
|
|
||||||
<Tooltip message="Ctrl+S" side="bottom"><Button @click="() => save(true)" :loading="saveStatus === 'pending'" class="border-light-blue dark:border-dark-blue hover:border-light-blue dark:hover:border-dark-blue focus:shadow-light-blue dark:focus:shadow-dark-blue">Enregistrer</Button></Tooltip>
|
|
||||||
<Tooltip message="Ctrl+Shift+Z" side="bottom"><NuxtLink :href="{ name: 'explore-path', params: { path: path } }"><Button>Annuler</Button></NuxtLink></Tooltip>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="my-4 flex-1 w-full max-h-full flex">
|
|
||||||
<template v-if="overview.type === 'markdown'">
|
|
||||||
<Loading v-if="contentStatus === 'pending'" />
|
|
||||||
<span v-else-if="contentError">{{ contentError.message }}</span>
|
|
||||||
<SplitterGroup direction="horizontal" class="flex-1 w-full flex" v-else >
|
|
||||||
<SplitterPanel asChild collapsible :collapsedSize="0" :minSize="20" v-slot="{ isCollapsed }" :defaultSize="50">
|
|
||||||
<Editor v-model="page!.content" class="flex-1 bg-transparent appearance-none outline-none max-h-full resize-none !overflow-y-auto" :class="{ 'hidden': isCollapsed }" />
|
|
||||||
</SplitterPanel>
|
|
||||||
<SplitterResizeHandle class="bg-light-35 dark:bg-dark-35 w-px xl!mx-4 mx-2" />
|
|
||||||
<SplitterPanel asChild collapsible :collapsedSize="0" :minSize="20" v-slot="{ isCollapsed }">
|
|
||||||
<div class="flex-1 max-h-full !overflow-y-auto px-8" :class="{ 'hidden': isCollapsed }"><Markdown :content="debounced" :proses="{ 'a': FakeA }" /></div>
|
|
||||||
</SplitterPanel>
|
|
||||||
</SplitterGroup>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="overview.type === 'canvas'">
|
|
||||||
<span class="flex-1 items-center"><ProseH1>Editeur de graphe en cours de développement</ProseH1></span>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="overview.type === 'file'">
|
|
||||||
<span>Modifier le contenu :</span><input type="file" @change="(e) => console.log(e)" />
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else-if="overviewStatus === 'pending'" class="flex">
|
|
||||||
<Head>
|
|
||||||
<Title>d[any] - Chargement</Title>
|
|
||||||
</Head>
|
|
||||||
<Loading />
|
|
||||||
</div>
|
|
||||||
<div v-else-if="overviewStatus === 'error'">{{ overviewError?.message }}</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import FakeA from '~/components/prose/FakeA.vue';
|
|
||||||
|
|
||||||
const nuxt = useNuxtApp();
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const route = router.currentRoute;
|
|
||||||
const path = computed(() => Array.isArray(route.value.params.path) ? route.value.params.path[0] : route.value.params.path);
|
|
||||||
const { user, loggedIn } = useUserSession();
|
|
||||||
|
|
||||||
const toaster = useToast();
|
|
||||||
const saveStatus = ref<'idle' | 'pending' | 'success' | 'error'>('idle');
|
|
||||||
|
|
||||||
const sessionContent = useSessionStorage<string | undefined>(path.value, undefined);
|
|
||||||
const { data: overview, status: overviewStatus, error: overviewError } = await useFetch(`/api/file/overview/${encodeURIComponent(path.value)}`, { watch: [ route, path ] });
|
|
||||||
const { data: page, status: contentStatus, error: contentError } = await useFetch(`/api/file/content/${encodeURIComponent(path.value)}`, { watch: [ route, path ], transform: (value) => {
|
|
||||||
if(value && sessionContent.value !== undefined)
|
|
||||||
{
|
|
||||||
value.content = sessionContent.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}, getCachedData: (key) => {
|
|
||||||
const value = nuxt.isHydrating ? nuxt.payload.data[key] : nuxt.static.data[key];
|
|
||||||
if(value && sessionContent.value !== undefined)
|
|
||||||
{
|
|
||||||
value.content = sessionContent.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
} });
|
|
||||||
|
|
||||||
const content = computed(() => page.value?.content);
|
|
||||||
const debounced = useDebounce(content, 250);
|
|
||||||
|
|
||||||
if(!loggedIn || (overview.value && overview.value.owner !== user.value?.id))
|
|
||||||
{
|
|
||||||
router.replace({ name: 'explore-path', params: { path: path.value } });
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(debounced, (value) => {
|
|
||||||
sessionContent.value = value;
|
|
||||||
});
|
|
||||||
|
|
||||||
useShortcuts({
|
|
||||||
meta_s: { usingInput: true, handler: () => save(false) },
|
|
||||||
meta_shift_z: { usingInput: true, handler: () => router.push({ name: 'explore-path', params: { path: path.value }}) }
|
|
||||||
})
|
|
||||||
|
|
||||||
async function save(redirect: boolean): Promise<void>
|
|
||||||
{
|
|
||||||
saveStatus.value = 'pending';
|
|
||||||
try {
|
|
||||||
await $fetch(`/api/file`, {
|
|
||||||
method: 'post',
|
|
||||||
body: { ...page.value, ...overview.value },
|
|
||||||
});
|
|
||||||
saveStatus.value = 'success';
|
|
||||||
sessionContent.value = undefined;
|
|
||||||
|
|
||||||
toaster.clear('error');
|
|
||||||
toaster.add({
|
|
||||||
type: 'success', content: 'Contenu enregistré', timer: true, duration: 10000
|
|
||||||
});
|
|
||||||
|
|
||||||
if(redirect)
|
|
||||||
router.push({ name: 'explore-path', params: { path: path.value } });
|
|
||||||
} catch(e: any) {
|
|
||||||
toaster.add({
|
|
||||||
type: 'error', content: e.message, timer: true, duration: 10000
|
|
||||||
})
|
|
||||||
saveStatus.value = 'error';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
@ -1,18 +1,89 @@
|
||||||
<template>
|
<template>
|
||||||
<Head>
|
<ClientOnly>
|
||||||
<Title>d[any] - Configuration du projet</Title>
|
<div class="xl:-ms-12 xl:-me-12 -ms-6 -me-4 flex flex-1">
|
||||||
</Head>
|
<div class="z-50 md:hidden flex w-full items-center justify-between h-12 border-b border-light-35 dark:border-dark-35">
|
||||||
<div class="flex flex-1 flex-row gap-4 p-6 items-start" v-if="navigation">
|
<div class="flex items-center px-2">
|
||||||
<div class="flex flex-1 flex-col w-[450px] max-w-[450px] max-h-full">
|
<Button icon class="ms-2 !bg-transparent group" disabled>
|
||||||
<DraggableTree class="list-none select-none border border-light-35 dark:border-dark-35 text-light-100 dark:text-dark-100 p-2 xl:text-base text-sm overflow-auto"
|
<Icon class="group-data-[state=open]:hidden" icon="radix-icons:hamburger-menu" />
|
||||||
:items="navigation ?? undefined" :get-key="(item: Partial<ProjectExtendedItem>) => item.path !== undefined ? getPath(item as ProjectExtendedItem) : ''" @updateTree="drop">
|
<Icon class="group-data-[state=closed]:hidden" icon="radix-icons:cross-1" />
|
||||||
|
</Button>
|
||||||
|
<span class="text-light-100 dark:text-dark-100 hover:text-opacity-70 max-md:ps-6" aria-label="Accueil">Accueil</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center px-2">
|
||||||
|
<Tooltip message="Changer de theme" side="left"><ThemeSwitch /></Tooltip>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-1 flex-row relative h-screen overflow-hidden">
|
||||||
|
<div class="bg-light-0 md:py-11 dark:bg-dark-0 z-40 xl:w-96 md:w-[15em] w-full border-r border-light-30 dark:border-dark-30 flex flex-col justify-between max-md:absolute max-md:-top-0 max-md:-bottom-0 md:left-0 max-md:data-[state=closed]:-left-full max-md:transition-[left] py-8 max-md:z-40 max-md:data-[state=open]:left-0">
|
||||||
|
<div class="relative bottom-6 flex flex-col gap-4 xl:px-6 px-3">
|
||||||
|
<div class="flex justify-between items-center max-md:hidden">
|
||||||
|
<div class=" text-light-100 dark:text-dark-100 hover:text-opacity-70 max-md:ps-6" aria-label="Accueil">
|
||||||
|
<Avatar src="/logo.dark.svg" class="dark:block hidden" />
|
||||||
|
<Avatar src="/logo.light.svg" class="block dark:hidden" />
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-4 items-center">
|
||||||
|
<Tooltip message="Changer de theme" side="left"><ThemeSwitch /></Tooltip>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex-1 xl:px-6 px-3 max-w-full max-h-full" v-if="navigation">
|
||||||
|
<div class="flex flex-1 flex-row justify-between items-center mb-4">
|
||||||
|
<div class="flex flex-1 flex-row justify-start items-center gap-4">
|
||||||
|
<Tooltip side="top" message="Annuler (Ctrl+Shift+W)" ><Button icon @click="router.go(-1)"><Icon class="w-5 h-5" icon="radix-icons:arrow-left" /></Button></Tooltip>
|
||||||
|
<Tooltip side="top" message="Enregistrer (Ctrl+S)" ><Button icon :loading="saveStatus === 'pending'" @click="save(true)"><Icon class="w-5 h-5" icon="radix-icons:check" /></Button></Tooltip>
|
||||||
|
<span v-if="edited" class="text-sm text-light-60 dark:text-dark-60 italic">Modifications non enregistrées</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row justify-end items-center gap-4">
|
||||||
|
<AlertDialogRoot v-if="selected">
|
||||||
|
<AlertDialogTrigger as="span"><Tooltip side="top" message="Supprimer"><Button icon class="border-light-red dark:border-dark-red hover:border-light-red dark:hover:border-dark-red hover:bg-light-redBack dark:hover:bg-dark-redBack text-light-red dark:text-dark-red focus:shadow-light-red dark:focus:shadow-dark-red" ><Icon class="w-5 h-5" icon="radix-icons:trash" /></Button></Tooltip></AlertDialogTrigger>
|
||||||
|
<AlertDialogPortal>
|
||||||
|
<AlertDialogOverlay class="bg-light-0 dark:bg-dark-0 opacity-70 fixed inset-0 z-40" />
|
||||||
|
<AlertDialogContent class="data-[state=open]:animate-contentShow fixed top-[50%] left-[50%] max-h-[85vh] w-[90vw] max-w-[800px] translate-x-[-50%] translate-y-[-50%] bg-light-10 dark:bg-dark-10 border border-light-30 dark:border-dark-30 p-6 z-50 text-light-100 dark:text-dark-100 flex flex-row items-center">
|
||||||
|
<AlertDialogTitle class="text-xl font-semibold">Supprimer <span>{{ selected.title }}</span><span v-if="selected.children"> et tous ces enfants</span> ?</AlertDialogTitle>
|
||||||
|
<div class="flex flex-1 flex-row gap-4 justify-end">
|
||||||
|
<AlertDialogAction asChild @click="navigation = tree.remove(navigation, getPath(selected))"><Button class="border-light-red dark:border-dark-red hover:border-light-red dark:hover:border-dark-red hover:bg-light-redBack dark:hover:bg-dark-redBack text-light-red dark:text-dark-red focus:shadow-light-red dark:focus:shadow-dark-red">Oui</Button></AlertDialogAction>
|
||||||
|
<AlertDialogCancel asChild><Button>Non</Button></AlertDialogCancel>
|
||||||
|
</div>
|
||||||
|
</AlertDialogContent>
|
||||||
|
</AlertDialogPortal>
|
||||||
|
</AlertDialogRoot>
|
||||||
|
<DropdownMenu align="center" side="bottom" :options="[{
|
||||||
|
type: 'item',
|
||||||
|
label: 'Markdown',
|
||||||
|
kbd: 'Ctrl+N',
|
||||||
|
icon: 'radix-icons:file',
|
||||||
|
select: () => add('markdown'),
|
||||||
|
}, {
|
||||||
|
type: 'item',
|
||||||
|
label: 'Dossier',
|
||||||
|
kbd: 'Ctrl+Shift+N',
|
||||||
|
icon: 'lucide:folder',
|
||||||
|
select: () => add('folder'),
|
||||||
|
}, {
|
||||||
|
type: 'item',
|
||||||
|
label: 'Canvas',
|
||||||
|
icon: 'ph:graph-light',
|
||||||
|
select: () => add('canvas'),
|
||||||
|
}, {
|
||||||
|
type: 'item',
|
||||||
|
label: 'Fichier',
|
||||||
|
icon: 'radix-icons:file-text',
|
||||||
|
select: () => add('file'),
|
||||||
|
}]">
|
||||||
|
<Tooltip side="top" message="Nouveau" ><Button icon><Icon class="w-5 h-5" icon="radix-icons:plus" /></Button></Tooltip>
|
||||||
|
</DropdownMenu>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<DraggableTree class="-mx-3 list-none select-none text-light-100 dark:text-dark-100 p-2 xl:text-base text-sm overflow-auto"
|
||||||
|
:items="navigation ?? undefined" :get-key="(item: Partial<ProjectExtendedItem>) => item.path !== undefined ? getPath(item as ProjectExtendedItem) : ''" @updateTree="drop"
|
||||||
|
v-model="selected" :defaultExpanded="defaultExpanded" >
|
||||||
<template #default="{ handleToggle, handleSelect, isExpanded, isSelected, isDragging, item }">
|
<template #default="{ handleToggle, handleSelect, isExpanded, isSelected, isDragging, item }">
|
||||||
<div class="flex flex-1 items-center px-2" :class="{ 'opacity-50': isDragging }" :style="{ 'padding-left': `${item.level - 0.5}em` }">
|
<div class="flex flex-1 items-center px-2" :class="{ 'opacity-50': isDragging }" :style="{ 'padding-left': `${item.level - 0.5}em` }">
|
||||||
<span class="py-2 px-2" @click="handleToggle" v-if="item.hasChildren" >
|
<span class="py-2 px-2" @click="handleToggle" v-if="item.hasChildren" >
|
||||||
<Icon :icon="isExpanded ? 'lucide:folder-open' : 'lucide:folder'"/>
|
<Icon :icon="isExpanded ? 'lucide:folder-open' : 'lucide:folder'"/>
|
||||||
</span>
|
</span>
|
||||||
<Icon v-else-if="iconByType[item.value.type]" :icon="iconByType[item.value.type]" class="group-[:hover]:text-accent-purple mx-2" @click="() => { handleSelect(); selected = isSelected ? undefined : item.value; }" />
|
<Icon v-else-if="iconByType[item.value.type]" :icon="iconByType[item.value.type]" class="group-[:hover]:text-accent-purple mx-2" @click="handleSelect" />
|
||||||
<div class="pl-3 py-1 flex-1 truncate" :title="item.value.title" @click="() => { handleSelect(); selected = isSelected ? undefined : item.value; }">
|
<div class="pl-3 py-1 flex-1 truncate" :title="item.value.title" @click="handleSelect">
|
||||||
{{ item.value.title }}
|
{{ item.value.title }}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
|
|
@ -38,47 +109,14 @@
|
||||||
</template>
|
</template>
|
||||||
</DraggableTree>
|
</DraggableTree>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col flex-1">
|
|
||||||
<div class="flex self-end gap-4 px-4">
|
|
||||||
<DropdownMenu align="center" side="bottom" :options="[{
|
|
||||||
type: 'item',
|
|
||||||
label: 'Markdown',
|
|
||||||
kbd: 'Ctrl+N',
|
|
||||||
icon: 'radix-icons:file',
|
|
||||||
select: () => add('markdown'),
|
|
||||||
}, {
|
|
||||||
type: 'item',
|
|
||||||
label: 'Dossier',
|
|
||||||
kbd: 'Ctrl+Shift+N',
|
|
||||||
icon: 'lucide:folder',
|
|
||||||
select: () => add('folder'),
|
|
||||||
}, {
|
|
||||||
type: 'item',
|
|
||||||
label: 'Canvas',
|
|
||||||
icon: 'ph:graph-light',
|
|
||||||
select: () => add('canvas'),
|
|
||||||
}, {
|
|
||||||
type: 'item',
|
|
||||||
label: 'Fichier',
|
|
||||||
icon: 'radix-icons:file-text',
|
|
||||||
select: () => add('file'),
|
|
||||||
}]">
|
|
||||||
<Button>Nouveau</Button>
|
|
||||||
</DropdownMenu>
|
|
||||||
<Button @click="navigation = tree.remove(navigation, getPath(selected))" v-if="selected" class="border-light-red dark:border-dark-red hover:border-light-red dark:hover:border-dark-red focus:shadow-light-red dark:focus:shadow-dark-red">Supprimer</Button>
|
|
||||||
<Tooltip message="Ctrl+S" side="bottom"><Button @click="() => save(true)" :loading="saveStatus === 'pending'" class="border-light-blue dark:border-dark-blue hover:border-light-blue dark:hover:border-dark-blue focus:shadow-light-blue dark:focus:shadow-dark-blue">Enregistrer</Button></Tooltip>
|
|
||||||
<Tooltip message="Ctrl+Shift+Z" side="bottom"><NuxtLink :href="{ name: 'explore' }"><Button>Annuler</Button></NuxtLink></Tooltip>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="selected" class="flex-1 flex justify-start items-start">
|
<div class="flex flex-1 flex-row">
|
||||||
<div class="flex flex-col flex-1 justify-start items-start">
|
<div v-if="selected" class="xl:p-12 lg:p-8 py-4 flex flex-1 flex-col items-start justify-start max-h-full">
|
||||||
<input type="text" v-model="selected.title" @change="(e) => {
|
<Head>
|
||||||
if(selected && !selected.customPath)
|
<Title>d[any] - Modification de {{ selected.title }}</Title>
|
||||||
{
|
</Head>
|
||||||
selected.name = parsePath(selected.title);
|
<div class="">
|
||||||
rebuildPath(selected.children, getPath(selected));
|
<input type="text" v-model="selected.title" placeholder="Titre" class="inline h-16 w-full caret-light-50 dark:caret-dark-50 text-light-100 dark:text-dark-100 placeholder:text-light-50 dark:placeholder:text-dark-50 appearance-none outline-none py-1 text-5xl font-thin bg-transparent" />
|
||||||
}
|
|
||||||
}" placeholder="Titre" class="flex-1 mx-4 h-16 w-full caret-light-50 dark:caret-dark-50 text-light-100 dark:text-dark-100 placeholder:text-light-50 dark:placeholder:text-dark-50 appearance-none outline-none px-3 py-1 text-5xl font-thin bg-transparent" />
|
|
||||||
<div class="flex ms-6 flex-col justify-start items-start gap-2">
|
|
||||||
<div class="flex flex-col justify-start items-start">
|
<div class="flex flex-col justify-start items-start">
|
||||||
<Switch label="Chemin personnalisé" v-model="selected.customPath" />
|
<Switch label="Chemin personnalisé" v-model="selected.customPath" />
|
||||||
<span>
|
<span>
|
||||||
|
|
@ -92,19 +130,35 @@
|
||||||
<pre v-else>/{{ getPath(selected) }}</pre>
|
<pre v-else>/{{ getPath(selected) }}</pre>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<HoverCard class="!py-2 !px-4"><Icon icon="radix-icons:question-mark-circled" /><template #content><span class="text-sm italic text-light-60 dark:text-dark-60">Un fichier privé n'est consultable que par le propriétaire du projet. Rendre un dossier privé cache automatiquement son contenu sans avoir à chaque fichier un par un.</span></template></HoverCard>
|
|
||||||
<Switch label="Privé" v-model="selected.private" />
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<HoverCard class="!py-2 !px-4"><Icon icon="radix-icons:question-mark-circled" /><template #content><span class="text-sm italic text-light-60 dark:text-dark-60">Un fichier navigable est disponible dans le menu de navigation à gauche. Les fichiers non navigable peuvent toujours être utilisés dans des liens.</span></template></HoverCard>
|
|
||||||
<Switch label="Navigable" v-model="selected.navigable" />
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="py-4 flex-1 w-full max-h-full flex overflow-hidden">
|
||||||
|
<template v-if="selected.type === 'markdown'">
|
||||||
|
<div v-if="contentStatus === 'pending'" class="flex flex-1 justify-center items-center">
|
||||||
|
<Loading />
|
||||||
|
</div>
|
||||||
|
<span v-else-if="contentError">{{ contentError }}</span>
|
||||||
|
<SplitterGroup direction="horizontal" class="flex-1 w-full flex" v-else-if="selected.content !== undefined">
|
||||||
|
<SplitterPanel asChild collapsible :collapsedSize="0" :minSize="20" v-slot="{ isCollapsed }" :defaultSize="50">
|
||||||
|
<Editor v-model="selected.content" placeholder="Commencer votre aventure ..." class="flex-1 bg-transparent appearance-none outline-none max-h-full resize-none !overflow-y-auto" :class="{ 'hidden': isCollapsed }" />
|
||||||
|
</SplitterPanel>
|
||||||
|
<SplitterResizeHandle class="bg-light-35 dark:bg-dark-35 w-px xl!mx-4 mx-2" />
|
||||||
|
<SplitterPanel asChild collapsible :collapsedSize="0" :minSize="20" v-slot="{ isCollapsed }">
|
||||||
|
<div class="flex-1 max-h-full !overflow-y-auto px-8" :class="{ 'hidden': isCollapsed }"><Markdown :content="debounced" :proses="{ 'a': FakeA }" /></div>
|
||||||
|
</SplitterPanel>
|
||||||
|
</SplitterGroup>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="selected.type === 'canvas'">
|
||||||
|
<span class="flex flex-1 justify-center items-center"><ProseH3>Editeur de graphe en cours de développement</ProseH3></span>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="selected.type === 'file'">
|
||||||
|
<span>Modifier le contenu :</span><input type="file" @change="(e) => console.log(e)" />
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ClientOnly>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
@ -114,10 +168,12 @@ import { parsePath } from '#shared/general.utils';
|
||||||
import type { ProjectItem } from '~/schemas/project';
|
import type { ProjectItem } from '~/schemas/project';
|
||||||
import type { FileType } from '~/schemas/file';
|
import type { FileType } from '~/schemas/file';
|
||||||
import { iconByType } from '#shared/general.utils';
|
import { iconByType } from '#shared/general.utils';
|
||||||
|
import FakeA from '~/components/prose/FakeA.vue';
|
||||||
|
|
||||||
interface ProjectExtendedItem extends ProjectItem
|
interface ProjectExtendedItem extends ProjectItem
|
||||||
{
|
{
|
||||||
customPath: boolean
|
customPath: boolean
|
||||||
|
content?: string
|
||||||
children?: ProjectExtendedItem[]
|
children?: ProjectExtendedItem[]
|
||||||
}
|
}
|
||||||
interface ProjectExtended
|
interface ProjectExtended
|
||||||
|
|
@ -127,6 +183,7 @@ interface ProjectExtended
|
||||||
|
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
rights: ['admin', 'editor'],
|
rights: ['admin', 'editor'],
|
||||||
|
layout: 'null',
|
||||||
});
|
});
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -146,6 +203,7 @@ const navigation = computed<ProjectExtendedItem[] | undefined>({
|
||||||
get: () => project.value?.items,
|
get: () => project.value?.items,
|
||||||
set: (value) => {
|
set: (value) => {
|
||||||
const proj = project.value;
|
const proj = project.value;
|
||||||
|
edited.value = true;
|
||||||
|
|
||||||
if(proj && value)
|
if(proj && value)
|
||||||
proj.items = value;
|
proj.items = value;
|
||||||
|
|
@ -153,13 +211,63 @@ const navigation = computed<ProjectExtendedItem[] | undefined>({
|
||||||
project.value = proj;
|
project.value = proj;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const selected = ref<ProjectExtendedItem>();
|
const selected = ref<ProjectExtendedItem>(), edited = ref(false);
|
||||||
|
const contentStatus = ref<'idle' | 'pending' | 'success' | 'error'>('idle'), contentError = ref<string>();
|
||||||
|
|
||||||
|
watch(selected, async (value, old) => {
|
||||||
|
if(selected.value)
|
||||||
|
{
|
||||||
|
if(!selected.value.content && selected.value.path)
|
||||||
|
{
|
||||||
|
contentStatus.value = 'pending';
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const storedEdit = sessionStorage.getItem(`editing:${encodeURIComponent(selected.value.path)}`);
|
||||||
|
|
||||||
|
if(storedEdit)
|
||||||
|
{
|
||||||
|
selected.value.content = storedEdit;
|
||||||
|
contentStatus.value = 'success';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selected.value.content = (await $fetch(`/api/file/content/${encodeURIComponent(selected.value.path)}`, { query: { type: 'editing'} }))?.content;
|
||||||
|
contentStatus.value = 'success';
|
||||||
|
}
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
|
debounced.value = selected.value.content ?? '';
|
||||||
|
}
|
||||||
|
catch(e)
|
||||||
|
{
|
||||||
|
contentError.value = (e as Error).message;
|
||||||
|
contentStatus.value = 'error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//@ts-ignore
|
||||||
|
debounced.value = selected.value.content ?? '';
|
||||||
|
}
|
||||||
|
router.replace({ hash: '#' + encodeURIComponent(selected.value.path || getPath(selected.value)) });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
router.replace({ hash: '' });
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const content = computed(() => selected.value?.content ?? '');
|
||||||
|
const debounced = useDebounce(content, 250, { maxWait: 500 });
|
||||||
|
|
||||||
|
watch(debounced, () => {
|
||||||
|
if(selected.value && debounced.value)
|
||||||
|
sessionStorage.setItem(`editing:${encodeURIComponent(selected.value.path)}`, debounced.value);
|
||||||
|
});
|
||||||
useShortcuts({
|
useShortcuts({
|
||||||
meta_s: { usingInput: true, handler: () => save(false) },
|
meta_s: { usingInput: true, handler: () => save(false) },
|
||||||
meta_n: { usingInput: true, handler: () => add('markdown') },
|
meta_n: { usingInput: true, handler: () => add('markdown') },
|
||||||
meta_shift_n: { usingInput: true, handler: () => add('folder') },
|
meta_shift_n: { usingInput: true, handler: () => add('folder') },
|
||||||
meta_shift_z: { usingInput: true, handler: () => router.push({ name: 'explore' }) }
|
meta_shift_z: { usingInput: true, handler: () => router.push({ name: 'explore-path', params: { path: 'index' } }) }
|
||||||
})
|
})
|
||||||
|
|
||||||
const tree = {
|
const tree = {
|
||||||
|
|
@ -289,7 +397,7 @@ function add(type: FileType): void
|
||||||
|
|
||||||
const news = [...tree.search(navigation.value, 'title', 'Nouveau')].filter((e, i, a) => a.indexOf(e) === i);
|
const news = [...tree.search(navigation.value, 'title', 'Nouveau')].filter((e, i, a) => a.indexOf(e) === i);
|
||||||
const title = `Nouveau${news.length > 0 ? ' (' + news.length +')' : ''}`;
|
const title = `Nouveau${news.length > 0 ? ' (' + news.length +')' : ''}`;
|
||||||
const item: ProjectExtendedItem = { navigable: true, private: false, parent: '', path: '', title: title, name: parsePath(title), type: type, order: 0, children: type === 'folder' ? [] : undefined, customPath: false };
|
const item: ProjectExtendedItem = { navigable: true, private: false, parent: '', path: '', title: title, name: parsePath(title), type: type, order: 0, children: type === 'folder' ? [] : undefined, customPath: false, content: type === 'markdown' ? '' : undefined };
|
||||||
|
|
||||||
if(!selected.value)
|
if(!selected.value)
|
||||||
{
|
{
|
||||||
|
|
@ -386,13 +494,15 @@ async function save(redirect: boolean): Promise<void>
|
||||||
body: project.value,
|
body: project.value,
|
||||||
});
|
});
|
||||||
saveStatus.value = 'success';
|
saveStatus.value = 'success';
|
||||||
|
edited.value = false;
|
||||||
|
sessionStorage.clear();
|
||||||
|
|
||||||
toaster.clear('error');
|
toaster.clear('error');
|
||||||
toaster.add({
|
toaster.add({
|
||||||
type: 'success', content: 'Contenu enregistré', timer: true, duration: 10000
|
type: 'success', content: 'Contenu enregistré', timer: true, duration: 10000
|
||||||
});
|
});
|
||||||
|
|
||||||
if(redirect) router.push({ name: 'explore' });
|
if(redirect) router.go(-1);
|
||||||
} catch(e: any) {
|
} catch(e: any) {
|
||||||
toaster.add({
|
toaster.add({
|
||||||
type: 'error', content: e.message, timer: true, duration: 10000
|
type: 'error', content: e.message, timer: true, duration: 10000
|
||||||
|
|
@ -404,4 +514,19 @@ function getPath(item: ProjectExtendedItem): string
|
||||||
{
|
{
|
||||||
return [item.parent, parsePath(item.customPath ? item.name : item.title)].filter(e => !!e).join('/');
|
return [item.parent, parsePath(item.customPath ? item.name : item.title)].filter(e => !!e).join('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const defaultExpanded = computed(() => {
|
||||||
|
if(router.currentRoute.value.hash)
|
||||||
|
{
|
||||||
|
const split = router.currentRoute.value.hash.substring(1).split('/');
|
||||||
|
split.forEach((e, i) => { if(i !== 0) split[i] = split[i - 1] + '/' + e });
|
||||||
|
return split;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
watch(router.currentRoute, (value) => {
|
||||||
|
if(value && value.hash && navigation.value)
|
||||||
|
selected.value = tree.find(navigation.value, decodeURIComponent(value.hash.substring(1)));
|
||||||
|
else
|
||||||
|
selected.value = undefined;
|
||||||
|
}, { immediate: true });
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -20,22 +20,27 @@ export default defineEventHandler(async (e) => {
|
||||||
throw body.error;
|
throw body.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const items = buildOrder(body.data.items);
|
const items = buildOrder(body.data.items) as Array<ProjectItem & { content?: string, match?: number }>;
|
||||||
|
|
||||||
const db = useDatabase();
|
const db = useDatabase();
|
||||||
const { content, ...cols } = getTableColumns(explorerContentTable);
|
const { ...cols } = getTableColumns(explorerContentTable);
|
||||||
const full = db.select(cols).from(explorerContentTable).all();
|
const full = db.select(cols).from(explorerContentTable).all() as Record<string, any>[];
|
||||||
|
|
||||||
for(let i = full.length - 1; i >= 0; i--)
|
for(let i = full.length - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if(items.find(e => (e.path === '' ? [e.parent, parsePath(e.name === '' ? e.title : e.name)].filter(e => !!e).join('/') : e.path) === full[i].path))
|
const item = items.find(e => (e.path === '' ? [e.parent, parsePath(e.name === '' ? e.title : e.name)].filter(e => !!e).join('/') : e.path) === full[i].path);
|
||||||
full.splice(i, 1);
|
if(item)
|
||||||
|
{
|
||||||
|
item.match = i;
|
||||||
|
full[i].include = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
db.transaction((tx) => {
|
db.transaction((tx) => {
|
||||||
for(let i = 0; i < items.length; i++)
|
for(let i = 0; i < items.length; i++)
|
||||||
{
|
{
|
||||||
const item = items[i];
|
const item = items[i];
|
||||||
|
const old = full[item.match!];
|
||||||
|
|
||||||
tx.insert(explorerContentTable).values({
|
tx.insert(explorerContentTable).values({
|
||||||
path: item.path,
|
path: item.path,
|
||||||
|
|
@ -45,7 +50,7 @@ export default defineEventHandler(async (e) => {
|
||||||
navigable: item.navigable,
|
navigable: item.navigable,
|
||||||
private: item.private,
|
private: item.private,
|
||||||
order: item.order,
|
order: item.order,
|
||||||
content: null,
|
content: item.content ?? old.content,
|
||||||
}).onConflictDoUpdate({
|
}).onConflictDoUpdate({
|
||||||
set: {
|
set: {
|
||||||
path: [item.parent, parsePath(item.name === '' ? item.title : item.name)].filter(e => !!e).join('/'),
|
path: [item.parent, parsePath(item.name === '' ? item.title : item.name)].filter(e => !!e).join('/'),
|
||||||
|
|
@ -55,12 +60,14 @@ export default defineEventHandler(async (e) => {
|
||||||
private: item.private,
|
private: item.private,
|
||||||
order: item.order,
|
order: item.order,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
content: item.content ?? old.content,
|
||||||
},
|
},
|
||||||
target: explorerContentTable.path,
|
target: explorerContentTable.path,
|
||||||
}).run();
|
}).run();
|
||||||
}
|
}
|
||||||
for(let i = 0; i < full.length; i++)
|
for(let i = 0; i < full.length; i++)
|
||||||
{
|
{
|
||||||
|
if(full[i].include !== true)
|
||||||
tx.delete(explorerContentTable).where(eq(explorerContentTable.path, full[i].path)).run();
|
tx.delete(explorerContentTable).where(eq(explorerContentTable.path, full[i].path)).run();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue