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,92 +285,96 @@ 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", {
text: "From user", icon: "ph-user ph-bold ph-lg",
action: () => { text: "From user",
os.selectUser().then((user) => { action: () => {
inputValue.value += " from:@" + Acct.toString(user); os.selectUser().then((user) => {
}); inputValue.value += " from:@" + Acct.toString(user);
} });
}, },
{ },
icon: "ph-file ph-bold ph-lg", {
text: "With file", icon: "ph-file ph-bold ph-lg",
action: () => { text: "With file",
os.select({ action: () => {
title: "Has file", os.select({
items: [ title: "Has file",
{ items: [
text: "Image", {
value: "image", text: "Image",
}, value: "image",
{ },
text: "Video", {
value: "video", text: "Video",
}, value: "video",
{ },
text: "Audio", {
value: "audio", text: "Audio",
}, value: "audio",
{ },
text: "File", {
value: "file", text: "File",
} value: "file",
] },
}).then((res) => { ],
if (res.canceled) return; }).then((res) => {
inputValue.value += " has:" + res.result; if (res.canceled) return;
}); inputValue.value += " has:" + res.result;
} });
}, },
{ },
icon: "ph-link ph-bold ph-lg", {
text: "From domain", icon: "ph-link ph-bold ph-lg",
action: () => { text: "From domain",
inputValue.value += " domain:"; action: () => {
} inputValue.value += " domain:";
}, },
{ },
icon: "ph-calendar-blank ph-bold ph-lg", {
text: "Posts before", icon: "ph-calendar-blank ph-bold ph-lg",
action: () => { text: "Posts before",
os.inputDate({ action: () => {
title: "Posts before" os.inputDate({
}).then((res) => { title: "Posts before",
if (res.canceled) return; }).then((res) => {
inputValue.value += " before:" + res.result; if (res.canceled) return;
}); inputValue.value += " before:" + res.result;
} });
}, },
{ },
icon: "ph-calendar-blank ph-bold ph-lg", {
text: "Posts after", icon: "ph-calendar-blank ph-bold ph-lg",
action: () => { text: "Posts after",
os.inputDate({ action: () => {
title: "Posts after" os.inputDate({
}).then((res) => { title: "Posts after",
if (res.canceled) return; }).then((res) => {
inputValue.value += " after:" + res.result; if (res.canceled) return;
}); inputValue.value += " after:" + res.result;
} });
}, },
{ },
icon: "ph-eye ph-bold ph-lg", {
text: "Following only", icon: "ph-eye ph-bold ph-lg",
action: () => { text: "Following only",
inputValue.value += " filter:following "; action: () => {
} inputValue.value += " filter:following ";
}, },
{ },
icon: "ph-users-three ph-bold ph-lg", {
text: "Followers only", icon: "ph-users-three ph-bold ph-lg",
action: () => { text: "Followers only",
inputValue.value += " filter:followers "; action: () => {
} 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

@ -1,5 +1,5 @@
<template> <template>
<FocusTrap <FocusTrap
:active="false" :active="false"
ref="focusTrap" ref="focusTrap"
:return-focus-on-deactivate="!noReturnFocus" :return-focus-on-deactivate="!noReturnFocus"

View File

@ -18,7 +18,7 @@
@enter="emit('opening')" @enter="emit('opening')"
@after-enter="onOpened" @after-enter="onOpened"
> >
<FocusTrap <FocusTrap
v-model:active="isActive" v-model:active="isActive"
:return-focus-on-deactivate="!noReturnFocus" :return-focus-on-deactivate="!noReturnFocus"
> >

View File

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