From d4f9067b279ae18eb62c1c62089377bcd08597aa Mon Sep 17 00:00:00 2001 From: Stanislaw Adaszewski Date: Thu, 16 Apr 2020 18:38:50 +0200 Subject: [PATCH] Avoid accordion folding in WBJsonEditor but not when properties updated. --- frontend/src/js/component/wb-json-editor.js | 60 +++++++++++++-------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/frontend/src/js/component/wb-json-editor.js b/frontend/src/js/component/wb-json-editor.js index 0fe39b8..52f6011 100644 --- a/frontend/src/js/component/wb-json-editor.js +++ b/frontend/src/js/component/wb-json-editor.js @@ -3,6 +3,41 @@ import WBJsonViewer from 'wb-json-viewer'; import WBAccordion from 'wb-accordion'; import WBDialog from 'wb-dialog'; +class WbJsonEditorDialog extends Component { + constructor(...args) { + super(...args); + this.dialogRef = createRef(); + } + + render({ name, onChange }, { editValue, parseError }) { + return ( + { + onChange(JSON.parse(editValue)); + } } + canAccept={ () => { + try { JSON.parse(editValue) } + catch (exc) { this.setState({ parseError: exc.message }); return false; } + return true; + } }> +
+