fix popup menu

This commit is contained in:
ThatOneCalculator 2023-07-11 19:44:00 -07:00
parent e57a9a075c
commit cfb46f2775
No known key found for this signature in database
GPG key ID: 8703CACD01000000

View file

@ -54,8 +54,6 @@ const emits = defineEmits([
"changeName", "changeName",
]); ]);
let menu = ref<Promise<any> | null>(null);
const _files = computed({ const _files = computed({
get: () => props.files, get: () => props.files,
set: (value) => emits("updated", value), set: (value) => emits("updated", value),
@ -121,46 +119,45 @@ async function describe(file) {
} }
function showFileMenu(file, ev: MouseEvent) { function showFileMenu(file, ev: MouseEvent) {
if (menu) return; os.popupMenu(
menu = os [
.popupMenu( {
[ text: i18n.ts.renameFile,
{ icon: "ph-cursor-text ph-bold ph-lg",
text: i18n.ts.renameFile, action: () => {
icon: "ph-cursor-text ph-bold ph-lg", rename(file);
action: () => {
rename(file);
},
}, },
{ },
text: file.isSensitive {
? i18n.ts.unmarkAsSensitive text: file.isSensitive
: i18n.ts.markAsSensitive, ? i18n.ts.unmarkAsSensitive
icon: file.isSensitive : i18n.ts.markAsSensitive,
? "ph-eye ph-bold ph-lg" icon: file.isSensitive
: "ph-eye-slash ph-bold ph-lg", ? "ph-eye ph-bold ph-lg"
action: () => { : "ph-eye-slash ph-bold ph-lg",
toggleSensitive(file); action: () => {
}, toggleSensitive(file);
}, },
{ },
text: i18n.ts.describeFile, {
icon: "ph-subtitles ph-bold ph-lg", text: i18n.ts.describeFile,
action: () => { icon: "ph-subtitles ph-bold ph-lg",
describe(file); action: () => {
}, describe(file);
}, },
{ },
text: i18n.ts.attachCancel, {
icon: "ph-x ph-bold ph-lg", text: i18n.ts.attachCancel,
action: () => { icon: "ph-x ph-bold ph-lg",
detachMedia(file.id); action: () => {
}, detachMedia(file.id);
}, },
], },
ev.currentTarget ?? ev.target, ],
) (ev.currentTarget ?? ev.target ?? undefined) as
.then(() => (menu = null)); | HTMLElement
| undefined,
);
} }
</script> </script>