commit f69c7d2e2daa275d7c4454817337c06b5fe9aec0
parent 8b36f335135b3d6ed2c17ec1615426429f14d5fa
Author: Adomas VenĨkauskas <adomas.ven@gmail.com>
Date: Wed, 25 Apr 2018 14:07:49 +0300
Fix a http integration client conflict with zotero addons
Diffstat:
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/xpcom/connector/httpIntegrationClient.js b/chrome/content/zotero/xpcom/connector/httpIntegrationClient.js
@@ -171,10 +171,17 @@ Zotero.HTTPIntegrationClient.Field.prototype.getText = async function() {
Zotero.HTTPIntegrationClient.Field.prototype.setText = async function(text, isRich) {
// The HTML will be stripped by Google Docs and and since we're
// caching this value, we need to strip it ourselves
- var wm = Services.wm;
- var win = wm.getMostRecentWindow('navigator:browser');
- var doc = new win.DOMParser().parseFromString(text, "text/html");
- this._text = doc.documentElement.textContent;
+ if (isRich) {
+ var win = window;
+ if (!win) {
+ var wm = Services.wm;
+ var win = wm.getMostRecentWindow('navigator:browser');
+ }
+ var doc = new win.DOMParser().parseFromString(text, "text/html");
+ this._text = doc.documentElement.textContent;
+ } else {
+ this._text = text;
+ }
return Zotero.HTTPIntegrationClient.sendCommand("Field.setText", [this._documentID, this._id, text, isRich]);
};
Zotero.HTTPIntegrationClient.Field.prototype.getCode = async function() {