diff --git a/packages/tiptap-extensions/src/nodes/BulletList.js b/packages/tiptap-extensions/src/nodes/BulletList.js index ab6888f4e..d4a0b41b0 100644 --- a/packages/tiptap-extensions/src/nodes/BulletList.js +++ b/packages/tiptap-extensions/src/nodes/BulletList.js @@ -1,5 +1,5 @@ import { Node } from 'tiptap' -import { wrappingInputRule, wrapInList, toggleList } from 'tiptap-commands' +import { wrappingInputRule, toggleList } from 'tiptap-commands' export default class BulletNode extends Node { @@ -22,9 +22,9 @@ export default class BulletNode extends Node { return toggleList(type, schema.nodes.list_item) } - keys({ type }) { + keys({ type, schema }) { return { - 'Shift-Ctrl-8': wrapInList(type), + 'Shift-Ctrl-8': toggleList(type, schema.nodes.list_item), } } diff --git a/packages/tiptap-extensions/src/nodes/OrderedList.js b/packages/tiptap-extensions/src/nodes/OrderedList.js index 61184c09b..4d56d288b 100644 --- a/packages/tiptap-extensions/src/nodes/OrderedList.js +++ b/packages/tiptap-extensions/src/nodes/OrderedList.js @@ -1,5 +1,5 @@ import { Node } from 'tiptap' -import { wrappingInputRule, wrapInList, toggleList } from 'tiptap-commands' +import { wrappingInputRule, toggleList } from 'tiptap-commands' export default class OrderedListNode extends Node { @@ -32,9 +32,9 @@ export default class OrderedListNode extends Node { return toggleList(type, schema.nodes.list_item) } - keys({ type }) { + keys({ type, schema }) { return { - 'Shift-Ctrl-9': wrapInList(type), + 'Shift-Ctrl-9': toggleList(type, schema.nodes.list_item), } } diff --git a/packages/tiptap/src/utils/ExtensionManager.js b/packages/tiptap/src/utils/ExtensionManager.js index b1733a543..eac4cb91e 100644 --- a/packages/tiptap/src/utils/ExtensionManager.js +++ b/packages/tiptap/src/utils/ExtensionManager.js @@ -94,11 +94,15 @@ export default class ExtensionManager { ...commands, [name]: attrs => { view.focus() - command({ + + const provider = command({ type: schema[`${type}s`][name], attrs, schema, - })(view.state, view.dispatch, view) + }) + const callbacks = Array.isArray(provider) ? provider : [provider] + + callbacks.forEach(callback => callback(view.state, view.dispatch, view)) }, }), {}) }