Closed himalaya0035lumiq closed 7 months ago
There is currently no good way to do something like that. You can make specific fields read-only or customize how they are rendered using onRenderValue
. But you can't really control it, since the user can work around it by renaming the key, then editing, and then renaming it again, or pasting content using Ctrl+V, or temporarily switch to text
mode, or tricks like that.
It would be nice to have better control over this though, we could work out a plan for that.
Related: #342
Thanks for your answer, Jos. I agree the user can work around by editing the key, changing the value then again renaming the key, but can't we disable the editing of keys altogether.
and please tell me how to get rid of context Menu. Thanks
edit: I removed it using CSS, is there a prefered way ?
.jse-absolute-popup-content, .jse-context-menu-pointer-anchor, .jse-context-menu-pointer{
display: none;
}
There is no preferred way for this kind of customization :). Your CSS will indeed prevent the ContextMenu from opening (no guarantees though that this will keep working in the future).
Thank you Jos and I disabled editing of keys by using pointer-events:none.
Using vanilla-jsoneditor": "^0.19.0", for react Let's take this json for example
{ "name" : "sample", "age" : "22", "address" : { "city" : "sample city", "country" : "sample country" } }
For a certain reason, I only want age and "address.country" to be editable and not other fields when I double click on it. is there a way to achieve the same ?
Thanks