refactor: remove duplicated function (#2956)
This commit is contained in:
@@ -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())
|
||||||
|
|||||||
Reference in New Issue
Block a user