3
3
- Angular <= 4: v3.x.x
4
4
- Angular 5: v5.x.x
5
5
- Angular 6: v6.x.x
6
+ - Angular 7: v7.x.x
6
7
7
8
Using this Module you can utilize the Monaco Editor as an Angular Component. Feel free to contribute, raise feature requests and make it better.
8
9
@@ -17,9 +18,9 @@ Install from npm repository:
17
18
npm install ngx-monaco-editor --save
18
19
```
19
20
20
- For angular version 5 use v5 .x.x
21
+ For angular version 6 use v6 .x.x
21
22
```
22
- npm install ngx-monaco-editor@5 .0.0 --save
23
+ npm install ngx-monaco-editor@6 .0.0 --save
23
24
```
24
25
25
26
Add the glob to assets in .angular-cli.json (to make monaco-editor lib available to the app):
@@ -185,32 +186,35 @@ import { MonacoEditorModule, NgxMonacoEditorConfig } from 'ngx-monaco-editor';
185
186
import { AppComponent } from ' ./app.component' ;
186
187
187
188
const monacoConfig: NgxMonacoEditorConfig = {
188
- onMonacoLoad : () => {
189
- const id = " foo.json" ;
189
+ baseUrl: ' assets' ,
190
+ defaultOptions: { scrollBeyondLastLine: false },
191
+ onMonacoLoad : () => {
192
+ console .log ((window as any ).monaco );
193
+ const uri = monaco .Uri .parse (' a://b/foo.json' );
190
194
monaco .languages .json .jsonDefaults .setDiagnosticsOptions ({
191
195
validate: true ,
192
196
schemas: [{
193
- uri: " http://myserver/foo-schema.json" ,
194
- fileMatch: [id ],
197
+ uri: ' http://myserver/foo-schema.json' ,
198
+ fileMatch: [uri . toString () ],
195
199
schema: {
196
- type: " object" ,
200
+ type: ' object' ,
197
201
properties: {
198
202
p1: {
199
- enum: [ " v1 " , " v2 " ]
203
+ enum: [' v1 ' , ' v2 ' ]
200
204
},
201
205
p2: {
202
- $ref: " http://myserver/bar-schema.json"
206
+ $ref: ' http://myserver/bar-schema.json'
203
207
}
204
208
}
205
209
}
206
- },{
207
- uri: " http://myserver/bar-schema.json" ,
208
- fileMatch: [id ],
210
+ }, {
211
+ uri: ' http://myserver/bar-schema.json' ,
212
+ fileMatch: [uri . toString () ],
209
213
schema: {
210
- type: " object" ,
214
+ type: ' object' ,
211
215
properties: {
212
216
q1: {
213
- enum: [ " x1 " , " x2 " ]
217
+ enum: [' x1 ' , ' x2 ' ]
214
218
}
215
219
}
216
220
}
@@ -257,7 +261,7 @@ export class AppComponent {
257
261
model: NgxEditorModel = {
258
262
value: this .jsonCode ,
259
263
language: ' json' ,
260
- uri: ' foo.json'
264
+ uri: monaco . Uri . parse ( ' a://b/ foo.json' )
261
265
};
262
266
}
263
267
```
0 commit comments