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.

Fixes and improvments

Smaug67397e74bd46be93
diff --git a/frontend/components/MarkdownEditor/MarkdownEditor.vue b/frontend/components/MarkdownEditor/MarkdownEditor.vue
index d5659c13..b0119b84 100644
--- a/frontend/components/MarkdownEditor/MarkdownEditor.vue
+++ b/frontend/components/MarkdownEditor/MarkdownEditor.vue
@@ -1,6 +1,6 @@
<template>
<div class="editor-container" @keydown="editor.handleKeydown">
- <Toolbar :document="document" :minimal="options?.toolbar == 'minimal'" />
+ <Toolbar :document="document" :minimal="options?.toolbar == 'minimal'" @execute-action="(a:string) => editor.actions(a)" />
<div style="padding: 15px; height: 100%; width: 100%">
<input placeholder="Title" class="title" v-model="document.name" />
<input placeholder="Description" class="description" v-model="document.description" />
diff --git a/frontend/components/MarkdownEditor/Toolbar.vue b/frontend/components/MarkdownEditor/Toolbar.vue
index 35f3c850..a0bbd6b1 100644
--- a/frontend/components/MarkdownEditor/Toolbar.vue
+++ b/frontend/components/MarkdownEditor/Toolbar.vue
@@ -105,6 +105,9 @@ button {
padding: 0;
margin: 0;
transform: none;
+ &:hover {
+ background-color: var(--selection-color);
+ }
}
.toolbar {
@@ -118,7 +121,7 @@ button {
padding: 0.25rem;
color: var(--font-color-dark);
* {
- margin-right: 5px;
+ margin: 0 2.5px;
}
}
diff --git a/frontend/components/ModalManager.vue b/frontend/components/ModalManager.vue
index 8ce88dca..8f4e8e2e 100644
--- a/frontend/components/ModalManager.vue
+++ b/frontend/components/ModalManager.vue
@@ -4,23 +4,16 @@
<div v-for="(modal, index) in modals" :key="modal.name" class="modal-mask modal-pos" :style="{ zIndex: 120 + index }">
<div v-if="index !== modals.length - 1" class="modal-overlay"></div>
<div class="modal-container">
- <button @click="close(modal)" class="close-btn"><Icon name="close" :big="true" /></button>
- <component :is="modal.component" v-bind="modal.props" class="modal" @close="close(modal)" />
+ <button @click="modalManager.close(modal)" class="close-btn"><Icon name="close" :big="true" /></button>
+ <component :is="modal.component" v-bind="modal.props" class="modal" @close="modalManager.close(modal)" />
</div>
</div>
</div>
</Transition>
</template>
<script setup lang="ts">
-const modals = useModal().modals;
-
-const close = (modal: Modal) => {
- modal.onClose?.();
- const index = modals.value.findIndex(m => m.name === modal.name);
- if (index !== -1) {
- modals.value.splice(index, 1);
- }
-};
+const modalManager = useModal();
+const modals = modalManager.modals;
</script>
<style scoped lang="scss">
diff --git a/frontend/components/Notification.vue b/frontend/components/Notification.vue
index ad23d1e8..f7fd00be 100644
--- a/frontend/components/Notification.vue
+++ b/frontend/components/Notification.vue
@@ -1,13 +1,11 @@
<template>
- <TransitionGroup name="notification-slide" tag="div" class="notification-container" enter-from-class="notification-enter-from" enter-to-class="notification-enter-to" leave-from-class="notification-leave-from" leave-to-class="notification-leave-to">
+ <TransitionGroup name="notification-slide" tag="div" class="notification-container">
<div v-for="notification in notifications" :key="notification.id" class="notification" :class="notification.type">
- <div class="header">
- <p>{{ notification.title }}</p>
- <svg @click="close(notification.id)" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24" class="close-icon">
- <path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z" />
- </svg>
+ <div class="content">
+ <p class="title">{{ notification.title }}</p>
+ <p v-if="notification.message" class="message">{{ notification.message }}</p>
+ <button @click="close(notification.id)" aria-label="Close">&times;</button>
</div>
- <p>{{ notification.message }}</p>
</div>
</TransitionGroup>
</template>
@@ -21,88 +19,98 @@ const close = (id: number) => useNotifications().remove(id);
<style scoped lang="scss">
.notification-container {
position: fixed;
- bottom: 10px;
- right: 10px;
+ bottom: 20px;
+ right: 20px;
+ display: flex;
+ flex-direction: column;
+ gap: 15px;
z-index: 1000;
}
.notification {
- padding: 18px 15px;
- border-radius: 8px;
- color: white;
- margin-bottom: 10px;
- box-shadow: 0 4px 12px var(--border-color);
- width: 350px;
-}
-
-.header {
display: flex;
- justify-content: space-between;
align-items: flex-start;
- font-weight: 500;
+ gap: 12px;
+ width: 360px;
+ padding: 16px 18px;
+ border-radius: 14px;
+ backdrop-filter: blur(12px);
+ background: rgba(30, 30, 30, 0.6);
+ color: white;
+ box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
+ animation: fadeIn 0.3s ease;
+ position: relative;
}
p {
+ font-size: 14px;
margin: 0;
- padding: 0 5px;
+ line-height: 1.4;
}
-
-.close-icon {
- cursor: pointer;
- margin-left: 12px;
- transition: transform $transition-duration ease;
- fill: var(--font-color);
+.title {
+ font-weight: 500;
}
-
-.close-icon:hover {
- transform: scale(1.1);
+.message {
+ opacity: 0.8;
+ margin-top: 4px;
}
-
-.info {
- border-color: var(--blue-border);
- color: var(--blue);
- background-color: var(--blue-bg);
+button {
+ font-size: 30px;
+ color: white;
+ border: none;
+ cursor: pointer;
+ opacity: 0.6;
+ position: absolute;
+ top: 10px;
+ right: 15px;
+}
+/* Notification types */
+.success {
+ background: $green;
}
.error {
- color: white;
- background-color: red;
+ background: $red;
}
-.success {
- color: white;
- background-color: $green;
+.warning {
+ background: $yellow;
}
-.warning {
- border-color: var(--yellow-border);
- color: var(--yellow);
- background-color: var(--yellow-bg);
+.info {
+ background: $blue;
}
/* Transitions */
.notification-slide-enter-active,
.notification-slide-leave-active {
- transition: transform $transition-duration, opacity $transition-duration;
+ transition: opacity 0.3s ease, transform 0.3s ease;
}
-
.notification-enter-from {
opacity: 0;
transform: translateX(100%);
}
-
.notification-enter-to {
opacity: 1;
- transform: translateX(0%);
+ transform: translateX(0);
}
-
.notification-leave-from {
opacity: 1;
- transform: translateX(0%);
+ transform: translateX(0);
}
-
.notification-leave-to {
opacity: 0;
transform: translateX(100%);
}
+
+@keyframes fadeIn {
+ from {
+ opacity: 0;
+ transform: translateY(20px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
</style>
diff --git a/frontend/composables/modal_bus.ts b/frontend/composables/modal_bus.ts
index d377f02c..068ec710 100644
--- a/frontend/composables/modal_bus.ts
+++ b/frontend/composables/modal_bus.ts
@@ -2,8 +2,21 @@
const modals = ref<Modal[]>([]);
+function add(modal: Modal) {
+ modals.value.push(modal);
+}
+function close(modal: Modal) {
+ const index = modals.value.indexOf(modal);
+ if (index !== -1) {
+ modals.value.splice(index, 1);
+ modal.onClose();
+ }
+}
+
export function useModal() {
return {
+ add,
+ close,
modals,
};
}
diff --git a/frontend/composables/structuresTree.ts b/frontend/composables/structuresTree.ts
index 64ae1ef1..aa897412 100644
--- a/frontend/composables/structuresTree.ts
+++ b/frontend/composables/structuresTree.ts
@@ -36,9 +36,9 @@ export function useSidebarTree() {
);
const allItems = computed(() => [...documents.value, ...categories.value.filter(cat => (cat as Item<Category>).data.role == 1)]);
- const structure = new TreeStructure(allItems.value);
+ const structure = computed(() => new TreeStructure(allItems.value));
- const tree = computed(() => structure.generateTree());
+ const tree = computed(() => structure.value.generateTree());
const filtered = computed(() => {
return tree.value.filter(item => {
@@ -57,7 +57,7 @@ export function useSidebarTree() {
});
};
const getSubTreeById = (id: string) => {
- return structure.treeToArray(structure.getSubTreeById(id)?.childrens || []);
+ return structure.value.treeToArray(structure.value.getSubTreeById(id)?.childrens || []);
};
return {
diff --git a/frontend/pages/dashboard/categories/index.vue b/frontend/pages/dashboard/categories/index.vue
index 92abce0e..ae617e25 100644
--- a/frontend/pages/dashboard/categories/index.vue
+++ b/frontend/pages/dashboard/categories/index.vue
@@ -11,7 +11,7 @@
<div style="padding: 10px 0; border-top: 1px solid #ddd; display: flex; justify-content: space-between; align-items: center">
<input placeholder="Search category..." style="width: 50%; padding: 8px; border: 1px solid #ccc; border-radius: 4px" />
</div>
- <div v-if="custom_tree.length" class="workspace" v-for="workspace in custom_tree" :key="workspace.id">
+ <div v-if="tree.length" class="workspace" v-for="workspace in tree" :key="workspace.id">
<h3 class="wp-name">{{ workspace.title }}</h3>
<WorkspaceTree v-for="node in workspace.childrens" :node="node" @edit="editNode" @delete="deleteNode" />
</div>
@@ -25,14 +25,10 @@ import CreateCategoryModal from './_modals/CreateCategoryModal.vue';
import WorkspaceTree from './_components/WorkspaceTree.vue';
import type { Category } from '~/stores';
-const custom_tree = new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2) as Item<Category>[];
+const tree = new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2) as Item<Category>[];
-function createWorkspace() {
- useModal().modals.value?.push(new Modal(shallowRef(CreateCategoryModal), '', { role: 2 }));
-}
-function createCategory() {
- useModal().modals.value?.push(new Modal(shallowRef(CreateCategoryModal), '', { role: 1 }));
-}
+const createWorkspace = () => useModal().add(new Modal(shallowRef(CreateCategoryModal), '', { role: 2 }));
+const createCategory = () => useModal().add(new Modal(shallowRef(CreateCategoryModal), '', { role: 1 }));
function editNode(node: Item) {
// ouvrir modal ou formulaire d'édition
diff --git a/frontend/pages/dashboard/docs/_components/DocumentCardHeaderActionRow.vue b/frontend/pages/dashboard/docs/_components/DocumentCardHeaderActionRow.vue
index 869b4540..e4410cc3 100644
--- a/frontend/pages/dashboard/docs/_components/DocumentCardHeaderActionRow.vue
+++ b/frontend/pages/dashboard/docs/_components/DocumentCardHeaderActionRow.vue
@@ -25,9 +25,7 @@ import DeleteDocumentModal from '../_modals/DeleteDocumentModal.vue';
const props = defineProps<{ doc_id: string }>();
const print = () => window.print();
-const openDeleteModal = () => {
- useModal().modals.value.push(new Modal(shallowRef(DeleteDocumentModal), 'Delete modal', { documentId: props.doc_id }));
-};
+const openDeleteModal = () => useModal().add(new Modal(shallowRef(DeleteDocumentModal), 'Delete modal', { documentId: props.doc_id }));
</script>
<style lang="scss" scoped>
diff --git a/frontend/pages/dashboard/docs/_modals/DeleteDocumentModal.vue b/frontend/pages/dashboard/docs/_modals/DeleteDocumentModal.vue
index 9a12c342..93f6440d 100644
--- a/frontend/pages/dashboard/docs/_modals/DeleteDocumentModal.vue
+++ b/frontend/pages/dashboard/docs/_modals/DeleteDocumentModal.vue
@@ -13,7 +13,18 @@
<script setup lang="ts">
const props = defineProps<{ documentId: string }>();
-const deleteDoc = () => useCategoriesStore().delete(props.documentId);
+const deleteDoc = () => {
+ useDocumentsStore()
+ .delete(props.documentId)
+ .then(() => {
+ useNotifications().add({ title: 'Success:', message: 'Document deleted', type: 'success', timeout: 3000 });
+ emit('close');
+ useRouter().push('/dashboard');
+ })
+ .catch(e => {
+ useNotifications().add({ title: 'Error:', message: e, type: 'error', timeout: 3000 });
+ });
+};
const emit = defineEmits(['close']);
const allChildren = useSidebarTree().getSubTreeById(props.documentId);
</script>
diff --git a/frontend/pages/dashboard/docs/edit/[id].vue b/frontend/pages/dashboard/docs/edit/[id].vue
index 0fd10eca..2f7d55e7 100644
--- a/frontend/pages/dashboard/docs/edit/[id].vue
+++ b/frontend/pages/dashboard/docs/edit/[id].vue
@@ -29,7 +29,7 @@ definePageMeta({ breadcrumb: 'Edit' });
function save(doc: Document) {
store
.update(doc)
- .then(() => notifications.add({ title: 'Success:', message: 'Document updated', type: 'success', timeout: 3000 }))
+ .then(() => notifications.add({ title: 'Document successfully updated:', message: '', type: 'success', timeout: 3000 }))
.catch(e => notifications.add({ title: 'Error:', message: e, type: 'error', timeout: 3000 }));
}
function exit() {