MCPcopy Create free account
hub / github.com/TruthHun/BookStack / textHeight

Function textHeight

static/mergely/lib/codemirror.js:2947–2964  ·  view source on GitHub ↗
(display)

Source from the content-addressed store, hash-verified

2945 var measureText;
2946 // Compute the default text height.
2947 function textHeight(display) {
2948 if (display.cachedTextHeight != null) return display.cachedTextHeight;
2949 if (measureText == null) {
2950 measureText = elt("pre");
2951 // Measure a bunch of lines, for browsers that compute
2952 // fractional heights.
2953 for (var i = 0; i < 49; ++i) {
2954 measureText.appendChild(document.createTextNode("x"));
2955 measureText.appendChild(elt("br"));
2956 }
2957 measureText.appendChild(document.createTextNode("x"));
2958 }
2959 removeChildrenAndAdd(display.measure, measureText);
2960 var height = measureText.offsetHeight / 50;
2961 if (height > 3) display.cachedTextHeight = height;
2962 removeChildren(display.measure);
2963 return height || 1;
2964 }
2965
2966 // Compute the default character width.
2967 function charWidth(display) {

Callers 5

estimateHeightFunction · 0.70
updateHeightsInViewportFunction · 0.70
calculateScrollPosFunction · 0.70
findPosVFunction · 0.70
codemirror.jsFile · 0.70

Calls 3

eltFunction · 0.70
removeChildrenAndAddFunction · 0.70
removeChildrenFunction · 0.70

Tested by

no test coverage detected