Skip to content

Commit

Permalink
Update monaco-diff-editor.component.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
CN-Tower authored Oct 22, 2018
1 parent 69d7cb9 commit 3b0ebfe
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions client/src/app/monaco-editor/monaco-diff-editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ export class MonacoDiffEditorComponent extends MonacoEditorBase implements OnIni
_originalModel: any;
_modifiedModel: any;
private _editor: any;
options: any = {
theme: '',
language: 'json'
};

constructor(private appService: AppService, public broadcast: SharedBroadcastService) {
super(broadcast);
Expand All @@ -63,18 +59,16 @@ export class MonacoDiffEditorComponent extends MonacoEditorBase implements OnIni
if (!this._originalModel || !this._modifiedModel) {
throw new Error('originalModel or modifiedModel not found for ngx-monaco-diff-editor');
}
const theme = this.appService.getAppTheme();
this.options.theme = this.appService.getEditorTheme(theme);

this._originalModel.language = this.options.language;
this._modifiedModel.language = this.options.language;
this._originalModel.language = 'json';
this._modifiedModel.language = 'json';

this._editorContainer.nativeElement.innerHTML = '';

const originalModel = win.monaco.editor.createModel(this._originalModel.code, this._originalModel.language);
const modifiedModel = win.monaco.editor.createModel(this._modifiedModel.code, this._modifiedModel.language);

this._editor = win.monaco.editor.createDiffEditor(this._editorContainer.nativeElement, this.options);
this._editor = win.monaco.editor.createDiffEditor(this._editorContainer.nativeElement);
this._editor.setModel({
original: originalModel,
modified: modifiedModel
Expand Down

0 comments on commit 3b0ebfe

Please sign in to comment.