Highlight the differences

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

Highlight the differences

Post by SmitaPatil »

Hi Team,

I am using diffUrl parameter, is there any way or parameter using which we can highlight differences by default when we compare xml files side by side.

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

Re: Highlight the differences

Post by Bogdan Dumitru »

Hi Smita,

When opening a diff, the differences are highlighted by default. If there is no difference, a green stripe is presented saying "No differences between the two files were detected".

When editing the document, the differences are automatically recomputed depending on the "runDiffOnChange" URL parameter that can have 3 values:
  • "auto" - differences are automatically recomputed if the size of the merged file is less than 10 MB, otherwise on-demand by invoking the toolbar button. This is the default value.
  • "true" - differences are automatically recomputed no matter the size
  • "false" - differences are not automatically recomputed, you have to invoke the "Re-compute differences" toolbar button

Keep in mind that here you can find a list with all available URL parameters, you may find it useful to take a look next time when seeking a custom behavior from the Web Author.
Bogdan Dumitru
http://www.oxygenxml.com
SmitaPatil
Posts: 93
Joined: Mon Aug 08, 2022 2:32 pm

Re: Highlight the differences

Post by SmitaPatil »

Hi Team,

I tried on runDiffOnChange parameter, I think differences are getting highlighted in grey color.
can we highlight differences in different color.
or at least is there any way or method to identify all differences.

Thanks & Regards,
Smita
SmitaPatil
Posts: 93
Joined: Mon Aug 08, 2022 2:32 pm

Re: Highlight the differences

Post by SmitaPatil »

Hi Team,

Now, I am able to highlight differences with different color.
I have just one question, is there any way to identify different kinds of differences eg. change because of inserting text, change because of deleted text or change because of modification?

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

Re: Highlight the differences

Post by Bogdan Dumitru »

Hi Smita,
can we highlight differences in different color.
Let's clarify the coloring strategy for each mode:
  • Two-Way Comparisons - active when you don't have the "diffBaseUrl" parameter specified.
    Just two files are compared.
    All diffs are presented by the gray highlight.
  • Three-Way Comparisons - active when you have the "diffBaseUrl" parameter specified.
    The two files are compared taking into account the base version so that conflicts can be detected.
    In this type of comparison, the differences are highlighted in additional possible colors:
    • Pink - Identifies differences in both sides where conflicts are possible.
    • Gray - Identifies an addition of a node on the left side (the current document).
    • Blue - Identifies an addition of a node on the right side (the latest version from the repository).
    • Darker Shade - Identifies specific changes within the blocks.


or at least is there any way or method to identify all differences.
Yes, there are two ways to identify all differences:
  • The "Next Block of Changes", "Previous Block of Changes", "Next Change" and "Previous Change" actions from the toolbar. You can iterate through all diffs using those actions.
    Note that the currently selected diff is highlighted with yellow.
  • The Range Ruller is presented on the left side, next to the scroll bar (if present). For each diff, a proportional square that has the same diff color is rendered.
Image


I have just one question, is there any way to identify different kinds of differences eg. change because of inserting text, change because of deleted text or change because of modification?
Yes, you can identify the different kinds of diffs:
  • because of inserting text - you should see in the left editor the inserted text highlighted with yellow and in the right editor the insertion position is marked with a black caret with a yellow arrow above.
  • because of deleted text - you should see in the left editor the position of the deleted text marked with a black caret with a yellow arrow above and in the right editor the deleted text is highlighted with yellow.
  • because of modification - you should see in both editors the modified text highlighted with yellow.

-----


Why do you want to change the colors? Do you want to see the colors like in the three-way mode or to change the gray color to be more visible or to easily differentiate between different kinds of diffs?
Please provide an example picture of how you would want the diffs to look
.
Bogdan Dumitru
http://www.oxygenxml.com
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Highlight the differences

Post by chrispitude »

Hi Bogdan,

The highlight colors are useful, especially in a three-way comparison! But in complicated diffs with lots of colors, sometimes it takes me some time to remember what the colors mean, or to re-infer it from the changes in the window. And less technical writers are not as easily able to remember or infer the color meanings.

