add hardbreak commands

This commit is contained in:
Philipp Kühn 2020-11-18 12:11:45 +01:00
parent fbee7656c8
commit bf08653bba
5 changed files with 7 additions and 7 deletions

View File

@ -55,7 +55,7 @@
<button @click="editor.chain().focus().horizontalRule().run()">
horizontal rule
</button>
<button @click="editor.chain().focus().hardBreak().run()">
<button @click="editor.chain().focus().setHardBreak().run()">
hard break
</button>
<button @click="editor.chain().focus().undo().run()">

View File

@ -55,7 +55,7 @@
<button @click="editor.chain().focus().horizontalRule().run()">
horizontal rule
</button>
<button @click="editor.chain().focus().hardBreak().run()">
<button @click="editor.chain().focus().setHardBreak().run()">
hard break
</button>
<button @click="editor.chain().focus().undo().run()">

View File

@ -55,7 +55,7 @@
<button @click="editor.chain().focus().horizontalRule().run()">
horizontal rule
</button>
<button @click="editor.chain().focus().hardBreak().run()">
<button @click="editor.chain().focus().setHardBreak().run()">
hard break
</button>
<button @click="editor.chain().focus().undo().run()">

View File

@ -1,6 +1,6 @@
<template>
<div v-if="editor">
<button @click="editor.chain().focus().hardBreak().run()">
<button @click="editor.chain().focus().setHardBreak().run()">
hardBreak
</button>

View File

@ -25,7 +25,7 @@ const HardBreak = Node.create({
/**
* Add a hard break
*/
hardBreak: (): Command => ({ commands, state, dispatch }) => {
setHardBreak: (): Command => ({ commands, state, dispatch }) => {
return commands.try([
() => exitCode(state, dispatch),
() => {
@ -42,8 +42,8 @@ const HardBreak = Node.create({
addKeyboardShortcuts() {
return {
'Mod-Enter': () => this.editor.commands.hardBreak(),
'Shift-Enter': () => this.editor.commands.hardBreak(),
'Mod-Enter': () => this.editor.commands.setHardBreak(),
'Shift-Enter': () => this.editor.commands.setHardBreak(),
}
},
})