zotero: fix: can't select language or store as option in citation style

- problem: in combobox widget we were always passing the
`_defaultCallback` which will send `dialogevent` to server but in
zotero's case the callback is different
- also fixes some `undefined type` errors

Signed-off-by: Rashesh Padia <rashesh.padia@collabora.com>
Change-Id: I7bd7aff6a1a3a9715123c1335ea83ab13fd7b22a
This commit is contained in:
Rashesh Padia 2024-05-21 14:18:16 +05:30 committed by Rashesh Padia
parent 93e9259aaf
commit a6cf4eb118
2 changed files with 4 additions and 3 deletions

View file

@ -1064,7 +1064,7 @@ L.Control.Zotero = L.Control.extend({
var targetEntry = this._findEntryWithUrl(searchArray, row);
if (entry && targetEntry) {
if (targetEntry.children.length === 1
if (targetEntry.children && targetEntry.children.length === 1
&& targetEntry.children[0].text === '<dummy>') {
targetEntry.children = [];
targetEntry.ondemand = undefined;
@ -1133,6 +1133,7 @@ L.Control.Zotero = L.Control.extend({
}
}
if (element === 'edit' && data.id === 'zoterosearch') {
if (data.value)
document.getElementById('zoterolist').filterEntries(data.value);
return;
}

View file

@ -279,7 +279,7 @@ JSDialog.combobox = function (parentContainer, data, builder) {
var callback = function(objectType, eventType, object, data) {
// send command with correct WindowId (from parent, not dropdown)
if (eventType !== 'close')
parentBuilder._defaultCallbackHandler(objectType, eventType, object, data, parentBuilder);
parentBuilder.callback(objectType, eventType, object, data, parentBuilder);
// close after selection
if (eventType === 'selected') {