@@ -48,6 +48,17 @@ export class CodeEditorComponent
48
48
}
49
49
} ;
50
50
51
+ /**
52
+ * The instance of the editor.
53
+ */
54
+ get editor ( ) : editor . IEditor {
55
+ return this . _editor ;
56
+ }
57
+
58
+ protected set editor ( value : editor . IEditor ) {
59
+ this . _editor = value ;
60
+ }
61
+
51
62
@ViewChild ( 'editor' , { static : true } )
52
63
editorContent : ElementRef < HTMLDivElement > ;
53
64
@@ -118,9 +129,9 @@ export class CodeEditorComponent
118
129
protected jsonDefaults = inject ( JsonDefaultsService ) ;
119
130
120
131
ngOnDestroy ( ) {
121
- if ( this . _editor ) {
122
- this . _editor . dispose ( ) ;
123
- this . _editor = null ;
132
+ if ( this . editor ) {
133
+ this . editor . dispose ( ) ;
134
+ this . editor = null ;
124
135
}
125
136
126
137
if ( this . _model ) {
@@ -135,8 +146,8 @@ export class CodeEditorComponent
135
146
}
136
147
137
148
if ( changes . readOnly && ! changes . readOnly . firstChange ) {
138
- if ( this . _editor ) {
139
- this . _editor . updateOptions ( {
149
+ if ( this . editor ) {
150
+ this . editor . updateOptions ( {
140
151
readOnly : changes . readOnly . currentValue
141
152
} ) ;
142
153
}
@@ -149,8 +160,8 @@ export class CodeEditorComponent
149
160
150
161
@HostListener ( 'window:resize' )
151
162
onResize ( ) {
152
- if ( this . _editor ) {
153
- this . _editor . layout ( ) ;
163
+ if ( this . editor ) {
164
+ this . editor . layout ( ) ;
154
165
}
155
166
}
156
167
@@ -180,7 +191,7 @@ export class CodeEditorComponent
180
191
model : this . _model
181
192
} ) ;
182
193
183
- this . _editor = monaco . editor . create ( domElement , options ) ;
194
+ this . editor = monaco . editor . create ( domElement , options ) ;
184
195
185
196
this . _model . onDidChangeContent ( ( e : editor . IModelContentChangedEvent ) => {
186
197
this . modelContentChanged . emit ( e ) ;
0 commit comments