Could this be working!?

pull/87/head
Zef Hemel 2022-10-07 10:42:54 +02:00
parent 82faee9baa
commit df41796245
7 changed files with 92 additions and 86 deletions

View File

@ -18,21 +18,6 @@ export {
encode as b64encode,
} from "https://deno.land/std@0.158.0/encoding/base64.ts";
export {
defaultHighlightStyle,
defineLanguageFacet,
foldNodeProp,
HighlightStyle,
indentNodeProp,
Language,
languageDataProp,
LanguageDescription,
LanguageSupport,
ParseContext,
syntaxHighlighting,
syntaxTree,
} from "@codemirror/language";
export { markdown } from "https://esm.sh/@codemirror/lang-markdown@6.0.1?external=@codemirror/state";
export {
history,
historyKeymap,
@ -49,7 +34,7 @@ export {
Tag,
tagHighlighter,
tags,
} from "https://esm.sh/@lezer/highlight";
} from "https://esm.sh/@lezer/highlight@1.1.1";
export type {
BlockContext,
@ -57,7 +42,7 @@ export type {
LeafBlockParser,
MarkdownConfig,
MarkdownExtension,
} from "https://esm.sh/@lezer/markdown";
} from "https://esm.sh/@lezer/markdown@1.0.2";
export {
Emoji,
@ -69,11 +54,11 @@ export {
Superscript,
Table,
TaskList,
} from "https://esm.sh/@lezer/markdown";
} from "https://esm.sh/@lezer/markdown@1.0.2";
export type { SyntaxNode, Tree } from "https://esm.sh/@lezer/common";
export type { SyntaxNode, Tree } from "https://esm.sh/@lezer/common@1.0.1";
export { searchKeymap } from "https://esm.sh/@codemirror/search?external=@codemirror/state";
export { searchKeymap } from "https://esm.sh/@codemirror/search@6.2.1?external=@codemirror/state";
export {
Decoration,
drawSelection,
@ -100,3 +85,17 @@ export {
Transaction,
} from "@codemirror/state";
export type { ChangeSpec, StateCommand } from "@codemirror/state";
export {
defineLanguageFacet,
foldNodeProp,
HighlightStyle,
indentNodeProp,
// bla
Language,
languageDataProp,
LanguageDescription,
LanguageSupport,
ParseContext,
syntaxHighlighting,
syntaxTree,
} from "https://esm.sh/@codemirror/language@6.2.1?external=@codemirror/state";

View File

@ -1,7 +1,6 @@
{
"imports": {
"@codemirror/state": "https://esm.sh/@codemirror/state",
"@codemirror/language": "https://esm.sh/@codemirror/language",
"@codemirror/state": "https://esm.sh/@codemirror/state@6.1.2",
"@lezer/lr": "https://esm.sh/@lezer/lr@1.2.3",
"yaml": "https://deno.land/std@0.158.0/encoding/yaml.ts",
"$sb/": "./packages/",

@ -0,0 +1 @@
Subproject commit 70c34bb6d77b2dd05255f0e4a813bb62239d62d1

View File

@ -1,60 +1,67 @@
import { autocompletion, completionKeymap, CompletionResult } from "../../dep_web.ts";
import { closeBrackets, closeBracketsKeymap } from "../../dep_web.ts";
import { indentWithTab, standardKeymap } from "../../dep_web.ts";
import { history, historyKeymap } from "../../dep_web.ts";
import { syntaxHighlighting } from "../../dep_web.ts";
import { searchKeymap } from "../../dep_web.ts";
import { EditorSelection, EditorState } from "../../dep_web.ts";
import ReactDOM from "https://esm.sh/react-dom@17";
import React, { useEffect, useReducer } from "https://esm.sh/react@17";
import {
autocompletion,
closeBrackets,
closeBracketsKeymap,
completionKeymap,
CompletionResult,
drawSelection,
dropCursor,
EditorSelection,
EditorState,
EditorView,
highlightSpecialChars,
history,
historyKeymap,
indentWithTab,
KeyBinding,
keymap,
runScopeHandlers,
searchKeymap,
standardKeymap,
syntaxHighlighting,
syntaxTree,
ViewPlugin,
ViewUpdate,
} from "../../dep_web.ts";
import React, { useEffect, useReducer } from "https://esm.sh/react@17";
import ReactDOM from "https://esm.sh/react-dom@17";
} from "../../dep_common.ts";
import { SilverBulletHooks } from "../common/manifest.ts";
import { markdown } from "../common/markdown/index.ts";
import { loadMarkdownExtensions, MDExt } from "../common/markdown_ext.ts";
import buildMarkdown from "../common/parser.ts";
import { Space } from "../common/spaces/space.ts";
import { markdownSyscalls } from "../common/syscalls/markdown.ts";
import { FilterOption, PageMeta } from "../common/types.ts";
import { safeRun, throttle } from "../common/util.ts";
import { createSandbox as createIFrameSandbox } from "../plugos/environments/webworker_sandbox.ts";
import { EventHook } from "../plugos/hooks/event.ts";
import { eventSyscalls } from "../plugos/syscalls/event.ts";
import sandboxSyscalls from "../plugos/syscalls/sandbox.ts";
import { System } from "../plugos/system.ts";
import { AppEvent, ClickEvent } from "./app_event.ts";
import { CommandPalette } from "./components/command_palette.tsx";
import { FilterList } from "./components/filter.tsx";
import { PageNavigator } from "./components/page_navigator.tsx";
import { TopBar } from "./components/top_bar.tsx";
import { lineWrapper } from "./line_wrapper.ts";
import { markdown } from "../common/markdown/index.ts";
import { PathPageNavigator } from "./navigator.ts";
import buildMarkdown from "../common/parser.ts";
import reducer from "./reducer.ts";
import { smartQuoteKeymap } from "./smart_quotes.ts";
import { Space } from "../common/spaces/space.ts";
import customMarkdownStyle from "./style.ts";
import { editorSyscalls } from "./syscalls/editor.ts";
import { indexerSyscalls } from "./syscalls/index.ts";
import { spaceSyscalls } from "./syscalls/space.ts";
import { Action, AppViewState, initialViewState } from "./types.ts";
import { SilverBulletHooks } from "../common/manifest.ts";
import { safeRun, throttle } from "../common/util.ts";
import { System } from "../plugos/system.ts";
import { EventHook } from "../plugos/hooks/event.ts";
import { systemSyscalls } from "./syscalls/system.ts";
import { Panel } from "./components/panel.tsx";
import { TopBar } from "./components/top_bar.tsx";
import { attachmentExtension, pasteLinkExtension } from "./editor_paste.ts";
import { CommandHook } from "./hooks/command.ts";
import { SlashCommandHook } from "./hooks/slash_command.ts";
import { attachmentExtension, pasteLinkExtension } from "./editor_paste.ts";
import { markdownSyscalls } from "../common/syscalls/markdown.ts";
import { clientStoreSyscalls } from "./syscalls/clientStore.ts";
import { loadMarkdownExtensions, MDExt } from "../common/markdown_ext.ts";
import { FilterList } from "./components/filter.tsx";
import { FilterOption, PageMeta } from "../common/types.ts";
import { syntaxTree } from "../../dep_web.ts";
import sandboxSyscalls from "../plugos/syscalls/sandbox.ts";
import { eventSyscalls } from "../plugos/syscalls/event.ts";
import { storeSyscalls } from "./syscalls/store.ts";
import { inlineImagesPlugin } from "./inline_image.ts";
import { lineWrapper } from "./line_wrapper.ts";
import { PathPageNavigator } from "./navigator.ts";
import reducer from "./reducer.ts";
import { smartQuoteKeymap } from "./smart_quotes.ts";
import customMarkdownStyle from "./style.ts";
import { clientStoreSyscalls } from "./syscalls/clientStore.ts";
import { editorSyscalls } from "./syscalls/editor.ts";
import { fulltextSyscalls } from "./syscalls/fulltext.ts";
import { indexerSyscalls } from "./syscalls/index.ts";
import { spaceSyscalls } from "./syscalls/space.ts";
import { storeSyscalls } from "./syscalls/store.ts";
import { systemSyscalls } from "./syscalls/system.ts";
import { Action, AppViewState, initialViewState } from "./types.ts";
class PageState {
constructor(
@ -69,28 +76,28 @@ const saveInterval = 1000;
// properly, no idea why
// TODO: Remove at some point
EditorState.prototype.languageDataAt = function (
name: string,
pos: number,
side = -1,
) {
let values = [];
// console.log("Getting language data");
// @ts-ignore
for (let provider of this.facet(EditorState.languageData)) {
let providerResult = provider(this, pos, side);
if (!providerResult) {
// console.log("Empty provider result");
continue;
}
for (let result of providerResult) {
if (Object.prototype.hasOwnProperty.call(result, name)) {
values.push(result[name]);
}
}
}
return values;
};
// EditorState.prototype.languageDataAt = function (
// name: string,
// pos: number,
// side = -1,
// ) {
// let values = [];
// // console.log("Getting language data");
// // @ts-ignore
// for (let provider of this.facet(EditorState.languageData)) {
// let providerResult = provider(this, pos, side);
// if (!providerResult) {
// // console.log("Empty provider result");
// continue;
// }
// for (let result of providerResult) {
// if (Object.prototype.hasOwnProperty.call(result, name)) {
// values.push(result[name]);
// }
// }
// }
// return values;
// };
export class Editor {
readonly commandHook: CommandHook;

View File

@ -1,11 +1,11 @@
import { syntaxTree } from "../../dep_web.ts";
import { syntaxTree } from "../../dep_common.ts";
import {
Decoration,
DecorationSet,
EditorView,
ViewPlugin,
ViewUpdate,
} from "../../dep_web.ts";
} from "../../dep_common.ts";
import { Range } from "../../dep_web.ts";

View File

@ -1,5 +1,5 @@
import { KeyBinding } from "../../dep_web.ts";
import { syntaxTree } from "../../dep_web.ts";
import { syntaxTree } from "../../dep_common.ts";
const straightQuoteContexts = ["CommentBlock", "FencedCode", "InlineCode"];

View File

@ -1,4 +1,4 @@
import { HighlightStyle } from "../../dep_web.ts";
import { HighlightStyle } from "../../dep_common.ts";
import { tagHighlighter, tags as t } from "../../dep_web.ts";
import * as ct from "../common/customtags.ts";
import { MDExt } from "../common/markdown_ext.ts";