Fix a http integration client conflict with zotero addons
This commit is contained in:
parent
8b36f33513
commit
f69c7d2e2d
1 changed files with 11 additions and 4 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Reference in a new issue