From cd9b5e7d7b3998bd37ebf25be39281b4403ba8b0 Mon Sep 17 00:00:00 2001 From: Gamosoft Date: Mon, 6 Apr 2026 11:25:21 +0200 Subject: [PATCH 1/4] tab key inserts tab --- documentation/FEATURES.md | 1 + frontend/app.js | 29 +++++++++++++++++++++++++++-- frontend/index.html | 21 ++++++++++++++++++++- locales/de-DE.json | 4 +++- locales/en-GB.json | 4 +++- locales/en-US.json | 4 +++- locales/es-ES.json | 4 +++- locales/fr-FR.json | 4 +++- locales/hu-HU.json | 4 +++- locales/it-IT.json | 4 +++- locales/ja-JP.json | 4 +++- locales/ru-RU.json | 4 +++- locales/sl-SI.json | 4 +++- locales/zh-CN.json | 4 +++- 14 files changed, 81 insertions(+), 14 deletions(-) diff --git a/documentation/FEATURES.md b/documentation/FEATURES.md index 613f420..2833198 100644 --- a/documentation/FEATURES.md +++ b/documentation/FEATURES.md @@ -32,6 +32,7 @@ - **Rename anything** - Files and folders, instantly - **Visual tree view** - Expandable/collapsible navigation - **Hide system folders** - Toggle to hide `_attachments`, `_templates` and other underscore-prefixed folders from sidebar +- **Tab inserts tab** - Toggle to make Tab key insert a tab character in the editor instead of changing focus ## 🔗 Linking & Discovery diff --git a/frontend/app.js b/frontend/app.js index 013ddfe..832450b 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -20,6 +20,7 @@ const LOCAL_SETTINGS = { favoritesExpanded: { key: 'favoritesExpanded', type: 'boolean', default: true }, tagsExpanded: { key: 'tagsExpanded', type: 'boolean', default: false }, hideUnderscoreFolders: { key: 'hideUnderscoreFolders', type: 'boolean', default: false }, + tabInsertsTab: { key: 'tabInsertsTab', type: 'boolean', default: false }, // Number settings with validation sidebarWidth: { key: 'sidebarWidth', type: 'number', default: CONFIG.DEFAULT_SIDEBAR_WIDTH, min: 200, max: 600 }, editorWidth: { key: 'editorWidth', type: 'number', default: 50, min: 20, max: 80 }, @@ -214,7 +215,10 @@ function noteApp() { // Hide underscore-prefixed folders (_attachments, _templates) from sidebar // Read synchronously to prevent flash on initial render hideUnderscoreFolders: localStorage.getItem('hideUnderscoreFolders') === 'true', - + + // Tab key inserts tab character instead of changing focus + tabInsertsTab: localStorage.getItem('tabInsertsTab') === 'true', + // Icon rail / panel state activePanel: 'files', // 'files', 'search', 'tags', 'settings' @@ -826,7 +830,28 @@ function noteApp() { this.hideUnderscoreFolders = !this.hideUnderscoreFolders; localStorage.setItem('hideUnderscoreFolders', this.hideUnderscoreFolders); }, - + + // Tab inserts tab toggle (Tab key inserts tab character instead of changing focus) + toggleTabInsertsTab() { + this.tabInsertsTab = !this.tabInsertsTab; + localStorage.setItem('tabInsertsTab', this.tabInsertsTab); + }, + + // Handle Tab key in editor (inserts tab if setting enabled) + handleTabKey(event) { + if (!this.tabInsertsTab) return; + + event.preventDefault(); + const textarea = event.target; + const start = textarea.selectionStart; + const end = textarea.selectionEnd; + this.noteContent = this.noteContent.substring(0, start) + '\t' + this.noteContent.substring(end); + this.$nextTick(() => { + textarea.selectionStart = textarea.selectionEnd = start + 1; + }); + this.autoSave(); + }, + // Update syntax highlight overlay (debounced, called on input) updateSyntaxHighlight() { if (!this.syntaxHighlightEnabled) return; diff --git a/frontend/index.html b/frontend/index.html index 1fad5ea..0352301 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -2037,6 +2037,24 @@

+ + +
+ +

+
@@ -2639,11 +2657,12 @@ x-show="syntaxHighlightEnabled" x-html="syntaxHighlightEnabled ? highlightMarkdown(noteContent) : ''" >
-