π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
Add context menu to document card and line
Smaug6739c1069444189e
diff --git a/frontend/app/components/DocumentCard.vue b/frontend/app/components/DocumentCard.vueindex 3f1c3c29..194c60d7 100644--- a/frontend/app/components/DocumentCard.vue+++ b/frontend/app/components/DocumentCard.vue@@ -1,5 +1,5 @@<template>- <div class="document-card">+ <div class="document-card" @contextmenu.prevent="showContextMenu"><div class="top"><div class="header"><span style="display: flex">@@ -35,6 +35,7 @@<script setup lang="ts">import type { Node } from '~/stores';import DeleteDocumentModal from '~/components/Node/DeleteNodeModal.vue';+import NodeContextMenu from '~/components/Node/NodeContextMenu.vue';const props = defineProps<{ document: Node }>();const nodesStore = useNodesStore();@@ -42,6 +43,13 @@ const category = computed(() => nodesStore.getById(props.document.parent_id || 'useUserStore().fetchPublicUser(props.document.user_id);const user = computed(() => useUserStore().getById(props.document.user_id || ''));const deleteDoc = () => useModal().add(new Modal(shallowRef(DeleteDocumentModal), { props: { node: props.document } }));++function showContextMenu(event: MouseEvent) {+ if (props.document.role === -1) return; // Prevent context menu on nav items+ useContextMenu().open(shallowRef(NodeContextMenu), event, {+ props: { node: props.document as Node },+ });+}</script><style scoped lang="scss">diff --git a/frontend/app/components/DocumentLine.vue b/frontend/app/components/DocumentLine.vueindex 967e29d3..1c01877d 100644--- a/frontend/app/components/DocumentLine.vue+++ b/frontend/app/components/DocumentLine.vue@@ -1,5 +1,5 @@<template>- <div class="document-line">+ <div class="document-line" @contextmenu.prevent="showContextMenu"><header style="display: flex; justify-content: space-between"><div style="display: flex; align-items: center; justify-content: flex-start"><Icon@@ -29,6 +29,7 @@<script setup lang="ts">import type { Node } from '~/stores';import DeleteDocumentModal from '~/components/Node/DeleteNodeModal.vue';+import NodeContextMenu from '~/components/Node/NodeContextMenu.vue';const props = defineProps<{ document: Node }>();const categoriesStore = useNodesStore();@@ -36,6 +37,13 @@ const category = computed(() => categoriesStore.getById(props.document.parent_iduseUserStore().fetchPublicUser(props.document.user_id);const user = computed(() => useUserStore().getById(props.document.user_id || ''));const deleteDoc = () => useModal().add(new Modal(shallowRef(DeleteDocumentModal), { props: { node: props.document } }));++function showContextMenu(event: MouseEvent) {+ if (props.document.role === -1) return; // Prevent context menu on nav items+ useContextMenu().open(shallowRef(NodeContextMenu), event, {+ props: { node: props.document as Node },+ });+}</script><style scoped lang="scss">