Skip to content
Snippets Groups Projects
Commit 785ac6ae authored by chris's avatar chris
Browse files

fix lists

parent f2776774
No related branches found
No related tags found
1 merge request!50fix lists
......@@ -33,16 +33,16 @@ class Rules {
// 1. ordered list
wrappingInputRule(
/^(\d+)\.\s$/,
this.schema.nodes.ordered_list,
this.schema.nodes.orderedlist,
match => ({ order: +match[1] }),
(match, node) => node.childCount + node.attrs.order === +match[1]
),
// * bullet list
wrappingInputRule(/^\s*([-+*])\s$/, this.schema.nodes.bullet_list),
wrappingInputRule(/^\s*([-+*])\s$/, this.schema.nodes.bulletlist),
// ``` code block
textblockTypeInputRule(/^```$/, this.schema.nodes.code_block),
// textblockTypeInputRule(/^```$/, this.schema.nodes.code_block),
// # heading
textblockTypeInputRule(
......
......@@ -3,6 +3,13 @@ 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,
setBlockType,
......@@ -40,7 +47,7 @@ class ShortCuts {
}
addShortCut(shortcut) {
this.keys = Object.assign(this.keys, shortcut);
Object.assign(this.keys, shortcut);
this.createShortCuts();
}
......@@ -65,8 +72,13 @@ class ShortCuts {
Escape: selectParentNode,
"Mod-Enter": chainCommands(exitCode, this.insertBreak),
"Shift-Enter": chainCommands(exitCode, this.insertBreak),
"Ctrl-Enter": chainCommands(exitCode, this.insertBreak), // mac-only?
"Mod-_": this.insertRule
"Ctrl-Enter": chainCommands(exitCode, this.insertBreak),
"Mod-_": this.insertRule,
"Mod-[": liftListItem(this.schema.nodes.list_item),
"Mod-]": sinkListItem(this.schema.nodes.list_item),
Enter: splitListItem(this.schema.nodes.list_item),
"Shift-Ctrl-8": wrapInList(this.schema.nodes.bullet_list),
"Shift-Ctrl-9": wrapInList(this.schema.nodes.ordered_list)
};
}
......
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