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.

feat(editor): scroll beyond the last line (#660)

Dipak Chaudharibee00d849397
diff --git a/frontend/app/components/MarkdownEditor/MarkdownEditor.vue b/frontend/app/components/MarkdownEditor/MarkdownEditor.vue
index d794b214..8df6f9f1 100644
--- a/frontend/app/components/MarkdownEditor/MarkdownEditor.vue
+++ b/frontend/app/components/MarkdownEditor/MarkdownEditor.vue
@@ -25,7 +25,7 @@
<!-- Editor Content Section -->
<div ref="container" class="editor-content">
<div class="editor-panel" :class="{ 'with-preview': showPreview }">
- <div ref="editorContainer" class="codemirror-editor" />
+ <div ref="editorContainer" class="codemirror-editor" :class="{ 'scroll-beyond-last-line': scrollBeyondLastLine }" />
</div>
<div v-if="showPreview" class="preview-panel">
@@ -72,6 +72,7 @@ const editorView = ref<EditorView | null>(null);
const showPreview = ref(false);
const autoSaveEnabled = preferences.get('documentAutoSave');
+const scrollBeyondLastLine = preferences.get('editorScrollBeyondLastLine');
const scrollSync = createScrollSync({
getView: () => editorView.value as EditorView | null,
@@ -328,6 +329,18 @@ const autoSave = debounceDelayed(() => {
padding: 8px 12px;
}
+// Scroll past the end of the document (#653), so the line being typed need not sit at
+// the bottom of the screen. Padding on .cm-content rather than a CodeMirror extension:
+// the space has to be INSIDE the scrollable content for the scroller to reach it, and
+// this way toggling the preference is a class change with no editor reconfiguration.
+//
+// vh rather than a line count: the useful amount is "most of a screen", which is what
+// makes the last line reachable near the top, and it stays right when the font size or
+// the window changes.
+.codemirror-editor.scroll-beyond-last-line:deep(.cm-content) {
+ padding-bottom: 60vh;
+}
+
.markdown-preview {
flex: 1;
padding: 12px 16px;
diff --git a/frontend/app/pages/dashboard/settings/_views/editor.vue b/frontend/app/pages/dashboard/settings/_views/editor.vue
index f0d25d48..32984e00 100644
--- a/frontend/app/pages/dashboard/settings/_views/editor.vue
+++ b/frontend/app/pages/dashboard/settings/_views/editor.vue
@@ -66,6 +66,13 @@ const options = computed<Array<{ label: string; options: InterfaceOption[] }>>((
type: 'toggle',
key: 'editorSimplifiedViewOnMobile',
},
+ {
+ label: t('settings.editor.scrollBeyondLastLine'),
+ tag: t('settings.nav.new'),
+ description: t('settings.editor.scrollBeyondLastLineDesc'),
+ type: 'toggle',
+ key: 'editorScrollBeyondLastLine',
+ },
],
},
]);
diff --git a/frontend/app/stores/preferences/constants.ts b/frontend/app/stores/preferences/constants.ts
index 3a34ea8c..5644f872 100644
--- a/frontend/app/stores/preferences/constants.ts
+++ b/frontend/app/stores/preferences/constants.ts
@@ -68,6 +68,7 @@ export const DEFAULT_PREFERENCES = {
editorSpellCheck: true as boolean,
editorDisplayStats: false as boolean,
editorSnippetsEnabled: true as boolean,
+ editorScrollBeyondLastLine: true as boolean,
editorSimplifiedViewOnMobile: true as boolean,
developerMode: false as boolean,
stylesInjectionEnabled: false as boolean,
@@ -116,6 +117,7 @@ export const EDITOR_KEYS: PreferenceKey[] = [
'editorSpellCheck',
'editorDisplayStats',
'editorSnippetsEnabled',
+ 'editorScrollBeyondLastLine',
'editorSimplifiedViewOnMobile',
];
diff --git a/frontend/i18n/locales/de/settings.ts b/frontend/i18n/locales/de/settings.ts
index 61542edc..49f63766 100644
--- a/frontend/i18n/locales/de/settings.ts
+++ b/frontend/i18n/locales/de/settings.ts
@@ -145,6 +145,8 @@ export default {
section: 'Editor',
simplifiedMobileView: 'Vereinfachte Mobilansicht',
simplifiedMobileViewDesc: 'Aktiviere eine vereinfachte Editor-Ansicht auf Mobilgeräten für bessere Benutzerfreundlichkeit.',
+ scrollBeyondLastLine: 'Über die letzte Zeile hinaus scrollen',
+ scrollBeyondLastLineDesc: 'Erlaube dem Editor, über das Ende des Dokuments hinaus zu scrollen, damit die letzte Zeile nicht am unteren Bildschirmrand bleibt.',
subtitle: 'Verwalte deine Editor-Einstellungen.',
title: 'Editor-Einstellungen',
},
diff --git a/frontend/i18n/locales/en/settings.ts b/frontend/i18n/locales/en/settings.ts
index d06af55d..c3415aaa 100644
--- a/frontend/i18n/locales/en/settings.ts
+++ b/frontend/i18n/locales/en/settings.ts
@@ -144,6 +144,8 @@ export default {
section: 'Editor',
simplifiedMobileView: 'Simplified mobile view',
simplifiedMobileViewDesc: 'Enable a simplified editor view on mobile for better usability.',
+ scrollBeyondLastLine: 'Scroll beyond last line',
+ scrollBeyondLastLineDesc: 'Allow the editor to scroll past the end of the document, so the last line need not sit at the bottom of the screen.',
subtitle: 'Manage your editor preferences.',
title: 'Editor preferences',
},
diff --git a/frontend/i18n/locales/fr/settings.ts b/frontend/i18n/locales/fr/settings.ts
index ada24e50..3852b811 100644
--- a/frontend/i18n/locales/fr/settings.ts
+++ b/frontend/i18n/locales/fr/settings.ts
@@ -145,6 +145,8 @@ export default {
section: 'Éditeur',
simplifiedMobileView: 'Vue simplifiée pour mobile',
simplifiedMobileViewDesc: "Activer une vue simplifiée de l'éditeur sur les appareils mobiles pour une meilleure utilisabilité.",
+ scrollBeyondLastLine: 'Défiler au-delà de la dernière ligne',
+ scrollBeyondLastLineDesc: "Permettre à l'éditeur de défiler au-delà de la fin du document, afin que la dernière ligne ne reste pas en bas de l'écran.",
subtitle: "Gérez vos préférences d'édition.",
title: "Préférences de l'éditeur",
},
diff --git a/frontend/i18n/locales/it/settings.ts b/frontend/i18n/locales/it/settings.ts
index dfb1eab7..8446b7f7 100644
--- a/frontend/i18n/locales/it/settings.ts
+++ b/frontend/i18n/locales/it/settings.ts
@@ -146,6 +146,8 @@ export default {
section: 'Editor',
simplifiedMobileView: 'Vista mobile semplificata',
simplifiedMobileViewDesc: "Abilita una vista semplificata dell'editor su dispositivi mobili per una migliore usabilità.",
+ scrollBeyondLastLine: "Scorri oltre l'ultima riga",
+ scrollBeyondLastLineDesc: "Consenti all'editor di scorrere oltre la fine del documento, così l'ultima riga non resta in fondo allo schermo.",
subtitle: "Gestisci le tue preferenze dell'editor.",
title: 'Preferenze editor',
},
diff --git a/frontend/i18n/locales/ko/settings.ts b/frontend/i18n/locales/ko/settings.ts
index d57121f0..ba42222e 100644
--- a/frontend/i18n/locales/ko/settings.ts
+++ b/frontend/i18n/locales/ko/settings.ts
@@ -143,6 +143,8 @@ export default {
section: '에디터',
simplifiedMobileView: '단순화된 모바일 보기',
simplifiedMobileViewDesc: '모바일에서 사용성을 높이기 위해 단순화된 에디터 보기를 활성화합니다.',
+ scrollBeyondLastLine: '마지막 줄 아래로 스크롤',
+ scrollBeyondLastLineDesc: '문서 끝을 지나서도 스크롤할 수 있게 하여 마지막 줄이 화면 맨 아래에 머물지 않도록 합니다.',
subtitle: '에디터 환경설정을 관리합니다.',
title: '에디터 환경설정',
},
diff --git a/frontend/i18n/locales/uk/settings.ts b/frontend/i18n/locales/uk/settings.ts
index 39b6f971..24eba039 100644
--- a/frontend/i18n/locales/uk/settings.ts
+++ b/frontend/i18n/locales/uk/settings.ts
@@ -144,6 +144,8 @@ export default {
section: 'Редактор',
simplifiedMobileView: 'Спрощений мобільний вигляд',
simplifiedMobileViewDesc: 'Увімкнути спрощений вигляд редактора на мобільних пристроях для кращої зручності.',
+ scrollBeyondLastLine: 'Прокрутка за останній рядок',
+ scrollBeyondLastLineDesc: 'Дозволити редактору прокручуватися за кінець документа, щоб останній рядок не залишався внизу екрана.',
subtitle: 'Керуйте налаштуваннями редактора.',
title: 'Налаштування редактора',
},