json-editor
json-editor copied to clipboard
WYSIWYG area is rendered unusable after saving inside the "Edit JSON" pop-up.
I am using the SCEditor and it works fine with the starting values and also when I edit the input inside the editor. The only problem is when I click on "Save" in the "Edit JSON" pop-up. All the values in the WYSIWYG fields get removed, and I can't click inside it anymore. The rest of the fields are fine. The values are still in the JSON object as well.
It seems like there's some conflict between the validation and the WYSIWYG field when I press on save. Or I might be wrong.
I get the same issue with SCEditor (having text disappear and be unable to subsequently edit) by clicking "Object Properties" and enabling a previously unenabled field.
I get a similar issue I think after resetting the form's value programmatically to be something new...
Specifically, the wysiwyg box is uneditable (can still view text/source) and vast majority of toolbar buttons are disabled.
After doing lots of exploring, I think (not sure) the json editor doesn't update SCEditor's value properly when the json editor's setValue() function is called. At least I seem to have identified that the error happens whenever the setValue() function is called on an already initialised editor. I've got a hacky solution at the moment that destroys and recreates the editor every time I want to set a new value.
@jonathansberry
Anyone found a solution for this issue? I am wrestling with it now ( #751 ) and so far have not found either the cause nor a viable workaround.
Root cause is SCEditor uses iframe and json-editor moves field DOM subtrees during object property change to accommodate property ordering. Content inside iframe is lost during the move due to iframe sandbox scoping constraint. A workaround is switching to summernote with my working fork based on pr #440, which contains some bugs perhaps due to relying on an older version of summernote api. Related discussion on so
thanks @f-w – I did end up switching to SummerNote and cobbling together the changes from your fork and updating for the changes to the SummerNote api. Worked ok.