This commit is contained in:
kakkokari-gtyih 2025-05-24 19:04:49 +09:00
parent a95878ba1b
commit 67512e0b43
4 changed files with 6 additions and 8 deletions

View File

@ -437,10 +437,7 @@ function focus() {
function chooseFileFrom(ev) { function chooseFileFrom(ev) {
if (props.mock) return; if (props.mock) return;
selectFile(ev.currentTarget ?? ev.target, { selectFiles(ev.currentTarget ?? ev.target, i18n.ts.attachFile).then(files_ => {
label: i18n.ts.attachFile,
multiple: true,
}).then(files_ => {
for (const file of files_) { for (const file of files_) {
files.value.push(file); files.value.push(file);
} }

View File

@ -24,7 +24,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { } from 'vue'; import { } from 'vue';
import MkA, { type MkABehavior } from '@/components/global/MkA.vue'; import MkA from '@/components/global/MkA.vue';
import type { MkABehavior } from '@/components/global/MkA.vue';
const props = defineProps<{ const props = defineProps<{
to?: string; to?: string;

View File

@ -64,7 +64,7 @@ const title = ref<string | null>(null);
const isSensitive = ref(false); const isSensitive = ref(false);
function chooseFile(evt) { function chooseFile(evt) {
selectFile(evt.currentTarget ?? evt.target, { multiple: true }).then(selected => { selectFiles(evt.currentTarget ?? evt.target).then(selected => {
files.value = files.value.concat(selected); files.value = files.value.concat(selected);
}); });
} }

View File

@ -166,7 +166,7 @@ export function applyWatermark(img: string | Blob, el: HTMLCanvasElement | Offsc
if (config.repeat) { if (config.repeat) {
// 余白をもたせた状態のウォーターマークを作成しておく(それをパターン繰り返しする) // 余白をもたせた状態のウォーターマークを作成しておく(それをパターン繰り返しする)
const resizedWatermark = document.createElement('canvas'); const resizedWatermark = window.document.createElement('canvas');
resizedWatermark.width = width + (config.padding ? (config.padding.left ?? 0) + (config.padding.right ?? 0) : 0); resizedWatermark.width = width + (config.padding ? (config.padding.left ?? 0) + (config.padding.right ?? 0) : 0);
resizedWatermark.height = height + (config.padding ? (config.padding.top ?? 0) + (config.padding.bottom ?? 0) : 0); resizedWatermark.height = height + (config.padding ? (config.padding.top ?? 0) + (config.padding.bottom ?? 0) : 0);
const resizedCtx = resizedWatermark.getContext('2d')!; const resizedCtx = resizedWatermark.getContext('2d')!;
@ -295,7 +295,7 @@ export function applyWatermark(img: string | Blob, el: HTMLCanvasElement | Offsc
* @returns Blob * @returns Blob
*/ */
export async function getWatermarkAppliedImage(img: Blob, config: WatermarkConfig): Promise<Blob> { export async function getWatermarkAppliedImage(img: Blob, config: WatermarkConfig): Promise<Blob> {
const canvas = document.createElement('canvas'); const canvas = window.document.createElement('canvas');
await applyWatermark(img, canvas, config); await applyWatermark(img, canvas, config);
return new Promise(resolve => canvas.toBlob(blob => resolve(blob!))); return new Promise(resolve => canvas.toBlob(blob => resolve(blob!)));
} }