This is an automated email from the ASF dual-hosted git repository.

hbshin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/age-viewer.git


The following commit(s) were added to refs/heads/main by this push:
     new 30f552f  Fixed Auto rescaling after maually resizing window (#73)
30f552f is described below

commit 30f552f0103f7cd6a4aaac2050edad0259ce1441
Author: Sarthak <[email protected]>
AuthorDate: Thu Dec 29 10:46:50 2022 +0530

    Fixed Auto rescaling after maually resizing window (#73)
---
 frontend/src/components/contents/presentations/Editor.jsx        | 2 +-
 .../src/components/editor/presentations/CodeMirrorWrapper.jsx    | 9 +++++++++
 frontend/src/static/style.css                                    | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/frontend/src/components/contents/presentations/Editor.jsx 
b/frontend/src/components/contents/presentations/Editor.jsx
index 2ef22a8..4a9ebe7 100644
--- a/frontend/src/components/contents/presentations/Editor.jsx
+++ b/frontend/src/components/contents/presentations/Editor.jsx
@@ -149,7 +149,7 @@ const Editor = ({
                 Editor
               </spna>
             </div>
-            <div className="form-control col-11 editor-code-wrapper">
+            <div id="codeMirrorEditor" className="form-control col-11 
editor-code-wrapper">
               <CodeMirror
                 onClick={onClick}
                 value={command}
diff --git a/frontend/src/components/editor/presentations/CodeMirrorWrapper.jsx 
b/frontend/src/components/editor/presentations/CodeMirrorWrapper.jsx
index ab70aa5..38b892f 100644
--- a/frontend/src/components/editor/presentations/CodeMirrorWrapper.jsx
+++ b/frontend/src/components/editor/presentations/CodeMirrorWrapper.jsx
@@ -99,10 +99,19 @@ const CodeMirrorWrapper = ({
       onChange={(editor) => {
         onChange(editor.getValue());
         const lineCount = editor.lineCount();
+        let draggedHeight;
+        let height;
         if (lineCount <= 1) {
           editor.setOption('lineNumberFormatter', () => '$');
         } else {
           editor.setOption('lineNumberFormatter', (number) => number);
+          draggedHeight = 
document.getElementById('codeMirrorEditor').style.height;
+          if (draggedHeight) {
+            [height] = draggedHeight.split('px');
+            if (height < (58 + 21 * lineCount)) {
+              document.getElementById('codeMirrorEditor').style.height = null;
+            }
+          }
         }
         return true;
       }}
diff --git a/frontend/src/static/style.css b/frontend/src/static/style.css
index 29209f6..41e61e5 100644
--- a/frontend/src/static/style.css
+++ b/frontend/src/static/style.css
@@ -228,6 +228,7 @@ a[data-toggle="collapse"] {
     resize: vertical;
     overflow: auto;
     height:auto;
+    display: flex;
 }
 
 .editor-button-wrapper {

Reply via email to