From 6d21c162508a7c72f3afc1df5a2d3950baa583e8 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Tue, 6 Jul 2021 15:35:59 +0200 Subject: [PATCH] Add select all shortcut + Remove addEventListener for Ctrl+C/V/A It seems like they're really not necessary --- ts/editor/SelectedTagBadge.svelte | 14 +++++++++++++- ts/editor/TagEditor.svelte | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ts/editor/SelectedTagBadge.svelte b/ts/editor/SelectedTagBadge.svelte index 708bea87a..efa91e716 100644 --- a/ts/editor/SelectedTagBadge.svelte +++ b/ts/editor/SelectedTagBadge.svelte @@ -16,6 +16,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { dotsIcon } from "./icons"; const dispatch = createEventDispatcher(); + + const allLabel = "Select all tags"; const copyLabel = "Copy tags"; const removeLabel = "Remove tags"; @@ -25,7 +27,17 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {@html dotsIcon} - + + { + dispatch("tagselectall"); + event.stopImmediatePropagation(); + }} + on:mount={withButton(createShortcut)} + >{appendInParentheses(allLabel, shortcutLabel)} + + dispatch("tagcopy")} on:mount={withButton(createShortcut)} diff --git a/ts/editor/TagEditor.svelte b/ts/editor/TagEditor.svelte index f81852116..c671b39b2 100644 --- a/ts/editor/TagEditor.svelte +++ b/ts/editor/TagEditor.svelte @@ -339,6 +339,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html document.body.removeChild(textarea); } + function selectAllTags() { + tags.forEach((tag) => (tag.selected = true)); + tags = tags; + } + function copySelectedTags() { const content = tags .filter((tag) => tag.selected) @@ -368,6 +373,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {#if tags.some((tag) => tag.selected)}