Editor refactor: extract UI

This commit is contained in:
Zef Hemel
2023-07-14 14:22:26 +02:00
parent c5849f881b
commit e92ed2c5be
20 changed files with 315 additions and 274 deletions
+5 -5
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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 -1
View File
@@ -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(