mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 17:26:36 -04:00
Improve enter behavior
This commit is contained in:
parent
5f1bcb691e
commit
ab429ec413
1 changed files with 4 additions and 8 deletions
|
@ -53,11 +53,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
activeInput.setSelectionRange(Infinity, Infinity);
|
activeInput.setSelectionRange(Infinity, Infinity);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChosen(chosen: string) {
|
|
||||||
onAutocomplete(chosen);
|
|
||||||
splitTag(active!, Infinity, Infinity);
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateTagName(tag: TagType): void {
|
function updateTagName(tag: TagType): void {
|
||||||
tag.name = activeName;
|
tag.name = activeName;
|
||||||
tags = tags;
|
tags = tags;
|
||||||
|
@ -111,9 +106,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (autocomplete.hasSelected()) {
|
if (autocomplete.hasSelected()) {
|
||||||
autocomplete.chooseSelected();
|
autocomplete.chooseSelected();
|
||||||
} else {
|
await tick();
|
||||||
splitTag(index, start, end);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
splitTag(index, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function splitTag(index: number, start: number, end: number): Promise<void> {
|
async function splitTag(index: number, start: number, end: number): Promise<void> {
|
||||||
|
@ -444,7 +440,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
{suggestionsPromise}
|
{suggestionsPromise}
|
||||||
on:update={updateSuggestions}
|
on:update={updateSuggestions}
|
||||||
on:select={({ detail }) => onAutocomplete(detail.selected)}
|
on:select={({ detail }) => onAutocomplete(detail.selected)}
|
||||||
on:choose={({ detail }) => onChosen(detail.chosen)}
|
on:choose={({ detail }) => onAutocomplete(detail.chosen)}
|
||||||
let:createAutocomplete
|
let:createAutocomplete
|
||||||
>
|
>
|
||||||
<TagInput
|
<TagInput
|
||||||
|
|
Loading…
Reference in a new issue