Closed see7788 closed 6 months ago
The svelte-jsoneditor
library is not very suitable for a "form" mode like you describe: only allowing edits of values.
I did a short experiment with creating an editor with readOnly=true
, and then create a custom onRenderValue
which ignores this readOnly
prop, intercepts the onPatch
event and applies that itself to the JSON data, but it comes with some difficulties (because of the readOnly
mode of the editor, and also, quickkeys don't work etc).
Besides that, you'll need to disable text
mode and table
mode. You can hide the buttons from the menu using some CSS, though when loading invalid JSON, the editor will still show a button to switch to text
mode, so it may be hard to take care of all those edge cases.
How to configure it: Only the value can be modified, the key can not be modified, the key cannot be added, and the deletion is not allowed