From 93e96829f47c8b7e4a9f61144a20eaafd1b851d1 Mon Sep 17 00:00:00 2001 From: Yuri Karamian Date: Fri, 19 Jun 2026 11:06:49 +0200 Subject: [PATCH] Add setting to toggle link arrows (#128) --- src-tauri/src/commands.rs | 2 ++ src-tauri/src/types.rs | 3 +++ src/lib/api.ts | 2 ++ src/lib/components/Editor.svelte | 8 ++++++++ src/lib/components/SettingsPanel.svelte | 19 +++++++++++++++++-- src/lib/types.ts | 1 + src/routes/+layout.svelte | 7 +++++++ 7 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index d61d438..c4c507d 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -1087,6 +1087,7 @@ pub fn set_general_settings( title_mode: String, hide_title_in_body: bool, show_line_numbers: bool, + show_link_arrows: bool, default_view_mode: bool, show_tray_icon: bool, close_to_tray: bool, @@ -1108,6 +1109,7 @@ pub fn set_general_settings( config.title_mode = title_mode; config.hide_title_in_body = hide_title_in_body; config.show_line_numbers = show_line_numbers; + config.show_link_arrows = show_link_arrows; config.default_view_mode = default_view_mode; config.show_tray_icon = show_tray_icon; config.close_to_tray = close_to_tray; diff --git a/src-tauri/src/types.rs b/src-tauri/src/types.rs index b0860bb..368f93d 100644 --- a/src-tauri/src/types.rs +++ b/src-tauri/src/types.rs @@ -95,6 +95,8 @@ pub struct AppConfig { pub hide_title_in_body: bool, #[serde(default)] pub show_line_numbers: bool, + #[serde(default = "default_true")] + pub show_link_arrows: bool, #[serde(default)] pub backup_enabled: bool, #[serde(default = "default_backup_frequency")] @@ -215,6 +217,7 @@ impl Default for AppConfig { title_mode: "input".to_string(), hide_title_in_body: false, show_line_numbers: false, + show_link_arrows: true, backup_enabled: false, backup_frequency: "24h".to_string(), backup_max_count: 10, diff --git a/src/lib/api.ts b/src/lib/api.ts index 254ac09..d2350ac 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -228,6 +228,7 @@ export async function setGeneralSettings( titleMode: string, hideTitleInBody: boolean, showLineNumbers: boolean, + showLinkArrows: boolean, defaultViewMode: boolean, showTrayIcon: boolean, closeToTray: boolean, @@ -247,6 +248,7 @@ export async function setGeneralSettings( titleMode, hideTitleInBody, showLineNumbers, + showLinkArrows, defaultViewMode, showTrayIcon, closeToTray, diff --git a/src/lib/components/Editor.svelte b/src/lib/components/Editor.svelte index 627d6e9..0629e80 100644 --- a/src/lib/components/Editor.svelte +++ b/src/lib/components/Editor.svelte @@ -8156,6 +8156,14 @@ vertical-align: 15%; } + :global(html.no-link-arrows .tiptap-wrapper .tiptap a::after) { + content: none; + } + + :global(html.no-link-arrows .tiptap-wrapper .tiptap a[href$=".md"]::after) { + content: none; + } + :global(.tiptap-wrapper .tiptap a[href$=".md"]::after) { content: '⤴'; } diff --git a/src/lib/components/SettingsPanel.svelte b/src/lib/components/SettingsPanel.svelte index fdfab38..ceb392b 100644 --- a/src/lib/components/SettingsPanel.svelte +++ b/src/lib/components/SettingsPanel.svelte @@ -508,6 +508,7 @@ let titleMode = $state($appConfig?.title_mode ?? 'input'); let hideTitleInBody = $state($appConfig?.hide_title_in_body ?? false); let showLineNumbers = $state($appConfig?.show_line_numbers ?? false); + let showLinkArrows = $state($appConfig?.show_link_arrows ?? true); let defaultViewMode = $state($appConfig?.default_view_mode ?? false); let showTrayIcon = $state($appConfig?.show_tray_icon ?? false); let closeToTray = $state($appConfig?.close_to_tray ?? false); @@ -565,15 +566,20 @@ $appConfig.title_mode = titleMode; $appConfig.hide_title_in_body = hideTitleInBody; $appConfig.show_line_numbers = showLineNumbers; + $appConfig.show_link_arrows = showLinkArrows; $appConfig.default_view_mode = defaultViewMode; $appConfig.show_tray_icon = showTrayIcon; $appConfig.close_to_tray = closeToTray; $appConfig.enable_wiki_links = enableWikiLinks; - } - setGeneralSettings(compactNotes, timeFormat, weekStart, dailyTitleFormat, gpuAcceleration, autostart, pdfPreview, pdfHeight, titleMode, hideTitleInBody, showLineNumbers, defaultViewMode, showTrayIcon, closeToTray, enableWikiLinks, showNoteDates, restoreLastSession) + } + setGeneralSettings(compactNotes, timeFormat, weekStart, dailyTitleFormat, gpuAcceleration, autostart, pdfPreview, pdfHeight, titleMode, hideTitleInBody, showLineNumbers, showLinkArrows, defaultViewMode, showTrayIcon, closeToTray, enableWikiLinks, showNoteDates, restoreLastSession) .catch((e) => console.error('Failed to save general settings:', e)); } + function applyLinkArrows() { + document.documentElement.classList.toggle('no-link-arrows', !showLinkArrows); + } + function selectTheme(preset: typeof themePresets[0]) { $theme = preset.id; setTheme(preset.id); @@ -964,6 +970,15 @@ + {#if !isMobile}