[v1.3] 兼容 FF: GM_setClipboard by cyfung1031 · Pull Request #928 · scriptscat/scriptcat

类型处理错误。参数 type 可能是字符串或对象(GMTypes.GMClipboardInfo = string | { type?: string; mimetype?: string })。当 type 是对象时,应该提取其 typemimetype 属性,而不是直接将对象传递给 setData。建议修改为:

const { type, data } = customClipboardData;
customClipboardData = undefined;
let mimeType = "text/plain";
if (typeof type === "string") {
  mimeType = type;
} else if (typeof type === "object" && type) {
  mimeType = type.type || type.mimetype || "text/plain";
}
e.clipboardData.setData(mimeType, data);
e.clipboardData.setData(type || "text/plain", data);
let mimeType = "text/plain";
if (typeof type === "string") {
mimeType = type;
} else if (typeof type === "object" && type) {
mimeType = type.type || type.mimetype || "text/plain";
}
e.clipboardData.setData(mimeType, data);