Initial commit
This commit is contained in:
31
src/app/editor/editor.component.ts
Normal file
31
src/app/editor/editor.component.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { ChangeDetectionStrategy, Component, input } from "@angular/core";
|
||||
import { FormsModule } from "@angular/forms";
|
||||
import { readTextFile } from "@tauri-apps/api/fs";
|
||||
import { load, parse } from "protobufjs";
|
||||
|
||||
@Component({
|
||||
selector: "app-editor",
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule],
|
||||
templateUrl: "./editor.component.html",
|
||||
styleUrl: "./editor.component.css",
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class EditorComponent {
|
||||
fileContents = input<string>();
|
||||
selectedProtoPath = input<string>();
|
||||
|
||||
async loadProtoDefinition() {
|
||||
try {
|
||||
const protoPath = this.selectedProtoPath();
|
||||
if (protoPath) {
|
||||
const protoContents = await readTextFile(protoPath);
|
||||
const definition = await parse(protoContents);
|
||||
console.log(definition);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user