Commit 3bc2d650 authored by Christos's avatar Christos

Merge branch 'develop' into 'master'

pass dynamic keys

See merge request !13
parents 91841a5e 2965bf08
import React, { Component } from "react";
import styled, { createGlobalStyle } from "styled-components";
import { orderedList, bulletList, listItem } from "prosemirror-schema-list";
import {
orderedList,
bulletList,
listItem,
wrapInList,
splitListItem,
liftListItem,
sinkListItem
} from "prosemirror-schema-list";
import {
tableNodes,
columnResizing,
......@@ -8,7 +17,7 @@ import {
goToNextCell
} from "prosemirror-tables";
import { Wax, CreateSchema } from "wax-prosemirror-core";
import { Wax, CreateSchema, WaxKeys } from "wax-prosemirror-core";
import { EditoriaSchema } from "wax-prosemirror-schema";
import { MainMenuBar, SideMenuBar } from "wax-prosemirror-components";
import "wax-prosemirror-layouts/layouts/editoria-layout.css";
......@@ -37,12 +46,26 @@ const extraNodes = {
};
EditoriaSchema.nodes = { ...EditoriaSchema.nodes, ...extraNodes };
const schema = new CreateSchema(EditoriaSchema);
const plugins = [columnResizing(), tableEditing()];
const keys = {};
const shortCuts = {
Tab: goToNextCell(1),
"Shift-Tab": goToNextCell(-1),
Enter: splitListItem(schema.nodes.list_item),
"Mod-[": liftListItem(schema.nodes.list_item),
"Mod-]": sinkListItem(schema.nodes.list_item),
"Shift-Ctrl-8": wrapInList(schema.nodes.bullet_list),
"Shift-Ctrl-9": wrapInList(schema.nodes.ordered_list)
};
const keys = new WaxKeys({ schema: schema, shortCuts: shortCuts });
const options = {
schema: new CreateSchema(EditoriaSchema),
plugins
schema,
plugins,
keys
};
const GlobalStyle = createGlobalStyle`
......
export { default as Wax } from "./src/Wax";
export { default as CreateSchema } from "./src/config/classes/CreateSchema";
export { default as WaxKeys } from "./src/config/classes/WaxKeys";
import { keymap } from "prosemirror-keymap";
import { undoInputRule } from "prosemirror-inputrules";
import { undo, redo } from "prosemirror-history";
import {
wrapInList,
splitListItem,
liftListItem,
sinkListItem
} from "prosemirror-schema-list";
import {
baseKeymap,
......@@ -69,15 +63,10 @@ class WaxKeys {
"Mod-i": toggleMark(this.schema.marks.em),
"Mod-u": toggleMark(this.schema.marks.underline),
"Mod-`": toggleMark(this.schema.marks.code),
"Shift-Ctrl-8": wrapInList(this.schema.nodes.bullet_list),
"Shift-Ctrl-9": wrapInList(this.schema.nodes.ordered_list),
"Ctrl->": wrapIn(this.schema.nodes.blockquote),
"Mod-Enter": chainCommands(exitCode, this.insertBreak),
"Shift-Enter": chainCommands(exitCode, this.insertBreak),
"Ctrl-Enter": chainCommands(exitCode, this.insertBreak), // mac-only?
Enter: splitListItem(this.schema.nodes.list_item),
"Mod-[": liftListItem(this.schema.nodes.list_item),
"Mod-]": sinkListItem(this.schema.nodes.list_item),
"Shift-Ctrl-0": setBlockType(this.schema.nodes.paragraph),
"Shift-Ctrl-\\": setBlockType(this.schema.nodes.code_block),
"Shift-Ctrl-1": setBlockType(this.schema.nodes.heading, { level: 1 }),
......
Markdown is supported
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