Fix searching for MenuItems
This commit is contained in:
@@ -25,8 +25,13 @@
|
|||||||
$: buttonStore = $api.buttonStore;
|
$: buttonStore = $api.buttonStore;
|
||||||
|
|
||||||
let elementRef: HTMLElement | undefined;
|
let elementRef: HTMLElement | undefined;
|
||||||
$: textValue = elementRef?.textContent?.toLowerCase().trim();
|
$: textValue = elementRef?.textContent?.toLowerCase().trim() || "";
|
||||||
$: data = { disabled, textValue } as MenuItemData;
|
// Fairly hacky (Svelte): only mutate the contents of the data object.
|
||||||
|
// On first registration, `data` will not contain the correct textValue,
|
||||||
|
// so it must be mutated afterwards
|
||||||
|
let data = { disabled, textValue } as MenuItemData;
|
||||||
|
$: data.disabled = disabled;
|
||||||
|
$: data.textValue = textValue;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
$api.registerItem(id, data);
|
$api.registerItem(id, data);
|
||||||
|
|||||||
Reference in New Issue
Block a user