Fix dead integration field object function calls
This commit is contained in:
parent
3f905be77e
commit
5a1cf3ab02
1 changed files with 6 additions and 5 deletions
|
@ -1130,7 +1130,7 @@ Zotero.Integration.Fields.prototype.addEditCitation = Zotero.Promise.coroutine(f
|
|||
if (fields[i].equals(field._field)) {
|
||||
// This is needed, because LibreOffice integration plugin caches the field code instead of asking
|
||||
// the document every time when calling #getCode().
|
||||
field._field = fields[i];
|
||||
field = new Zotero.Integration.CitationField(fields[i]);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -1967,10 +1967,9 @@ Zotero.Integration.Field = class {
|
|||
if (field instanceof Zotero.Integration.Field) {
|
||||
throw new Error("Trying to instantiate Integration.Field with Integration.Field, not doc field");
|
||||
}
|
||||
// This is not the best solution in terms of performance
|
||||
for (let prop in field) {
|
||||
if (prop[0] != '_' && !(prop in this)) {
|
||||
this[prop] = field[prop].bind ? field[prop].bind(field) : field[prop];
|
||||
for (let func of Zotero.Integration.Field.INTERFACE) {
|
||||
if (!(func in this)) {
|
||||
this[func] = field[func].bind(field);
|
||||
}
|
||||
}
|
||||
this._field = field;
|
||||
|
@ -2018,6 +2017,8 @@ Zotero.Integration.Field = class {
|
|||
return isRich;
|
||||
}
|
||||
};
|
||||
Zotero.Integration.Field.INTERFACE = ['delete', 'removeCode', 'select', 'setText',
|
||||
'getText', 'setCode', 'getCode', 'equals', 'getNoteIndex'];
|
||||
|
||||
/**
|
||||
* Load existing field in document and return correct instance of field type
|
||||
|
|
Loading…
Reference in a new issue