Page 1 of 1

Replicate Insert Image Dialog from Oxygen XML Editor

Posted: Thu Sep 21, 2023 2:34 am
by dreifsnider
Hi Oxygen Folks,

(apologies for all the questions!)

Is it possible to replicate the Insert Image... dialog from Oxygen XML Editor in Web Author?

For example:
editor-insert-image-dialog-options.png
web-author-insert-image-dialog-options.png
Our Web Author users are using the Insert Image toolbar button to add images; however, they are also expecting to be able to add figures (with a figure title) when using the same button. In Web Author, there's no option to add a figure title, and have the corresponding image element automatically placed in a figure element like there is in Oxygen XML Editor.

I was hoping that we could easily replicate the Insert Image action used in Oxygen XML Editor in Web Author; however, looking at the actual Insert Image action/operation preferences in Oxygen XML Editor, I don't see the arguments that are presented in the Insert Image dialog so I'm not sure where they are coming from.
editor-insert-image-action.png
Any help with replicating this dialog for the Insert Image action in Web Author would be appreciated!

Daniel

Re: Replicate Insert Image Dialog from Oxygen XML Editor

Posted: Thu Sep 21, 2023 2:32 pm
by Bogdan Dumitru
Hello Daniel,

In order to replicate the image browser dialog from Oxygen XML Editor you have to override the built-in "insert.image" action with a custom action that shows a dialog using the sync.api.Workspace.createDialog API method and that adds needed inputs. For the browsing part you can use the sync.api.Workspace.getUrlChooser API.
See also the Implementing a Custom Action and Presenting a Dialog to the User tutorials.
Then you have to compute the XML fragment to be inserted and insert it by invoking ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation, somewhat like this: actionsManager.invokeOperation("ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation", {fragment: "test", insertLocation: "."})

Re: Replicate Insert Image Dialog from Oxygen XML Editor

Posted: Fri Sep 22, 2023 3:37 am
by dreifsnider
Hi Bogdan,

Thank you for your reply.

I will investigate using the createDialog() method to recreate the insert image dialog available in Oxygen XML Editor. I'm also grateful that there's tutorials for creating a dialog and implementing a custom action.

Is there a sample of the Oxygen XML Editor insert image dialog available anywhere? It would be much easier and time saving for us if the code to build the insert image dialog is already available. Just thought I'd ask. :)

Thanks again,

Daniel

Re: Replicate Insert Image Dialog from Oxygen XML Editor

Posted: Fri Sep 22, 2023 11:23 am
by Bogdan Dumitru
Hi Daniel,

Unfortunately, the code from the insert image dialog from Oxygen XML Editor isn't available. But you might find it useful to browse the repository with sample plugins: https://github.com/oxygenxml/web-author-sample-plugins/, you might find useful examples there.