Changes in Zotero version 6 and LibreOffice Plugin Wire Protocol

119 views
Skip to first unread message

Michael Jungnickl

unread,
Jul 15, 2022, 12:31:16 PM7/15/22
to zotero-dev
Hello, 

our TextMaker writer application (part of SoftMaker Office and FreeOffice) uses the  LibreOffice Plugin Wire Protocol and of course the LibreOffice plugin. 

Link to documentation
https://www.zotero.org/support/dev/client_coding/libreoffice_plugin_wire_protocol

With the new Zotero version 6 and TextMaker there is a warning message shown in Zotero that the plugin is not up-to-date.

Of course is the updated LibreOffice plugin and it works with LibreOffice 7 and Zotero 6. 

***

After some testing with LibreOffice and Zotero 6 I see that the Integration Commands were changed. 

Old integration commands: 

"addEditCitation""            // Add/Edit a citation. 
"addEditBibliography"    // Add/Edit the bibliography
"setDocPrefs"                  // Change the citation style or other document parameters
"refresh"                        // Refresh all fields in the document
"removeCodes"            // Remove field codes from the document 

Beware that add / edit commands for citations and bibliography use this command above. This is different to the documentation. 

New integration command (sample): 

{"command": "setDocPrefs", "templateVersion": 1} 

When I change it for all commands in TextMaker it works well. 

Question 1: I don't know what the "templateVersion" variable is used for, and it's values. 
It's not not part of the documentation. 

Question 2: Are other commands etc... changed which must be fixed too? 

adoma...@gmail.com

unread,
Jul 20, 2022, 9:48:08 AM7/20/22
to zotero-dev
Hi Michael,

Sorry we did not update the docs for Zotero 6 changes. I have done so now: https://www.zotero.org/support/dev/client_coding/libreoffice_plugin_wire_protocol

Note that we added a new button in the LibreOffice plugin with Zotero 6, which corresponds to the new command `addNote`. There are also two additional commands that plugin needs to handle if they add this button and the command: `insertText` and `convertPlaceholdersToFields`, both now described in the docs. There have been no compatibility-breaking changes to the existing commands, so if you just update your command signature your users should be able to use the plugin without issues although we urge you to implement the full API.

Best wishes,
Adomas

Michael Jungnickl

unread,
Jul 26, 2022, 10:29:52 AM7/26/22
to zotero-dev
Hello Adomas, 

thank you very much for your fast reply and the updated documentation. 

There are now seven integration commands. Two of them are new. 

I tested it with Word 2016 and LibreOffice 7.3 Writer.  

1. “addNote”

It has an icon in Word and Writer. Clicking to it opens an edit control in Zotero. I type in some text and confirm it. But nothing happened. 

What is this note? Do I have to set some special view mode in Word and Writer to see it?

Where is it saved (document text, Zotero database)? 

2.  “exportDocument”

I can't find an icon in Word and Writer. Is it optional (and I just don't see it)? 

Since it is a integration command it should have a button for the user to click to. 

It seems to be equal to the Word processor commands 
- Document_importDocument
- Document_exportDocument ? 

Both commands are implemented in TextMaker. 

Bye, 

Michael 

adoma...@gmail.com

unread,
Jul 27, 2022, 3:31:26 AM7/27/22
to zotero-dev
`addNote` is used to insert Zotero notes that you create in Zotero UI, e.g. when you read a PDF, or any other way. They may also contain citations themselves. See https://www.zotero.org/blog/zotero-6/

You don't have to use `exportDocument`. It's available as a command because Google Docs has a UI menu option to export the document (called "Switch word processors" in the menu). It's been available for a while, but we didn't have it documented, so I just filled that gap in the docs.

Adomas

Michael Jungnickl

unread,
Jul 28, 2022, 10:26:12 AM7/28/22
to zotero-dev
Hello Adomas, 

thank you for your reply. 

I fixed the source code in TextMaker. 


Question: 

Is the "addNote" command broken in LibreOffice 7.3 and Word 2016? 


When testing it with both applications I got an edit control from Zotero, insert same text, confirm it, but nothing is shown in both applications. 

I compared messages with LibreOffice 7.3 and TextMaker. Both are identicall now. 

Zotero 6 doesn't send the command Document_InsertText. 
It send Document_InsertField with a TEMP field data only. 

