zotero / zotero-google-docs-integration

32 stars 6 forks source link

[Chrome] Cut-pasting unlinks Zotero citations #56

Closed adomasven closed 3 years ago

adomasven commented 3 years ago

Copying from a Google Doc no longer includes paste data for application/x-vnd.google-docs-document-slice-clip+wrapped which is where the plugin used to get named range data from and perform a manual update to Google Docs. A somewhat suboptimal way to replace it would be to fetch all stored Zotero fields on doc load and then maintain a list of fields in memory and update the doc on paste from that list. I'll also post on a Google Docs bug that asks for native NamedRange copying.

adomasven commented 3 years ago

Ok, so we can restore this with some amount of additional pain to the user on document load (although maybe not too much).

Two big concerns:

  1. When you are editing with a collaborator, they insert a citation and then you cut and paste it it will become unlinked. For it to not become unlinked you either need to perform any Zotero operation in the doc (which will refresh the cache of fields present in the doc) or refresh the page before copy/paste. This will not be a frequent issue, but it will be another annoying unlinking bug that we will get reports of (alongside drag-unlinking) and need to explain to users in the forums. Unfortunately I cannot think of a way to fix it.
  2. I don't know if I can get cross-document pastes to work, although I assume I can intercept cut/copy clipboard events and include custom Zotero fields data there which we can then pick up on paste intercepts.
adomasven commented 3 years ago

Ok, so I produced a bugfix for this only to find out that it doesn't work. Apparently it's a chrome bug, and it's new in 91. I've submitted a ticket, I assume it will get solved hastily as it's quite a big regression (although it doesn't seem like it's been reported yet).

Without custom clipboard data types we cannot fix this for cross-document pastes. I'll wait for Chrome bugtracker response before looking for further ways to fix this.

adomasven commented 3 years ago

My ticket got marked as a duplicate of a private bug, but I found another closed ticket as a duplicate and this comment claims that the bugfix will be backported to Chrome 91.

adomasven commented 3 years ago

Fixed upstream