krassowski / jupyterlab-citation-manager

Citation Manager for JupyterLab using Zotero Web API
BSD 3-Clause "New" or "Revised" License
61 stars 2 forks source link

Citation manager stops working when copying cells in a new notebook #35

Open baggiponte opened 2 years ago

baggiponte commented 2 years ago

Description

I am drafting my final dissertation using Jupyter Notebooks and Jupyter Book to "compile" it into LaTeX. jupyterlab-citation-manager is a godsend, but unfortunately today I encountered some minor issues that gave me some pretty decent sized headaches.

When I moved some paragraphs (containing citations) that I had written in one notebook to another one, the extension stops working in that notebook. When I alt + c to insert a citation, the search bar appears, but nothing is inserted. It took me the cell metadata inspector to find out what happened: while the cells metadata are copied over, the notebook metadata is not.

Reproduce

EDIT: the error does not occur when copying the content of the cell (like with ctrl+c ctrl+v), but only when copying over multiple cells with Jupyter default shortcuts C V or X

Context

Possible Suggestions?

krassowski commented 2 years ago

Thank you for the report and narrowing down the likely cause. I'm sorry about the bad experience you had. I will set aside some time to fix this one during next weekend.

baggiponte commented 2 years ago

Dear Mike, do not be sorry at all! Quite the opposite, I wish I could be of greater help. I need to finish my dissertation by November 15th and then I have time to contribute. I basically just know Python (for data analytics/data science), so I do not really know how I could help. But please do let me know if there is something I could do for this project - even just writing the documentation.

krassowski commented 2 years ago

I was not able to reproduce the bug as described (by copying between notebooks, or cutting and pasting to another notebook). I was able to break it by copying a cell and pasting it again in the same notebook, which is a simpler case; I wonder if it could be that you tried to paste a cell copied from notebook A twice into the notebook B?

In my case I get the following error in the console in developer tools:

Screenshot from 2021-10-31 22-01-26

This is relatively simple to fix as we just need to re-assign the citation ID if it is already taken. I didn't find a paste-specific event for cells, but it probably should be triggered when catching the exception shown above, so that the manual edits give the same result.

If it happens again (or if you have time to try to reproduce it), would you be able to check if there is any error in the console, please? A GIF demonstration on two clean notebooks could also help, maybe I am just missing some less obvious step that leads to the occurrence of this bug.

baggiponte commented 2 years ago

Hi Mike, sorry if I could not reply to the conversation here and on the other issue - I will be more active after the 15th, I need to finish my dissertation

eldad-a commented 2 years ago

@krassowski

Thank you for this wonderful extension!

I've noticed that when I copy parts of jupyterlab cells containing citations, or move entire cells, I encounter a bug that seems related (or the same?).

At the bottom toolbar of jupyterlab there appears the following (please see snapshot)

image

stdout reads

[IPKernelApp] ERROR | No such comm target registered: jupyter.widget.control

(at the terminal from which the jupyter server has been started)

Looking into the dev tools, as you kindly suggested 35#issuecomment-955800056, here's what shows up:

image

Please let me know if any further info could help resolve.

For now, once this occurs, the work around is to remove the conflicting citation. Any other ideas?

Any suggestions how to idetify which citation is the conflicting one?

For completeness : here's the specific element that is added when trying to add a new citation when the problem occurs: image

Many thanks!