aboutsummaryrefslogtreecommitdiff
path: root/editor/editor.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor.ts')
-rw-r--r--editor/editor.ts21
1 files changed, 3 insertions, 18 deletions
diff --git a/editor/editor.ts b/editor/editor.ts
index 56a3ece..8f175ac 100644
--- a/editor/editor.ts
+++ b/editor/editor.ts
@@ -14,8 +14,6 @@ export interface WuiEditorOptions {
id: string
is_editable: boolean
- OpenFile(path: string): WuiResponseInterface
-
// Handler that will be called when user select lines.
OnSelection(begin: number, end: number): void
@@ -335,21 +333,10 @@ export class WuiEditor {
}
}
- async OpenFile(path: string): Promise<WuiResponseInterface> {
- let res = await this.opts.OpenFile(path)
- if (!res) {
- return { code: 500 } as WuiResponseInterface
- }
- if (res.code != 200) {
- return res
- }
- if (!res.data) {
- return res
- }
-
- this.active_file = res.data as WuiVfsNodeInterface
+ Open(node: WuiVfsNodeInterface): void {
+ this.active_file = node
- let content = this.active_file.content as string
+ let content = node.content as string
content = content.replace("\r\n", "\n")
this.raw_lines = content.split("\n")
@@ -360,8 +347,6 @@ export class WuiEditor {
}
this.render()
-
- return res
}
private clearSelection() {