This commit is contained in:
Freeplay 2023-06-10 20:48:35 -04:00
parent f0ea3ad0a6
commit 4baf90cb71
4 changed files with 93 additions and 89 deletions

View file

@ -285,7 +285,8 @@ function onInputKeydown(evt: KeyboardEvent) {
} }
async function openSearchFilters(ev) { async function openSearchFilters(ev) {
await os.popupMenu([ await os.popupMenu(
[
{ {
icon: "ph-user ph-bold ph-lg", icon: "ph-user ph-bold ph-lg",
text: "From user", text: "From user",
@ -293,7 +294,7 @@ async function openSearchFilters(ev) {
os.selectUser().then((user) => { os.selectUser().then((user) => {
inputValue.value += " from:@" + Acct.toString(user); inputValue.value += " from:@" + Acct.toString(user);
}); });
} },
}, },
{ {
icon: "ph-file ph-bold ph-lg", icon: "ph-file ph-bold ph-lg",
@ -317,60 +318,63 @@ async function openSearchFilters(ev) {
{ {
text: "File", text: "File",
value: "file", value: "file",
} },
] ],
}).then((res) => { }).then((res) => {
if (res.canceled) return; if (res.canceled) return;
inputValue.value += " has:" + res.result; inputValue.value += " has:" + res.result;
}); });
} },
}, },
{ {
icon: "ph-link ph-bold ph-lg", icon: "ph-link ph-bold ph-lg",
text: "From domain", text: "From domain",
action: () => { action: () => {
inputValue.value += " domain:"; inputValue.value += " domain:";
} },
}, },
{ {
icon: "ph-calendar-blank ph-bold ph-lg", icon: "ph-calendar-blank ph-bold ph-lg",
text: "Posts before", text: "Posts before",
action: () => { action: () => {
os.inputDate({ os.inputDate({
title: "Posts before" title: "Posts before",
}).then((res) => { }).then((res) => {
if (res.canceled) return; if (res.canceled) return;
inputValue.value += " before:" + res.result; inputValue.value += " before:" + res.result;
}); });
} },
}, },
{ {
icon: "ph-calendar-blank ph-bold ph-lg", icon: "ph-calendar-blank ph-bold ph-lg",
text: "Posts after", text: "Posts after",
action: () => { action: () => {
os.inputDate({ os.inputDate({
title: "Posts after" title: "Posts after",
}).then((res) => { }).then((res) => {
if (res.canceled) return; if (res.canceled) return;
inputValue.value += " after:" + res.result; inputValue.value += " after:" + res.result;
}); });
} },
}, },
{ {
icon: "ph-eye ph-bold ph-lg", icon: "ph-eye ph-bold ph-lg",
text: "Following only", text: "Following only",
action: () => { action: () => {
inputValue.value += " filter:following "; inputValue.value += " filter:following ";
} },
}, },
{ {
icon: "ph-users-three ph-bold ph-lg", icon: "ph-users-three ph-bold ph-lg",
text: "Followers only", text: "Followers only",
action: () => { action: () => {
inputValue.value += " filter:followers "; inputValue.value += " filter:followers ";
}
}, },
], ev.target, { noReturnFocus: true }); },
],
ev.target,
{ noReturnFocus: true }
);
inputEl.value.focus(); inputEl.value.focus();
inputEl.value.selectRange(inputValue.value.length, inputValue.value.length); // cursor at end inputEl.value.selectRange(inputValue.value.length, inputValue.value.length); // cursor at end
} }

View file

@ -183,7 +183,7 @@ onMounted(() => {
defineExpose({ defineExpose({
focus, focus,
selectRange selectRange,
}); });
</script> </script>