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
+1 -1
View File
@@ -6,7 +6,7 @@ import {
syntaxTree,
WidgetType,
} from "../deps.ts";
import { Editor } from "../editor.tsx";
import { Editor } from "../editor.ts";
import { decoratorStateField, isCursorInRange } from "./util.ts";
type AdmonitionType = "note" | "warning";
+1 -1
View File
@@ -1,6 +1,6 @@
import type { ClickEvent } from "../../plug-api/app_event.ts";
import type { Extension } from "../deps.ts";
import type { Editor } from "../editor.tsx";
import type { Editor } from "../editor.ts";
import { blockquotePlugin } from "./block_quote.ts";
import { admonitionPlugin } from "./admonition.ts";
import { directivePlugin } from "./directive.ts";
+1 -1
View File
@@ -1,7 +1,7 @@
import { commandLinkRegex } from "../../common/markdown_parser/parser.ts";
import { ClickEvent } from "$sb/app_event.ts";
import { Decoration, syntaxTree } from "../deps.ts";
import { Editor } from "../editor.tsx";
import { Editor } from "../editor.ts";
import {
ButtonWidget,
decoratorStateField,
+1 -1
View File
@@ -1,6 +1,6 @@
import { EditorView, syntaxTree, ViewPlugin, ViewUpdate } from "../deps.ts";
import { maximumAttachmentSize } from "../../common/types.ts";
import { Editor } from "../editor.tsx";
import { Editor } from "../editor.ts";
// We use turndown to convert HTML to Markdown
import TurndownService from "https://cdn.skypack.dev/turndown@7.1.1";
+1 -1
View File
@@ -1,7 +1,7 @@
import { WidgetContent } from "../../plug-api/app_event.ts";
import { panelHtml } from "../components/panel.tsx";
import { Decoration, EditorState, syntaxTree, WidgetType } from "../deps.ts";
import type { Editor } from "../editor.tsx";
import type { Editor } from "../editor.ts";
import { CodeWidgetCallback } from "../hooks/code_widget.ts";
import {
decoratorStateField,
+1 -1
View File
@@ -8,7 +8,7 @@ import {
import { decoratorStateField } from "./util.ts";
import type { Space } from "../space.ts";
import type { Editor } from "../editor.tsx";
import type { Editor } from "../editor.ts";
class InlineImageWidget extends WidgetType {
constructor(
+1 -1
View File
@@ -8,7 +8,7 @@ import {
import { renderMarkdownToHtml } from "../../plugs/markdown/markdown_render.ts";
import { ParseTree } from "$sb/lib/tree.ts";
import { lezerToParseTree } from "../../common/markdown_parser/parse_tree.ts";
import type { Editor } from "../editor.tsx";
import type { Editor } from "../editor.ts";
class TableViewWidget extends WidgetType {
constructor(
+1 -1
View File
@@ -1,7 +1,7 @@
import { pageLinkRegex } from "../../common/markdown_parser/parser.ts";
import { ClickEvent } from "../../plug-api/app_event.ts";
import { Decoration, syntaxTree } from "../deps.ts";
import { Editor } from "../editor.tsx";
import { Editor } from "../editor.ts";
import {
decoratorStateField,
invisibleDecoration,