feat(frontend): 画像を投稿前にプレビュー可能に (#15341)

* feat(client): 画像をプレビュー可能に

* Update Changelog

* SPDX

* 消えてたのFix

* Add storybook for MkImgPreviewDialog

* backgroundのスタイル変更

Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>

* Add MkImgPreviewDialog to storybook generator

* Update packages/frontend/.storybook/generate.tsx

---------

Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>
This commit is contained in:
taichan
2025-02-08 17:33:09 +09:00
committed by GitHub
parent 4b98b446be
commit 2f8d02024a
5 changed files with 116 additions and 4 deletions

View File

@@ -22,20 +22,24 @@ 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,
}]"
>
{{ 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 MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import type { MenuItem } from '@/types/menu.js';
const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default));
@@ -168,6 +172,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,
});
},
});
}