Editor refactor: extract UI
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Editor } from "../editor.tsx";
|
||||
import { Editor } from "../editor.ts";
|
||||
import {
|
||||
EditorView,
|
||||
foldAll,
|
||||
@@ -81,14 +81,14 @@ export function editorSyscalls(editor: Editor): SysCallMapping {
|
||||
html: string,
|
||||
script: string,
|
||||
) => {
|
||||
editor.viewDispatch({
|
||||
editor.ui.viewDispatch({
|
||||
type: "show-panel",
|
||||
id: id as any,
|
||||
config: { html, script, mode },
|
||||
});
|
||||
},
|
||||
"editor.hidePanel": (_ctx, id: string) => {
|
||||
editor.viewDispatch({
|
||||
editor.ui.viewDispatch({
|
||||
type: "hide-panel",
|
||||
id: id as any,
|
||||
});
|
||||
@@ -169,10 +169,10 @@ export function editorSyscalls(editor: Editor): SysCallMapping {
|
||||
return editor.confirm(message);
|
||||
},
|
||||
"editor.getUiOption": (_ctx, key: string): any => {
|
||||
return (editor.viewState.uiOptions as any)[key];
|
||||
return (editor.ui.viewState.uiOptions as any)[key];
|
||||
},
|
||||
"editor.setUiOption": (_ctx, key: string, value: any) => {
|
||||
editor.viewDispatch({
|
||||
editor.ui.viewDispatch({
|
||||
type: "set-ui-option",
|
||||
key,
|
||||
value,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Editor } from "../editor.tsx";
|
||||
import { Editor } from "../editor.ts";
|
||||
import { SysCallMapping } from "../../plugos/system.ts";
|
||||
import { AttachmentMeta, PageMeta } from "../types.ts";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SysCallMapping } from "../../plugos/system.ts";
|
||||
import type { Editor } from "../editor.tsx";
|
||||
import type { Editor } from "../editor.ts";
|
||||
|
||||
export function syncSyscalls(editor: Editor): SysCallMapping {
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Plug } from "../../plugos/plug.ts";
|
||||
import { SysCallMapping, System } from "../../plugos/system.ts";
|
||||
import type { Editor } from "../editor.tsx";
|
||||
import type { Editor } from "../editor.ts";
|
||||
import { CommandDef } from "../hooks/command.ts";
|
||||
|
||||
export function systemSyscalls(
|
||||
|
||||
Reference in New Issue
Block a user