diff --git a/demos/src/Nodes/Blockquote/React/index.jsx b/demos/src/Nodes/Blockquote/React/index.jsx index 1413a3f0..8c326097 100644 --- a/demos/src/Nodes/Blockquote/React/index.jsx +++ b/demos/src/Nodes/Blockquote/React/index.jsx @@ -8,13 +8,18 @@ import './styles.scss' export default () => { const editor = useEditor({ - extensions: [Document, Paragraph, Text, Blockquote], + extensions: [ + Document, + Paragraph, + Text, + Blockquote, + ], content: ` -
- Nothing is impossible, the word itself says “I’m possible!” -
-

Audrey Hepburn

- `, +
+ Nothing is impossible, the word itself says “I’m possible!” +
+

Audrey Hepburn

+ `, }) if (!editor) { @@ -31,13 +36,13 @@ export default () => { diff --git a/demos/src/Nodes/Blockquote/Vue/index.vue b/demos/src/Nodes/Blockquote/Vue/index.vue index 207ad5d1..7c173527 100644 --- a/demos/src/Nodes/Blockquote/Vue/index.vue +++ b/demos/src/Nodes/Blockquote/Vue/index.vue @@ -3,10 +3,10 @@ - - diff --git a/packages/core/src/commands/toggleWrap.ts b/packages/core/src/commands/toggleWrap.ts index 799a61e1..08693c15 100644 --- a/packages/core/src/commands/toggleWrap.ts +++ b/packages/core/src/commands/toggleWrap.ts @@ -1,4 +1,3 @@ -import { wrapIn, lift } from 'prosemirror-commands' import { NodeType } from 'prosemirror-model' import { RawCommands } from '../types' import { isNodeActive } from '../helpers/isNodeActive' @@ -15,13 +14,13 @@ declare module '@tiptap/core' { } } -export const toggleWrap: RawCommands['toggleWrap'] = (typeOrName, attributes = {}) => ({ state, dispatch }) => { +export const toggleWrap: RawCommands['toggleWrap'] = (typeOrName, attributes = {}) => ({ state, commands }) => { const type = getNodeType(typeOrName, state.schema) const isActive = isNodeActive(state, type, attributes) if (isActive) { - return lift(state, dispatch) + return commands.lift(type) } - return wrapIn(type, attributes)(state, dispatch) + return commands.wrapIn(type, attributes) } diff --git a/packages/core/src/commands/wrapIn.ts b/packages/core/src/commands/wrapIn.ts index f7d60fa5..ffcd227c 100644 --- a/packages/core/src/commands/wrapIn.ts +++ b/packages/core/src/commands/wrapIn.ts @@ -1,7 +1,6 @@ import { wrapIn as originalWrapIn } from 'prosemirror-commands' import { NodeType } from 'prosemirror-model' import { RawCommands } from '../types' -import { isNodeActive } from '../helpers/isNodeActive' import { getNodeType } from '../helpers/getNodeType' declare module '@tiptap/core' { @@ -17,11 +16,6 @@ declare module '@tiptap/core' { export const wrapIn: RawCommands['wrapIn'] = (typeOrName, attributes = {}) => ({ state, dispatch }) => { const type = getNodeType(typeOrName, state.schema) - const isActive = isNodeActive(state, type, attributes) - - if (isActive) { - return false - } return originalWrapIn(type, attributes)(state, dispatch) }