mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 19:59:02 +08:00
add hardbreak commands
This commit is contained in:
parent
fbee7656c8
commit
bf08653bba
@ -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()">
|
||||
|
@ -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()">
|
||||
|
@ -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()">
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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(),
|
||||
}
|
||||
},
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user