diff --git a/scribe/bun.lockb b/scribe/bun.lockb index 432ea94..a4916e8 100755 Binary files a/scribe/bun.lockb and b/scribe/bun.lockb differ diff --git a/scribe/index.html b/scribe/index.html index 0380b20..7ba140c 100644 --- a/scribe/index.html +++ b/scribe/index.html @@ -6,6 +6,7 @@ Tauri App + @@ -39,5 +40,8 @@

+ +
+
test
diff --git a/scribe/package.json b/scribe/package.json index bd997a5..d2df402 100644 --- a/scribe/package.json +++ b/scribe/package.json @@ -11,7 +11,12 @@ }, "dependencies": { "@tauri-apps/api": "^2", - "@tauri-apps/plugin-shell": "^2" + "@tauri-apps/plugin-shell": "^2", + "prosemirror-example-setup": "^1.2.3", + "prosemirror-schema-basic": "^1.2.3", + "prosemirror-schema-list": "^1.4.1", + "prosemirror-state": "^1.4.3", + "prosemirror-view": "^1.34.3" }, "devDependencies": { "@tauri-apps/cli": "^2", diff --git a/scribe/src/main.ts b/scribe/src/main.ts index 4783341..3473d70 100644 --- a/scribe/src/main.ts +++ b/scribe/src/main.ts @@ -1,5 +1,27 @@ import { invoke } from "@tauri-apps/api/core"; +import {EditorState} from "prosemirror-state" +import {EditorView} from "prosemirror-view" +import {Schema, DOMParser} from "prosemirror-model" +import {schema} from "prosemirror-schema-basic" +import {addListNodes} from "prosemirror-schema-list" +import {exampleSetup} from "prosemirror-example-setup" + +// Mix the nodes from prosemirror-schema-list into the basic schema to +// create a schema with list support. +const mySchema = new Schema({ + nodes: addListNodes(schema.spec.nodes, "paragraph block*", "block"), + marks: schema.spec.marks +}) + +window.view = new EditorView(document.querySelector("#editor"), { + state: EditorState.create({ + doc: DOMParser.fromSchema(mySchema).parse(document.querySelector("#content")), + plugins: exampleSetup({schema: mySchema}) + }) +}) + + let greetInputEl: HTMLInputElement | null; let greetMsgEl: HTMLElement | null; diff --git a/scribe/src/prosemirror.ts b/scribe/src/prosemirror.ts new file mode 100644 index 0000000..8bf62e9 --- /dev/null +++ b/scribe/src/prosemirror.ts @@ -0,0 +1,21 @@ +import {EditorState} from "prosemirror-state" +import {EditorView} from "prosemirror-view" +import {Schema, DOMParser} from "prosemirror-model" +import {schema} from "prosemirror-schema-basic" +import {addListNodes} from "prosemirror-schema-list" +import {exampleSetup} from "prosemirror-example-setup" + +// Mix the nodes from prosemirror-schema-list into the basic schema to +// create a schema with list support. +const mySchema = new Schema({ + nodes: addListNodes(schema.spec.nodes, "paragraph block*", "block"), + marks: schema.spec.marks +}) + +window.view = new EditorView(document.querySelector("#editor"), { + state: EditorState.create({ + doc: DOMParser.fromSchema(mySchema).parse(document.querySelector("#content")), + plugins: exampleSetup({schema: mySchema}) + }) +}) +