Skip to content

Commit

Permalink
removed unused instances of .layout()
Browse files Browse the repository at this point in the history
Signed-off-by: Priyansh61 <[email protected]>
  • Loading branch information
Priyansh61 committed Jun 30, 2023
1 parent 2c582fa commit dae1cff
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions webClient/src/app/editor/code-editor/monaco/monaco.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ export class MonacoComponent implements OnInit, OnChanges {
let options = this._options ? Object.assign({}, this._options) : {};
const hasModel = !!options.model;

this.viewportEvents.resized
.pipe(debounceTime(100))
.subscribe(() => {
this.handleDiffEditorResize();
});

if (hasModel) {
const model = monaco.editor.getModel(options.model.uri || '');
if(model) {
Expand Down Expand Up @@ -128,10 +122,6 @@ export class MonacoComponent implements OnInit, OnChanges {
}
});

this.editorControl.refreshLayout.subscribe(() => {
setTimeout(() => this.editor.layout(), 1);
});

this.editor.onContextMenu((e: any) => {
if(e.target.type === 3){ //if right click is on top of the line numbers
this.viewportEvents.spawnContextMenu(e.event.browserEvent.clientX, e.event.browserEvent.clientY, [
Expand All @@ -158,9 +148,7 @@ export class MonacoComponent implements OnInit, OnChanges {
focus(e: any) {
this.editor.focus();
}
layout(e: any) {
this.editor.layout();
}


ngOnChanges(changes: SimpleChanges) {
for (const input in changes) {
Expand All @@ -171,6 +159,7 @@ export class MonacoComponent implements OnInit, OnChanges {
changes[input].currentValue['line']);
//TODO: This is a workaround to instruct the editor to remeasure its container when switching from diff-viewer to code-editor
if (this.showDiffViewer) {
console.log("ngOnChanges: refreshing layout")
setTimeout(() => this.editor.layout(), 1);
}
this.showEditor = true;
Expand All @@ -184,8 +173,13 @@ export class MonacoComponent implements OnInit, OnChanges {
onMonacoInit(editor) {
this.editorControl.editor.next(editor);
this.keyBinds(editor);
this.viewportEvents.resized.subscribe(()=> {
editor.layout()
this.viewportEvents.resized
.pipe(debounceTime(100))
.subscribe(()=> {
if (!this.showDiffViewer) {
editor.layout()
}
this.handleDiffEditorResize();
});
/* disable for now...
this.editorControl.connToLS.subscribe((lang) => {
Expand Down

0 comments on commit dae1cff

Please sign in to comment.