tab key inserts tab
This commit is contained in:
parent
6af7310aad
commit
cd9b5e7d7b
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -2037,6 +2037,24 @@
|
|||
</label>
|
||||
<p class="text-xs mt-1" style="color: var(--text-tertiary);" x-text="t('settings.hide_underscore_folders_desc')"></p>
|
||||
</div>
|
||||
|
||||
<!-- Tab inserts tab -->
|
||||
<div class="mb-4">
|
||||
<label class="flex items-center justify-between cursor-pointer">
|
||||
<span class="text-xs font-medium" style="color: var(--text-secondary);" x-text="t('settings.tab_inserts_tab')"></span>
|
||||
<div
|
||||
@click="toggleTabInsertsTab()"
|
||||
class="relative w-10 h-5 rounded-full transition-colors cursor-pointer"
|
||||
:style="tabInsertsTab ? 'background-color: var(--accent-primary)' : 'background-color: var(--bg-tertiary)'"
|
||||
>
|
||||
<div
|
||||
class="absolute top-0.5 left-0.5 w-4 h-4 rounded-full transition-transform"
|
||||
:style="'background-color: var(--bg-primary);' + (tabInsertsTab ? ' transform: translateX(20px);' : '')"
|
||||
></div>
|
||||
</div>
|
||||
</label>
|
||||
<p class="text-xs mt-1" style="color: var(--text-tertiary);" x-text="t('settings.tab_inserts_tab_desc')"></p>
|
||||
</div>
|
||||
|
||||
<!-- Logout (if auth enabled) - uses authEnabled from main app state -->
|
||||
<div x-show="authEnabled" class="mb-4">
|
||||
|
|
@ -2639,11 +2657,12 @@
|
|||
x-show="syntaxHighlightEnabled"
|
||||
x-html="syntaxHighlightEnabled ? highlightMarkdown(noteContent) : ''"
|
||||
></div>
|
||||
<textarea
|
||||
<textarea
|
||||
id="note-editor"
|
||||
x-model="noteContent"
|
||||
@input="autoSave(); updateSyntaxHighlight()"
|
||||
@scroll="syncOverlayScroll()"
|
||||
@keydown.tab="handleTabKey($event)"
|
||||
@drop="onEditorDrop($event)"
|
||||
@dragover.prevent="onEditorDragOver($event)"
|
||||
@dragenter="onEditorDragEnter($event)"
|
||||
|
|
|
|||
|
|
@ -250,7 +250,9 @@
|
|||
"readable_line_length": "Lesbare Zeilenlänge",
|
||||
"readable_line_length_desc": "Vorschaubreite für bessere Lesbarkeit begrenzen",
|
||||
"hide_underscore_folders": "Systemordner ausblenden",
|
||||
"hide_underscore_folders_desc": "_attachments, _templates und andere Unterstrich-Ordner ausblenden"
|
||||
"hide_underscore_folders_desc": "_attachments, _templates und andere Unterstrich-Ordner ausblenden",
|
||||
"tab_inserts_tab": "Tab-Taste fügt Tab ein",
|
||||
"tab_inserts_tab_desc": "Tab drücken, um ein Tabulatorzeichen einzufügen statt den Fokus zu wechseln"
|
||||
},
|
||||
|
||||
"homepage": {
|
||||
|
|
|
|||
|
|
@ -249,7 +249,9 @@
|
|||
"readable_line_length": "Readable line length",
|
||||
"readable_line_length_desc": "Limit preview width for easier reading",
|
||||
"hide_underscore_folders": "Hide system folders",
|
||||
"hide_underscore_folders_desc": "Hide _attachments, _templates and other underscore folders from sidebar"
|
||||
"hide_underscore_folders_desc": "Hide _attachments, _templates and other underscore folders from sidebar",
|
||||
"tab_inserts_tab": "Tab key inserts tab",
|
||||
"tab_inserts_tab_desc": "Press Tab to insert a tab character instead of changing focus"
|
||||
},
|
||||
|
||||
"homepage": {
|
||||
|
|
|
|||
|
|
@ -250,7 +250,9 @@
|
|||
"readable_line_length": "Readable line length",
|
||||
"readable_line_length_desc": "Limit preview width for easier reading",
|
||||
"hide_underscore_folders": "Hide system folders",
|
||||
"hide_underscore_folders_desc": "Hide _attachments, _templates and other underscore folders from sidebar"
|
||||
"hide_underscore_folders_desc": "Hide _attachments, _templates and other underscore folders from sidebar",
|
||||
"tab_inserts_tab": "Tab key inserts tab",
|
||||
"tab_inserts_tab_desc": "Press Tab to insert a tab character instead of changing focus"
|
||||
},
|
||||
|
||||
"homepage": {
|
||||
|
|
|
|||
|
|
@ -250,7 +250,9 @@
|
|||
"readable_line_length": "Longitud de línea legible",
|
||||
"readable_line_length_desc": "Limitar el ancho de vista previa para facilitar la lectura",
|
||||
"hide_underscore_folders": "Ocultar carpetas de sistema",
|
||||
"hide_underscore_folders_desc": "Ocultar _attachments, _templates y otras carpetas con guion bajo"
|
||||
"hide_underscore_folders_desc": "Ocultar _attachments, _templates y otras carpetas con guion bajo",
|
||||
"tab_inserts_tab": "Tabulador inserta tabulación",
|
||||
"tab_inserts_tab_desc": "Pulsa Tab para insertar un tabulador en lugar de cambiar el foco"
|
||||
},
|
||||
|
||||
"homepage": {
|
||||
|
|
|
|||
|
|
@ -250,7 +250,9 @@
|
|||
"readable_line_length": "Longueur de ligne lisible",
|
||||
"readable_line_length_desc": "Limiter la largeur de l'aperçu pour une lecture plus facile",
|
||||
"hide_underscore_folders": "Masquer les dossiers système",
|
||||
"hide_underscore_folders_desc": "Masquer _attachments, _templates et autres dossiers préfixés"
|
||||
"hide_underscore_folders_desc": "Masquer _attachments, _templates et autres dossiers préfixés",
|
||||
"tab_inserts_tab": "Tab insère une tabulation",
|
||||
"tab_inserts_tab_desc": "Appuyez sur Tab pour insérer une tabulation au lieu de changer le focus"
|
||||
},
|
||||
|
||||
"homepage": {
|
||||
|
|
|
|||
|
|
@ -250,7 +250,9 @@
|
|||
"readable_line_length": "Olvasható sorhossz",
|
||||
"readable_line_length_desc": "Korlátozd az előnézeti szélességet a könnyebb olvasás érdekében",
|
||||
"hide_underscore_folders": "Rendszermappák elrejtése",
|
||||
"hide_underscore_folders_desc": "_attachments, _templates és más aláhúzásos mappák elrejtése"
|
||||
"hide_underscore_folders_desc": "_attachments, _templates és más aláhúzásos mappák elrejtése",
|
||||
"tab_inserts_tab": "Tab billentyű tabulátort szúr be",
|
||||
"tab_inserts_tab_desc": "Nyomja meg a Tab-ot tabulátor beszúrásához a fókuszváltás helyett"
|
||||
},
|
||||
|
||||
"homepage": {
|
||||
|
|
|
|||
|
|
@ -249,7 +249,9 @@
|
|||
"readable_line_length": "Larghezza riga leggibile",
|
||||
"readable_line_length_desc": "Limita la larghezza dell'anteprima per una lettura più facile",
|
||||
"hide_underscore_folders": "Nascondi cartelle di sistema",
|
||||
"hide_underscore_folders_desc": "Nascondi _attachments, _templates e altre cartelle con underscore"
|
||||
"hide_underscore_folders_desc": "Nascondi _attachments, _templates e altre cartelle con underscore",
|
||||
"tab_inserts_tab": "Tab inserisce tabulazione",
|
||||
"tab_inserts_tab_desc": "Premi Tab per inserire una tabulazione invece di cambiare focus"
|
||||
},
|
||||
|
||||
"homepage": {
|
||||
|
|
|
|||
|
|
@ -249,7 +249,9 @@
|
|||
"readable_line_length": "読みやすい行幅",
|
||||
"readable_line_length_desc": "プレビューの幅を制限して読みやすくする",
|
||||
"hide_underscore_folders": "システムフォルダを非表示",
|
||||
"hide_underscore_folders_desc": "_attachments、_templatesなどのフォルダをサイドバーから非表示"
|
||||
"hide_underscore_folders_desc": "_attachments、_templatesなどのフォルダをサイドバーから非表示",
|
||||
"tab_inserts_tab": "Tabキーでタブを挿入",
|
||||
"tab_inserts_tab_desc": "Tabキーでフォーカス移動ではなくタブ文字を挿入"
|
||||
},
|
||||
|
||||
"homepage": {
|
||||
|
|
|
|||
|
|
@ -249,7 +249,9 @@
|
|||
"readable_line_length": "Удобная длина строки",
|
||||
"readable_line_length_desc": "Ограничить ширину предпросмотра для удобства чтения",
|
||||
"hide_underscore_folders": "Скрыть системные папки",
|
||||
"hide_underscore_folders_desc": "Скрыть _attachments, _templates и другие папки с подчёркиванием"
|
||||
"hide_underscore_folders_desc": "Скрыть _attachments, _templates и другие папки с подчёркиванием",
|
||||
"tab_inserts_tab": "Tab вставляет табуляцию",
|
||||
"tab_inserts_tab_desc": "Нажмите Tab для вставки табуляции вместо переключения фокуса"
|
||||
},
|
||||
|
||||
"homepage": {
|
||||
|
|
|
|||
|
|
@ -249,7 +249,9 @@
|
|||
"readable_line_length": "Berljiva dolžina vrstice",
|
||||
"readable_line_length_desc": "Omejite širino predogleda za lažje branje",
|
||||
"hide_underscore_folders": "Skrij sistemske mape",
|
||||
"hide_underscore_folders_desc": "Skrij _attachments, _templates in druge mape s podčrtajem"
|
||||
"hide_underscore_folders_desc": "Skrij _attachments, _templates in druge mape s podčrtajem",
|
||||
"tab_inserts_tab": "Tipka Tab vstavi tabulator",
|
||||
"tab_inserts_tab_desc": "Pritisnite Tab za vstavljanje tabulatorja namesto premikanja fokusa"
|
||||
},
|
||||
|
||||
"homepage": {
|
||||
|
|
|
|||
|
|
@ -249,7 +249,9 @@
|
|||
"readable_line_length": "可读行宽",
|
||||
"readable_line_length_desc": "限制预览宽度以便于阅读",
|
||||
"hide_underscore_folders": "隐藏系统文件夹",
|
||||
"hide_underscore_folders_desc": "从侧边栏隐藏 _attachments、_templates 等下划线文件夹"
|
||||
"hide_underscore_folders_desc": "从侧边栏隐藏 _attachments、_templates 等下划线文件夹",
|
||||
"tab_inserts_tab": "Tab键插入制表符",
|
||||
"tab_inserts_tab_desc": "按Tab键插入制表符而不是切换焦点"
|
||||
},
|
||||
|
||||
"homepage": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue