Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// during the initial .set(), so we have a safety variable
// _editorLoaded to prevent a bunch of recursion
onChange: () => {
if (!this._editorLoaded) {
return;
}
this._hasEdits = true;
onUserEdit(editorContainer, this._editor.get());
this.render();
}
};
if (!this._editor) {
this._editorLoaded = false;
editorContainer.innerHTML = '';
this._editor = new JSONEditor(editorContainer, editorOptions);
setupListeners(editorContainer);
}
if (!this._hasEdits) {
this._editorLoaded = false;
// Only set the JSON when it is loaded, either because it's
// the first time we got it from the server or because the user
// hit applyEdits.
this._editor.set(this._state.lottie);
}
reannotate(editorContainer, this._state.lottie);
// We are now pretty confident that the onChange events will only be
// when the user modifies the JSON.
this._editorLoaded = true;
}// There are sometimes a few onChange events that happen
// during the initial .set(), so we have a safety variable
// _editorLoaded to prevent a bunch of recursion
onChange: () => {
if (!this._editorLoaded) {
return;
}
this._hasEdits = true;
this.render();
}
};
if (!this._editor) {
this._editorLoaded = false;
editorContainer.innerHTML = '';
this._editor = new JSONEditor(editorContainer, editorOptions);
}
if (!this._hasEdits) {
this._editorLoaded = false;
// Only set the JSON when it is loaded, either because it's
// the first time we got it from the server or because the user
// hit applyEdits.
this._editor.set(this._state.json);
}
// We are now pretty confident that the onChange events will only be
// when the user modifies the JSON.
this._editorLoaded = true;
}