@@ -506,6 +506,18 @@ var codeInput = {
506506 this . needsHighlight = false ;
507507 }
508508
509+ // Synchronise colors
510+ if ( this . textareaElement ) {
511+ let color ;
512+ if ( this . templateObject . preElementStyled ) {
513+ color = getComputedStyle ( this . preElement ) . color ;
514+ } else {
515+ color = getComputedStyle ( this . codeElement ) . color ;
516+ }
517+ this . style . setProperty ( "--code-input_highlight-text-color" , color ) ;
518+ }
519+ this . style . setProperty ( "--code-input_default-caret-color" , getComputedStyle ( this ) . color ) ;
520+
509521 window . requestAnimationFrame ( this . animateFrame . bind ( this ) ) ;
510522 }
511523
@@ -536,11 +548,9 @@ var codeInput = {
536548 syncSize ( ) {
537549 // Synchronise the size of the pre/code and textarea elements
538550 if ( this . templateObject . preElementStyled ) {
539- this . style . backgroundColor = getComputedStyle ( this . preElement ) . backgroundColor ;
540551 this . textareaElement . style . height = getComputedStyle ( this . preElement ) . height ;
541552 this . textareaElement . style . width = getComputedStyle ( this . preElement ) . width ;
542553 } else {
543- this . style . backgroundColor = getComputedStyle ( this . codeElement ) . backgroundColor ;
544554 this . textareaElement . style . height = getComputedStyle ( this . codeElement ) . height ;
545555 this . textareaElement . style . width = getComputedStyle ( this . codeElement ) . width ;
546556 }
@@ -765,7 +775,6 @@ var codeInput = {
765775 // Update with fallback textarea's state so can keep editing
766776 // if loaded slowly
767777 if ( fallbackSelectionStart !== undefined ) {
768- console . log ( "sel" , fallbackSelectionStart , fallbackSelectionEnd , fallbackSelectionDirection , "scr" , fallbackScrollTop , fallbackScrollLeft , "foc" , fallbackFocused ) ;
769778 textarea . setSelectionRange ( fallbackSelectionStart , fallbackSelectionEnd , fallbackSelectionDirection ) ;
770779 textarea . scrollTo ( fallbackScrollTop , fallbackScrollLeft ) ;
771780 }
0 commit comments