Wiring of info bar

This commit is contained in:
2025-06-12 02:45:17 -05:00
parent dbbc6deaae
commit 0675985a5e
13 changed files with 242 additions and 45 deletions

View File

@@ -0,0 +1,15 @@
<div class="col col-md-6" title="{{fpath || '...'}}">
{{path || "..."}}
</div>
<div class="col col-md-2">
{{cursorPos || "1:1"}}
</div>
<div class="col col-md-2">
{{encodeing || "utf-8"}}
</div>
<div class="col col-md-2">
{{ftype || "text"}}
</div>

View File

@@ -0,0 +1,76 @@
import { Component } from '@angular/core';
import { Subject, takeUntil } from 'rxjs';
import { InfoBarService } from '../../common/services/editor/info-bar/info-bar.service';
@Component({
selector: 'info-bar',
standalone: true,
imports: [
],
templateUrl: './info-bar.component.html',
styleUrl: './info-bar.component.css',
host: {
'class': 'row info-bar'
}
})
export class InfoBarComponent {
private unsubscribe = new Subject<void>();
fpath: string = "";
path: string = "";
cursorPos: string = "";
encodeing: string = "";
ftype: string = "";
constructor(
private infoBarService: InfoBarService
) {}
public ngAfterViewInit(): void {
this.loadSubscribers();
}
loadSubscribers() {
this.infoBarService.updateInfoBarFPath$().pipe(
takeUntil(this.unsubscribe)
).subscribe((fpath: string) => {
this.fpath = fpath;
let _path = fpath;
if (fpath?.length > 67) {
_path = "..." + fpath.slice(fpath.length - 67, fpath.length);
}
this.path = _path;
});
this.infoBarService.updateInfoBarCursorPos$().pipe(
takeUntil(this.unsubscribe)
).subscribe((cursorPos: any) => {
this.cursorPos = `${cursorPos.row + 1}:${cursorPos.column}`;
});
this.infoBarService.updateInfoBarEncodeing$().pipe(
takeUntil(this.unsubscribe)
).subscribe((encodeing: string) => {
this.encodeing = encodeing;
});
this.infoBarService.updateInfoBarFType$().pipe(
takeUntil(this.unsubscribe)
).subscribe((ftype: string) => {
let mode = ftype.split("/");
this.ftype = mode[ mode.length - 1 ];
});
}
}