Replicate Insert Image Dialog from Oxygen XML Editor

Are you missing a feature? Request its implementation here.
dreifsnider
Posts: 105
Joined: Thu Aug 30, 2018 10:06 pm

Replicate Insert Image Dialog from Oxygen XML Editor

Post 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
editor-insert-image-dialog-options.png (46.24 KiB) Viewed 560 times
web-author-insert-image-dialog-options.png
web-author-insert-image-dialog-options.png (82.55 KiB) Viewed 560 times
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
editor-insert-image-action.png (64.23 KiB) Viewed 560 times
Any help with replicating this dialog for the Insert Image action in Web Author would be appreciated!

Daniel
Attachments
editor-insert-image-dialog-options.png
editor-insert-image-dialog-options.png (46.24 KiB) Viewed 560 times
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: Replicate Insert Image Dialog from Oxygen XML Editor

Post 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: "."})
Bogdan Dumitru
http://www.oxygenxml.com
dreifsnider
Posts: 105
Joined: Thu Aug 30, 2018 10:06 pm

Re: Replicate Insert Image Dialog from Oxygen XML Editor

Post 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
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: Replicate Insert Image Dialog from Oxygen XML Editor

Post 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.
Bogdan Dumitru
http://www.oxygenxml.com
Post Reply