diff --git a/src/extensions/additional/Math/MathSpecs/index.ts b/src/extensions/additional/Math/MathSpecs/index.ts index 2d63e9bd..968cb75f 100644 --- a/src/extensions/additional/Math/MathSpecs/index.ts +++ b/src/extensions/additional/Math/MathSpecs/index.ts @@ -45,6 +45,7 @@ export const MathSpecs: ExtensionAuto = (builder) => { code: true, toDOM: () => ['div', {class: 'math-block'}, 0], parseDOM: [{tag: 'div.math-block', priority: 200}], + selectable: true, }, fromMd: { tokenName: 'math_block', diff --git a/src/extensions/base/BaseSchema/BaseSchemaSpecs/index.ts b/src/extensions/base/BaseSchema/BaseSchemaSpecs/index.ts index 47095856..07448fa3 100644 --- a/src/extensions/base/BaseSchema/BaseSchemaSpecs/index.ts +++ b/src/extensions/base/BaseSchema/BaseSchemaSpecs/index.ts @@ -54,6 +54,7 @@ export const BaseSchemaSpecs: ExtensionAuto = (builder, 0, ]; }, + selectable: true, placeholder: opts.paragraphPlaceholder ? { content: opts.paragraphPlaceholder, diff --git a/src/extensions/behavior/Selection/selection.ts b/src/extensions/behavior/Selection/selection.ts index 4c832d18..ee8272c3 100644 --- a/src/extensions/behavior/Selection/selection.ts +++ b/src/extensions/behavior/Selection/selection.ts @@ -99,18 +99,16 @@ const getTopLevelNodesFromSelection = (selection: Selection, doc: Node) => { const nodes: {node: Node; pos: number}[] = []; if (selection.from !== selection.to) { const {from, to} = selection; + doc.nodesBetween(from, to, (node, pos) => { const withinSelection = from <= pos && pos + node.nodeSize <= to; - if ( - node && - node.type.name !== 'paragraph' && - !node.isText && - node.type.spec.selectable && - withinSelection - ) { + + if (node && !node.isText && node.type.spec.selectable && withinSelection) { nodes.push({node, pos}); + return false; } + return true; }); } diff --git a/src/extensions/markdown/Blockquote/BlockquoteSpecs/index.ts b/src/extensions/markdown/Blockquote/BlockquoteSpecs/index.ts index cd8671dc..43614392 100644 --- a/src/extensions/markdown/Blockquote/BlockquoteSpecs/index.ts +++ b/src/extensions/markdown/Blockquote/BlockquoteSpecs/index.ts @@ -17,6 +17,7 @@ export const BlockquoteSpecs: ExtensionAuto = (builder) => { toDOM() { return ['blockquote', 0]; }, + selectable: true, }, fromMd: {tokenSpec: {name: blockquoteNodeName, type: 'block'}}, toMd: (state, node) => { diff --git a/src/extensions/markdown/HorizontalRule/HorizontalRuleSpecs/index.ts b/src/extensions/markdown/HorizontalRule/HorizontalRuleSpecs/index.ts index b7689ae9..52d2c8b1 100644 --- a/src/extensions/markdown/HorizontalRule/HorizontalRuleSpecs/index.ts +++ b/src/extensions/markdown/HorizontalRule/HorizontalRuleSpecs/index.ts @@ -14,6 +14,7 @@ export const HorizontalRuleSpecs: ExtensionAuto = (builder) => { toDOM() { return ['div', ['hr']]; }, + selectable: true, }, fromMd: { tokenName: 'hr', diff --git a/src/extensions/yfm/YfmTabs/YfmTabsSpecs/schema.ts b/src/extensions/yfm/YfmTabs/YfmTabsSpecs/schema.ts index 9a37d7b6..3b692052 100644 --- a/src/extensions/yfm/YfmTabs/YfmTabsSpecs/schema.ts +++ b/src/extensions/yfm/YfmTabs/YfmTabsSpecs/schema.ts @@ -78,6 +78,7 @@ export const getSchemaSpecs: ( toDOM(node) { return ['div', node.attrs, 0]; }, + selectable: true, complex: 'root', },