@@ -18,7 +18,6 @@ import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition, IViewZone, IViewZo
18
18
export interface IOptions {
19
19
showFrame ?: boolean ;
20
20
showArrow ?: boolean ;
21
- frameColor ?: string ;
22
21
frameWidth ?: number ;
23
22
className ?: string ;
24
23
isAccessible ?: boolean ;
@@ -28,7 +27,6 @@ export interface IOptions {
28
27
const defaultOptions : IOptions = {
29
28
showArrow : true ,
30
29
showFrame : true ,
31
- frameColor : '' ,
32
30
className : ''
33
31
} ;
34
32
@@ -103,6 +101,7 @@ export abstract class ZoneWidget extends Widget implements IHorizontalSashLayout
103
101
public domNode : HTMLElement ;
104
102
public editor : ICodeEditor ;
105
103
public options : IOptions ;
104
+ private arrow : HTMLElement = null ;
106
105
107
106
constructor ( editor : ICodeEditor , options : IOptions = { } ) {
108
107
super ( ) ;
@@ -148,8 +147,12 @@ export abstract class ZoneWidget extends Widget implements IHorizontalSashLayout
148
147
this . container = document . createElement ( 'div' ) ;
149
148
dom . addClass ( this . container , 'zone-widget-container' ) ;
150
149
this . domNode . appendChild ( this . container ) ;
151
- this . _fillContainer ( this . container ) ;
150
+ if ( this . options . showArrow ) {
151
+ this . arrow = document . createElement ( 'div' ) ;
152
+ this . arrow . className = 'zone-widget-arrow below' ;
153
+ }
152
154
155
+ this . _fillContainer ( this . container ) ;
153
156
this . _initSash ( ) ;
154
157
}
155
158
@@ -232,22 +235,17 @@ export abstract class ZoneWidget extends Widget implements IHorizontalSashLayout
232
235
233
236
// Render the widget as zone (rendering) and widget (lifecycle)
234
237
let viewZoneDomNode = document . createElement ( 'div' ) ,
235
- arrow = document . createElement ( 'div' ) ,
236
238
lineHeight = this . editor . getConfiguration ( ) . lineHeight ,
237
239
arrowHeight = 0 , frameThickness = 0 ;
238
240
239
241
// Render the arrow one 1/3 of an editor line height
240
242
if ( this . options . showArrow ) {
241
243
arrowHeight = Math . round ( lineHeight / 3 ) ;
244
+ this . arrow . style . top = - arrowHeight + 'px' ;
245
+ this . arrow . style . borderWidth = arrowHeight + 'px' ;
246
+ this . arrow . style . left = this . editor . getOffsetForColumn ( position . lineNumber , position . column ) + 'px' ;
242
247
243
- arrow = document . createElement ( 'div' ) ;
244
- arrow . className = 'zone-widget-arrow below' ;
245
- arrow . style . top = - arrowHeight + 'px' ;
246
- arrow . style . borderWidth = arrowHeight + 'px' ;
247
- arrow . style . left = this . editor . getOffsetForColumn ( position . lineNumber , position . column ) + 'px' ;
248
- arrow . style . borderBottomColor = this . options . frameColor ;
249
-
250
- viewZoneDomNode . appendChild ( arrow ) ;
248
+ viewZoneDomNode . appendChild ( this . arrow ) ;
251
249
}
252
250
253
251
// Render the frame as 1/9 of an editor line height
@@ -281,8 +279,6 @@ export abstract class ZoneWidget extends Widget implements IHorizontalSashLayout
281
279
282
280
if ( this . options . showFrame ) {
283
281
const width = this . options . frameWidth ? this . options . frameWidth : frameThickness ;
284
- this . container . style . borderTopColor = this . options . frameColor ;
285
- this . container . style . borderBottomColor = this . options . frameColor ;
286
282
this . container . style . borderTopWidth = width + 'px' ;
287
283
this . container . style . borderBottomWidth = width + 'px' ;
288
284
}
@@ -302,6 +298,20 @@ export abstract class ZoneWidget extends Widget implements IHorizontalSashLayout
302
298
this . editor . revealLine ( revealLineNumber ) ;
303
299
}
304
300
301
+ protected setCssClass ( className : string , classToReplace ?: string ) : void {
302
+ if ( classToReplace ) {
303
+ this . container . classList . remove ( classToReplace ) ;
304
+ if ( this . arrow ) {
305
+ this . arrow . classList . remove ( classToReplace ) ;
306
+ }
307
+ }
308
+
309
+ this . container . classList . add ( className ) ;
310
+ if ( this . arrow ) {
311
+ this . arrow . classList . add ( className ) ;
312
+ }
313
+ }
314
+
305
315
protected abstract _fillContainer ( container : HTMLElement ) : void ;
306
316
307
317
protected _onWidth ( widthInPixel : number ) : void {
0 commit comments