Update cropper-dialog.vue

This commit is contained in:
syuilo 2022-06-11 18:47:58 +09:00
parent 17731b978b
commit 5bf947eb0b

View file

@ -18,7 +18,7 @@
</div> </div>
</Transition> </Transition>
<div class="container"> <div class="container">
<img ref="imgEl" crossorigin="anonymous" :src="file.url" style="display: none;" @load="onImageLoad"> <img ref="imgEl" :src="imgUrl" style="display: none;" @load="onImageLoad">
</div> </div>
</div> </div>
</template> </template>
@ -34,7 +34,8 @@ import XModalWindow from '@/components/ui/modal-window.vue';
import * as os from '@/os'; import * as os from '@/os';
import { $i } from '@/account'; import { $i } from '@/account';
import { defaultStore } from '@/store'; import { defaultStore } from '@/store';
import { apiUrl } from '@/config'; import { apiUrl, url } from '@/config';
import { query } from '@/scripts/url';
const emit = defineEmits<{ const emit = defineEmits<{
(ev: 'ok', cropped: misskey.entities.DriveFile): void; (ev: 'ok', cropped: misskey.entities.DriveFile): void;
@ -47,6 +48,9 @@ const props = defineProps<{
aspectRatio: number; aspectRatio: number;
}>(); }>();
const imgUrl = `${url}/proxy/image.webp?${query({
url,
})}`;
let dialogEl = $ref<InstanceType<typeof XModalWindow>>(); let dialogEl = $ref<InstanceType<typeof XModalWindow>>();
let imgEl = $ref<HTMLImageElement>(); let imgEl = $ref<HTMLImageElement>();
let cropper: Cropper | null = null; let cropper: Cropper | null = null;