wip
This commit is contained in:
parent
cb6327dda6
commit
63b11f5e18
|
|
@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
@ok="save()"
|
@ok="save()"
|
||||||
@closed="emit('closed')"
|
@closed="emit('closed')"
|
||||||
>
|
>
|
||||||
<template #header><i class="ti ti-photo"></i> {{ i18n.ts._imageFrameEditor.title }}</template>
|
<template #header><i class="ti ti-device-ipad-horizontal"></i> {{ i18n.ts._imageFrameEditor.title }}</template>
|
||||||
|
|
||||||
<div :class="$style.root">
|
<div :class="$style.root">
|
||||||
<div :class="$style.container">
|
<div :class="$style.container">
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ export type UploaderItem = {
|
||||||
compressedSize?: number | null;
|
compressedSize?: number | null;
|
||||||
preprocessedFile?: Blob | null;
|
preprocessedFile?: Blob | null;
|
||||||
file: File;
|
file: File;
|
||||||
watermarkPresetId: string | null;
|
watermarkPresetId: string | null; // そのままpresetを入れてもいいのでは?
|
||||||
isSensitive?: boolean;
|
isSensitive?: boolean;
|
||||||
caption?: string | null;
|
caption?: string | null;
|
||||||
abort?: (() => void) | null;
|
abort?: (() => void) | null;
|
||||||
|
|
@ -332,6 +332,58 @@ export function useUploader(options: {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
uploaderFeatures.value.imageEditing &&
|
||||||
|
IMAGE_EDITING_SUPPORTED_TYPES.includes(item.file.type) &&
|
||||||
|
!item.preprocessing &&
|
||||||
|
!item.uploading &&
|
||||||
|
!item.uploaded
|
||||||
|
) {
|
||||||
|
function changePreset(presetId: string | null) {
|
||||||
|
item.imageFramePresetId = presetId;
|
||||||
|
preprocess(item).then(() => {
|
||||||
|
triggerRef(items);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.push({
|
||||||
|
icon: 'ti ti-device-ipad-horizontal',
|
||||||
|
text: i18n.ts.frame,
|
||||||
|
//caption: computed(() => item.watermarkPresetId == null ? null : prefer.s.watermarkPresets.find(p => p.id === item.watermarkPresetId)?.name),
|
||||||
|
type: 'parent',
|
||||||
|
children: [{
|
||||||
|
type: 'radioOption',
|
||||||
|
text: i18n.ts.none,
|
||||||
|
active: computed(() => item.watermarkPresetId == null),
|
||||||
|
action: () => changePreset(null),
|
||||||
|
}, {
|
||||||
|
type: 'divider',
|
||||||
|
}, ...prefer.s.watermarkPresets.map(preset => ({
|
||||||
|
type: 'radioOption' as const,
|
||||||
|
text: preset.name,
|
||||||
|
active: computed(() => item.watermarkPresetId === preset.id),
|
||||||
|
action: () => changePreset(preset.id),
|
||||||
|
})), ...(prefer.s.watermarkPresets.length > 0 ? [{
|
||||||
|
type: 'divider' as const,
|
||||||
|
}] : []), {
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ti ti-plus',
|
||||||
|
text: i18n.ts.add,
|
||||||
|
action: async () => {
|
||||||
|
const { dispose } = await os.popupAsyncWithDialog(import('@/components/MkImageFrameEditorDialog.vue').then(x => x.default), {
|
||||||
|
image: item.file,
|
||||||
|
}, {
|
||||||
|
ok: (preset) => {
|
||||||
|
prefer.commit('imageFramePresets', [...prefer.s.imageFramePresets, preset]);
|
||||||
|
changePreset(preset.id);
|
||||||
|
},
|
||||||
|
closed: () => dispose(),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(IMAGE_COMPRESSION_SUPPORTED_TYPES.includes(item.file.type) || VIDEO_COMPRESSION_SUPPORTED_TYPES.includes(item.file.type)) &&
|
(IMAGE_COMPRESSION_SUPPORTED_TYPES.includes(item.file.type) || VIDEO_COMPRESSION_SUPPORTED_TYPES.includes(item.file.type)) &&
|
||||||
!item.preprocessing &&
|
!item.preprocessing &&
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<SearchMarker :keywords="['label', 'frame', 'credit', 'metadata']">
|
<SearchMarker :keywords="['label', 'frame', 'credit', 'metadata']">
|
||||||
<MkFolder>
|
<MkFolder>
|
||||||
<template #icon><i class="ti ti-photo"></i></template>
|
<template #icon><i class="ti ti-device-ipad-horizontal"></i></template>
|
||||||
<template #label><SearchLabel>{{ i18n.ts.frame }}</SearchLabel></template>
|
<template #label><SearchLabel>{{ i18n.ts.frame }}</SearchLabel></template>
|
||||||
<template #caption>{{ i18n.ts._imageFrameEditor.tip }}</template>
|
<template #caption>{{ i18n.ts._imageFrameEditor.tip }}</template>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue