Skip to content

Commit 52ef745

Browse files
authored
Merge pull request #75 from WebCoder49/performance-improvements
Allow scrolling when highlight.js
2 parents 439b23f + f32ce10 commit 52ef745

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

code-input.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ code-input textarea, code-input:not(.code-input_pre-element-styled) pre code, co
4545
border: 0;
4646
min-width: calc(100% - var(--padding, 16px) * 2);
4747
min-height: calc(100% - var(--padding, 16px) * 2);
48-
height: max-content;
4948
overflow: hidden;
5049
resize: none;
5150
grid-row: 1;
5251
grid-column: 1;
52+
}
53+
code-input:not(.code-input_pre-element-styled) pre code, code-input.code-input_pre-element-styled pre {
5354
height: max-content;
55+
width: max-content;
5456
}
5557

5658
code-input:not(.code-input_pre-element-styled) pre, code-input.code-input_pre-element-styled pre code {

code-input.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,13 @@ var codeInput = {
528528
*/
529529
animateFrame() {
530530
// Sync size
531-
this.textareaElement.style.height = getComputedStyle(this.preElement).height;
532-
this.textareaElement.style.width = getComputedStyle(this.preElement).width;
531+
if(this.template.preElementStyled) {
532+
this.textareaElement.style.height = getComputedStyle(this.preElement).height;
533+
this.textareaElement.style.width = getComputedStyle(this.preElement).width;
534+
} else {
535+
this.textareaElement.style.height = getComputedStyle(this.codeElement).height;
536+
this.textareaElement.style.width = getComputedStyle(this.codeElement).width;
537+
}
533538
this.textareaElement.scrollTo(0,0);
534539

535540
// Sync content

0 commit comments

Comments
 (0)