Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
🐛 Fixed broken scrolling/scroll bars in Code Injection inputs
Browse files Browse the repository at this point in the history
closes TryGhost/Ghost#9635
- CodeMirror expects default CSS box-sizing rather than `border-box` so it's scroll calculations were thrown off
- reset the `box-sizing` properties on CM elements
- remove now unnecessary  `.CodeMirror-scroll` patches that we'd put in place to cover broken scroll behaviour
- move all non-layout-specific CM styles into a `components/codemirror.css` file
  • Loading branch information
kevinansfield committed Jun 4, 2018
1 parent 7089e6a commit 0620979
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/styles/app-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
@import "components/popovers.css";
@import "components/tour.css";
@import "components/unsplash.css";
@import "components/codemirror.css";


/* Layouts: Groups of Components
Expand Down
1 change: 1 addition & 0 deletions app/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
@import "components/popovers.css";
@import "components/tour.css";
@import "components/unsplash.css";
@import "components/codemirror.css";


/* Layouts: Groups of Components
Expand Down
18 changes: 18 additions & 0 deletions app/styles/components/codemirror.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* Exclude CodeMirror from the border-box reset to avoid scrollbar problems */
.CodeMirror,
.CodeMirror * {
box-sizing: initial;
}

/* Re-apply CodeMirror's content-box styles overridden by above reset */
.CodeMirror-scroll,
.CodeMirror-sizer,
.CodeMirror-gutter,
.CodeMirror-gutters,
.CodeMirror-linenumber {
box-sizing: content-box;
}

.CodeMirror-linenumber {
min-width: 13px;
}
2 changes: 0 additions & 2 deletions app/styles/components/settings-menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@

.settings-menu-content .CodeMirror-scroll {
min-height: 170px;
overflow: hidden !important;
margin-right: 0;
}

.settings-menu-content .for-radio .input-toggle-component,
Expand Down
5 changes: 0 additions & 5 deletions app/styles/layouts/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,6 @@
border-radius: inherit;
}

.settings-code-editor .CodeMirror-scroll {
overflow: hidden !important;
margin-right: 0;
}

.settings-code-editor .cm-s-xq-light span.cm-meta {
color: #000;
}
Expand Down

0 comments on commit 0620979

Please sign in to comment.