diff --git a/ts/components/DropdownItem.svelte b/ts/components/DropdownItem.svelte index 8fa598031..85cd8d130 100644 --- a/ts/components/DropdownItem.svelte +++ b/ts/components/DropdownItem.svelte @@ -11,7 +11,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html export { className as class }; export let tooltip: string | undefined = undefined; - export let tabbable: boolean = true; + export let tabbable: boolean = false; let buttonRef: HTMLButtonElement; @@ -54,7 +54,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html .btn-day { color: black; - &:active { + &:active, + &.active { background-color: button.$focus-color; color: white; } @@ -64,11 +65,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html color: white; &:hover, - &:focus { + &:focus, + &.focus { @include button.btn-night-base; } - &:active { + &:active, + &.active { background-color: button.$focus-color; color: white; } diff --git a/ts/components/WithDropdownMenu.svelte b/ts/components/WithDropdownMenu.svelte new file mode 100644 index 000000000..96d23470d --- /dev/null +++ b/ts/components/WithDropdownMenu.svelte @@ -0,0 +1,51 @@ + + + + diff --git a/ts/editor/TagAutocomplete.svelte b/ts/editor/TagAutocomplete.svelte index a7c7eaf52..96cab88b8 100644 --- a/ts/editor/TagAutocomplete.svelte +++ b/ts/editor/TagAutocomplete.svelte @@ -4,10 +4,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html --> - + + - - {#each suggestions as tag} - {tag} - {/each} - + + {#each suggestions as tag} + {tag} + {/each} + + diff --git a/ts/editor/TagEditor.svelte b/ts/editor/TagEditor.svelte index 4ba63e6a0..703c3cebc 100644 --- a/ts/editor/TagEditor.svelte +++ b/ts/editor/TagEditor.svelte @@ -12,6 +12,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { attachId, getName } from "./tags"; export let initialNames = ["en::foobar", "test", "def"]; + export let suggestions = ["en::idioms", "anki::functionality", "math"]; + export let size = isApplePlatform() ? 1.6 : 2.0; let tags = initialNames.map(attachId); @@ -90,7 +92,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
- + {#each tags as tag, index (tag.id)} @@ -107,6 +115,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html createDropdown(event.currentTarget)} on:tagupdate={appendTag} on:tagadd={appendTag} on:tagjoinprevious={joinWithLastTag} diff --git a/ts/editor/TagInput.svelte b/ts/editor/TagInput.svelte index a39f88448..67a02f5e4 100644 --- a/ts/editor/TagInput.svelte +++ b/ts/editor/TagInput.svelte @@ -6,27 +6,16 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { createEventDispatcher, onMount } from "svelte"; import { normalizeTagname } from "./tags"; - import TagAutocomplete from "./TagAutocomplete.svelte"; - export let name: string; export let input: HTMLInputElement; const dispatch = createEventDispatcher(); - function onFocus(): void { - /* dropdown.show(); */ - } - function onAccept(): void { name = normalizeTagname(name); dispatch("tagupdate", { name }); } - function dropdownBlur(): void { - onAccept(); - /* dropdown.hide(); */ - } - function onBackspace(event: KeyboardEvent) { if (input.selectionStart === 0 && input.selectionEnd === 0) { dispatch("tagjoinprevious"); @@ -99,21 +88,16 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html onMount(() => dispatch("mount", { input })); -