add paragraph command and keyboard shortcut
This commit is contained in:
@@ -28,6 +28,9 @@
|
||||
<button @click="editor.chain().focus().codeBlock().run()" :class="{ 'is-active': editor.isActive('codeBlock') }">
|
||||
code block
|
||||
</button>
|
||||
<button @click="editor.chain().focus().paragraph().run()" :class="{ 'is-active': editor.isActive('paragraph') }">
|
||||
paragraph
|
||||
</button>
|
||||
<button @click="editor.chain().focus().heading({ level: 1 }).run()" :class="{ 'is-active': editor.isActive('heading', { level: 1 }) }">
|
||||
h1
|
||||
</button>
|
||||
|
||||
@@ -10,4 +10,14 @@ export default new Node()
|
||||
toDOM: () => ['p', 0],
|
||||
// toVue: ParagraphComponent,
|
||||
}))
|
||||
.commands(({ name }) => ({
|
||||
[name]: () => ({ commands }) => {
|
||||
return commands.toggleNode(name, 'paragraph')
|
||||
},
|
||||
}))
|
||||
.keys(({ editor, name }) => ({
|
||||
// Exception: TS2339: Property 'paragraph' does not exist on type 'Editor'.
|
||||
// 'Mod-Alt-0': () => editor.paragraph(),
|
||||
'Mod-Alt-0': () => editor.toggleNode(name, 'paragraph'),
|
||||
}))
|
||||
.create()
|
||||
|
||||
Reference in New Issue
Block a user