mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-12 18:44:05 +02:00
fix(frontend): popupのemit型が正しく利用できるように修正 (#16826)
* fix(frontend): popupのemit型が正しく利用できるように修正 * fix: revert unnecessary code (for testing purpose) * fix lint * fix type errors * fix types * add comment * fix * fix * fix: OverloadToUnionの仕組みを変更 * add comments, clean up * fix lint * fix types * clean up [ci skip] * fix * add comments [ci skip]
This commit is contained in:
@@ -28,7 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</MkModalWindow>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
<script lang="ts" setup generic="F extends File | Blob">
|
||||
import { onMounted, useTemplateRef, ref, onUnmounted } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import Cropper from 'cropperjs';
|
||||
@@ -38,13 +38,13 @@ import * as os from '@/os.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
||||
const props = defineProps<{
|
||||
imageFile: File | Blob;
|
||||
imageFile: F;
|
||||
aspectRatio: number | null;
|
||||
uploadFolder?: string | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'ok', cropped: File | Blob): void;
|
||||
(ev: 'ok', cropped: F): void;
|
||||
(ev: 'cancel'): void;
|
||||
(ev: 'closed'): void;
|
||||
}>();
|
||||
@@ -74,8 +74,14 @@ async function ok() {
|
||||
});
|
||||
|
||||
const f = await promise;
|
||||
let finalFile: F;
|
||||
if (props.imageFile instanceof File) {
|
||||
finalFile = new File([f], props.imageFile.name, { type: f.type }) as F;
|
||||
} else {
|
||||
finalFile = f as F;
|
||||
}
|
||||
|
||||
emit('ok', f);
|
||||
emit('ok', finalFile);
|
||||
if (dialogEl.value != null) dialogEl.value.close();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user