Page 1 of 1

Extend ImageMapEditor for XML files

Posted: Thu Mar 19, 2020 3:32 pm
by B_Back
I want to use the ImageMapEditor functions, which work for XHTML files, also in my XML files.
The XML files use a similar (not identical) way of describing image maps. So I have to make some changes to this functionality.
What do I have to do to create such a custom extension?
Which classes do I have to extend (from the SDK)?
Where can I find the source of the XHTML ImageMapEditor?

Thanks for your help!

Re: Extend ImageMapEditor for XML files

Posted: Fri Mar 20, 2020 2:44 pm
by Radu
Hi,

The Java sources for all our framework specific code can be found on our Maven repository:

https://www.oxygenxml.com/maven/com/oxy ... ources.jar

There is an XHTMLExtensionsBundle class which overwrites two API methods:

ro.sync.ecss.extensions.xhtml.XHTMLExtensionsBundle.getAuthorImageDecorator()
ro.sync.ecss.extensions.xhtml.XHTMLExtensionsBundle.createEditPropertiesHandler()

unfortunately the method "ro.sync.ecss.extensions.xhtml.XHTMLEditImageMapCore.getSupportedFramework(String)" relies on a "magic" enumeration value which means that extra serializarion/deserialization based on a custom XML vocabulary cannot be done right now.
I will add an internal issue to consider allowing image maps pertaining to a certain custom vocabulary to be edited via the API.
Maybe in the meantime using a plugin you can add a side view to Oxygen and allow displaying and editing the current image map directly in that side view.

Regards,
Radu

Re: Extend ImageMapEditor for XML files

Posted: Fri Mar 20, 2020 3:21 pm
by B_Back
Thx for your reply, Radu! That helps alot!
Soas far as I understand, the only thing preventing me to implement a fully working XML ImageMapEditor is the limitation of the SupportedFrameworks enum, isnt it?
I looked into the source code of the other classes and think that I could make the needed adjustments there (respectively in my own forked classes).
Our current workflow is quite special:
We transform the XML imagemap to a standard HTML imagemap, copy that code in a dummy html document and edit the map in Dreamweaver. After editing we transform it back to our XML structure and copy the imagemap to the XML file.
We can stick to this workflow until your internal issue is solved in a favorable way for me.

Re: Extend ImageMapEditor for XML files

Posted: Tue Mar 24, 2020 1:16 pm
by Radu
Hi,

I took a look at what it would take as effort on our side to allow any XML framework to contribute image map rendering and editing based on its own way of representing this information. And this is not trivial, we would probably need 1-2 weeks to refactor all that code, also this is the first request of this kind so I cannot promise we will deliver this change in the next version of Oxygen.
Maybe we need to start thinking about alternative solutions to handle this.
How about if you contribute a side view to Oxygen using a workspace access Java plugin?

https://www.oxygenxml.com/doc/versions/ ... lugin.html

The side view would register a caret listener on the current edited content and if the caret is inside or close to an image, it would use this API:

Code: Select all

ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace.createEditorComponentProvider(String[], String)
to load an XHTML equivalent of your XML framework inside the side view. There the end user would see the image with the decorated content, they would be able to double click to edit the area targets. Then when the content is saved in the side view, you would need to perform a transform on the XHTML content and obtain your custom image map XML format, then use our APIs to replace the current image map with the modified one.
So this side view could show using the converted XHTML for each image in the main editing area how it looks like with the areas visible on it and even be able to edit the areas there, save them and then the content in the main editing area would be updated.

Regards,
Radu

Re: Extend ImageMapEditor for XML files

Posted: Fri Mar 27, 2020 9:14 am
by B_Back
Hi,

thank your for your explanations. I'll try that and report back here if I need some advice again (or if I have solved my issue).

Best regards!