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

Veauville Raphael512e017c43b2
diff --git a/.gitignore b/.gitignore
index a32fa2c6..ed2187bf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,6 @@
uploads/images/*
uploads/webp/*
uploads/backups/*
-!uploads/images/default
-!uploads/webp/default
-!uploads/backups/default
+!uploads/images/.gitkeep
+!uploads/webp/.gitkeep
+!uploads/backups/.gitkeep
diff --git a/@alexandrie/styles/src/_variables.scss b/@alexandrie/styles/src/_variables.scss
index 552b439b..bd23e354 100644
--- a/@alexandrie/styles/src/_variables.scss
+++ b/@alexandrie/styles/src/_variables.scss
@@ -17,7 +17,7 @@ $primary-500: darken($primary-400, 10%);
$selection-color: $blue;
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700&display=swap");
-
+@import url('https://cdn.jsdelivr.net/npm/[email protected]/neon.css');
$external-font: 'Poppins', sans-serif;
$mono-font: ui-monospace 'Roboto Mono', monospace;
@@ -59,7 +59,7 @@ $transition-duration: 0.3s;
.dark-mode {
- --bg-color: #0f0f11;
+ --bg-color: #27262b;
--bg-contrast: #27262b;
--bg-contrast-2: #484852;
--font-color: #ddd;
diff --git a/@alexandrie/styles/src/theme.scss b/@alexandrie/styles/src/theme.scss
index f61f3fd7..4ba39d4f 100644
--- a/@alexandrie/styles/src/theme.scss
+++ b/@alexandrie/styles/src/theme.scss
@@ -54,7 +54,6 @@ h2 {
border-bottom: 1px solid var(--border-color);
font-weight: 700;
line-height: 1.2;
- margin: 25px 0 15px 0;
padding-bottom: 10px;
}
@@ -69,10 +68,12 @@ h6 {
h1 {
font-size: 2em;
+ margin: 0 0 25px 0;
}
h2 {
font-size: 1.5em;
+ margin: 25px 0 15px 0;
}
h3 {
@@ -99,6 +100,7 @@ hr {
height: 1px;
width: 95%;
margin: auto;
+ margin-top: 250px;
}
img {
diff --git a/dashboard/App.vue b/dashboard/App.vue
index 61c3681e..c2837d9e 100644
--- a/dashboard/App.vue
+++ b/dashboard/App.vue
@@ -1,8 +1,8 @@
<template>
<div id="app">
+ <Navbar style="height: 60px" />
+ <NuxtPage class="page" />
<div id="backdrop"></div>
- <Navbar />
- <NuxtPage />
<Notification />
</div>
</template>
@@ -15,11 +15,12 @@ useDocumentsStore().fetch();
useCategoriesStore().fetch();
</script>
-<style scoped>
+<style scoped lang="scss">
#app {
- display: flex;
- flex-direction: column;
height: 100vh;
- width: 100%;
+}
+
+.page {
+ height: calc(100vh - 60px);
}
</style>
\ No newline at end of file
diff --git a/dashboard/bun.lockb b/dashboard/bun.lockb
index c032cabf..60cd2135 100755
Binary files a/dashboard/bun.lockb and b/dashboard/bun.lockb differ
diff --git a/dashboard/components/MarkdownEditor/MarkdownEditor.vue b/dashboard/components/MarkdownEditor/MarkdownEditor.vue
index 1ae177ab..4aa76bb6 100644
--- a/dashboard/components/MarkdownEditor/MarkdownEditor.vue
+++ b/dashboard/components/MarkdownEditor/MarkdownEditor.vue
@@ -1,14 +1,16 @@
<template>
<div class="editor-container">
- <Toolbar :document="document" @execute-action="(a: string) => exec(a)" />
- <div class="flex-container body">
- <div class="editor-input">
- <input placeholder="Titre" class="title input" v-model="document.name" />
- <input placeholder="Description" class="description input" v-model="document.description" />
- <textarea ref="textarea" class="content input" placeholder="Écrivez votre contenu ici..."
- v-model="document.content_markdown"></textarea>
+ <Toolbar style="height: fit-content;" :document="document" @execute-action="(a: string) => exec(a)" />
+ <div class="editor-input">
+ <input placeholder="Titre" class="title input" v-model="document.name" />
+ <input placeholder="Description" class="description input" v-model="document.description" />
+ <div class="markdown">
+ <textarea ref="textarea" class="content markdown-input input" placeholder="Écrivez votre contenu ici..."
+ v-model="document.content_markdown" @scroll="syncScroll"></textarea>
+ <div v-if="showPreview" class="markdown-preview document-theme" ref="markdownPreview">
+ <div v-html="html_content"></div>
+ </div>
</div>
- <div v-if="showPreview" class="markdown-preview document-theme" v-html="document.content_html"></div>
</div>
</div>
</template>
@@ -27,11 +29,12 @@ const showPreview = ref(false);
const emit = defineEmits(['save']);
-watchEffect(() => {
- if (!document.value.content_markdown) return;
+const html_content = computed(() => {
document.value.content_html = compile(document.value.content_markdown, true);
+ return document.value.content_html;
});
+
function exec(action: string) {
if (!textarea.value) return;
const selectedText = window.getSelection()?.toString() || '';
@@ -75,39 +78,43 @@ function exec(action: string) {
break;
}
}
+
+const markdownPreview = ref<HTMLDivElement>();
+
+function syncScroll() {
+ if (!textarea.value || !markdownPreview.value) return;
+ const scrollPercentage = textarea.value.scrollTop / (textarea.value.scrollHeight - textarea.value.clientHeight);
+ markdownPreview.value.scrollTop = scrollPercentage * (markdownPreview.value.scrollHeight - markdownPreview.value.clientHeight);
+}
</script>
<style scoped lang="scss">
.editor-container {
- display: flex;
- flex-direction: column;
+ height: 100%;
+ width: 100%;
}
-.flex-container {
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
+.editor-input {
+ height: 100%;
+ width: 100%;
}
-.body {
+.markdown {
+ display: flex;
height: 100%;
+ width: 100%;
}
-.editor-input,
+.markdown-input,
.markdown-preview {
- padding: 8px;
- min-height: 80vh;
-}
-
-.editor-input {
flex: 1;
- display: flex;
- flex-direction: column;
+ overflow: auto;
+ min-height: 60vh;
}
-.markdown-preview {
- border-left: 1px solid var(--border-color);
- flex: 1;
+.markdown-input {
+ resize: none;
+ font-family: 'Monaspace Neon';
}
.input {
@@ -116,7 +123,6 @@ function exec(action: string) {
background-color: var(--bg-color);
padding-left: 0;
-
&.title {
font-size: 24px;
font-weight: bold;
@@ -129,11 +135,5 @@ function exec(action: string) {
margin-bottom: 10px;
}
- &.content {
- width: 100%;
- flex: 1;
- padding: 0;
- resize: none;
- }
}
</style>
\ No newline at end of file
diff --git a/dashboard/components/MarkdownEditor/Toolbar.vue b/dashboard/components/MarkdownEditor/Toolbar.vue
index d4737486..f67e7754 100644
--- a/dashboard/components/MarkdownEditor/Toolbar.vue
+++ b/dashboard/components/MarkdownEditor/Toolbar.vue
@@ -1,30 +1,26 @@
<template>
<div class="toolbar flex-container">
- <div style="display:flex; align-items: flex-start;">
- <span v-for="item in toolbar" :key="item.name" v-html="item.icon" class="btn"
- @click="emitAction(item.action)"></span>
- </div>
- <div>
- <input placeholder="#tags" class="tags input" v-model="copy.tags" style="margin-right:5px;" />
- <select 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;">
- <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>
- </select>
- <select v-model="copy.parent_id">
- <option selected :value="null"> No parent </option>
- <option v-for="doc in documentsStore.getByCategories(copy.category || '')" :value="doc.id" :key="doc.id"
- v-text="doc.name">
+ <span v-for="item in toolbar" :key="item.name" v-html="item.icon" class="btn"
+ @click="emitAction(item.action)"></span>
+ <input placeholder="#tags" class="tags input" v-model="copy.tags" style="margin-right:5px;" />
+ <select 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;">
+ <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>
- </select>
- </div>
+ </optgroup>
+ </select>
+ <select v-model="copy.parent_id">
+ <option selected :value="null"> No parent </option>
+ <option v-for="doc in documentsStore.getByCategories(copy.category || '')" :value="doc.id" :key="doc.id"
+ v-text="doc.name">
+ </option>
+ </select>
</div>
</template>
@@ -107,8 +103,7 @@ const toolbar = [
.toolbar {
margin-bottom: 10px;
user-select: none;
- border-radius: 5px;
- padding: 5px;
+ display: flex;
.btn {
margin-right: 5px;
@@ -129,9 +124,7 @@ const toolbar = [
}
input {
- border: none;
- background-color: var(--bg-color);
- outline: none;
+ display: none;
}
input,
diff --git a/dashboard/components/Navbar.vue b/dashboard/components/Navbar.vue
index 7ec691fb..927574f9 100644
--- a/dashboard/components/Navbar.vue
+++ b/dashboard/components/Navbar.vue
@@ -25,7 +25,7 @@
<style lang="scss" scoped>
header {
width: 100%;
- height: 60px;
+ height: 100%;
display: flex;
justify-content: space-between;
}
@@ -38,13 +38,6 @@ header {
cursor: pointer;
}
-
-.dropdown-item {
- display: block;
- padding: 4px;
- font-size: calc(100% - 1px);
-}
-
ul {
list-style: none;
padding: 0;
diff --git a/dashboard/helpers/markdown/index.ts b/dashboard/helpers/markdown/index.ts
index 64342379..821b3e88 100644
--- a/dashboard/helpers/markdown/index.ts
+++ b/dashboard/helpers/markdown/index.ts
@@ -61,21 +61,9 @@ function markdownItKatexPlugin(md: any) {
}
export default function compile(str: string = '', plugins: boolean = true): string {
- let render = str;
- if (plugins) {
- // KATEX (math)
- //const results = matchText(render);
- // render = replaceText(render, results);
- render = md.render(render, {
- html: true,
- });
- } else {
- render = md.render(str, {
- html: true,
- });
- }
-
- return render;
+ return md.render(str, {
+ html: true,
+ });
}
function mdTokatex(text: string): string {
const expressionWithoutDollar = text;
diff --git a/dashboard/package.json b/dashboard/package.json
index 3023e2b5..7ed25a69 100644
--- a/dashboard/package.json
+++ b/dashboard/package.json
@@ -1,15 +1,5 @@
{
"name": "nuxt-app",
- "private": true,
- "type": "module",
- "scripts": {
- "build": "nuxt build",
- "dev": "nuxt dev",
- "dev:host": "nuxt dev --host",
- "generate": "nuxt generate",
- "preview": "nuxt preview",
- "postinstall": "nuxt prepare"
- },
"devDependencies": {
"@nuxt/devtools": "latest",
"@nuxtjs/color-mode": "^3.3.3",
@@ -18,7 +8,6 @@
"@types/markdown-it": "^13.0.4",
"@types/markdown-it-container": "^2.0.8",
"@types/node": "^20.8.5",
- "@types/prismjs": "^1.26.3",
"katex": "^0.16.10",
"markdown-it": "^14.1.0",
"markdown-it-anchor": "^8.6.7",
@@ -32,7 +21,14 @@
"vue": "^3.3.4",
"vue-router": "^4.2.5"
},
- "dependencies": {
- "prismjs": "^1.29.0"
- }
+ "private": true,
+ "scripts": {
+ "build": "nuxt build",
+ "dev": "nuxt dev",
+ "dev:host": "nuxt dev --host",
+ "generate": "nuxt generate",
+ "preview": "nuxt preview",
+ "postinstall": "nuxt prepare"
+ },
+ "type": "module"
}
diff --git a/dashboard/pages/dashboard/edit.vue b/dashboard/pages/dashboard/edit.vue
index 671b5cc6..5c93ee31 100644
--- a/dashboard/pages/dashboard/edit.vue
+++ b/dashboard/pages/dashboard/edit.vue
@@ -36,6 +36,5 @@ function save(doc: Document) {
.edit-component {
width: 100%;
height: 100%;
- padding: 12px;
}
</style>
\ No newline at end of file
diff --git a/uploads/backups/default b/uploads/backups/.gitkeep
similarity index 100%
rename from uploads/backups/default
rename to uploads/backups/.gitkeep
diff --git a/uploads/images/default b/uploads/images/.gitkeep
similarity index 100%
rename from uploads/images/default
rename to uploads/images/.gitkeep
diff --git a/uploads/webp/default b/uploads/webp/.gitkeep
similarity index 100%
rename from uploads/webp/default
rename to uploads/webp/.gitkeep