mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Align suggestions with start of tag
This commit is contained in:
parent
4029a608bc
commit
69c6265111
3 changed files with 32 additions and 9 deletions
|
@ -13,15 +13,35 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
|
||||
export let toggleOpen = true;
|
||||
export let drop: "down" | "up" = "down";
|
||||
export let align: "start" | "end" | "auto" = "auto";
|
||||
|
||||
let placement: "bottom" | "top";
|
||||
$: switch (drop) {
|
||||
case "down":
|
||||
placement = "bottom";
|
||||
break;
|
||||
case "up":
|
||||
placement = "top";
|
||||
break;
|
||||
let placement: string;
|
||||
|
||||
$: {
|
||||
let blockPlacement: string;
|
||||
|
||||
switch (drop) {
|
||||
case "down":
|
||||
blockPlacement = "bottom";
|
||||
break;
|
||||
case "up":
|
||||
blockPlacement = "top";
|
||||
break;
|
||||
}
|
||||
|
||||
let inlinePlacement: string;
|
||||
|
||||
switch (align) {
|
||||
case "start":
|
||||
case "end":
|
||||
inlinePlacement = `-${align}`;
|
||||
break;
|
||||
default:
|
||||
inlinePlacement = "";
|
||||
break;
|
||||
}
|
||||
|
||||
placement = `${blockPlacement}${inlinePlacement}`;
|
||||
}
|
||||
|
||||
$: dropClass = `drop${drop}`;
|
||||
|
|
|
@ -50,6 +50,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
|
||||
.autocomplete-item {
|
||||
padding: 1px 7px 2px;
|
||||
|
||||
text-align: start;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
button {
|
||||
|
|
|
@ -146,7 +146,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
}
|
||||
</script>
|
||||
|
||||
<WithDropdown {drop} toggleOpen={false} let:createDropdown>
|
||||
<WithDropdown {drop} toggleOpen={false} let:createDropdown align="start">
|
||||
<slot createAutocomplete={createAutocomplete(createDropdown)} />
|
||||
|
||||
<DropdownMenu class={className} {show}>
|
||||
|
|
Loading…
Reference in a new issue