-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return something on change callback #136
base: master
Are you sure you want to change the base?
Conversation
I made it simplest way possible, to reuse current jsoneditor But I wonder maybe is should be separate PR, as then maybe we could also unify some internals. |
Thanks for your PR Tomec. I think this solution does help a little, but is no complete solution, and will give a lot of hassle for the user to do something useful with this. I think a solution like JSON-Patch will work great, and it may not be too difficult to implement. It should be implemented two way: output change objects on change, but also accept changes as input and adjust the document accordingly. Then integration with for example sharejs will be trivial. I rather want to go for a "real", long term solution rather than having a "half" solution causing a lot of questions and frustration. Few practical things:
|
Sorry for such messy PR. I have just needed quick workaround for yesterdays conference. I will upgrade it soon (at least those two things you mentioned). I use it inside Polymer Custom Element, and this feature would be useful to preserve Polymer's two-way (HTML-JS) data binding. I do not have experience with That is great that you also like going for "real" :) but do you think it should also use JSON-Patch for internal history manipulations (-> use already made implementation), or just expose/consume changes in this format? |
I think JSONEditor should use its own protocol internally, this can be similar to JSON-Patch, but for example we can gain a lot of performance by keeping detached DOM elements in memory and reusing them (for example when moving a subtree from one place to another). |
…change callback, if no change was made with undo/redo.
|
Nice job so far! Your code looks well structured and well documented. I might try to come up with a shorter name for the function I don't see any shockingly heavy operations, is there some reason you think there will be performance issues? a. For the duplicateNode issue we could give the copied node a field like |
Hey guys, is this going to happen? I'd like to see it in master ;) |
👍 Are there plans to accept this or to provide similar functionality? Thanks so much. |
Time to pick this up again. @tomalec are you still interested in finishing this feature? |
I'm very interested as I am wrapping |
Thanks @timelyportfolio, would be great if you could pick this up! |
I actually came across this issue because I actually started implementing it myself. I would be interested in helping out. |
Thanks for your offer @mmacfadden would be great if you could give this a go. |
Sorry for leaving it for so long. I'm still interesting in make it done. |
Conflicts: jsoneditor.js jsoneditor.map jsoneditor.min.js src/js/History.js src/js/textmode.js src/js/treemode.js
Any more progress on this? |
@djmattyg007 yep, I'm working on a completely new version of the JSONEditor which works with JSON-Patch internally. So the I've opened an issue describing the progress of this new version, see: #337. It will still take a couple of months to finish. |
Awesome! |
PR with suggested solution for #102
Let's return something to onChange callback.