UNPKG

@atlaskit/editor-plugin-block-controls

Version:

Block controls plugin for @atlaskit/editor-core

13 lines 507 B
import { TextSelection } from '@atlaskit/editor-prosemirror/state'; export const createNewLine = start => ({ tr }) => { var _tr$doc$nodeAt; const nodeSize = (_tr$doc$nodeAt = tr.doc.nodeAt(start)) === null || _tr$doc$nodeAt === void 0 ? void 0 : _tr$doc$nodeAt.nodeSize; if (nodeSize === undefined) { return tr; } const position = start + nodeSize; tr.insert(position, tr.doc.type.schema.nodes.paragraph.create()); return tr.setSelection(TextSelection.near(tr.doc.resolve(position))); };