Skip to content

Commit dc93109

Browse files
thomasjmmarijnh
authored andcommitted
Update PR to use .CodeMirror-line-like class
1 parent 19c620b commit dc93109

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

addon/display/placeholder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
var elt = cm.state.placeholder = document.createElement("pre");
4040
elt.style.cssText = "height: 0; overflow: visible";
4141
elt.style.direction = cm.getOption("direction");
42-
elt.className = "CodeMirror-placeholder";
42+
elt.className = "CodeMirror-placeholder CodeMirror-line-like";
4343
var placeHolder = cm.getOption("placeholder")
4444
if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder)
4545
elt.appendChild(placeHolder)

lib/codemirror.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
padding: 4px 0; /* Vertical padding around content */
1515
}
1616
.CodeMirror pre.CodeMirror-line,
17-
.CodeMirror pre.CodeMirror-measure-elem {
17+
.CodeMirror pre.CodeMirror-line-like {
1818
padding: 0 4px; /* Horizontal padding of content */
1919
}
2020

@@ -238,7 +238,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
238238
min-height: 1px; /* prevents collapsing before first draw */
239239
}
240240
.CodeMirror pre.CodeMirror-line,
241-
.CodeMirror pre.CodeMirror-measure-elem {
241+
.CodeMirror pre.CodeMirror-line-like {
242242
/* Reset some styles that the rest of the page might have set */
243243
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
244244
border-width: 0;
@@ -258,7 +258,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
258258
font-variant-ligatures: contextual;
259259
}
260260
.CodeMirror-wrap pre.CodeMirror-line,
261-
.CodeMirror-wrap pre.CodeMirror-measure-elem {
261+
.CodeMirror-wrap pre.CodeMirror-line-like {
262262
word-wrap: break-word;
263263
white-space: pre-wrap;
264264
word-break: normal;

src/measurement/position_measurement.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function paddingTop(display) {return display.lineSpace.offsetTop}
1818
export function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
1919
export function paddingH(display) {
2020
if (display.cachedPaddingH) return display.cachedPaddingH
21-
let e = removeChildrenAndAdd(display.measure, elt("pre", "x", "CodeMirror-measure-elem"))
21+
let e = removeChildrenAndAdd(display.measure, elt("pre", "x", "CodeMirror-line-like"))
2222
let style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle
2323
let data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)}
2424
if (!isNaN(data.left) && !isNaN(data.right)) display.cachedPaddingH = data
@@ -585,7 +585,7 @@ let measureText
585585
export function textHeight(display) {
586586
if (display.cachedTextHeight != null) return display.cachedTextHeight
587587
if (measureText == null) {
588-
measureText = elt("pre", null, "CodeMirror-measure-elem")
588+
measureText = elt("pre", null, "CodeMirror-line-like")
589589
// Measure a bunch of lines, for browsers that compute
590590
// fractional heights.
591591
for (let i = 0; i < 49; ++i) {
@@ -605,7 +605,7 @@ export function textHeight(display) {
605605
export function charWidth(display) {
606606
if (display.cachedCharWidth != null) return display.cachedCharWidth
607607
let anchor = elt("span", "xxxxxxxxxx")
608-
let pre = elt("pre", [anchor], "CodeMirror-measure-elem")
608+
let pre = elt("pre", [anchor], "CodeMirror-line-like")
609609
removeChildrenAndAdd(display.measure, pre)
610610
let rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10
611611
if (width > 2) display.cachedCharWidth = width

0 commit comments

Comments
 (0)