From 0b62b3842f72d0fa563efec247d018fe06d42561 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Wed, 17 Apr 2019 16:41:19 +0300 Subject: [PATCH] hard break --- wax-prosemirror-core/Wax.js | 12 ++++-------- wax-prosemirror-core/config/classes/WaxKeys.js | 8 ++------ wax-prosemirror-core/index.js | 2 +- wax-prosemirror-schema/defaultSchema.js | 14 +++++++++++++- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/wax-prosemirror-core/Wax.js b/wax-prosemirror-core/Wax.js index b6e6d9a43..9155d6483 100644 --- a/wax-prosemirror-core/Wax.js +++ b/wax-prosemirror-core/Wax.js @@ -7,8 +7,6 @@ import Editor from "./Editor"; import plugins from "./config/plugins"; import placeholder from "./config/plugins/placeholder"; -import MainMenuBar from "./components/menu/MainMenuBar"; -import defaultMenuItems from "./config/DefaultMenuItems"; import WaxKeys from "./config/classes/WaxKeys"; const parser = schema => { @@ -46,12 +44,10 @@ class Wax extends Component { // TO DO Find a way to start plugins with options plugins.push(...[placeholder({ content: this.props.placeholder }), keys]); - this.WaxOptions = options - ? options - : { - plugins, - schema - }; + this.WaxOptions = { + schema, + plugins + }; const parse = parser(schema); const serialize = serializer(schema); diff --git a/wax-prosemirror-core/config/classes/WaxKeys.js b/wax-prosemirror-core/config/classes/WaxKeys.js index ceef5f58b..bc4c34e89 100644 --- a/wax-prosemirror-core/config/classes/WaxKeys.js +++ b/wax-prosemirror-core/config/classes/WaxKeys.js @@ -7,7 +7,7 @@ import { liftListItem, sinkListItem } from "prosemirror-schema-list"; -// import { goToNextCell } from "prosemirror-tables"; + import { baseKeymap, toggleMark, @@ -21,8 +21,6 @@ import { selectParentNode } from "prosemirror-commands"; -import { goToNextCell } from "prosemirror-tables"; - class WaxKeys { constructor(config) { this.schema = config.schema; @@ -88,9 +86,7 @@ class WaxKeys { "Shift-Ctrl-4": setBlockType(this.schema.nodes.heading, { level: 4 }), "Shift-Ctrl-5": setBlockType(this.schema.nodes.heading, { level: 5 }), "Shift-Ctrl-6": setBlockType(this.schema.nodes.heading, { level: 6 }), - "Mod-_": this.insertRule, - Tab: goToNextCell(1), - "Shift-Tab": goToNextCell(-1) + "Mod-_": this.insertRule }; } diff --git a/wax-prosemirror-core/index.js b/wax-prosemirror-core/index.js index 35d79a14c..ad583d713 100644 --- a/wax-prosemirror-core/index.js +++ b/wax-prosemirror-core/index.js @@ -1,6 +1,6 @@ export { default as Wax } from "./Wax"; - export { default as createSchema } from "./config/classes/createSchema"; + export { default as plugins } from "./config/plugins"; //Components diff --git a/wax-prosemirror-schema/defaultSchema.js b/wax-prosemirror-schema/defaultSchema.js index 5ce06618e..0933aa5f2 100644 --- a/wax-prosemirror-schema/defaultSchema.js +++ b/wax-prosemirror-schema/defaultSchema.js @@ -1,13 +1,25 @@ -const pDOM = ["p", 0]; +const pDOM = ["p", 0], + brDOM = ["br"]; const defaultSchema = { nodes: { doc: { content: "block+" }, + text: { group: "inline" }, + hard_break: { + inline: true, + group: "inline", + selectable: false, + parseDOM: [{ tag: "br" }], + toDOM() { + return brDOM; + } + }, + paragraph: { content: "inline*", group: "block", -- GitLab