π 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
New home page
Smaug6739ef1192852a6c
diff --git a/frontend/App.vue b/frontend/App.vueindex 71424613..fa673ddf 100644--- a/frontend/App.vue+++ b/frontend/App.vue@@ -1,9 +1,6 @@<template>- <div style="height: 100vh;">+ <div style="height: 100vh"><NuxtPage /><Notification />- <ClientOnly>- <BackToTop />- </ClientOnly></div></template>diff --git a/frontend/components/Logo.vue b/frontend/components/Logo.vueindex 0c2a1139..6bf79c60 100644--- a/frontend/components/Logo.vue+++ b/frontend/components/Logo.vue@@ -3,8 +3,18 @@ const colorMode = useColorMode();</script><template>- <div style="display: flex; align-items: center; column-gap: 0.5rem">- <img style="width: 50px" :src="`/Alexandrie-${colorMode.value}.svg`" alt="Alexandrie" />- <p style="font-weight: 600; font-family: Poppins">Alexandrie</p>- </div>+ <div style="display: flex; align-items: center; column-gap: 0.5rem">+ <img style="width: 50px" :src="`/Alexandrie-${colorMode.value}.svg`" alt="Alexandrie" />+ <p style="font-weight: 600; font-family: Poppins">Alexandrie</p>+ </div></template>+<style scoped>+@media screen and (max-width: 768px) {+ p {+ display: none;+ }+ img {+ margin: 0 10px;+ }+}+</style>diff --git a/frontend/components/MarkdownEditor/Editor.ts b/frontend/components/MarkdownEditor/Editor.tsindex a4c72095..8409cff2 100644--- a/frontend/components/MarkdownEditor/Editor.ts+++ b/frontend/components/MarkdownEditor/Editor.ts@@ -1,22 +1,23 @@import MarkdownUtil from '~/components/MarkdownEditor/Utils';-import { type Snippet, snippets } from './snippets';+import { snippets } from './snippets';export class Editor extends EventTarget {public area: Ref<HTMLTextAreaElement | undefined>; // The editor areapublic util: MarkdownUtil; // The markdown utility formatter- public showPreview: Ref<boolean> = ref(false); // Whether to show the preview or not+ public showPreview: Ref<boolean>; // Whether to show the preview or notpublic container: Ref<HTMLElement | undefined>; // The container elementpublic inlineToolbar: Ref<{ element: HTMLElement } | undefined>;- constructor(area: Ref<HTMLTextAreaElement | undefined>, inlineToolbar: Ref<{ element: HTMLElement } | undefined>, container: Ref<HTMLElement | undefined>) {+ constructor(area: Ref<HTMLTextAreaElement | undefined>, inlineToolbar: Ref<{ element: HTMLElement } | undefined>, container: Ref<HTMLElement | undefined>, opts: EditorOptions = {}) {super();this.area = area;this.inlineToolbar = inlineToolbar as Ref<{ element: HTMLElement }>;this.util = new MarkdownUtil(area);this.container = container;+ this.showPreview = opts.showPreview ? ref(true) : ref(false);}- public format(action: string) {+ public actions(action: string) {switch (action) {case 'blue':this.util.inlineFormat('<blue>', '</blue>');@@ -63,6 +64,9 @@ export class Editor extends EventTarget {case 'orderedList':this.util.inlineFormat('1. ', '');break;+ case 'preview':+ this.showPreview.value = !this.showPreview.value;+ break;}}public handleKeydown(event: KeyboardEvent) {@@ -75,26 +79,26 @@ export class Editor extends EventTarget {// Ctrl + B for boldif (event.ctrlKey && event.key === 'b') {event.preventDefault();- this.format('bold');+ this.actions('bold');}// Ctrl + I for italicif (event.ctrlKey && event.key === 'i') {event.preventDefault();- this.format('italic');+ this.actions('italic');}// Ctrl + U for underlineif (event.ctrlKey && event.key === 'u') {event.preventDefault();- this.format('underline');+ this.actions('underline');}// Ctrl + K for linkif (event.ctrlKey && event.key === 'k') {event.preventDefault();- this.format('link');+ this.actions('link');}if (event.ctrlKey && event.key === 'm') {event.preventDefault();- this.format('image');+ this.actions('image');}// Ctrl + S for savingif (event.ctrlKey && event.key === 's') {@@ -192,3 +196,8 @@ export class Editor extends EventTarget {return { top, left };}}++export interface EditorOptions {+ showPreview?: boolean;+ toolbar?: 'minimal' | 'complete';+}diff --git a/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue b/frontend/components/MarkdownEditor/MarkdownEditor.vuesimilarity index 81%rename from frontend/components/MarkdownEditor/LazyMarkdownEditor.vuerename to frontend/components/MarkdownEditor/MarkdownEditor.vueindex d6a13ff5..11ac1eea 100644--- a/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue+++ b/frontend/components/MarkdownEditor/MarkdownEditor.vue@@ -1,6 +1,6 @@<template><div class="editor-container" @keydown="editor.handleKeydown">- <Toolbar style="height: fit-content" :document="document" @execute-action="(a: string) => exec(a)" />+ <Toolbar style="height: fit-content" :document="document" @execute-action="(a: string) => exec(a)" :minimal="options?.toolbar == 'minimal'" /><input placeholder="Title" class="title" v-model="document.name" /><input placeholder="Description" class="description" v-model="document.description" /><div class="markdown" ref="container">@@ -12,40 +12,40 @@</template><script setup lang="ts">-import { Editor } from './Editor';-import Toolbar from './LazyToolbar.vue';+import { Editor, type EditorOptions } from './Editor';+import Toolbar from './Toolbar.vue';import compile from '~/helpers/markdown';import InlineToolbar from '~/components/MarkdownEditor/InlineToolbar.vue';import type { Document } from '~/stores';-const props = defineProps<{ doc?: Partial<Document> }>();-const document = ref<Document | Partial<Document>>({ ...props.doc });+const props = defineProps<{+ doc?: Partial<Document>;+ options?: EditorOptions;+}>();+const document = ref<Document | Partial<Document>>({ ...props.doc, content_html: compile(props.doc?.content_markdown) });const toolbar = ref<{ element: HTMLDivElement }>();const container = ref<HTMLDivElement>();const textarea = ref<HTMLTextAreaElement>();-const editor = new Editor(textarea, toolbar, container);+const editor = new Editor(textarea, toolbar, container, props.options);const emit = defineEmits(['save']);const update = () => (document.value.content_html = compile(textarea.value?.value || ''));const handleClick = () => editor.handleInlineToolbar();const markdownPreview = ref<HTMLDivElement>();-editor.addEventListener('save', saveDocument);+editor.addEventListener('save', emitSave);onMounted(() => window.addEventListener('mouseup', handleClick));onBeforeUnmount(() => window.removeEventListener('mouseup', handleClick));function exec(action: string) {- editor.format(action);+ editor.actions(action);switch (action) {case 'exit':useRouter().push(document.value.id ? `/dashboard/docs/${document.value.id}` : '/dashboard');break;- case 'preview':- editor.showPreview.value = !editor.showPreview.value;- break;case 'save':- saveDocument();+ emitSave();}update();}@@ -56,7 +56,7 @@ function syncScroll() {const scrollPercentage = textarea.value.scrollTop / (textarea.value.scrollHeight - textarea.value.clientHeight);markdownPreview.value.scrollTop = scrollPercentage * (markdownPreview.value.scrollHeight - markdownPreview.value.clientHeight);}-function saveDocument() {+function emitSave() {document.value.content_markdown = textarea.value?.value || '';document.value.content_html = compile(document.value.content_markdown);emit('save', document.value);@@ -65,8 +65,11 @@ function saveDocument() {<style scoped lang="scss">.editor-container {- height: 90%;+ height: 95%;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/LazyToolbar.vue b/frontend/components/MarkdownEditor/Toolbar.vuesimilarity index 94%rename from frontend/components/MarkdownEditor/LazyToolbar.vuerename to frontend/components/MarkdownEditor/Toolbar.vueindex 7dc18b1f..e1ab55ab 100644--- a/frontend/components/MarkdownEditor/LazyToolbar.vue+++ b/frontend/components/MarkdownEditor/Toolbar.vue@@ -1,12 +1,12 @@<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>- <select v-model="copy.accessibility" style="margin-right: 5px">+ <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-model="copy.category" style="margin-right: 5px">+ <select v-if="!minimal" v-model="copy.category" style="margin-right: 5px"><optgroup v-for="cat in categoriesStore.getParents" :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>@@ -19,7 +19,7 @@import { useCategoriesStore, type Document } from '~/stores';const categoriesStore = useCategoriesStore();-const props = defineProps<{ document: Partial<Document> }>();+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);diff --git a/frontend/components/MarkdownEditor/snippets.ts b/frontend/components/MarkdownEditor/snippets.tsindex 4503c539..c6bc0f13 100644--- a/frontend/components/MarkdownEditor/snippets.ts+++ b/frontend/components/MarkdownEditor/snippets.ts@@ -46,4 +46,4 @@ const snippets = [},];-export { type Snippet, snippets };+export { snippets };diff --git a/frontend/pages/dashboard.vue b/frontend/pages/dashboard.vueindex e2ebccb6..2d118ebb 100644--- a/frontend/pages/dashboard.vue+++ b/frontend/pages/dashboard.vue@@ -1,5 +1,8 @@<template><div style="display: flex; width: 100%; height: 100%">+ <ClientOnly>+ <BackToTop />+ </ClientOnly><Sidebar /><MediumView><Navbar />diff --git a/frontend/pages/dashboard/docs/edit/[id].vue b/frontend/pages/dashboard/docs/edit/[id].vueindex 7fbb6037..40f20eb2 100644--- a/frontend/pages/dashboard/docs/edit/[id].vue+++ b/frontend/pages/dashboard/docs/edit/[id].vue@@ -3,7 +3,7 @@</template><script lang="ts" setup>import type { Document } from '@/stores';-import MarkdownEditor from '~/components/MarkdownEditor/LazyMarkdownEditor.vue';+import MarkdownEditor from '~/components/MarkdownEditor/MarkdownEditor.vue';const store = useDocumentsStore();const route = useRoute();diff --git a/frontend/pages/dashboard/docs/new.vue b/frontend/pages/dashboard/docs/new.vueindex c591db81..9a78630b 100644--- a/frontend/pages/dashboard/docs/new.vue+++ b/frontend/pages/dashboard/docs/new.vue@@ -2,7 +2,7 @@<MarkdownEditor ref="editor" :doc="document" @save="data => save(data)" /></template><script lang="ts" setup>-import MarkdownEditor from '~/components/MarkdownEditor/LazyMarkdownEditor.vue';+import MarkdownEditor from '~/components/MarkdownEditor/MarkdownEditor.vue';import type { Document } from '@/stores';const store = useDocumentsStore();diff --git a/frontend/pages/index.vue b/frontend/pages/index.vueindex b722918a..e647f680 100644--- a/frontend/pages/index.vue+++ b/frontend/pages/index.vue@@ -1,7 +1,6 @@<template><div class="container"><nav>- <div class="container"></div><div class="actions"><NuxtLink to="/login" class="login">Login</NuxtLink><NuxtLink to="/signup" class="sign-up">Sign up</NuxtLink>@@ -26,31 +25,151 @@<img :src="`/main-${colorMode.value}.webp`" alt="Documents Image" /></div></div>+ <h2 style="text-align: center; border: none">Try editor online</h2>+ <div class="editor"><MarkdownEditor :doc="doc" :options="{ showPreview: !isMobile(), toolbar: 'minimal' }" /></div>+ <h2 style="text-align: center; border: none">Organize your documents</h2>+ <div class="demo">+ <img src="/home.webp" alt="home" />+ </div></main><footer><Logo />+ <p class="p2">Developed and designed by Smaug with β€οΈ</p></footer></div></template><script setup lang="ts">const colorMode = useColorMode();+import MarkdownEditor from '~/components/MarkdownEditor/MarkdownEditor.vue';++const doc = ref({+ content_markdown: `# Welcome to Alexandrie ! π+## Formatting options++Lorem **ipsum dolor** *sit amet*, consectetur _adipiscing elit_. ==But not sad.==++### Different content blocks++:::blue Blue+A blue block+:::+:::red Red+A red block+:::+:::green Green+A green block+:::+:::grey Grey+A grey block+:::+:::yellow Yellow+A yellow block+:::+:::turquoise Turquoise+A turquoise block+:::+:::details Details+A details block+:::+++:::no-print+This content will not be printed+:::++:::center+This content is centered+:::++:::definition Red Info+Block of content (ex: definition)+:::++:::property Blue Info+Block of content (ex: property)+:::++:::theorem Turquoise Info+Block of content (ex: theorem)+:::++:::info-u Info without background+Block of content (ex: info, tip, note)+:::++:::warning Warning Info+Block of content (ex: warning)+:::++### Bullet and Numbered Lists:++- Bullet 1+- Bullet 2+ - Sub-bullet 2-1++1. Item 1+1. Item 2++### Markdown Tables++| Column 1 | Column 2 | Column 3 |+|:----------|:----------|:---------|+|Item 1 | Item 2 | Item 3 |++### Other formats++$\\text{This is a math block: } f(x) = ax^2+bx+c$++\`\`\`javascript+const hello = "Hello world";+\`\`\`++> Note: This content is a quote+>> Nested quote++## Shortcuts++- **Ctrl + S**: Save+- **Ctrl + P**: Toggle preview+- **Ctrl + Q**: Switch to document+- **Ctrl + B**: Bold formatting+- **Ctrl + I**: Italic formatting+- **Ctrl + U**: Underline formatting+- **Ctrl + K**: Insert link+- **Ctrl + M**: Insert image++## Snippets++- **!m**: Insert a math block (LaTeX)+- **!def**: Insert a definition block+- **!thm**: Insert a theorem block+- **!center**: Center the content+- **!red**: Insert a red block+- **!green**: Insert a green block+- **!blue**: Insert a blue block+- **!yellow**: Insert a yellow block+- **!details**: Insert a details block+`,+});</script><style scoped lang="scss">.container {- display: flex;- flex-direction: column;- justify-content: space-between;+ width: 95%;+ margin: 0 auto;}nav {- height: 65px;- width: 90%;- display: flex;- align-items: center;+ width: fit-content;justify-content: space-between;font-weight: 500;+ margin: 15px 0 0 auto;+}+h2 {+ font-size: 1.8rem;+ font-weight: 700;+ margin: 0;}.actions {@@ -60,7 +179,22 @@ nav {border-radius: 25px;}}-+.demo {+ width: 100%;+ height: 100%;+ img {+ max-height: unset;+ display: block;+ max-width: 1000px;+ width: 100%;+ margin: 25px auto;+ }+}+.editor {+ max-width: 1200px;+ height: 700px;+ margin: 0 auto;+}.sign-up {background: var(--bg-color);border: 1px solid var(--border-color);@@ -156,6 +290,9 @@ main {footer {padding: 1rem;+ display: flex;+ justify-content: space-between;+ margin: 0 30px;}@media (max-width: 768px) {@@ -166,5 +303,9 @@ footer {.intro h3 {font-size: 1rem;}+ footer {+ margin: 0;+ padding: 0;+ }}</style>diff --git a/frontend/public/home.webp b/frontend/public/home.webpnew file mode 100644index 00000000..d360307eBinary files /dev/null and b/frontend/public/home.webp differ