From 7bde95f2212f19c96931e173702578fd8e4e8ea5 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 10 Sep 2025 00:31:28 +0800 Subject: [PATCH] save custom colour palette on colour picker open and input there doesn't seem to be an event fired when the picker is cancelled/closed, so it's still possible for work to be lost --- ts/editor/editor-toolbar/ColorPicker.svelte | 11 ++++++++++- ts/editor/editor-toolbar/HighlightColorButton.svelte | 2 ++ ts/editor/editor-toolbar/TextColorButton.svelte | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ts/editor/editor-toolbar/ColorPicker.svelte b/ts/editor/editor-toolbar/ColorPicker.svelte index 746b193a2..f5934441c 100644 --- a/ts/editor/editor-toolbar/ColorPicker.svelte +++ b/ts/editor/editor-toolbar/ColorPicker.svelte @@ -4,6 +4,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html --> - + saveCustomColours({})} +/> {#if keyCombination} inputRef.click()} /> diff --git a/ts/editor/editor-toolbar/HighlightColorButton.svelte b/ts/editor/editor-toolbar/HighlightColorButton.svelte index 865ec5668..257f41aa5 100644 --- a/ts/editor/editor-toolbar/HighlightColorButton.svelte +++ b/ts/editor/editor-toolbar/HighlightColorButton.svelte @@ -19,6 +19,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import ColorPicker from "./ColorPicker.svelte"; import { context as editorToolbarContext } from "./EditorToolbar.svelte"; import WithColorHelper from "./WithColorHelper.svelte"; + import { saveCustomColours } from "@generated/backend"; export let color: string; @@ -133,6 +134,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html on:input={(event) => { color = setColor(event); bridgeCommand(`lastHighlightColor:${color}`); + saveCustomColours({}); }} on:change={() => setTextColor()} /> diff --git a/ts/editor/editor-toolbar/TextColorButton.svelte b/ts/editor/editor-toolbar/TextColorButton.svelte index 165953180..88d5e49f4 100644 --- a/ts/editor/editor-toolbar/TextColorButton.svelte +++ b/ts/editor/editor-toolbar/TextColorButton.svelte @@ -22,6 +22,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import ColorPicker from "./ColorPicker.svelte"; import { context as editorToolbarContext } from "./EditorToolbar.svelte"; import WithColorHelper from "./WithColorHelper.svelte"; + import { saveCustomColours } from "@generated/backend"; export let color: string; @@ -152,6 +153,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html on:input={(event) => { color = setColor(event); bridgeCommand(`lastTextColor:${color}`); + saveCustomColours({}); }} on:change={() => { // Delay added to work around intermittent failures on macOS/Qt6.5