diff --git a/packages/core/src/commands/clear-marks.ts b/packages/core/src/commands/clear-marks.ts index 92a8f8b6..949ae0e4 100644 --- a/packages/core/src/commands/clear-marks.ts +++ b/packages/core/src/commands/clear-marks.ts @@ -6,11 +6,12 @@ import { Command } from 'prosemirror-state'; */ export const clearMarks = (): Command => (state, dispatch) => { const { from, to } = state.selection; - const tr = state.tr; - tr.removeMark(from, to); - tr.setStoredMarks([]); - if (dispatch) { - dispatch(tr); + let tr = state.tr; + tr = tr.removeMark(from, to); + tr = tr.setStoredMarks([]); + if (!tr.docChanged) { + return false; } + dispatch?.(tr); return true; }; diff --git a/packages/core/src/commands/transform-range-to-block.ts b/packages/core/src/commands/transform-range-to-block.ts index 2cf4d964..0e092568 100644 --- a/packages/core/src/commands/transform-range-to-block.ts +++ b/packages/core/src/commands/transform-range-to-block.ts @@ -28,7 +28,10 @@ export const transformRangeToBlock = if (!nodeType.validContent(node.content)) { return tr; } - tr.setBlockType(pos, pos + node.nodeSize, nodeType, attrs); + tr.setBlockType(pos, pos + node.nodeSize, nodeType, { + ...node.attrs, + ...attrs, + }); return tr; }, tr); selection = state.selection.map(tr.doc, tr.mapping); diff --git a/packages/core/src/utils/get-block-container-children.ts b/packages/core/src/utils/get-block-container-children.ts index ca7f92be..4838cb61 100644 --- a/packages/core/src/utils/get-block-container-children.ts +++ b/packages/core/src/utils/get-block-container-children.ts @@ -8,10 +8,7 @@ export const getBlockContainerChildren = ( ) => { const nodes: NodePair[] = []; doc.nodesBetween(from, to, (node, pos, parent) => { - if ( - parent?.type.spec.group?.includes('block-container') && - node.type.name !== 'table' - ) { + if (parent?.type.spec.group?.includes('block-container')) { nodes.push({ node, pos, parent }); return false; }