mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-27 10:20:27 +01:00
設定が不十分な場合はウォーターマークをかけられないように
This commit is contained in:
parent
fabe1a17ae
commit
d1eadbd908
2 changed files with 11 additions and 2 deletions
|
@ -130,6 +130,7 @@ import { claimAchievement } from '@/scripts/achievements.js';
|
|||
import { emojiPicker } from '@/scripts/emoji-picker.js';
|
||||
import { mfmFunctionPicker } from '@/scripts/mfm-function-picker.js';
|
||||
import type { PostFormProps } from '@/types/post-form.js';
|
||||
import { canPreview } from '@/scripts/watermark';
|
||||
|
||||
const $i = signinRequired();
|
||||
|
||||
|
@ -598,7 +599,11 @@ async function onPaste(ev: ClipboardEvent) {
|
|||
const formatted = `${formatTimeString(new Date(file.lastModified), defaultStore.state.pastedFileName).replace(/{{number}}/g, `${i + 1}`)}${ext}`;
|
||||
|
||||
if (file.type.startsWith('image/')) {
|
||||
if (shouldApplyWatermark == null && defaultStore.state.clipboardWatermarkBehavior === 'confirm') {
|
||||
if (
|
||||
shouldApplyWatermark == null &&
|
||||
defaultStore.state.clipboardWatermarkBehavior === 'confirm' &&
|
||||
canPreview(defaultStore.reactiveState.watermarkConfig.value)
|
||||
) {
|
||||
const { canceled } = await os.confirm({
|
||||
type: 'info',
|
||||
text: i18n.ts.watermarkConfirm,
|
||||
|
|
|
@ -12,6 +12,7 @@ import { i18n } from '@/i18n.js';
|
|||
import { defaultStore } from '@/store.js';
|
||||
import { uploadFile } from '@/scripts/upload.js';
|
||||
import type { MenuItem } from '@/types/menu.js';
|
||||
import { canPreview } from './watermark.js';
|
||||
|
||||
export function chooseFileFromPc(opts?: {
|
||||
multiple?: boolean;
|
||||
|
@ -94,7 +95,9 @@ function select(src: HTMLElement | EventTarget | null, opts?: {
|
|||
}): Promise<Misskey.entities.DriveFile[]> {
|
||||
return new Promise((res, rej) => {
|
||||
const keepOriginal = ref(defaultStore.state.keepOriginalUploading);
|
||||
const useWatermark = ref(opts?.dontUseWatermark ? false : defaultStore.state.useWatermark);
|
||||
|
||||
const watermarkCanPreview = canPreview(defaultStore.reactiveState.watermarkConfig.value);
|
||||
const useWatermark = ref(opts?.dontUseWatermark || !watermarkCanPreview ? false : defaultStore.state.useWatermark);
|
||||
|
||||
const menu: MenuItem[] = [];
|
||||
|
||||
|
@ -115,6 +118,7 @@ function select(src: HTMLElement | EventTarget | null, opts?: {
|
|||
menu.push({
|
||||
type: 'switch',
|
||||
text: i18n.ts.useWatermark,
|
||||
disabled: !watermarkCanPreview,
|
||||
ref: useWatermark,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue