Skip to content

Commit

Permalink
refactor: remove duplicated function
Browse files Browse the repository at this point in the history
  • Loading branch information
Arman Hashemi committed Jul 6, 2022
1 parent 9e84353 commit b806201
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions packages/core/src/commands/splitBlock.ts
Original file line number Diff line number Diff line change
@@ -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())
Expand Down

0 comments on commit b806201

Please sign in to comment.