Fix #63 desktop/mobile layout; hide Updates tab on Android; dim inline task tokens in the editor

This commit is contained in:
Yuri Karamian committed 2026-06-23 13:52:26 +02:00
1 parent eeea16531a
commit 56dc0eefd7
3 files changed
+65 -3

No files matched your search

+60
View File
@@ -1323,6 +1323,60 @@
},
});
// Dim the inline task metadata tokens (!high / !medium / !med / !low and due:YYYY-MM-DD) inside
// task items so they recede visually without disappearing. View-only inline decorations - the
// note text is untouched. Token shapes mirror the parser in commands.rs.
const taskMetaPluginKey = new PluginKey('taskMetaDim');
const TASK_PRIO_RE = /(^|\s)(!(?:high|medium|med|low))\b/gi;
const TASK_DUE_RE = /\bdue:\d{4}-\d{2}-\d{2}\b/gi;
function buildTaskMetaDecorations(doc: any): DecorationSet {
const decos: any[] = [];
doc.descendants((node: any, pos: number) => {
if (!node.isText || !node.text) return;
// Only inside task items - elsewhere "!high" / "due:..." are ordinary prose.
const rpos = doc.resolve(pos);
let inTask = false;
for (let d = rpos.depth; d > 0; d--) {
if (rpos.node(d).type.name === 'taskItem') { inTask = true; break; }
}
if (!inTask) return;
const text: string = node.text;
let m: RegExpExecArray | null;
TASK_PRIO_RE.lastIndex = 0;
while ((m = TASK_PRIO_RE.exec(text)) !== null) {
const start = pos + m.index + m[1].length;
decos.push(Decoration.inline(start, start + m[2].length, { class: 'task-meta-dim' }));
}
TASK_DUE_RE.lastIndex = 0;
while ((m = TASK_DUE_RE.exec(text)) !== null) {
decos.push(Decoration.inline(pos + m.index, pos + m.index + m[0].length, { class: 'task-meta-dim' }));
}
});
return DecorationSet.create(doc, decos);
}
const TaskMetaDim = Extension.create({
name: 'taskMetaDim',
addProseMirrorPlugins() {
return [
new Plugin({
key: taskMetaPluginKey,
state: {
init: (_, state) => buildTaskMetaDecorations(state.doc),
apply: (tr, old, _oldState, newState) => {
if (!tr.docChanged) return old;
return buildTaskMetaDecorations(newState.doc);
},
},
props: {
decorations(state) { return taskMetaPluginKey.getState(state); },
},
}),
];
},
});
const MoveLineShortcuts = Extension.create({
name: 'moveLineShortcuts',
addProseMirrorPlugins() {
@@ -3726,6 +3780,7 @@
TabIndent,
NoteSearchExtension,
ColorSwatch,
TaskMetaDim,
...($appConfig?.enable_wiki_links ? [WikiLink, WikiLinkAutocomplete] : []),
],
content: html,
@@ -8461,6 +8516,11 @@
color: var(--text-tertiary);
}
/* Dim inline task metadata (!high / due:YYYY-MM-DD) so it recedes but stays readable. */
:global(.tiptap-wrapper .tiptap .task-meta-dim) {
opacity: 0.45;
}
:global(.tiptap-wrapper .tiptap hr) {
border: none;
border-top: 1px solid var(--border-color);
+3 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { showSettings, theme, appConfig, updateAvailable as globalUpdateAvailable, updateObj as globalUpdateObj, installType, settingsTab, vaultReady, androidApkUrl, checkForUpdateMobile, notebookSortMode, isManagedInstall } from '$lib/stores/app';
import { setTheme, setAccentColor, setFontSize, setFontFamily, setLineHeight, setUiScale, setContentWidth, setGeneralSettings, importObsidian, createBackup, listBackups, restoreBackup, deleteBackup, setBackupSettings, setAiSettings, testAiConnection, setSyncSettings, testSyncConnection, syncNow } from '$lib/api';
import { darkThemes, isMobile } from '$lib/platform';
import { darkThemes, isMobile, isAndroid } from '$lib/platform';
import { open as openDialog } from '@tauri-apps/plugin-dialog';
import { listen } from '@tauri-apps/api/event';
import { getVersion } from '@tauri-apps/api/app';
@@ -862,12 +862,14 @@
</svg>
Sync
</button>
{#if !isAndroid}
<button class="tab-btn" class:active={activeTab === 'updates'} onclick={() => activeTab = 'updates'}>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 12a9 9 0 00-9-9 9.75 9.75 0 00-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l3 3"/>
</svg>
Updates
</button>
{/if}
</nav>
<div class="settings-body">
+2 -2
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { onMount } from 'svelte';
import '../app.css';
import { theme, appConfig, activeNote, activeNotePath, installType, platformIsMobile, checkForUpdate, checkForUpdateMobile, isManagedInstall } from '$lib/stores/app';
import { theme, appConfig, activeNote, activeNotePath, installType, platformIsMobile, checkForUpdate, isManagedInstall } from '$lib/stores/app';
import { openFile, openUrl, readNote, getInstallType, isMobilePlatform } from '$lib/api';
import { get } from 'svelte/store';
import { darkThemes, isMobile, isAndroid } from '$lib/platform';
@@ -95,7 +95,7 @@
isMobilePlatform().then((m) => platformIsMobile.set(m)).catch(() => {});
if (isMobile) {
installType.set('android');
checkForUpdateMobile();
// Android updates come from the F-droid repo / Obtainium, so no in-app update check.
} else {
getInstallType().then(t => {
installType.set(t);