mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-07-24 07:45:57 +02:00
Add setting to toggle link arrows (#128)
This commit is contained in:
@@ -1087,6 +1087,7 @@ pub fn set_general_settings(
|
|||||||
title_mode: String,
|
title_mode: String,
|
||||||
hide_title_in_body: bool,
|
hide_title_in_body: bool,
|
||||||
show_line_numbers: bool,
|
show_line_numbers: bool,
|
||||||
|
show_link_arrows: bool,
|
||||||
default_view_mode: bool,
|
default_view_mode: bool,
|
||||||
show_tray_icon: bool,
|
show_tray_icon: bool,
|
||||||
close_to_tray: bool,
|
close_to_tray: bool,
|
||||||
@@ -1108,6 +1109,7 @@ pub fn set_general_settings(
|
|||||||
config.title_mode = title_mode;
|
config.title_mode = title_mode;
|
||||||
config.hide_title_in_body = hide_title_in_body;
|
config.hide_title_in_body = hide_title_in_body;
|
||||||
config.show_line_numbers = show_line_numbers;
|
config.show_line_numbers = show_line_numbers;
|
||||||
|
config.show_link_arrows = show_link_arrows;
|
||||||
config.default_view_mode = default_view_mode;
|
config.default_view_mode = default_view_mode;
|
||||||
config.show_tray_icon = show_tray_icon;
|
config.show_tray_icon = show_tray_icon;
|
||||||
config.close_to_tray = close_to_tray;
|
config.close_to_tray = close_to_tray;
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ pub struct AppConfig {
|
|||||||
pub hide_title_in_body: bool,
|
pub hide_title_in_body: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub show_line_numbers: bool,
|
pub show_line_numbers: bool,
|
||||||
|
#[serde(default = "default_true")]
|
||||||
|
pub show_link_arrows: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub backup_enabled: bool,
|
pub backup_enabled: bool,
|
||||||
#[serde(default = "default_backup_frequency")]
|
#[serde(default = "default_backup_frequency")]
|
||||||
@@ -215,6 +217,7 @@ impl Default for AppConfig {
|
|||||||
title_mode: "input".to_string(),
|
title_mode: "input".to_string(),
|
||||||
hide_title_in_body: false,
|
hide_title_in_body: false,
|
||||||
show_line_numbers: false,
|
show_line_numbers: false,
|
||||||
|
show_link_arrows: true,
|
||||||
backup_enabled: false,
|
backup_enabled: false,
|
||||||
backup_frequency: "24h".to_string(),
|
backup_frequency: "24h".to_string(),
|
||||||
backup_max_count: 10,
|
backup_max_count: 10,
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ export async function setGeneralSettings(
|
|||||||
titleMode: string,
|
titleMode: string,
|
||||||
hideTitleInBody: boolean,
|
hideTitleInBody: boolean,
|
||||||
showLineNumbers: boolean,
|
showLineNumbers: boolean,
|
||||||
|
showLinkArrows: boolean,
|
||||||
defaultViewMode: boolean,
|
defaultViewMode: boolean,
|
||||||
showTrayIcon: boolean,
|
showTrayIcon: boolean,
|
||||||
closeToTray: boolean,
|
closeToTray: boolean,
|
||||||
@@ -247,6 +248,7 @@ export async function setGeneralSettings(
|
|||||||
titleMode,
|
titleMode,
|
||||||
hideTitleInBody,
|
hideTitleInBody,
|
||||||
showLineNumbers,
|
showLineNumbers,
|
||||||
|
showLinkArrows,
|
||||||
defaultViewMode,
|
defaultViewMode,
|
||||||
showTrayIcon,
|
showTrayIcon,
|
||||||
closeToTray,
|
closeToTray,
|
||||||
|
|||||||
@@ -8156,6 +8156,14 @@
|
|||||||
vertical-align: 15%;
|
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) {
|
:global(.tiptap-wrapper .tiptap a[href$=".md"]::after) {
|
||||||
content: '⤴';
|
content: '⤴';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -508,6 +508,7 @@
|
|||||||
let titleMode = $state($appConfig?.title_mode ?? 'input');
|
let titleMode = $state($appConfig?.title_mode ?? 'input');
|
||||||
let hideTitleInBody = $state($appConfig?.hide_title_in_body ?? false);
|
let hideTitleInBody = $state($appConfig?.hide_title_in_body ?? false);
|
||||||
let showLineNumbers = $state($appConfig?.show_line_numbers ?? 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 defaultViewMode = $state($appConfig?.default_view_mode ?? false);
|
||||||
let showTrayIcon = $state($appConfig?.show_tray_icon ?? false);
|
let showTrayIcon = $state($appConfig?.show_tray_icon ?? false);
|
||||||
let closeToTray = $state($appConfig?.close_to_tray ?? false);
|
let closeToTray = $state($appConfig?.close_to_tray ?? false);
|
||||||
@@ -565,15 +566,20 @@
|
|||||||
$appConfig.title_mode = titleMode;
|
$appConfig.title_mode = titleMode;
|
||||||
$appConfig.hide_title_in_body = hideTitleInBody;
|
$appConfig.hide_title_in_body = hideTitleInBody;
|
||||||
$appConfig.show_line_numbers = showLineNumbers;
|
$appConfig.show_line_numbers = showLineNumbers;
|
||||||
|
$appConfig.show_link_arrows = showLinkArrows;
|
||||||
$appConfig.default_view_mode = defaultViewMode;
|
$appConfig.default_view_mode = defaultViewMode;
|
||||||
$appConfig.show_tray_icon = showTrayIcon;
|
$appConfig.show_tray_icon = showTrayIcon;
|
||||||
$appConfig.close_to_tray = closeToTray;
|
$appConfig.close_to_tray = closeToTray;
|
||||||
$appConfig.enable_wiki_links = enableWikiLinks;
|
$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));
|
.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]) {
|
function selectTheme(preset: typeof themePresets[0]) {
|
||||||
$theme = preset.id;
|
$theme = preset.id;
|
||||||
setTheme(preset.id);
|
setTheme(preset.id);
|
||||||
@@ -964,6 +970,15 @@
|
|||||||
<span class="toggle-knob"></span>
|
<span class="toggle-knob"></span>
|
||||||
</button>
|
</button>
|
||||||
</label>
|
</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}
|
{#if !isMobile}
|
||||||
<label class="setting-toggle" style="margin-top: 12px;">
|
<label class="setting-toggle" style="margin-top: 12px;">
|
||||||
<span class="setting-label">
|
<span class="setting-label">
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ export interface AppConfig {
|
|||||||
title_mode: string;
|
title_mode: string;
|
||||||
hide_title_in_body: boolean;
|
hide_title_in_body: boolean;
|
||||||
show_line_numbers: boolean;
|
show_line_numbers: boolean;
|
||||||
|
show_link_arrows: boolean;
|
||||||
backup_enabled: boolean;
|
backup_enabled: boolean;
|
||||||
backup_frequency: string;
|
backup_frequency: string;
|
||||||
backup_max_count: number;
|
backup_max_count: number;
|
||||||
|
|||||||
@@ -16,6 +16,13 @@
|
|||||||
applyTheme($theme);
|
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) {
|
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 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;
|
const root = document.documentElement;
|
||||||
|
|||||||
Reference in New Issue
Block a user