diff options
| author | Shulhan <ms@kilabit.info> | 2021-08-27 08:40:25 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2021-08-27 23:47:17 +0700 |
| commit | 58cfb51717241721b8e66bdbf4ea4bb9a41b5ca1 (patch) | |
| tree | be8d487163024cccd7daf32980f1a3da5cacfa6e /editor/editor.d.ts | |
| parent | 6857ce06167038eb5980a9b2bfc2af2c6c0a87ae (diff) | |
| download | pakakeh.ts-58cfb51717241721b8e66bdbf4ea4bb9a41b5ca1.tar.xz | |
editor: add handler to save the content
When user press CTRL+S on the editor, it will trigger the OnSave handler.
While at it,
* auto scroll when pressing arrow up or down
* auto scroll to bottom when pressing Enter at the end of file
* fix tab key not inserting tab characters
Diffstat (limited to 'editor/editor.d.ts')
| -rw-r--r-- | editor/editor.d.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/editor/editor.d.ts b/editor/editor.d.ts index c5a8a88..d0023df 100644 --- a/editor/editor.d.ts +++ b/editor/editor.d.ts @@ -4,6 +4,7 @@ export interface IEditor { is_editable: boolean; OpenFile(path: string): Response; OnSelection(begin: number, end: number): void; + OnSave(content: string): void; } export declare class Editor { opts: IEditor; @@ -36,7 +37,7 @@ export declare class Editor { insertNewline(x: number, text: string): void; onClickText(text: HTMLElement): void; onKeyup(x: number, text: HTMLElement, ev: KeyboardEvent): boolean | undefined; - onKeydown(x: number, elText: HTMLElement, ev: KeyboardEvent): void; + onKeydown(x: number, elText: HTMLElement, ev: KeyboardEvent): false | undefined; onMouseDownAtLine(x: number): void; onMouseUpAtLine(x: number): void; render(): void; |