Is there a way to quickly see the color meanings from the comparison window?

If not, perhaps there could be a tooltip that appears when the pointer is hovered over diff-shaded content? Ideally the tooltip would show the entire legend you provided:
  • Pink - Identifies differences in both sides where conflicts are possible.
  • Gray - Identifies an addition of a node on the left side (the current document).
  • Blue - Identifies an addition of a node on the right side (the latest version from the repository).
  • Darker Shade - Identifies specific changes within the blocks.
regardless of the particular color being hovered over. This would help to learn the entire color convention without having to find examples of each color to hover over and learn the information.

There are some existing tooltips in the comparison window that would need to remain in place. For example, if tags are shown, hovering over a tag shows the tooltip for that tag. So this new behavior would need to be a lower priority tooltip in shaded content that does not already show a tooltip.

What do you think?
SmitaPatil
Posts: 93
Joined: Mon Aug 08, 2022 2:32 pm

Re: Highlight the differences

Post by SmitaPatil »

Hi Team,
I don't want three way comparison.
In oxygen author, its comparing side by side, May I know if there is there any way to know if the operation which has been carried out for that changes or differences.
Please let me know if there is any to identify which kind of operation has been performed that can help me add color based on operation performed.
I am trying to achieve color code which has shown in below screenshot, anyway we can see differences side by side just want to highlight in different colors.
image.png
image.png (29.72 KiB) Viewed 1879 times

Thanks & Regards,
Smita
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Highlight the differences

Post by chrispitude »

Hi Smita,

I think the colors that Bogdan described (addition of content on one side, the other side, or both sides) is as close as you are going to get. The differences aren't broken down into exact details of what element operations are performed.

Sometimes I find that I get more insight by switching to the XML (text) view by clicking the Text button at the bottom of the comparison window.
SmitaPatil
Posts: 93
Joined: Mon Aug 08, 2022 2:32 pm

Re: Highlight the differences

Post by SmitaPatil »

Hi Team,
I just want to confirm that I need normal two xml comparison for that currently I am using only diffUrl parameter.
color code which Bogdan has described is being used in three way comparison right?
I am not using three way comparison. I am using tw way comparison.
in this two way comparison, Can we get some color code for different kind of changes such as insert, delete?

Sometimes I find that I get more insight by switching to the XML (text) view by clicking the Text button at the bottom of the comparison window.
is this option available in two way comparison? because I am not able to see this option in comparison window which I have open using diffUrl parameter?

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

Re: Highlight the differences

Post by Bogdan Dumitru »

Hi Chris,

Thank you very much for your so well-detailed feedback! You are right, in the three-way diff, users may have a hard time understanding each diff or each color.
I've registered an issue for this.

In addition to the solution you proposed, we were thinking to show a tooltip for each diff saying something like "left changed 'abc' to 'def'". What do you think about this?

---

Regarding "Sometimes I find that I get more insight by switching to the XML (text) view by clicking the Text button at the bottom of the comparison window.", that option is available only in Oxygen XML Editor, it's not available in Oxygen XML Web Author.
Would you find it useful to have a button that opens each document in a separate window in text move? Or maybe even an in-place dialog that shows the XML source.
Bogdan Dumitru
http://www.oxygenxml.com
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: Highlight the differences

Post by Bogdan Dumitru »

Hi Smita,

Thank you for offering the screenshot, now it's a little bit clearer.

Regarding switching to XML source, Oxygen XML Web Author doesn't support showing the XML source on diff.


Regarding your need, in the two-way mode the application receives two strings, let's say for example "My name is Bogdan" and "My name is Dumitru" and it cannot generically say what is deleted and what is inserted. This is because it doesn't know which version was first and it doesn't make any assumptions whether the document specified via "url" is newer than the one specified via "diffUrl".

Now that we understood your use case, we are working on a beta version of the web-author-diff-plugin that shows diffs on the left editor colored in green, and diffs on the right editor in red.
Bogdan Dumitru
http://www.oxygenxml.com
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Highlight the differences

Post by chrispitude »

