Skip to content

Commit d207e6b

Browse files
committed
nav.js: set CM height based on line count
1 parent 6c0b996 commit d207e6b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

assets/nav.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,11 @@
134134
lineNumbers: false,
135135
lineWrapping: false,
136136
});
137-
cm.setSize('100%', 'auto');
138-
cm.getWrapperElement().style.height = 'auto';
139-
cm.getScrollerElement().style.overflowY = 'visible';
137+
// Force full height - CM defaults to 300px
138+
const lineCount = cm.lineCount();
139+
const lineHeight = 18;
140+
const height = lineCount * lineHeight + 10;
141+
cm.setSize('100%', height + 'px');
140142
});
141143
// Switch theme on dark toggle
142144
document.querySelectorAll('.CodeMirror').forEach(el => {

0 commit comments

Comments
 (0)