restructure commands

This commit is contained in:
Philipp Kühn
2020-11-18 16:43:27 +01:00
parent 03f009d5f0
commit 3cd6c55279
37 changed files with 214 additions and 231 deletions

View File

@@ -14,21 +14,21 @@ import { Extension } from '../Extension'
export const Keymap = Extension.create({
addKeyboardShortcuts() {
const handleBackspace = () => this.editor.commands.try(({ state, dispatch }) => [
const handleBackspace = () => this.editor.commands.first(({ state, dispatch }) => [
() => undoInputRule(state, dispatch),
() => deleteSelection(state, dispatch),
() => joinBackward(state, dispatch),
() => selectNodeBackward(state, dispatch),
])
const handleDelete = () => this.editor.commands.try(({ state, dispatch }) => [
const handleDelete = () => this.editor.commands.first(({ state, dispatch }) => [
() => deleteSelection(state, dispatch),
() => joinForward(state, dispatch),
() => selectNodeForward(state, dispatch),
])
return {
Enter: () => this.editor.commands.try(({ commands, state, dispatch }) => [
Enter: () => this.editor.commands.first(({ commands, state, dispatch }) => [
() => newlineInCode(state, dispatch),
() => createParagraphNear(state, dispatch),
() => liftEmptyBlock(state, dispatch),