How to keep position when switching between "tree" and "code" modes?
I have read https://github.com/josdejong/jsoneditor/pull/504 and still find no way to keep position when switching between "tree" and "code" modes. Is there any simple way? And why there is no button to switch between modes?
I guess you mean #524 instead of #504?
Maybe you can simply create two editors, one in code mode and one in tree mode, and always hide one of the two depending on the actual mode.
No. I mean if I caret it positioned at row 3 and column 7 in code mode and I switch to tree mode by calling setMode("tree") then caret is moved to row 1 and column 1. But I expected it will be located in that node in which caret was in previous mode.
Ok I think I understand what you mean. The code mode and tree mode are simply two different editors, they are not aware of each other. When switching to an other mode, there is basically a new editor created which starts with a clean slate. There are currently no methods to somehow keep focus on the node where the caret was.