Add setting to toggle link arrows (#128)

This commit is contained in:
Yuri Karamian
2026-06-19 11:06:49 +02:00
parent 11673bd8c4
commit 93e96829f4
7 changed files with 40 additions and 2 deletions
+2
View File
@@ -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;
+3
View File
@@ -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,
+2
View File
@@ -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,
+8
View File
@@ -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: '⤴';
}
+16 -1
View File
@@ -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 @@
<span class="toggle-knob"></span>
</button>
</label>
<label class="setting-toggle" style="margin-top: 12px;">
<span class="setting-label">
<span class="setting-name">Show link arrows</span>
<span class="setting-desc">Display the arrow icon after external links</span>
</span>
<button class="toggle-switch" class:on={showLinkArrows} onclick={() => { showLinkArrows = !showLinkArrows; saveGeneralSettings(); applyLinkArrows(); }}>
<span class="toggle-knob"></span>
</button>
</label>
{#if !isMobile}
<label class="setting-toggle" style="margin-top: 12px;">
<span class="setting-label">
+1
View File
@@ -67,6 +67,7 @@ export interface AppConfig {
title_mode: string;
hide_title_in_body: boolean;
show_line_numbers: boolean;
show_link_arrows: boolean;
backup_enabled: boolean;
backup_frequency: string;
backup_max_count: number;
+7
View File
@@ -16,6 +16,13 @@
applyTheme($theme);
});
// Apply link arrow visibility from config
$effect(() => {
if ($appConfig) {
document.documentElement.classList.toggle('no-link-arrows', !$appConfig.show_link_arrows);
}
});
function applyTheme(t: string) {
const namedThemes = ['solarized-light', 'solarized-dark', 'catppuccin', 'nord', 'tokyo-night', 'github-light', 'github-dark', 'dracula', 'blueberry', 'forest-green', 'gruvbox', 'midnight-tide', 'cherry-blossom', 'synthwave', 'ember', 'moonlit', 'light-coffee', 'dark-coffee', 'cotton-candy', 'crimson', 'cloud', 'peach', 'material-dark', 'material-light', 'monokai', 'rose-pine', 'everforest', 'horizon', 'cyberpunk', 'black', 'one-dark'];
const root = document.documentElement;