Fixing command pakllet call; fixing session swap session defaulting
This commit is contained in:
parent
41f6ea5854
commit
4193d46d0d
@ -16,7 +16,7 @@ export const Keybindings: Array<{}> = [
|
|||||||
bindKey: {win: "ctrl-shift-k", mac: "command-shift-k"},
|
bindKey: {win: "ctrl-shift-k", mac: "command-shift-k"},
|
||||||
readOnly: false
|
readOnly: false
|
||||||
}, {
|
}, {
|
||||||
name: "openCommandPalette",
|
name: "openCommandPalette2",
|
||||||
bindKey: {linux: "Command-shift-/|F1", win: "ctrl-shift-/|F1"},
|
bindKey: {linux: "Command-shift-/|F1", win: "ctrl-shift-/|F1"},
|
||||||
readOnly: false
|
readOnly: false
|
||||||
}, {
|
}, {
|
||||||
|
@ -54,6 +54,11 @@ export class EditorsComponent {
|
|||||||
rightEditor.instance.leftSiblingUUID = leftEditor.instance.uuid;
|
rightEditor.instance.leftSiblingUUID = leftEditor.instance.uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.unsubscribe.next();
|
||||||
|
this.unsubscribe.complete();
|
||||||
|
}
|
||||||
|
|
||||||
loadSubscribers() {
|
loadSubscribers() {
|
||||||
|
|
||||||
this.editorsService.getMessage$().pipe(
|
this.editorsService.getMessage$().pipe(
|
||||||
@ -72,23 +77,31 @@ export class EditorsComponent {
|
|||||||
} else if (message.action === "move-session-left") {
|
} else if (message.action === "move-session-left") {
|
||||||
let editorComponent = this.editorsService.get(message.editorUUID);
|
let editorComponent = this.editorsService.get(message.editorUUID);
|
||||||
if (!editorComponent.leftSiblingUUID) return;
|
if (!editorComponent.leftSiblingUUID) return;
|
||||||
|
|
||||||
let siblingComponent = this.editorsService.get(editorComponent.leftSiblingUUID);
|
let siblingComponent = this.editorsService.get(editorComponent.leftSiblingUUID);
|
||||||
let session = editorComponent.editor.getSession();
|
let session = editorComponent.editor.getSession();
|
||||||
let siblingSession = siblingComponent.editor.getSession();
|
let siblingSession = siblingComponent.editor.getSession();
|
||||||
|
|
||||||
if (session == siblingSession) return;
|
if (session == siblingSession) return;
|
||||||
|
|
||||||
siblingComponent.editor.setSession(session);
|
siblingComponent.editor.setSession(session);
|
||||||
|
siblingComponent.activeFile = editorComponent.activeFile;
|
||||||
|
|
||||||
editorComponent.newBuffer();
|
editorComponent.newBuffer();
|
||||||
siblingComponent.editor.focus()
|
siblingComponent.editor.focus()
|
||||||
} else if (message.action === "move-session-right") {
|
} else if (message.action === "move-session-right") {
|
||||||
let editorComponent = this.editorsService.get(message.editorUUID);
|
let editorComponent = this.editorsService.get(message.editorUUID);
|
||||||
if (!editorComponent.rightSiblingUUID) return;
|
if (!editorComponent.rightSiblingUUID) return;
|
||||||
|
|
||||||
let siblingComponent = this.editorsService.get(editorComponent.rightSiblingUUID);
|
let siblingComponent = this.editorsService.get(editorComponent.rightSiblingUUID);
|
||||||
let session = editorComponent.editor.getSession();
|
let session = editorComponent.editor.getSession();
|
||||||
let siblingSession = siblingComponent.editor.getSession();
|
let siblingSession = siblingComponent.editor.getSession();
|
||||||
|
|
||||||
if (session == siblingSession) return;
|
if (session == siblingSession) return;
|
||||||
|
|
||||||
siblingComponent.editor.setSession(session);
|
siblingComponent.editor.setSession(session);
|
||||||
|
siblingComponent.activeFile = editorComponent.activeFile;
|
||||||
|
|
||||||
editorComponent.newBuffer();
|
editorComponent.newBuffer();
|
||||||
siblingComponent.editor.focus()
|
siblingComponent.editor.focus()
|
||||||
} else if (message.action === "set-active-editor") {
|
} else if (message.action === "set-active-editor") {
|
||||||
@ -207,11 +220,6 @@ export class EditorsComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.unsubscribe.next();
|
|
||||||
this.unsubscribe.complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: Only really works with 2 editors and very brittle logic.
|
// Note: Only really works with 2 editors and very brittle logic.
|
||||||
protected setEditorSize(event: any) {
|
protected setEditorSize(event: any) {
|
||||||
let lEditorComponent = null;
|
let lEditorComponent = null;
|
||||||
@ -248,6 +256,10 @@ export class EditorsComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.resizeAndFocus(lEditorComponent, lSize, rEditorComponent, rSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
private resizeAndFocus(lEditorComponent: any, lSize: number, rEditorComponent: any, rSize: number) {
|
||||||
let lElm = lEditorComponent.editorElm.nativeElement.parentElement;
|
let lElm = lEditorComponent.editorElm.nativeElement.parentElement;
|
||||||
let rElm = rEditorComponent.editorElm.nativeElement.parentElement;
|
let rElm = rEditorComponent.editorElm.nativeElement.parentElement;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ export class NewtonEditorBase {
|
|||||||
this.editorElm.nativeElement.classList.remove("active-editor")
|
this.editorElm.nativeElement.classList.remove("active-editor")
|
||||||
}
|
}
|
||||||
|
|
||||||
public openCommandPalette() {
|
public openCommandPalette2() {
|
||||||
this.editor.execCommand("openCommandPalette");
|
this.editor.execCommand("openCommandPalette");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +127,8 @@ export class NewtonEditorComponent extends NewtonEditorBase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.editor.on("change", () => {
|
this.editor.on("change", () => {
|
||||||
|
if (!this.activeFile) return;
|
||||||
|
|
||||||
let message = new ServiceMessage();
|
let message = new ServiceMessage();
|
||||||
message.action = "file-changed";
|
message.action = "file-changed";
|
||||||
message.filePath = this.activeFile.path;
|
message.filePath = this.activeFile.path;
|
||||||
|
Loading…
Reference in New Issue
Block a user