From 03527a1f95dd2bf29c46eadd3786267f5071a60f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Thu, 22 May 2025 22:35:26 +0200 Subject: [PATCH 1/4] fix it damn it --- client/homebrew/editor/editor.less | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/homebrew/editor/editor.less b/client/homebrew/editor/editor.less index 372d8b302..d37c076ca 100644 --- a/client/homebrew/editor/editor.less +++ b/client/homebrew/editor/editor.less @@ -5,7 +5,7 @@ height : 100%; container : editor / inline-size; .codeEditor { - height : 100%; + height : calc(100% - 25px); .CodeMirror { height : 100%; } .pageLine, .snippetLine { background : #33333328; @@ -111,6 +111,6 @@ } @container editor (width < 683px) { - .editor .codeEditor .CodeMirror { height : calc(100% - 51px);} - .homePage .editor .codeEditor .CodeMirror { height : calc(100% - 25px);} + .editor .codeEditor { height : calc(100% - 51px);} + .homePage .editor .codeEditor { height : calc(100% - 25px);} } \ No newline at end of file From 9adf6dee619f761fad16a6d868a28ada38dd568d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Thu, 22 May 2025 23:29:08 +0200 Subject: [PATCH 2/4] use js for it --- client/homebrew/editor/editor.jsx | 19 +++++++++++++------ client/homebrew/editor/editor.less | 5 ----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index cf9a17303..8d331e46e 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -14,7 +14,6 @@ const EDITOR_THEME_KEY = 'HOMEBREWERY-EDITOR-THEME'; const PAGEBREAK_REGEX_V3 = /^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m; const SNIPPETBREAK_REGEX_V3 = /^\\snippet\ .*$/; -const SNIPPETBAR_HEIGHT = 25; const DEFAULT_STYLE_TEXT = dedent` /*=======--- Example CSS styling ---=======*/ /* Any CSS here will apply to your document! */ @@ -60,8 +59,9 @@ const Editor = createClass({ }, getInitialState : function() { return { - editorTheme : this.props.editorTheme, - view : 'text' //'text', 'style', 'meta', 'snippet' + editorTheme : this.props.editorTheme, + view : 'text', //'text', 'style', 'meta', 'snippet' + snippetbarHeight : 25 }; }, @@ -88,6 +88,7 @@ const Editor = createClass({ editorTheme : editorTheme }); } + this.setState({ snippetbarHeight: document.querySelector('.editor > .snippetBar').offsetHeight }); }, componentDidUpdate : function(prevProps, prevState, snapshot) { @@ -412,6 +413,9 @@ const Editor = createClass({ //Called when there are changes to the editor's dimensions update : function(){ this.codeEditor.current?.updateSize(); + const snipHeight = document.querySelector('.editor > .snippetBar').offsetHeight; + if(snipHeight !== this.state.snippetbarHeight) + this.setState({ snippetbarHeight: snipHeight }); }, updateEditorTheme : function(newTheme){ @@ -436,7 +440,8 @@ const Editor = createClass({ value={this.props.brew.text} onChange={this.props.onTextChange} editorTheme={this.state.editorTheme} - rerenderParent={this.rerenderParent} /> + rerenderParent={this.rerenderParent} + style={{ height: `calc(100% - ${this.state.snippetbarHeight}px)` }} /> ; } if(this.isStyle()){ @@ -449,7 +454,8 @@ const Editor = createClass({ onChange={this.props.onStyleChange} enableFolding={true} editorTheme={this.state.editorTheme} - rerenderParent={this.rerenderParent} /> + rerenderParent={this.rerenderParent} + style={{ height: `calc(100% - ${this.state.snippetbarHeight}px)` }} /> ; } if(this.isMeta()){ @@ -478,7 +484,8 @@ const Editor = createClass({ onChange={this.props.onSnipChange} enableFolding={true} editorTheme={this.state.editorTheme} - rerenderParent={this.rerenderParent} /> + rerenderParent={this.rerenderParent} + style={{ height: `calc(100% - ${this.state.snippetbarHeight}px)` }} /> ; } }, diff --git a/client/homebrew/editor/editor.less b/client/homebrew/editor/editor.less index d37c076ca..fb5891fbe 100644 --- a/client/homebrew/editor/editor.less +++ b/client/homebrew/editor/editor.less @@ -108,9 +108,4 @@ span { padding : 2px 5px; } } -} - -@container editor (width < 683px) { - .editor .codeEditor { height : calc(100% - 51px);} - .homePage .editor .codeEditor { height : calc(100% - 25px);} } \ No newline at end of file From 6748639ec5010a91e53e75faf1a4767913b05d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Thu, 22 May 2025 23:35:00 +0200 Subject: [PATCH 3/4] remove dumb console log from another pr --- client/homebrew/brewRenderer/brewRenderer.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index 16bd5adb0..c391d8c43 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -119,7 +119,6 @@ const BrewRenderer = (props)=>{ //useEffect to store or gather toolbar state from storage useEffect(()=>{ const toolbarState = JSON.parse(window.localStorage.getItem('hb_toolbarState')); - console.log('toolbar state:', toolbarState); toolbarState && setDisplayOptions(toolbarState); }, []); From 6960beb739c8a5be15775bf1919543e64ad40f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Thu, 22 May 2025 23:35:26 +0200 Subject: [PATCH 4/4] updating changelog to reflect reality --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 5c3a3cb34..3a5e37489 100644 --- a/changelog.md +++ b/changelog.md @@ -130,7 +130,7 @@ Fixes issue [#4146](https://github.com/naturalcrit/homebrewery/issues/4146) New snippet found at {{openSans **:fas_pencil: TEXT EDITOR :fas_arrow_right: :fas_bookmark: PAGE NUMBERING :fas_arrow_right: :fas_arrow_down_1_9: VARIABLE AUTO PAGE NUMBER**}} ##### 5e-Cleric -* [x] Fix search bar covering up snippet bar +* [x] Fix search bar covering up snippet bar (3 times) Fixes issue [#4098](https://github.com/naturalcrit/homebrewery/issues/4098)