Jsoneditor: Using `difference feature` in Vanilla JS?

Created on 8 Oct 2020  路  9Comments  路  Source: josdejong/jsoneditor

Could you give me a hint to use the difference feature like the image above?
I checked the API and Example but there is no document mentioned.
Thank you very much.
image

question

All 9 comments

You can search for a suitable JSON diff library, there are quite a few high quality libraries for this.

JSONEditorOnline uses https://www.npmjs.com/package/diff-sequences under the hood.

in fact you can read the official demo's source code in inspections

but the question what i meet is how to change the inited editor's option and renew it

I'm not sure what you mean Anoninz. Do you mean there is an issue with the difference feature of the web application (https://jsoneditoronline.org), or are you building a diff feature yourself?

I'm trying to build a diff feature and here I have a question. When I change the editor's container, the class of diff_element style will disappear.
Could you tell me what am I missing?

@josdejong yes I'm also referring to the code in examples/04_load_and_save.html to upload the json files.

If you look at the CSS styles in https://github.com/josdejong/jsoneditor/blob/develop/examples/20_custom_css_style_for_nodes.html, you'll see a lot of styling is bound to the container id #containerLeft and #containerRight, so you'll have to change that.

@josdejong I see! Thank u so much!

馃憤

Was this page helpful?
0 / 5 - 0 ratings