Skip to content

Commit 069f4c8

Browse files
committed
Angular and Monaco Editor version upgrade.
Breaking Change: Set relative path for loader as default to skip configurations when base-href set other then root. for other cases this can be configured.
1 parent 1b84305 commit 069f4c8

File tree

6 files changed

+8256
-6037
lines changed

6 files changed

+8256
-6037
lines changed

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Angular 5: v5.x.x
55
- Angular 6: v6.x.x
66
- Angular 7: v7.x.x
7+
- Angular 8: v8.x.x
78

89
Using this Module you can utilize the Monaco Editor as an Angular Component. Feel free to contribute, raise feature requests and make it better.
910

@@ -23,34 +24,35 @@ For angular version 6 use v6.x.x
2324
npm install [email protected] --save
2425
```
2526

26-
Add the glob to assets in `.angular-cli.json` (to make monaco-editor lib available to the app):
27+
Add the glob to assets in `.angular-cli.json` schema - `projects.[project-name].architect.build` (to make monaco-editor lib available to the app):
2728
```typescript
2829
{
29-
"apps": [
30+
"options": {
3031
{
3132
"assets": [
32-
{ "glob": "**/*", "input": "../node_modules/ngx-monaco-editor/assets/monaco", "output": "./assets/monaco/" }
33+
{ "glob": "**/*", "input": "node_modules/ngx-monaco-editor/assets/monaco", "output": "./assets/monaco/" }
3334
],
3435
...
3536
}
3637
...
37-
],
38+
},
3839
...
3940
}
4041
```
4142

42-
For Angular 7+, add the glob to assets in `angular.json` schema - `projects.[project-name].architect.build`
43+
44+
For Angular 6 and below, add the glob to assets in `angular.json`
4345
```typescript
4446
{
45-
"options": {
47+
"apps": [
4648
{
4749
"assets": [
48-
{ "glob": "**/*", "input": "node_modules/ngx-monaco-editor/assets/monaco", "output": "./assets/monaco/" }
50+
{ "glob": "**/*", "input": "../node_modules/ngx-monaco-editor/assets/monaco", "output": "./assets/monaco/" }
4951
],
5052
...
5153
}
5254
...
53-
},
55+
],
5456
...
5557
}
5658
```
@@ -128,6 +130,12 @@ export class AppComponent {
128130
```
129131

130132
### Styling
133+
To match height of container element add height: 100% and wrap in container
134+
```html
135+
<div style="height: 500px">
136+
<ngx-monaco-editor style="height: 100%" [options]="editorOptions" [(ngModel)]="code"></ngx-monaco-editor>
137+
</div>
138+
```
131139
Add class to editor tag. (eg. class="my-code-editor")
132140
```html
133141
<ngx-monaco-editor class="my-code-editor" [options]="editorOptions" [(ngModel)]="code"></ngx-monaco-editor>
@@ -170,7 +178,7 @@ import { MonacoEditorModule, NgxMonacoEditorConfig } from 'ngx-monaco-editor';
170178
import { AppComponent } from './app.component';
171179

172180
const monacoConfig: NgxMonacoEditorConfig = {
173-
baseUrl: 'app-name/assets', // configure base path for monaco editor
181+
baseUrl: 'app-name/assets', // configure base path for monaco editor default: './assets'
174182
defaultOptions: { scrollBeyondLastLine: false }, // pass default options to be used
175183
onMonacoLoad: () => { console.log((<any>window).monaco); } // here monaco object will be available as window.monaco use this function to extend monaco editor functionalities.
176184
};

0 commit comments

Comments
 (0)