mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 03:40:25 +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 { emojiPicker } from '@/scripts/emoji-picker.js';
|
||||||
import { mfmFunctionPicker } from '@/scripts/mfm-function-picker.js';
|
import { mfmFunctionPicker } from '@/scripts/mfm-function-picker.js';
|
||||||
import type { PostFormProps } from '@/types/post-form.js';
|
import type { PostFormProps } from '@/types/post-form.js';
|
||||||
|
import { canPreview } from '@/scripts/watermark';
|
||||||
|
|
||||||
const $i = signinRequired();
|
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}`;
|
const formatted = `${formatTimeString(new Date(file.lastModified), defaultStore.state.pastedFileName).replace(/{{number}}/g, `${i + 1}`)}${ext}`;
|
||||||
|
|
||||||
if (file.type.startsWith('image/')) {
|
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({
|
const { canceled } = await os.confirm({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
text: i18n.ts.watermarkConfirm,
|
text: i18n.ts.watermarkConfirm,
|
||||||
|
|
|
@ -12,6 +12,7 @@ import { i18n } from '@/i18n.js';
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
import { uploadFile } from '@/scripts/upload.js';
|
import { uploadFile } from '@/scripts/upload.js';
|
||||||
import type { MenuItem } from '@/types/menu.js';
|
import type { MenuItem } from '@/types/menu.js';
|
||||||
|
import { canPreview } from './watermark.js';
|
||||||
|
|
||||||
export function chooseFileFromPc(opts?: {
|
export function chooseFileFromPc(opts?: {
|
||||||
multiple?: boolean;
|
multiple?: boolean;
|
||||||
|
@ -94,7 +95,9 @@ function select(src: HTMLElement | EventTarget | null, opts?: {
|
||||||
}): Promise<Misskey.entities.DriveFile[]> {
|
}): Promise<Misskey.entities.DriveFile[]> {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
const keepOriginal = ref(defaultStore.state.keepOriginalUploading);
|
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[] = [];
|
const menu: MenuItem[] = [];
|
||||||
|
|
||||||
|
@ -115,6 +118,7 @@ function select(src: HTMLElement | EventTarget | null, opts?: {
|
||||||
menu.push({
|
menu.push({
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
text: i18n.ts.useWatermark,
|
text: i18n.ts.useWatermark,
|
||||||
|
disabled: !watermarkCanPreview,
|
||||||
ref: useWatermark,
|
ref: useWatermark,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue