File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,17 @@ interface ITerminalDimensions {
2323const MINIMUM_COLS = 2 ;
2424const MINIMUM_ROWS = 1 ;
2525
26+ function getWindow ( e : Node ) : Window {
27+ if ( e ?. ownerDocument ?. defaultView ) {
28+ return e . ownerDocument . defaultView . window ;
29+ }
30+
31+ return window ;
32+ }
33+ function getComputedStyle ( el : HTMLElement ) : CSSStyleDeclaration {
34+ return getWindow ( el ) . getComputedStyle ( el , null ) ;
35+ }
36+
2637export class FitAddon implements ITerminalAddon , IFitApi {
2738 private _terminal : Terminal | undefined ;
2839
@@ -69,10 +80,10 @@ export class FitAddon implements ITerminalAddon , IFitApi {
6980 ? 0
7081 : ( this . _terminal . options . overviewRuler ?. width || ViewportConstants . DEFAULT_SCROLL_BAR_WIDTH ) ) ;
7182
72- const parentElementStyle = window . getComputedStyle ( this . _terminal . element . parentElement ) ;
83+ const parentElementStyle = getComputedStyle ( this . _terminal . element . parentElement ) ;
7384 const parentElementHeight = parseInt ( parentElementStyle . getPropertyValue ( 'height' ) ) ;
7485 const parentElementWidth = Math . max ( 0 , parseInt ( parentElementStyle . getPropertyValue ( 'width' ) ) ) ;
75- const elementStyle = window . getComputedStyle ( this . _terminal . element ) ;
86+ const elementStyle = getComputedStyle ( this . _terminal . element ) ;
7687 const elementPadding = {
7788 top : parseInt ( elementStyle . getPropertyValue ( 'padding-top' ) ) ,
7889 bottom : parseInt ( elementStyle . getPropertyValue ( 'padding-bottom' ) ) ,
You can’t perform that action at this time.
0 commit comments