wshanks / Zutilo

Zotero plugin providing some additional editing features
Other
1.53k stars 72 forks source link

"Add tag" shortcut not working #113

Closed qqobb closed 4 years ago

qqobb commented 4 years ago

After updating to Zotero 5.0.78, the shortcut "Item pane: Add tag" is just like "Item pane: Focus Tags tab". Previously, "Item pane: Add tag" had the same effect as pressing the "Add" button in the "Tags" tab.

It would be great if the old behavior could be restored. It was very useful for quickly tagging items. Thanks a lot for your great add-on!

wshanks commented 4 years ago

Yes, that is one of my favorite features as well. I am not sure when I will have time, but I will look into it when I can (if anyone else wants to look at it, feel free).

qqobb commented 4 years ago

I tried to track down the error.

Zotero's "Debug Output Logging" is showing a "tagPane is null" error message:

[JavaScript Error: "TypeError: tagPane is null" {file: "chrome://zutilo/content/zoteroOverlay.js" line: 101}] addTagGUI@chrome://zutilo/content/zoteroOverlay.js:101:1 keys.shortcuts.addTag@chrome://zutilo/content/keys.js:186:5 createKey/<@chrome://zutilo/content/zoteroOverlay.js:1157:17

The relevant Zutilo code in 'zoteroOverlay.js' that produces this error is here.

This error seems to result from the "Reactify item tags box" changes, see here.

I suspect that one needs to call the function 'handleAddTag' in 'tagsBox.jsx' somehow, but I don't know how to do it. The function is here.

Maybe @dstillman could help us and check whether there is a quick fix.

qqobb commented 4 years ago

It seems that one needs to replace getElementById('zotero-editpane-tags') by querySelector('.tags-box') in 'zoteroOverlay.js', see here.

wshanks commented 4 years ago

Thanks @qqobb for doing the research. It should be easy to make the fix with this information.

wshanks commented 4 years ago

I forgot to tag this issue in the commit message, but this should be closed by 6242643e4dbca050a38497eff29bc83a379de533 (available in the 3.3.1 release).

It was a little more complicated than just switching out the query functions, but I put something in that works for now...(had to query for the anonymous "Add" child button of the header and click() it because the add new tag function was no longer public).

qqobb commented 4 years ago

Great, thanks a lot! The update works like a charm.