diff --git a/src/basic.ts b/src/basic.ts index 5b56d70..42bc5fd 100644 --- a/src/basic.ts +++ b/src/basic.ts @@ -154,6 +154,10 @@ export class BasicTool { return Zotero.platformMajorVersion >= 102; } + isFX115(): boolean { + return Zotero.platformMajorVersion >= 115; + } + /** * Get DOMParser. * diff --git a/src/helpers/clipboard.ts b/src/helpers/clipboard.ts index eeefa10..a8ed88e 100644 --- a/src/helpers/clipboard.ts +++ b/src/helpers/clipboard.ts @@ -42,12 +42,14 @@ export class ClipboardHelper extends BasicTool { public addText( source: string, - type: "text/html" | "text/unicode" = "text/unicode" + type: "text/html" | "text/plain" | "text/unicode" = "text/plain" ) { const str = Components.classes[ "@mozilla.org/supports-string;1" ].createInstance(Components.interfaces.nsISupportsString); str.data = source; + // Compatible to text/unicode in fx115 + if (this.isFX115() && type === "text/unicode") type = "text/plain"; this.transferable.addDataFlavor(type); this.transferable.setTransferData(type, str, source.length * 2); return this;