Extend ImageMapEditor for XML files

B_Back
Posts: 3
Joined: Thu Mar 19, 2020 3:23 pm

Extend ImageMapEditor for XML files

Post by B_Back » Thu Mar 19, 2020 3:32 pm

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!

Radu
Posts: 6923
Joined: Fri Jul 09, 2004 5:18 pm

Re: Extend ImageMapEditor for XML files

Post by Radu » Fri Mar 20, 2020 2:44 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

B_Back
Posts: 3
Joined: Thu Mar 19, 2020 3:23 pm

Re: Extend ImageMapEditor for XML files

Post by B_Back » Fri Mar 20, 2020 3:21 pm

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.

Radu
Posts: 6923
Joined: Fri Jul 09, 2004 5:18 pm

Re: Extend ImageMapEditor for XML files

Post by Radu » Tue Mar 24, 2020 1:16 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

B_Back
Posts: 3
Joined: Thu Mar 19, 2020 3:23 pm

Re: Extend ImageMapEditor for XML files

Post by B_Back » Fri Mar 27, 2020 9:14 am

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!

Post Reply