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.

Add possibility to hide table of content

Smaug67395a65c1ea4c99
diff --git a/frontend/pages/dashboard/docs/[id].vue b/frontend/pages/dashboard/docs/[id].vue
index e6b8f2b3..d6aef3bd 100644
--- a/frontend/pages/dashboard/docs/[id].vue
+++ b/frontend/pages/dashboard/docs/[id].vue
@@ -1,12 +1,13 @@
<template>
<div v-if="article?.id" style="width: 100%">
<div style="display: flex; justify-content: space-between">
- <div style="width: 100%; max-width: 900px; margin: auto">
+ <div style="width: 100%; max-width: 980px; margin: auto">
<DocumentCardHeader :doc="article" style="margin-bottom: 20px" />
<article class="document-theme" style="max-width: 100%" ref="element" v-html="article.content_html"></article>
<DocumentCardFooter :document="article" :next="next" :previous="previous" />
</div>
- <TableOfContent :element="element" :doc_id="article.id" class="toc" style="width: 400px" v-if="!isTablet()" />
+ <TableOfContent :element="element" :doc_id="article.id" class="toc" style="width: 400px" v-if="!isTablet() && !preferencesStore.get('hideTOC')" />
+ <div v-else-if="!isTablet() && preferencesStore.get('hideTOC')" style="margin-right: 200px"></div>
</div>
</div>
</template>
@@ -18,6 +19,7 @@ import DocumentCardHeader from './_components/DocumentCardHeader.vue';
import DocumentCardFooter from './_components/DocumentCardFooter.vue';
const route = useRoute();
const documentsStore = useDocumentsStore();
+const preferencesStore = usePreferencesStore();
const element = ref<HTMLElement>();
const article = ref<Document | undefined>();
diff --git a/frontend/pages/dashboard/settings/_views/preferences.vue b/frontend/pages/dashboard/settings/_views/preferences.vue
index 1fb6b083..89ce8899 100644
--- a/frontend/pages/dashboard/settings/_views/preferences.vue
+++ b/frontend/pages/dashboard/settings/_views/preferences.vue
@@ -26,6 +26,12 @@ const options = ref([
storageKey: 'darkMode' as const,
onToggle: () => (colorMode.value === 'light' ? (colorMode.preference = 'dark') : (colorMode.preference = 'light')),
},
+ {
+ id: 'hide-toc',
+ label: 'Hide Table of Content',
+ value: Boolean(preferencesStore.get('hideTOC')),
+ storageKey: 'hideTOC' as const,
+ },
]);
// Toggle function for options
diff --git a/frontend/stores/preferences.store.ts b/frontend/stores/preferences.store.ts
index 19628b80..d8f0e3a2 100644
--- a/frontend/stores/preferences.store.ts
+++ b/frontend/stores/preferences.store.ts
@@ -1,6 +1,6 @@
/* Store to save user local preferences */
/* Only local settings with localStorage but no db or requests */
-type PreferenceKey = 'printMode' | 'darkMode';
+type PreferenceKey = 'printMode' | 'darkMode' | 'hideTOC';
export interface Preference {
key: PreferenceKey;
value: any;