Giter Site home page Giter Site logo

Comments (5)

mariohmol avatar mariohmol commented on June 24, 2024

Hi!
Thanks for reporting this..

Can u please use this link and check if this behaviour happens?

https://stackblitz.com/edit/angular-json-editor?file=src%2Fapp%2Fapp.component.ts

from ang-jsoneditor.

MarcusRiemer avatar MarcusRiemer commented on June 24, 2024

Sure, I forked your example and added the assignment: https://stackblitz.com/edit/angular-json-editor-uodqc5

And just to make sure that we are talking about the same thing:
A quick screencast to show what happens

I am fully aware that it is impossible to automatically do much about the changing data itself: If the bound data changes there may be any number of conflicts that can't be resolved automatically. I do not expect any meaningful cursor position or expansion state if the bound data changes randomly! This is basically the same scenario a text editor is in when it detects that the edited file has changed on disk. And it resolves that by asking the user what to do: "Keep the state from the editor" or "Reload from disk"? Imho this kind of logic is far outside the scope of this neat little wrapper.

But maybe it would be possible to somehow preserve some state like the previous position of the cursor and the selected mode? At least for minor edits this should do the trick.

from ang-jsoneditor.

mariohmol avatar mariohmol commented on June 24, 2024

Gotcha!

My question is.. why you need to change the data? If you need to save this on database, just call the ajax, or if you need that in another component, you can call a event or service to pass it on

Because the problem here is to update the same data you used to build the jsoneditor

from ang-jsoneditor.

MarcusRiemer avatar MarcusRiemer commented on June 24, 2024

I use the editor as a (weak) excuse to postpone some "real" UI writing (screenshot 2 and 3). The edited data models are quite complex, so building their UI simply takes a while. Having some kind of two way databinding allows loads of experimentation: You can change the model from the (only partially finished) UI and from the editor.

As I said: I wouldn't expect the actually edited data to survive or to get merged. But I would love to see "trivial" parts the editor state preserved when changing the data. Currently even if I only "write back" the data selectively (shown in the first screenshot) things like the selected mode are lost.

Screenshot 1: Selective update, asking the user "Data has changed, which version do you prefer?"
screenshot_20180803_161609

Screenshot 2: Hardly any UI at all, only a JSON-editor
Hardly any UI at all

Screenshot 3: A little UI, but still a JSON-editor
A little UI

from ang-jsoneditor.

mariohmol avatar mariohmol commented on June 24, 2024

Thanks!!

I think i got a solution for you, check version 1.6.2.. if is not working as expected please reopen

from ang-jsoneditor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.