import { syscall } from "./syscall"; import { FilterOption } from "../common/types"; export function getCurrentPage(): Promise { return syscall("editor.getCurrentPage"); } export function setPage(newName: string): Promise { return syscall("editor.setPage", newName); } export function getText(): Promise { return syscall("editor.getText"); } export function getCursor(): Promise { return syscall("editor.getCursor"); } export function save(): Promise { return syscall("editor.save"); } export function navigate(name: string, pos?: number): Promise { return syscall("editor.navigate", name, pos); } export function reloadPage(): Promise { return syscall("editor.reloadPage"); } export function openUrl(url: string): Promise { return syscall("editor.openUrl", url); } export function flashNotification(message: string): Promise { return syscall("editor.flashNotification", message); } export function filterBox( label: string, options: FilterOption[], helpText: string = "", placeHolder: string = "" ): Promise { return syscall("editor.filterBox", label, options, helpText, placeHolder); } export function showRhs(html: string, flex = 1): Promise { return syscall("editor.showRhs", html, flex); } export function hideRhs(): Promise { return syscall("editor.hideRhs"); } export function showLhs(html: string, flex = 1): Promise { return syscall("editor.showLhs", html, flex); } export function hideLhs(): Promise { return syscall("editor.hideLhs"); } export function insertAtPos(text: string, pos: number): Promise { return syscall("editor.insertAtPos", text, pos); } export function replaceRange( from: number, to: number, text: string ): Promise { return syscall("editor.replaceRange", from, to, text); } export function moveCursor(pos: number): Promise { return syscall("editor.moveCursor", pos); } export function insertAtCursor(text: string): Promise { 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 { return syscall("editor.dispatch", change); } export function prompt( message: string, defaultValue = "" ): Promise { return syscall("editor.prompt", message, defaultValue); }