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"},
|
||||
readOnly: false
|
||||
}, {
|
||||
name: "openCommandPalette",
|
||||
name: "openCommandPalette2",
|
||||
bindKey: {linux: "Command-shift-/|F1", win: "ctrl-shift-/|F1"},
|
||||
readOnly: false
|
||||
}, {
|
||||
|
@ -54,6 +54,11 @@ export class EditorsComponent {
|
||||
rightEditor.instance.leftSiblingUUID = leftEditor.instance.uuid;
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.unsubscribe.next();
|
||||
this.unsubscribe.complete();
|
||||
}
|
||||
|
||||
loadSubscribers() {
|
||||
|
||||
this.editorsService.getMessage$().pipe(
|
||||
@ -72,23 +77,31 @@ export class EditorsComponent {
|
||||
} else if (message.action === "move-session-left") {
|
||||
let editorComponent = this.editorsService.get(message.editorUUID);
|
||||
if (!editorComponent.leftSiblingUUID) return;
|
||||
|
||||
let siblingComponent = this.editorsService.get(editorComponent.leftSiblingUUID);
|
||||
let session = editorComponent.editor.getSession();
|
||||
let siblingSession = siblingComponent.editor.getSession();
|
||||
|
||||
if (session == siblingSession) return;
|
||||
|
||||
siblingComponent.editor.setSession(session);
|
||||
siblingComponent.activeFile = editorComponent.activeFile;
|
||||
|
||||
editorComponent.newBuffer();
|
||||
siblingComponent.editor.focus()
|
||||
} else if (message.action === "move-session-right") {
|
||||
let editorComponent = this.editorsService.get(message.editorUUID);
|
||||
if (!editorComponent.rightSiblingUUID) return;
|
||||
|
||||
let siblingComponent = this.editorsService.get(editorComponent.rightSiblingUUID);
|
||||
let session = editorComponent.editor.getSession();
|
||||
let siblingSession = siblingComponent.editor.getSession();
|
||||
|
||||
if (session == siblingSession) return;
|
||||
|
||||
siblingComponent.editor.setSession(session);
|
||||
siblingComponent.activeFile = editorComponent.activeFile;
|
||||
|
||||
editorComponent.newBuffer();
|
||||
siblingComponent.editor.focus()
|
||||
} 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.
|
||||
protected setEditorSize(event: any) {
|
||||
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 rElm = rEditorComponent.editorElm.nativeElement.parentElement;
|
||||
|
||||
|
@ -34,7 +34,7 @@ export class NewtonEditorBase {
|
||||
this.editorElm.nativeElement.classList.remove("active-editor")
|
||||
}
|
||||
|
||||
public openCommandPalette() {
|
||||
public openCommandPalette2() {
|
||||
this.editor.execCommand("openCommandPalette");
|
||||
}
|
||||
|
||||
|
@ -127,6 +127,8 @@ export class NewtonEditorComponent extends NewtonEditorBase {
|
||||
});
|
||||
|
||||
this.editor.on("change", () => {
|
||||
if (!this.activeFile) return;
|
||||
|
||||
let message = new ServiceMessage();
|
||||
message.action = "file-changed";
|
||||
message.filePath = this.activeFile.path;
|
||||
|
Loading…
Reference in New Issue
Block a user