refactor: remove duplicated function (#2956)

This commit is contained in:
ahhshm
2022-07-06 22:41:20 +04:30
committed by GitHub
parent 3e05093f00
commit f4b9a46a0b

View File

@@ -1,21 +1,10 @@
import { ContentMatch } from 'prosemirror-model'
import { EditorState, NodeSelection, TextSelection } from 'prosemirror-state' import { EditorState, NodeSelection, TextSelection } from 'prosemirror-state'
import { canSplit } from 'prosemirror-transform' import { canSplit } from 'prosemirror-transform'
import { defaultBlockAt } from '../helpers/defaultBlockAt'
import { getSplittedAttributes } from '../helpers/getSplittedAttributes' import { getSplittedAttributes } from '../helpers/getSplittedAttributes'
import { RawCommands } from '../types' 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[]) { function ensureMarks(state: EditorState, splittableMarks?: string[]) {
const marks = state.storedMarks const marks = state.storedMarks
|| (state.selection.$to.parentOffset && state.selection.$from.marks()) || (state.selection.$to.parentOffset && state.selection.$from.marks())