Created
November 6, 2025 04:23
-
-
Save potados99/0cff32713df375249185f75c1931c1fd to your computer and use it in GitHub Desktop.
Cursor 뜯어고치기
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function adjustEditorContainerMaxHeight(editorContainer) { | |
| const conditions = [ | |
| // 현재 에디터가 Cursor 설정 패널을 표시하고 있다면, max height를 7px 줄입니다. | |
| editorContainer.querySelector(".cursor-settings-pane-outer-wrapper") !== null, | |
| // 현재 에디터가 Split View를 표시하고 있다면(git diff view), max height를 7px 줄입니다. | |
| editorContainer.querySelector(".monaco-split-view2") !== null | |
| ]; | |
| if (conditions.some(condition => condition)) { | |
| let heightValue = editorContainer.style.height; | |
| if (heightValue) { | |
| let currentHeight = parseInt(heightValue.replace("px", "")); | |
| let maxHeight = currentHeight - 7; | |
| // 높이가 음수가 되지 않도록 체크 | |
| if (maxHeight > 0) { | |
| editorContainer.style.maxHeight = `${maxHeight}px`; | |
| } | |
| } | |
| } else { | |
| // Cursor 설정 패널이 아니면 높이 조절 안 함. | |
| editorContainer.style.maxHeight = "none"; | |
| } | |
| } | |
| // 모든 editor-container를 체크하는 함수 | |
| function checkAllEditorContainers() { | |
| const editorContainers = document.querySelectorAll(".editor-container"); | |
| editorContainers.forEach((container) => { | |
| adjustEditorContainerMaxHeight(container); | |
| }); | |
| } | |
| const observer = new MutationObserver((mutations) => { | |
| mutations.forEach((mutation) => { | |
| // style 속성 변경 감지 | |
| if (mutation.type === "attributes" && mutation.attributeName === "style") { | |
| if ( | |
| mutation.target.matches && | |
| mutation.target.matches(".editor-container") | |
| ) { | |
| adjustEditorContainerMaxHeight(mutation.target); | |
| } | |
| } | |
| // DOM 변경 시 모든 editor-container 체크 | |
| if (mutation.type === "childList") { | |
| checkAllEditorContainers(); | |
| } | |
| }); | |
| }); | |
| observer.observe(document.body, { | |
| childList: true, | |
| subtree: true, | |
| attributes: true, | |
| attributeFilter: ["style"], | |
| }); | |
| // 초기 체크 | |
| checkAllEditorContainers(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment