Skip to content

Commit

Permalink
Merge branch 'release/2.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
handcode committed Jan 12, 2023
2 parents d657066 + 62d35c9 commit 7284391
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions assets/backend/page-route-items.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,22 @@ $(function () {
// we only want to change schema, so get defined options from current editor.
var editorOptions = editor.options;
editorOptions.schema = JSON.parse(schema);
// reset startval && make all "new" options required in schema
editorOptions.startval = {};
editorOptions.required_by_default = true;
// recreate Editor
editor.destroy();
jsonEditorList[editorIndex] = new JSONEditor(element, editorOptions);
jsonEditorList[editorIndex].on('ready', function () {
// inital update of value
$('input[name="Tree[request_params]"]').val(JSON.stringify(jsonEditorList[editorIndex].getValue()));

// update/init change callback for newly inserted editor which update the input value
jsonEditorList[editorIndex].on('change', function () {
$('input[name="Tree[request_params]"]').val(JSON.stringify(jsonEditorList[editorIndex].getValue()));
});
$('input[name="Tree[request_params]"]').val(JSON.stringify(this.getValue()));
});
// update/init change callback for newly inserted editor which update the input value
jsonEditorList[editorIndex].on('change', function () {
$('input[name="Tree[request_params]"]').val(JSON.stringify(this.getValue()));
});


} else {
console.error('Editor not found.');
}
Expand Down

0 comments on commit 7284391

Please sign in to comment.