Bogdan Dumitru wrote: Tue Oct 04, 2022 6:08 pmIn addition to the solution you proposed, we were thinking to show a tooltip for each diff saying something like "left changed 'abc' to 'def'". What do you think about this?
Yes, this would be extremely useful!

And you would get bonus points for describing XML-domain changes, like "wrapped A in B" or "ungrouped B" or things like that from parsing the XML tree. :) But that is a separate topic (computing the minimum distance of XML operations between A and B) and as far as I know, there is not a single well-known solution to that problem.
SmitaPatil
Posts: 93
Joined: Mon Aug 08, 2022 2:32 pm

Re: Highlight the differences

Post by SmitaPatil »

Hi Bogdan,
As you said it don't keep track that which xml version is new and which is old so we can't get any details about changes happen.
Can you please tell when web-author-diff-plugin will be available to use?
just want to confirm that, will web-author-diff-plugin keep track of new xml version and old xml version and differentiate based on it?

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

Re: Highlight the differences

Post by Bogdan Dumitru »

Hi Smita,

I was thinking to define a new coloring strategy for the 2-way diff that considers the right editor to be older (the one specified via diffUrl parameter) and colors the diffs from the left editor with green and the ones from the right editor with red.

To enable the custom coloring strategy I was thinking of either adding a new URL parameter or specifying the right-side document as the base ("diffUrl" and "diffBaseUrl" should be both specified and should have the same value).

The plugin should be ready in the near future if just need to customize the coloring.
Bogdan Dumitru
http://www.oxygenxml.com
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: Highlight the differences

Post by Bogdan Dumitru »

Hi Chris,
And you would get bonus points for describing XML-domain changes.
I think it might be possible for us to reach the bonus points but we have to analyze the problem in depth.
Bogdan Dumitru
http://www.oxygenxml.com
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: Highlight the differences

Post by Bogdan Dumitru »

Hello Smita and Chris,

We've created a beta version of web-author-diff-plugin that:
  • if both "diffUrl" and "diffBaseUrl" URL parameters are specified and are equal, the differences will be colored in red and green, red for the old version considered to be on the right side and green for the new version on the left side
  • shows a tooltip when hovering over the items within the range ruler that explains each diff
The tooltip says stuff like "left added 'ABC'", 'left changed 'tpo' to 'typo'", 'left changed tag '<p/>' to '<p id="new-id"/>''.

Download the zip from here, extract it, then upload the containing Jar file to the Web Author's Administration page, in the "Plugins" section.

red-green-with-description.png
red-green-with-description.png (140.01 KiB) Viewed 1727 times
Bogdan Dumitru
http://www.oxygenxml.com
SmitaPatil
Posts: 93
Joined: Mon Aug 08, 2022 2:32 pm

Re: Highlight the differences

Post by SmitaPatil »

Hi Team,
Thank you so much,
I wanted to check wit you that is there any event available in oxygen which will trigger once this diffUrl parameter got applied on the document?
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 let me know if there is something which will help me here?

Thanks & Regards,
Smita
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Highlight the differences

Post by chrispitude »

Hi Bogdan,

Somehow I missed that this discussion was for Web Author. Do you think the tooltip enhancements might make their way to the desktop version some day too?

- Chris
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: Highlight the differences

Post by Bogdan Dumitru »

Hello Smita,

Please see my answer from the other thread,
Bogdan Dumitru
http://www.oxygenxml.com
Bogdan Dumitru
Site Admin
Posts: 142
Joined: Tue Mar 20, 2018 5:28 pm

Re: Highlight the differences

Post by Bogdan Dumitru »

Hello Chris,

Yes, the descriptive tooltips might make their way to the desktop version someday. I've noted your interest in this.
But first, we have to clarify some aspects of the tooltips even before including them in Web Author:
- what should present when there is a change made with change tracking. Is there or to show the XML source?
- what should be present when the user adds, removes, or edits a review comment?
- do they should contain the base version in case of a conflict?
- what the tooltip should look like when the difference description is too long or too complex?
- are there any places where the tooltip should be visible too?

Feel free to give us any feedback if using the beta plugin.
Bogdan Dumitru
http://www.oxygenxml.com
Post Reply