mirror of
https://github.com/ankitects/anki.git
synced 2025-11-15 00:57:13 -05:00
Add select all shortcut
+ Remove addEventListener for Ctrl+C/V/A It seems like they're really not necessary
This commit is contained in:
parent
d40e0df11b
commit
6d21c16250
2 changed files with 19 additions and 1 deletions
|
|
@ -16,6 +16,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import { dotsIcon } from "./icons";
|
import { dotsIcon } from "./icons";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
|
const allLabel = "Select all tags";
|
||||||
const copyLabel = "Copy tags";
|
const copyLabel = "Copy tags";
|
||||||
const removeLabel = "Remove tags";
|
const removeLabel = "Remove tags";
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -25,7 +27,17 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<Badge class="me-1" on:mount={withSpan(createDropdown)}>{@html dotsIcon}</Badge>
|
<Badge class="me-1" on:mount={withSpan(createDropdown)}>{@html dotsIcon}</Badge>
|
||||||
|
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<WithShortcut shortcut="C" let:createShortcut let:shortcutLabel>
|
<WithShortcut shortcut="Control+A" let:createShortcut let:shortcutLabel>
|
||||||
|
<DropdownItem
|
||||||
|
on:click={(event) => {
|
||||||
|
dispatch("tagselectall");
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
}}
|
||||||
|
on:mount={withButton(createShortcut)}
|
||||||
|
>{appendInParentheses(allLabel, shortcutLabel)}</DropdownItem
|
||||||
|
>
|
||||||
|
</WithShortcut>
|
||||||
|
<WithShortcut shortcut="Control+C" let:createShortcut let:shortcutLabel>
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
on:click={() => dispatch("tagcopy")}
|
on:click={() => dispatch("tagcopy")}
|
||||||
on:mount={withButton(createShortcut)}
|
on:mount={withButton(createShortcut)}
|
||||||
|
|
|
||||||
|
|
@ -339,6 +339,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
document.body.removeChild(textarea);
|
document.body.removeChild(textarea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectAllTags() {
|
||||||
|
tags.forEach((tag) => (tag.selected = true));
|
||||||
|
tags = tags;
|
||||||
|
}
|
||||||
|
|
||||||
function copySelectedTags() {
|
function copySelectedTags() {
|
||||||
const content = tags
|
const content = tags
|
||||||
.filter((tag) => tag.selected)
|
.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)}
|
{#if tags.some((tag) => tag.selected)}
|
||||||
<SelectedTagBadge
|
<SelectedTagBadge
|
||||||
--badge-align="-webkit-baseline-middle"
|
--badge-align="-webkit-baseline-middle"
|
||||||
|
on:tagselectall={selectAllTags}
|
||||||
on:tagcopy={copySelectedTags}
|
on:tagcopy={copySelectedTags}
|
||||||
on:tagdelete={deleteSelectedTags}
|
on:tagdelete={deleteSelectedTags}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue