From f1891d925014d8197f3b739c1e50bd7475adfe2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sun, 16 Nov 2025 19:02:37 +0100 Subject: [PATCH] use state instead --- client/homebrew/editor/editor.jsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 7148a7c22..4c753dbc3 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -58,6 +58,7 @@ const Editor = createClass({ return { editorTheme : this.props.editorTheme, view : 'text', //'text', 'style', 'meta', 'snippet' + snippetBarHeight : 26, }; }, @@ -88,11 +89,9 @@ const Editor = createClass({ if (!snippetBar) return; this.resizeObserver = new ResizeObserver(entries => { - // throttle/debounce inside if you like - const h = snippetBar.offsetHeight; - const editor = document.querySelector('.editor .codeEditor'); - if (!editor) return; - editor.style.height = `calc(100% - ${h}px)`; + const height = document.querySelector('.editor > .snippetBar').offsetHeight; + this.setState({ snippetbarHeight: height }); + console.log('setting state to ', height ); }); this.resizeObserver.observe(snippetBar); @@ -437,6 +436,7 @@ const Editor = createClass({ }, renderEditor : function(){ + console.log('state at rendering is: ',this.state.snippetBarHeight); if(this.isText()){ return <> + style={{ height: `calc(100% - ${this.state.snippetBarHeight}px)` }} /> ; } if(this.isStyle()){ @@ -461,7 +461,7 @@ const Editor = createClass({ enableFolding={true} editorTheme={this.state.editorTheme} rerenderParent={this.rerenderParent} - style={{ height: `calc(100% - 26px)` }} /> + style={{ height: `calc(100% - ${this.state.snippetBarHeight}px)` }} /> ; } if(this.isMeta()){ @@ -490,7 +490,7 @@ const Editor = createClass({ enableFolding={true} editorTheme={this.state.editorTheme} rerenderParent={this.rerenderParent} - style={{ height: `calc(100% - 26px)` }} /> + style={{ height: `calc(100% -${this.state.snippetBarHeight}px)` }} /> ; } },