Full command sequence: 
command: addNote templateVersion: 1
Application_getActiveDocument
Document_getDocumentData
Document_canInsertField
Document_canInsertField
Document_cursorInField
Document_insertField
Field_setCode - with TEMP
Document_getFields
Field_delete
Document_setDocumentData
Document_activate
Document_complete

Michael 

Dan Stillman

unread,
Jul 28, 2022, 3:52:31 PM7/28/22
to zoter...@googlegroups.com
On 7/28/22 10:26 AM, Michael Jungnickl wrote:
> Is the "addNote" command broken in LibreOffice 7.3 and Word 2016?
>
>
> When testing it with both applications I got an edit control from
> Zotero, insert same text, confirm it, but nothing is shown in both
> applications.

It's not broken. This feature inserts a note from the Zotero database
into the document, with active Zotero citations. You have to actually
select a note from the search results. (What should happen if you enter
random text that doesn't match anything and press Return is debatable.
Right now that just closes both the Add/Edit Citation and Add Note
dialogs without inserting anything.)

https://www.zotero.org/blog/zotero-6/#adding_notes_to_word_processors

Michael Jungnickl

unread,
Jul 29, 2022, 5:18:12 AM7/29/22
to zotero-dev
Hello Dan, 

can you give step by step instructions how it should work with Libre Office 7 and Word 2016? 

Where are the search results? The edit box does only show my text input. 


I tested it with Word 2016 and Libre Office 7.
Selecting fields and footnotes. And adding notes.
In both cases adding a note deletes the field and footnote and nothing is shown. 

Adding a note into normal text does nothing. 

Thank you very much, 

Michael Jungnickl 

Dan Stillman

unread,
Jul 29, 2022, 5:27:25 AM7/29/22
to zoter...@googlegroups.com
On 7/29/22 5:18 AM, Michael Jungnickl wrote:
> can you give step by step instructions how it should work with Libre
> Office 7 and Word 2016?

1) Create a note in Zotero with the word "foo" in it.
2) Click "Add Note" in Word or LibreOffice.
3) Type "foo" into the yellow dialog
4) Select the note from the search results
5) Press Return.

The contents of the note will be inserted into the word processor. If
there were citations in the note (e.g., from adding annotations to the
note), those will be inserted as active citations.

https://www.zotero.org/support/pdf_reader#adding_annotations_to_notes
https://www.zotero.org/blog/zotero-6/#adding_notes_to_word_processors

Michael Jungnickl

unread,
Jul 29, 2022, 5:48:56 AM7/29/22
to zotero-dev
Thank you very much Dan. 

Now it works with Word and Libre Office. 

My database simply didn't has had notes. 

Michael Jungnickl

unread,
Aug 3, 2022, 9:55:15 AM8/3/22
to zotero-dev
I think there is a small issue in the description. 

The command  Document_insertText does return a text in an html file format. And not in rich text format. 

It can also contain citations with data from the database. Before the commands send only text or rtf text with the visible data. 

The note can have heading format and multiple paragraphs. It's more like a small text editior. 

adoma...@gmail.com

unread,
Aug 4, 2022, 6:12:01 AM8/4/22
to zotero-dev
On Wednesday, 3 August 2022 at 16:55:15 UTC+3 Michael_...@posteo.de wrote:
The command  Document_insertText does return a text in an html file format. And not in rich text format. 

That's as described in the documents. HTML is rich text, separate from RTF (Rich Text Format).
 
It can also contain citations with data from the database. Before the commands send only text or rtf text with the visible data. 

You're probably referring to the data-citation-items attribute. That's an artifact of the way we generate HTML from our notes and we should probably strip it before sending it to document processors, but that's not really relevant. As data- attributes do not contain any styling or semantic information for general text editors and should be ignored and/or stripped by them. Latter Zotero commands only rely on the links inserted, not any divs with data-citation-items attribute. Word processor plugin implementations should ignore that attribute.
 
The note can have heading format and multiple paragraphs. It's more like a small text editior. 

Yes. We don't explain this here as we expect someone implementing the document plugin to have enough experience (or just do some testing) with Zotero to know the general capabilities of the Zotero note editor and thus the possible content of notes. Not that it should matter to those implementing it either way. Word processors are usually able to insert HTML and format it appropriately.
Reply all
Reply to author
Forward
0 new messages