Skip to content
Snippets Groups Projects
Commit 8c15351e authored by chris's avatar chris
Browse files

WIP creating default

parent 58088b4c
No related branches found
No related tags found
1 merge request!5Develop
import React, { Component } from "react"; import React, { Component } from "react";
import { Schema } from "prosemirror-model";
import { Wax } from "wax-prosemirror-core"; import { Wax } from "wax-prosemirror-core";
import { defaultSchema } from "wax-prosemirror-schema"; import { defaultSchema } from "wax-prosemirror-schema";
const { nodes, marks } = defaultSchema;
const options = {
schema: new Schema({ nodes, marks })
};
class Default extends Component { class Default extends Component {
render() { render() {
console.log(options.schema);
return ( return (
<Wax <Wax
placeholder="Type Something..." placeholder="Type Something..."
options={options}
autoFocus autoFocus
theme="default" theme="default"
layout="default" layout="default"
......
...@@ -35,9 +35,9 @@ const serializer = schema => { ...@@ -35,9 +35,9 @@ const serializer = schema => {
class Wax extends Component { class Wax extends Component {
componentWillMount() { componentWillMount() {
const { value, onChange, options } = this.props; const { value, onChange, options } = this.props;
const { schema } = options;
const WaxOnchange = onChange ? onChange : value => true; const WaxOnchange = onChange ? onChange : value => true;
const schema = WaxSchema();
const keys = const keys =
options && options.keys options && options.keys
? options.keys ? options.keys
......
import { history } from "prosemirror-history"; import { history } from "prosemirror-history";
import { dropCursor } from "prosemirror-dropcursor"; import { dropCursor } from "prosemirror-dropcursor";
import { gapCursor } from "prosemirror-gapcursor"; import { gapCursor } from "prosemirror-gapcursor";
import "prosemirror-tables/style/tables.css";
import "prosemirror-gapcursor/style/gapcursor.css"; import "prosemirror-gapcursor/style/gapcursor.css";
//TODO remove everything in comments
// import "prosemirror-tables/style/tables.css";
import placeholderPlugin from "./plugins/placeholderPlugin"; import placeholderPlugin from "./plugins/placeholderPlugin";
import { columnResizing, tableEditing } from "prosemirror-tables"; // import { columnResizing, tableEditing } from "prosemirror-tables";
import rules from "./rules"; // import rules from "./rules";
export default [ export default [
rules, // rules,
dropCursor(), dropCursor(),
gapCursor(), gapCursor(),
history(), history(),
placeholderPlugin, placeholderPlugin
columnResizing(), // columnResizing(),
tableEditing() // tableEditing()
]; ];
// for tables // for tables
document.execCommand("enableObjectResizing", false, false); // document.execCommand("enableObjectResizing", false, false);
document.execCommand("enableInlineTableEditing", false, false); // document.execCommand("enableInlineTableEditing", false, false);
const pDOM = ["p", 0]; const pDOM = ["p", 0];
const defaultSchema = { const defaultSchema = {
doc: { nodes: {
content: "block+" doc: {
}, content: "block+"
},
text: {
group: "inline"
},
paragraph: { paragraph: {
content: "inline*", content: "inline*",
group: "block", group: "block",
parseDOM: [{ tag: "p" }], parseDOM: [{ tag: "p" }],
toDOM() { toDOM() {
return pDOM; return pDOM;
}
} }
} },
marks: {}
}; };
export default defaultSchema; export default defaultSchema;
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment