diff --git a/packages/core/src/commands/splitBlock.ts b/packages/core/src/commands/splitBlock.ts index 32d66cfd..6127177d 100644 --- a/packages/core/src/commands/splitBlock.ts +++ b/packages/core/src/commands/splitBlock.ts @@ -1,21 +1,10 @@ -import { ContentMatch } from 'prosemirror-model' import { EditorState, NodeSelection, TextSelection } from 'prosemirror-state' import { canSplit } from 'prosemirror-transform' +import { defaultBlockAt } from '../helpers/defaultBlockAt' import { getSplittedAttributes } from '../helpers/getSplittedAttributes' import { RawCommands } from '../types' -function defaultBlockAt(match: ContentMatch) { - for (let i = 0; i < match.edgeCount; i += 1) { - const { type } = match.edge(i) - - if (type.isTextblock && !type.hasRequiredAttrs()) { - return type - } - } - return null -} - function ensureMarks(state: EditorState, splittableMarks?: string[]) { const marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks())