Wiring of info bar
This commit is contained in:
0
src/app/editor/info-bar/info-bar.component.css
Normal file
0
src/app/editor/info-bar/info-bar.component.css
Normal file
15
src/app/editor/info-bar/info-bar.component.html
Normal file
15
src/app/editor/info-bar/info-bar.component.html
Normal 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>
|
76
src/app/editor/info-bar/info-bar.component.ts
Normal file
76
src/app/editor/info-bar/info-bar.component.ts
Normal 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 ];
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user