diff --git a/g2p_registry_addl_info/static/src/js/g2p_additional_info.js b/g2p_registry_addl_info/static/src/js/g2p_additional_info.js index 3fe7169..d167cf2 100644 --- a/g2p_registry_addl_info/static/src/js/g2p_additional_info.js +++ b/g2p_registry_addl_info/static/src/js/g2p_additional_info.js @@ -18,10 +18,14 @@ export class G2PRegistryAddlInfoComponent extends TextField { editButtonClick() { const val = this.props.record.data[this.props.name]; - if (typeof val !== "string") { - this.props.record.data[this.props.name] = JSON.stringify(val); - } this.state.editingMode = true; + + setTimeout(() => { + if (this.textareaRef.el && val) { + const jsonVal = typeof val === "string" ? JSON.parse(val) : val; + this.textareaRef.el.value = JSON.stringify(val, null, 2); + } + }, 0); } doneButtonClick() {