Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Add default category on new docs from sidebar

Smaug6739eefb01884b45
diff --git a/frontend/components/Sidebar/SidebarItem.vue b/frontend/components/Sidebar/SidebarItem.vue
index a0eb5427..52d98534 100644
--- a/frontend/components/Sidebar/SidebarItem.vue
+++ b/frontend/components/Sidebar/SidebarItem.vue
@@ -3,7 +3,7 @@
<Icon :name="getIcon()" />
<NuxtLink :to="item.route" style="width: 100%" class="close">{{ item.title }} </NuxtLink>
<NuxtLink v-if="item.data.type === 'category'" :to="`/dashboard/categories/${item.id}/edit`" class="nav close"> <Icon name="c_settings" fill="var(--font-color)" /> </NuxtLink>
- <NuxtLink v-if="item.data.type === 'category' && item.parent_id" to="/dashboard/docs/new" class="nav close"> <Icon name="plus" fill="var(--font-color)" /> </NuxtLink>
+ <NuxtLink v-if="item.data.type === 'category' && item.parent_id" :to="`/dashboard/docs/new?cat=${item.id}`" class="nav close"> <Icon name="plus" fill="var(--font-color)" /> </NuxtLink>
<slot></slot>
</span>
</template>
diff --git a/frontend/pages/dashboard/docs/new.vue b/frontend/pages/dashboard/docs/new.vue
index 2fda7838..3aaa0c42 100644
--- a/frontend/pages/dashboard/docs/new.vue
+++ b/frontend/pages/dashboard/docs/new.vue
@@ -7,7 +7,7 @@ import type { Document } from '@/stores';
const store = useDocumentsStore();
const document = ref<Partial<Document>>({
- category: useSidebar().workspaceId.value || undefined,
+ category: (useRoute().query.cat as string | undefined) || useSidebar().workspaceId.value || undefined,
accessibility: 1,
});
const notifications = useNotifications();