From 29d40fd4ab3c1d65163680a619d0ecc2fffeb938 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Sat, 19 Jun 2021 16:26:30 +0200 Subject: [PATCH 1/2] Make Color Pickers also format with colors --- ts/editor/ColorButtons.svelte | 28 ++++++++++++++++++++++------ ts/editor/WithColorHelper.svelte | 8 ++++---- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ts/editor/ColorButtons.svelte b/ts/editor/ColorButtons.svelte index eac0cad46..cdb8f72f7 100644 --- a/ts/editor/ColorButtons.svelte +++ b/ts/editor/ColorButtons.svelte @@ -25,10 +25,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const wrapWithBackcolor = (color: string) => () => { document.execCommand("backcolor", false, color); }; + + const initialColor = "black"; + + let forecolorWrap = wrapWithForecolor(initialColor); + let backcolorWrap = wrapWithForecolor(initialColor); - + @@ -38,7 +43,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html shortcutLabel )} {disabled} - on:click={wrapWithForecolor(color)} + on:click={forecolorWrap} on:mount={createShortcut} > {@html textColorIcon} @@ -58,17 +63,23 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html widthMultiplier={0.5} > {@html arrowIcon} - + { + forecolorWrap = wrapWithForecolor(setColor(event)); + forecolorWrap(); + }} + on:mount={createShortcut} + /> - + - + {@html highlightColorIcon} {@html colorHelperIcon} @@ -81,7 +92,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {disabled} > {@html arrowIcon} - + { + backcolorWrap = wrapWithBackcolor(setColor(event)); + backcolorWrap(); + }} + /> diff --git a/ts/editor/WithColorHelper.svelte b/ts/editor/WithColorHelper.svelte index 77c5ee9e6..f991978ab 100644 --- a/ts/editor/WithColorHelper.svelte +++ b/ts/editor/WithColorHelper.svelte @@ -5,15 +5,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
- +