Major mini editor refactoring (#225)
Replaces most editing components with CM components, enabling vim mode and completions everywhere Fixes #205 Fixes #221 Fixes #222 Fixes #223
This commit is contained in:
@@ -3,7 +3,8 @@ import { ParsedQuery } from "$sb/lib/query.ts";
|
||||
|
||||
export type AppEvent =
|
||||
| "page:click"
|
||||
| "page:complete"
|
||||
| "editor:complete"
|
||||
| "minieditor:complete"
|
||||
| "page:load"
|
||||
| "editor:init"
|
||||
| "plugs:loaded";
|
||||
@@ -36,3 +37,8 @@ export type PublishEvent = {
|
||||
// Page name
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type CompleteEvent = {
|
||||
linePrefix: string;
|
||||
pos: number;
|
||||
};
|
||||
|
||||
@@ -95,12 +95,6 @@ export function insertAtCursor(text: string): Promise<void> {
|
||||
return syscall("editor.insertAtCursor", text);
|
||||
}
|
||||
|
||||
export function matchBefore(
|
||||
re: string,
|
||||
): Promise<{ from: number; to: number; text: string } | null> {
|
||||
return syscall("editor.matchBefore", re);
|
||||
}
|
||||
|
||||
export function dispatch(change: any): Promise<void> {
|
||||
return syscall("editor.dispatch", change);
|
||||
}
|
||||
@@ -122,10 +116,10 @@ export function enableReadOnlyMode(enabled: boolean) {
|
||||
return syscall("editor.enableReadOnlyMode", enabled);
|
||||
}
|
||||
|
||||
export function getVimEnabled(): Promise<boolean> {
|
||||
return syscall("editor.getVimEnabled");
|
||||
export function getUiOption(key: string): Promise<any> {
|
||||
return syscall("editor.getUiOption", key);
|
||||
}
|
||||
|
||||
export function setVimEnabled(enabled: boolean) {
|
||||
return syscall("editor.setVimEnabled", enabled);
|
||||
export function setUiOption(key: string, value: any): Promise<void> {
|
||||
return syscall("editor.setUiOption", key, value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user