I’ve got a CodeMirror instance displaying Markdown, and the following CSS to modify the display of header lines, similar to SimpleMDE:
.cm-header {
line-height: 120%;
}
.cm-header-1 {
font-size: 225%;
}
/* etc. */
Where the problems come in is with cursorCoords
, which I’m using at various points to draw lines to sections of the text that have been marked with markText
. Basically, if I add a #
character to the beginning of a line (making it into a header), the CSS gets applied, but the cursorCoords
for the rest of the document still report marker positions from their old locations, even though they’ve been moved down by the line above them increasing in size.
They get set appropriately once a linebreak has been introduced after the header line. (If I add a linebreak from the end of the header, the problem persists, but anywhere else and it works.)
Am I correct in thinking that the line dimensions are getting cached somewhere and not getting updated until the clean newline? Is there a way to force the measurement to happen?
(My first thought was that I was calling cursorCoords
before the CSS had a chance to get applied, but putting it on a timeout had no effect. )