removing WIP terminal
This commit is contained in:
@@ -46,7 +46,6 @@
|
|||||||
},
|
},
|
||||||
"postinstall": "electron-builder install-app-deps",
|
"postinstall": "electron-builder install-app-deps",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@xterm/xterm": "5.5.0",
|
|
||||||
"ace-diff": "3.0.3",
|
"ace-diff": "3.0.3",
|
||||||
"ace-layout": "1.5.0",
|
"ace-layout": "1.5.0",
|
||||||
"ace-linters": "1.8.3",
|
"ace-linters": "1.8.3",
|
||||||
@@ -56,8 +55,6 @@
|
|||||||
"electron-fetch": "1.9.1",
|
"electron-fetch": "1.9.1",
|
||||||
"express": "4.18.2",
|
"express": "4.18.2",
|
||||||
"marked": "16.4.0",
|
"marked": "16.4.0",
|
||||||
"node-fetch": "3.3.2",
|
|
||||||
"node-pty": "1.0.0",
|
|
||||||
"socket.io": "4.8.1",
|
"socket.io": "4.8.1",
|
||||||
"uuid": "11.1.0",
|
"uuid": "11.1.0",
|
||||||
"zone.js": "0.15.0"
|
"zone.js": "0.15.0"
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
<editors></editors>
|
<editors></editors>
|
||||||
<search-replace></search-replace>
|
<search-replace></search-replace>
|
||||||
<markdown-preview></markdown-preview>
|
<markdown-preview></markdown-preview>
|
||||||
<terminal></terminal>
|
|
||||||
|
|
||||||
<lsp-manager></lsp-manager>
|
<lsp-manager></lsp-manager>
|
||||||
</div>
|
</div>
|
||||||
@@ -5,7 +5,6 @@ import { TabsComponent } from './editor/tabs/tabs.component';
|
|||||||
import { EditorsComponent } from './editor/editors.component';
|
import { EditorsComponent } from './editor/editors.component';
|
||||||
import { SearchReplaceComponent } from "./editor/search-replace/search-replace.component";
|
import { SearchReplaceComponent } from "./editor/search-replace/search-replace.component";
|
||||||
import { MarkdownPreviewComponent } from "./editor/markdown-preview/markdown-preview.component";
|
import { MarkdownPreviewComponent } from "./editor/markdown-preview/markdown-preview.component";
|
||||||
import { TerminalComponent } from "./editor/terminal/terminal.component";
|
|
||||||
import { LspManagerComponent } from "./editor/lsp-manager/lsp-manager.component";
|
import { LspManagerComponent } from "./editor/lsp-manager/lsp-manager.component";
|
||||||
|
|
||||||
|
|
||||||
@@ -18,7 +17,6 @@ import { LspManagerComponent } from "./editor/lsp-manager/lsp-manager.component"
|
|||||||
EditorsComponent,
|
EditorsComponent,
|
||||||
SearchReplaceComponent,
|
SearchReplaceComponent,
|
||||||
MarkdownPreviewComponent,
|
MarkdownPreviewComponent,
|
||||||
TerminalComponent,
|
|
||||||
LspManagerComponent,
|
LspManagerComponent,
|
||||||
],
|
],
|
||||||
templateUrl: './app.component.html',
|
templateUrl: './app.component.html',
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
<div class="col">
|
|
||||||
<div class="row">
|
|
||||||
<div class="terminal-container" #terminalElm>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
import {
|
|
||||||
Component,
|
|
||||||
DestroyRef,
|
|
||||||
ElementRef,
|
|
||||||
HostBinding,
|
|
||||||
ViewChild,
|
|
||||||
inject
|
|
||||||
} from '@angular/core';
|
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
||||||
|
|
||||||
// import { Terminal } from 'xterm';
|
|
||||||
import { Terminal } from '@xterm/xterm';
|
|
||||||
// import { FitAddon } from 'xterm-addon-fit';
|
|
||||||
|
|
||||||
import { TerminalService } from '../../common/services/editor/terminal/terminal.service';
|
|
||||||
|
|
||||||
import { ServiceMessage } from '../../common/types/service-message.type';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'terminal',
|
|
||||||
standalone: true,
|
|
||||||
imports: [
|
|
||||||
],
|
|
||||||
templateUrl: './terminal.component.html',
|
|
||||||
styleUrl: './terminal.component.css',
|
|
||||||
host: {
|
|
||||||
'class': 'row terminal',
|
|
||||||
"(keyup)": "globalTerminalKeyHandler($event)"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
export class TerminalComponent {
|
|
||||||
readonly #destroyRef: DestroyRef = inject(DestroyRef);
|
|
||||||
|
|
||||||
private terminalService: TerminalService = inject(TerminalService);
|
|
||||||
private terminal: Terminal = new Terminal();
|
|
||||||
|
|
||||||
@HostBinding("class.hidden") isHidden: boolean = true;
|
|
||||||
@ViewChild("terminalElm") terminalElm!: ElementRef;
|
|
||||||
|
|
||||||
private editor!: any;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.loadSubscribers();
|
|
||||||
this.loadMainSubscribers();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ngAfterViewInit(): void {
|
|
||||||
this.loadTerminal();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: https://stackoverflow.com/questions/63390143/how-do-i-connect-xterm-jsin-electron-to-a-real-working-command-prompt
|
|
||||||
private loadTerminal() {
|
|
||||||
// const fitAddon = new FitAddon();
|
|
||||||
// this.terminal.loadAddon(fitAddon);
|
|
||||||
|
|
||||||
this.terminal.open(this.terminalElm.nativeElement);
|
|
||||||
this.terminal.onData(e => {
|
|
||||||
console.log(e);
|
|
||||||
// ipcRenderer.send("terminal-into", e);
|
|
||||||
// window.main.quit();
|
|
||||||
} );
|
|
||||||
|
|
||||||
// ipcRenderer.on('terminal-actions', (event, data) => {
|
|
||||||
// this.terminal.write(data);
|
|
||||||
// })
|
|
||||||
|
|
||||||
// Make the terminal's size and geometry fit the size of #terminal-container
|
|
||||||
// fitAddon.fit();
|
|
||||||
}
|
|
||||||
|
|
||||||
private loadSubscribers() {
|
|
||||||
this.terminalService.getMessage$().pipe(
|
|
||||||
takeUntilDestroyed(this.#destroyRef)
|
|
||||||
).subscribe((message: ServiceMessage) => {
|
|
||||||
switch ( message.action ) {
|
|
||||||
case "toggle-terminal":
|
|
||||||
this.toggleTerminal(message);
|
|
||||||
break;
|
|
||||||
case "set-active-editor":
|
|
||||||
this.setActiveEditor(message);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private loadMainSubscribers() {
|
|
||||||
window.main.onTerminalActions(async (action: string) => {
|
|
||||||
this.terminal.write(action);
|
|
||||||
// switch ( action ) {
|
|
||||||
// case "terminal-actions":
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private toggleTerminal(message: ServiceMessage) {
|
|
||||||
this.isHidden = !this.isHidden;
|
|
||||||
|
|
||||||
if (this.isHidden) {
|
|
||||||
this.editor.focus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// setTimeout(() => {
|
|
||||||
// }, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private setActiveEditor(message: ServiceMessage) {
|
|
||||||
if (this.editor == message.rawData) return;
|
|
||||||
|
|
||||||
this.editor = message.rawData;
|
|
||||||
|
|
||||||
if (this.isHidden) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public hideTerminal() {
|
|
||||||
this.isHidden = true;
|
|
||||||
this.editor.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public globalTerminalKeyHandler(event: any) {
|
|
||||||
if (event.ctrlKey && event.key === ".") {
|
|
||||||
this.hideTerminal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user