execute js function after applying diffUrl Parameter

Having trouble installing Oxygen? Got a bug to report? Post it all here.
SmitaPatil
Posts: 93
Joined: Mon Aug 08, 2022 2:32 pm

execute js function after applying diffUrl Parameter

Post by SmitaPatil »

Hi Team,

I have used diffUrl parameter in URL for comparison of two XML documents.
I want to execute one function only when document with diffUrl has been completely loaded and differences are available in HTML DOM.
Can you please tell if there is any event available in oxygen web author which will get trigger once this diffUrl parameter got applied on the document ?
Please let me know if you need any more information from my side.


Thanks & Regards,
Smita
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: execute js function after applying diffUrl Parameter

Post by Bogdan Dumitru »

Hello Smita,

Oxygen XML Web Author doesn't have such an API to notify when the diffs are highlighted or when are updated (when using &diffType=merge).
We can decide to add such an API but first, we have to understand and validate the use case for it. Please tell us your use case.
It always helps you to first express the use case because we might be able to guide you to a better-feeted solution.
We might be able to give you a non-API way to determine that but again, we first have to know your use case so that we give you a workaround that works for you. But keep in mind that we don't offer any guarantee that a non-API would work in a future release.

Please keep just a thread per issue/question to avoid us having to answer the same question on multiple threads (see duplicate questions [1] and [2]).
Also notice that you're posting questions about Oxygen XML Web Author into the wrong product category, you're posting to the Oxygen XML Editor.

[1] viewtopic.php?p=67728#p67789
[2] viewtopic.php?p=67774#p67774
Bogdan Dumitru
http://www.oxygenxml.com
SmitaPatil
Posts: 93
Joined: Mon Aug 08, 2022 2:32 pm

Re: execute js function after applying diffUrl Parameter

Post by SmitaPatil »

Hi Bogdan,

Apology for posting in wrong category.
My use case is, I have used url and DiffUrl parameter so that I can compare the two xmls which I have mentioned as url and diffUrl.
once the comparison has been performed between two xml, I want call one function and get elements which has differences and add some css to it based on some condition
I have observed that differences will have class as "diff" once comparison has been performed.
I want to all element which has this class. So I tried to call js function once EDITOR_LOADED event got triggered but I think this event will wait until content is getting loaded not for comparison to perform. therefore I am not getting element which has class as "diff".
that's why I thought of checking with you guys if there is any event is available which will get trigger once comparison is performed and page is completely loaded and stable. then I can execute my function instead of using wait for element.
I hope use case is cleared. if you have any question or doubt about it. Please let me know.

Thanks & Regards,
Smita
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: execute js function after applying diffUrl Parameter

Post by Bogdan Dumitru »

Hi,

Thank you for detailing the use case.
First, notice that changing the DOM elements it's pretty bad for a few reasons:
- the HTML DOM is not API and even if you can in practice change its structure or attributes, it might not work in a future release because the HTML DOM changes constantly.
- the HTML DOM sometimes is re-rendered (e.g.: when the user edits the document)
- you risk generating bugs or errors, depending on how big the changes are

Regarding "add some css to it based on some condition", could you please detail what the condition is? I think that we can find a way to change diff colors.
Bogdan Dumitru
http://www.oxygenxml.com
SmitaPatil
Posts: 93
Joined: Mon Aug 08, 2022 2:32 pm

Re: execute js function after applying diffUrl Parameter

Post by SmitaPatil »

Hi Bogdan,
As you can see in below screenshot, HARDER, WELLS got wrapped inside bold. this is the difference. but text is not changing just it is wrapping inside <bold>
image.png
image.png (38.98 KiB) Viewed 937 times
So we want to highlight just the difference, in this case as difference is only the tag got added. We want to remove highlight from left side text and from right side text and on right side only tag should get highlighted. As I have shown in below screenshot.
image.png
image.png (23.82 KiB) Viewed 937 times
this is what I am trying to achieve.
Please let me know if you need any more clarification.

Thanks & Regards,
Smita
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: execute js function after applying diffUrl Parameter

Post by Bogdan Dumitru »

Hi Smita,

The fact that a surround is not reported as two differences, one on the start and one on the end tag is actually a bug in our product. We'll fix it in a future release, thank you for reporting it.
Meanwhile, we can give you a beta plug-in that has this bug fixed. Are there any other cases where a difference is not reported as expected?
Bogdan Dumitru
http://www.oxygenxml.com
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: execute js function after applying diffUrl Parameter

Post by Bogdan Dumitru »

Hi Smita,

Here [0] is a beta web-author-diff-plugin that correctly detects surrounds.
[0] https://www.oxygenxml.com/userFiles/144 ... 014424.zip
Bogdan Dumitru
http://www.oxygenxml.com
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: execute js function after applying diffUrl Parameter

Post by mihaela »

Hi,

We just released the 25.1 version of Web Author, which includes a better presentation for surround edits in the File Comparison Tool: when a piece of text is marked with a <bold> tag, it will only highlight the additional tags.

Here is the list of "What is new" in this version:
https://www.oxygenxml.com/xml_web_autho ... 5.1.0.html

Best Regards,
Mihaela Calotescu
http://www.oxygenxml.com
Post Reply