π 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
Some refactors
Smaug6739989bf22ca058
diff --git a/frontend/components/MarkdownEditor/MarkdownEditor.vue b/frontend/components/MarkdownEditor/MarkdownEditor.vueindex c922da29..9b39ef98 100644--- a/frontend/components/MarkdownEditor/MarkdownEditor.vue+++ b/frontend/components/MarkdownEditor/MarkdownEditor.vue@@ -1,12 +1,14 @@<template><div class="editor-container" @keydown="editor.handleKeydown"><Toolbar :document="document" :minimal="options?.toolbar == 'minimal'" @execute-action="(a:string) => editor.actions(a)" />- <input placeholder="Title" class="title" v-model="document.name" />- <input placeholder="Description" class="description" v-model="document.description" />- <div class="markdown" ref="container">- <InlineToolbar ref="toolbar" @execute-action="(a:string) => editor.actions(a)" />- <textarea ref="textarea" class="content markdown-input" @scroll="syncScroll" @input="update" v-html="document.content_markdown || ''" placeholder="Write something or use the toolbar to create your document..."></textarea>- <div v-if="editor.showPreview.value" class="markdown-preview document-theme" ref="markdownPreview" v-html="document.content_html || ''"></div>+ <div style="padding: 10px; height: 100%; width: 100%">+ <input placeholder="Title" class="title" v-model="document.name" />+ <input placeholder="Description" class="description" v-model="document.description" />+ <div class="markdown" ref="container">+ <InlineToolbar ref="toolbar" @execute-action="(a:string) => editor.actions(a)" />+ <textarea ref="textarea" class="content markdown-input" @scroll="syncScroll" @input="update" v-html="document.content_markdown || ''" placeholder="Write something or use the toolbar to create your document..."></textarea>+ <div v-if="editor.showPreview.value" class="markdown-preview document-theme" ref="markdownPreview" v-html="document.content_html || ''"></div>+ </div></div></div></template>@@ -75,7 +77,6 @@ function debounce(fn: Function, wait: number) {width: 100%;box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);border-radius: 15px;- padding: 1rem;}.markdown {diff --git a/frontend/components/MarkdownEditor/Toolbar.vue b/frontend/components/MarkdownEditor/Toolbar.vueindex 9f8d698d..fa965526 100644--- a/frontend/components/MarkdownEditor/Toolbar.vue+++ b/frontend/components/MarkdownEditor/Toolbar.vue@@ -1,19 +1,20 @@<template><div class="toolbar">- <button v-for="item in toolbar" :key="item.name" v-html="item.icon" class="btn" @click="emitAction(item.action)" :title="item.name"></button>+ <button v-for="item in toolbar" :key="item.name" v-html="item.icon" @click="emitAction(item.action)" :title="item.name"></button><select v-if="!minimal" v-model="copy.accessibility" style="margin-right: 5px"><option :value="1">Visible</option><option :value="2">Draf</option><option :value="3">Archive</option></select><select v-if="!minimal" v-model="copy.category" style="margin-right: 5px">- <option :value="null">All notes</option>+ <option :value="null" selected>All notes</option><option v-for="wp in categoriesStore.getParents.filter(c => c.role == 2)" :value="wp.id" v-text="wp.name"></option><optgroup v-for="cat in categoriesStore.getParents.filter(c => c.role == 1)" :label="cat.name" :key="cat.id"><option v-for="subCat in categoriesStore.getChilds(cat.id)" :value="subCat.id" :key="subCat.id" v-text="subCat.name"></option></optgroup></select><input type="text" v-model="copy.tags" placeholder="Tags" style="margin-right: 5px" />+ <button @click="() => emitAction('exit')" style="margin-left: auto"><Icon name="close" :big="true" /></button></div></template>@@ -25,7 +26,6 @@ const props = defineProps<{ document: Partial<Document>; minimal?: boolean }>();const copy = ref(props.document);const emit = defineEmits(['execute-action']);const emitAction = (action: string) => emit('execute-action', action, copy);-const toolbar = [{name: 'Bold',@@ -107,16 +107,16 @@ button {display: flex;align-items: stretch;flex-wrap: wrap;+ background-color: var(--bg-contrast);+ border-top-left-radius: 15px;+ border-top-right-radius: 15px;+ padding: 0.5rem;+ color: var(--font-color-light);}svg,.toolbar:deep(svg) {- fill: var(--font-color);-}--svg:hover,-.toolbar:deep(svg):hover {- fill: $primary-400;+ fill: var(--font-color-light);}input,@@ -124,5 +124,6 @@ select {display: inline-block;width: min-content;padding: 0;+ background-color: var(--bg-contrast-2);}</style>diff --git a/frontend/composables/icons.ts b/frontend/composables/icons.tsindex 4cb587a4..2be683a1 100644--- a/frontend/composables/icons.ts+++ b/frontend/composables/icons.ts@@ -11,7 +11,7 @@ const icons = {plus: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"/></svg>`,users: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M40-160v-112q0-34 17.5-62.5T104-378q62-31 126-46.5T360-440q66 0 130 15.5T616-378q29 15 46.5 43.5T680-272v112H40Zm720 0v-120q0-44-24.5-84.5T666-434q51 6 96 20.5t84 35.5q36 20 55 44.5t19 53.5v120H760ZM360-480q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113t-113 47Zm400-160q0 66-47 113t-113 47q-11 0-28-2.5t-28-5.5q27-32 41.5-71t14.5-81q0-42-14.5-81T544-792q14-5 28-6.5t28-1.5q66 0 113 47t47 113ZM120-240h480v-32q0-11-5.5-20T580-306q-54-27-109-40.5T360-360q-56 0-111 13.5T140-306q-9 5-14.5 14t-5.5 20v32Zm240-320q33 0 56.5-23.5T440-640q0-33-23.5-56.5T360-720q-33 0-56.5 23.5T280-640q0 33 23.5 56.5T360-560Zm0 320Zm0-400Z"/></svg>`,draft: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--turquoise)" d="M240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>`,- folder: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--yellow);" d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640H447l-80-80H160v480l96-320h684L837-217q-8 26-29.5 41.5T760-160H160Zm84-80h516l72-240H316l-72 240Zm0 0 72-240-72 240Zm-84-400v-80 80Z"/></svg>`,+ folder: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path style="fill:var(--yellow)" d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640v400q0 33-23.5 56.5T800-160H160Zm0-80h640v-400H447l-80-80H160v480Zm0 0v-480 480Z"/></svg>`,file: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--red);" d="M320-240h320v-80H320v80Zm0-160h320v-80H320v80ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>`,file_parent: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path style="fill:var(--green);" d="M320-320h200v-200H320v200Zm0-280h480v-200H320v200Zm280 280h200v-200H600v200Zm-280 80q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Z"/></svg>`,archive: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none"><rect x="2.5" y="2.5" width="11" height="11" rx="1.5" fill="var(--grey-bg)" stroke="var(--grey)"/><rect x="6" y="4" width="2" height="2" rx="0.5" fill="var(--grey)"/><rect x="6" y="8" width="2" height="2" rx="0.5" fill="var(--grey)"/><rect x="8" y="10" width="2" height="2" rx="0.5" fill="var(--grey)"/><rect x="8" y="6" width="2" height="2" rx="0.5" fill="var(--grey)"/></svg>`,diff --git a/frontend/pages/dashboard/settings/index.vue b/frontend/pages/dashboard/settings/index.vueindex 4a589657..34c4aedb 100644--- a/frontend/pages/dashboard/settings/index.vue+++ b/frontend/pages/dashboard/settings/index.vue@@ -44,19 +44,6 @@ const router = useRouter();watchEffect(() => (currentPage.value = route.query.p || 'profile'));const close = () => router.push('/dashboard');-const downloadLink = ref<string | null>(null);-const copyLink = () => navigator.clipboard.writeText(downloadLink.value!);-const isLoading = ref(false);--async function submitFile() {- isLoading.value = true;- const result = await makeRequest<{ url: string }>('backups', 'POST', {});- isLoading.value = false;- if (result.status != 'success') {- return useNotifications().add({ type: 'error', title: 'Error', message: result.message, timeout: 3000 });- }- downloadLink.value = `${CDN}${result.result?.url || ''}`;-}watchEffect(() => (currentPage.value = route.query.p || 'profile'));</script>