Jsoneditor: On deleteing a node, the tree-path keeps the path of deleted node

Created on 9 Oct 2018  路  4Comments  路  Source: josdejong/jsoneditor

When we delete a node, the tree-path still contains the path of deleted node i.e. Null and not the newly-focused node i.e. Number in our case.
output

Edit: Also noticed a similar behaviour when we undo from the top bar.

bug

All 4 comments

Thanks for reporting. I've partially fixed it. Still have to fix it for undo/redo and dragging

I, on the other hand, tried to fix this part (undo/redo/dragging still pending, but this particular one works) with following change somewhere around the following line: https://github.com/josdejong/jsoneditor/blob/b45993ccd56f76b1f9eb412672dba871f4869eb0/src/js/Node.js#L3395

editor._updateTreePath(this.getNodeFromTarget(editor.focusTarget).getNodePath());
Not sure if this helps, sharing anyway

@tanmayrajani with my fix in should work now for the remove action with this fix https://github.com/josdejong/jsoneditor/commit/37e609d4d8b5997ff77cf08bcfc92f6b1223447b. I try to solve it at a single place where it works for any action and any change in selection but for undo/redo it's a bit tricky to figure out.

I found the cause, this.selection wasn't up to date right after an action was executed, and my solution to update the treepath was based on that. The tree path should now work for all actions and for undo/redo too in the just published v5.25.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fyyyyy picture fyyyyy  路  8Comments

MarkHerhold picture MarkHerhold  路  3Comments

hoogw picture hoogw  路  6Comments

bnewcomer picture bnewcomer  路  6Comments

ricardogaspar2 picture ricardogaspar2  路  3Comments