From 80c2d2681e1f7677a8ec50c994a9c375efc3a569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Tue, 22 Sep 2020 09:15:04 +0200 Subject: [PATCH] fix blockquote --- packages/extension-blockquote/index.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/extension-blockquote/index.ts b/packages/extension-blockquote/index.ts index 9d5ee350..565c1153 100644 --- a/packages/extension-blockquote/index.ts +++ b/packages/extension-blockquote/index.ts @@ -1,9 +1,11 @@ -import { Node } from '@tiptap/core' +import { Command, Node } from '@tiptap/core' import { textblockTypeInputRule } from 'prosemirror-inputrules' +export type BlockquoteCommand = () => Command + declare module '@tiptap/core/src/Editor' { interface Editor { - blockquote(): Editor, + blockquote: BlockquoteCommand, } } @@ -21,12 +23,11 @@ export default new Node() ], toDOM: () => ['blockquote', 0], })) - // .commands(({ editor, name }) => ({ - // [name]: next => attrs => { - // editor.toggleNode(name, 'paragraph', attrs) - // next() - // }, - // })) + .commands(({ name }) => ({ + [name]: attrs => ({ commands }) => { + return commands.toggleNode(name, 'paragraph', attrs) + }, + })) .keys(({ editor }) => ({ 'Shift-Mod-9': () => editor.blockquote(), }))