Personal no-bs blogging platform.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465import { EditorState } from "prosemirror-state";import { EditorView } from "prosemirror-view";import { history } from "prosemirror-history";import { addListNodes } from "prosemirror-schema-list";import { schema, defaultMarkdownParser } from "prosemirror-markdown";import { Schema } from "prosemirror-model";
import keymap, { tabKeymap } from './keymap';import { rules } from "./input-rules";import { initial_post } from "./sync";import { menu } from "./menu";import stats from "./stats";
type MyNodes = | "doc" | "paragraph" | "heading" | "blockquote" | "code_block" | "text" | "image" | "hard_break" | "horizontal_rule" | "ordered_list" | "bullet_list" | "list_item"
type MyMarks = | "em" | "strong" | "code" | "link"
export const custom_schema = new Schema<MyNodes, MyMarks>({ ...schema, nodes: addListNodes(schema.spec.nodes, "paragraph block*", "block"), marks: schema.spec.marks})
var editor_container: Element = document.querySelector("#editor-container")!;editor_container.innerHTML = '';
const plugins = [ rules, history(), keymap, tabKeymap, menu, stats,];
const state = EditorState.create({ schema: custom_schema, plugins, doc: defaultMarkdownParser.parse(initial_post.content),});
export var view = new EditorView(editor_container, { state, attributes: { class: "editor", id: "editor", style: "font-family: inherit;" },});