diff --git a/packages/core/src/commands/splitListItem.ts b/packages/core/src/commands/splitListItem.ts index a55e045f..f017ab26 100644 --- a/packages/core/src/commands/splitListItem.ts +++ b/packages/core/src/commands/splitListItem.ts @@ -5,6 +5,7 @@ import { Slice, } from 'prosemirror-model' import { canSplit } from 'prosemirror-transform' +import { TextSelection } from 'prosemirror-state' import { Command } from '../types' import getNodeType from '../helpers/getNodeType' @@ -52,8 +53,7 @@ export const splitListItem = (typeOrName: string | NodeType): Command => ({ stat } // Add a second list item with an empty default start node - // @ts-ignore - wrap = wrap.append(Fragment.from(type.createAndFill())) + wrap = wrap.append(Fragment.from(type.createAndFill() || undefined)) const tr = state.tr.replace( $from.before(keepItem ? undefined : -1), @@ -62,8 +62,7 @@ export const splitListItem = (typeOrName: string | NodeType): Command => ({ stat ) tr - // @ts-ignore - .setSelection(state.selection.constructor.near(tr.doc.resolve($from.pos + (keepItem ? 3 : 2)))) + .setSelection(TextSelection.near(tr.doc.resolve($from.pos + (keepItem ? 3 : 2)))) .scrollIntoView() } @@ -109,13 +108,11 @@ export const splitListItem = (typeOrName: string | NodeType): Command => ({ stat ? [{ type, attrs: newTypeAttributes }, { type: nextType, attrs: newNextTypeAttributes }] : [{ type, attrs: newTypeAttributes }] - // @ts-ignore - if (!canSplit(tr.doc, $from.pos, 2, nextType && [null])) { + if (!canSplit(tr.doc, $from.pos, 2)) { return false } if (dispatch) { - // @ts-ignore tr.split($from.pos, 2, types).scrollIntoView() } diff --git a/packages/extension-text-align/src/text-align.ts b/packages/extension-text-align/src/text-align.ts index 8984a0b0..66e37a56 100644 --- a/packages/extension-text-align/src/text-align.ts +++ b/packages/extension-text-align/src/text-align.ts @@ -57,16 +57,6 @@ export const TextAlign = Extension.create({ addKeyboardShortcuts() { return { - // TODO: re-use only 'textAlign' attribute - // TODO: use custom splitBlock only for `this.options.types` - // Enter: () => this.editor.commands.first(({ commands }) => [ - // () => commands.newlineInCode(), - // () => commands.createParagraphNear(), - // () => commands.liftEmptyBlock(), - // () => commands.splitBlock({ - // withAttributes: true, - // }), - // ]), 'Mod-Shift-l': () => this.editor.commands.setTextAlign('left'), 'Mod-Shift-e': () => this.editor.commands.setTextAlign('center'), 'Mod-Shift-r': () => this.editor.commands.setTextAlign('right'),