mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Make tagunique a more general tagaccept
* tagaccept includes what was previous done by on:blur * on:blur in TagInput was in some cases not bubbled up to TagEditor for some reason
This commit is contained in:
parent
68bbc8d25d
commit
2e00dc09d6
2 changed files with 7 additions and 14 deletions
|
@ -194,10 +194,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
await tick();
|
await tick();
|
||||||
input.setSelectionRange(0, 0);
|
input.setSelectionRange(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function activate(index: number): void {
|
|
||||||
active = index;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<StickyBottom>
|
<StickyBottom>
|
||||||
|
@ -219,25 +215,25 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
bind:name={tag.name}
|
bind:name={tag.name}
|
||||||
bind:input
|
bind:input
|
||||||
on:keydown={updateAutocomplete}
|
on:keydown={updateAutocomplete}
|
||||||
on:blur={() => {
|
|
||||||
destroyAutocomplete();
|
|
||||||
decideNextActive();
|
|
||||||
}}
|
|
||||||
on:tagsplit={({ detail }) =>
|
on:tagsplit={({ detail }) =>
|
||||||
splitTag(tag, index, detail.start, detail.end)}
|
splitTag(tag, index, detail.start, detail.end)}
|
||||||
on:tagadd={() => insertTag(tag, index)}
|
on:tagadd={() => insertTag(tag, index)}
|
||||||
on:tagdelete={() => deleteActiveTag(tag, index)}
|
on:tagdelete={() => deleteActiveTag(tag, index)}
|
||||||
on:tagunique={() => deleteActiveTagIfNotUnique(tag, index)}
|
|
||||||
on:tagjoinprevious={() => joinWithPreviousTag(tag, index)}
|
on:tagjoinprevious={() => joinWithPreviousTag(tag, index)}
|
||||||
on:tagjoinnext={() => joinWithNextTag(tag, index)}
|
on:tagjoinnext={() => joinWithNextTag(tag, index)}
|
||||||
on:tagmoveprevious={() => moveToPreviousTag(tag, index)}
|
on:tagmoveprevious={() => moveToPreviousTag(tag, index)}
|
||||||
on:tagmovenext={() => moveToNextTag(tag, index)}
|
on:tagmovenext={() => moveToNextTag(tag, index)}
|
||||||
|
on:tagaccept={() => {
|
||||||
|
deleteActiveTagIfNotUnique(tag, index);
|
||||||
|
destroyAutocomplete();
|
||||||
|
decideNextActive();
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<Tag
|
<Tag
|
||||||
name={tag.name}
|
name={tag.name}
|
||||||
bind:blink={tag.blink}
|
bind:blink={tag.blink}
|
||||||
on:click={() => activate(index)}
|
on:click={() => (active = index)}
|
||||||
on:tagdelete={() => deleteTag(tag, index)}
|
on:tagdelete={() => deleteTag(tag, index)}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -81,7 +81,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
dispatch("tagdelete");
|
dispatch("tagdelete");
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch("tagunique");
|
dispatch("tagaccept");
|
||||||
}
|
}
|
||||||
|
|
||||||
function onEnter(event: Event): void {
|
function onEnter(event: Event): void {
|
||||||
|
@ -177,13 +177,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
type="text"
|
type="text"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
size="1"
|
size="1"
|
||||||
on:focus
|
|
||||||
on:blur={onBlur}
|
on:blur={onBlur}
|
||||||
on:blur
|
|
||||||
on:keydown={onKeydown}
|
on:keydown={onKeydown}
|
||||||
on:keydown
|
on:keydown
|
||||||
on:paste={onPaste}
|
on:paste={onPaste}
|
||||||
on:click
|
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue