Vanessa 2025-02-19 16:08:26 +08:00
parent 3de93cd107
commit a9b17850ef
2 changed files with 4 additions and 4 deletions

View file

@ -43,7 +43,7 @@ export const readClipboard = async () => {
const text: {
textHTML?: string,
textPlain?: string,
files?: File,
files?: File[],
} = {textPlain: "", textHTML: ""};
if (isInAndroid()) {
text.textPlain = window.JSAndroid.readClipboard();
@ -62,7 +62,7 @@ export const readClipboard = async () => {
}
if (item.types.includes("image/png")) {
const blob = await item.getType("image/png");
text.files = new File([blob], "image.png", {type: "image/png", lastModified: Date.now()});
text.files = [new File([blob], "image.png", {type: "image/png", lastModified: Date.now()})];
}
}
return text;

View file

@ -255,7 +255,7 @@ const readLocalFile = async (protyle: IProtyle, localFiles: string[]) => {
export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEvent | {
textHTML?: string,
textPlain?: string,
files?: FileList,
files?: File[],
}) & {
target: HTMLElement
}) => {
@ -266,7 +266,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
let textHTML: string;
let textPlain: string;
let siyuanHTML: string;
let files: FileList | DataTransferItemList;
let files: FileList | DataTransferItemList | File[];
if ("clipboardData" in event) {
textHTML = event.clipboardData.getData("text/html");
textPlain = event.clipboardData.getData("text/plain");