summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkPostFormAttaches.vue
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/components/MkPostFormAttaches.vue')
-rw-r--r--packages/frontend/src/components/MkPostFormAttaches.vue37
1 files changed, 31 insertions, 6 deletions
diff --git a/packages/frontend/src/components/MkPostFormAttaches.vue b/packages/frontend/src/components/MkPostFormAttaches.vue
index bab7d22112..43348475e9 100644
--- a/packages/frontend/src/components/MkPostFormAttaches.vue
+++ b/packages/frontend/src/components/MkPostFormAttaches.vue
@@ -22,20 +22,27 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
</template>
</Sortable>
- <p :class="[$style.remain, {
- [$style.exceeded]: props.modelValue.length > 16,
- }]">{{ 16 - props.modelValue.length }}/16</p>
+ <p
+ :class="[$style.remain, {
+ [$style.exceeded]: props.modelValue.length > 16,
+ }]"
+ >
+ {{ props.modelValue.length }}/16
+ </p>
</div>
</template>
<script lang="ts" setup>
import { defineAsyncComponent, inject } from 'vue';
import * as Misskey from 'misskey-js';
+import type { MenuItem } from '@/types/menu';
+import { copyToClipboard } from '@/utility/copy-to-clipboard';
import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
import * as os from '@/os.js';
-import { misskeyApi } from '@/scripts/misskey-api.js';
+import { misskeyApi } from '@/utility/misskey-api.js';
import { i18n } from '@/i18n.js';
-import type { MenuItem } from '@/types/menu.js';
+import { prefer } from '@/preferences.js';
+import { DI } from '@/di.js';
const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default));
@@ -44,7 +51,7 @@ const props = defineProps<{
detachMediaFn?: (id: string) => void;
}>();
-const mock = inject<boolean>('mock', false);
+const mock = inject(DI.mock, false);
const emit = defineEmits<{
(ev: 'update:modelValue', value: Misskey.entities.DriveFile[]): void;
@@ -168,6 +175,14 @@ function showFileMenu(file: Misskey.entities.DriveFile, ev: MouseEvent | Keyboar
text: i18n.ts.cropImage,
icon: 'ti ti-crop',
action: () : void => { crop(file); },
+ }, {
+ text: i18n.ts.preview,
+ icon: 'ti ti-photo-search',
+ action: () => {
+ os.popup(defineAsyncComponent(() => import('@/components/MkImgPreviewDialog.vue')), {
+ file: file,
+ });
+ },
});
}
@@ -184,6 +199,16 @@ function showFileMenu(file: Misskey.entities.DriveFile, ev: MouseEvent | Keyboar
action: () => { detachAndDeleteMedia(file); },
});
+ if (prefer.s.devMode) {
+ menuItems.push({ type: 'divider' }, {
+ icon: 'ti ti-hash',
+ text: i18n.ts.copyFileId,
+ action: () => {
+ copyToClipboard(file.id);
+ },
+ });
+ }
+
os.popupMenu(menuItems, ev.currentTarget ?? ev.target).then(() => menuShowing = false);
menuShowing = true;
}