From b131330ca16c68e10b8512bcc37b27f2952dc701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Tue, 4 May 2021 20:51:32 +0200 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20check=20for=20canReplaceWith=20?= =?UTF-8?q?within=20replaceRange?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/commands/replaceRange.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/core/src/commands/replaceRange.ts b/packages/core/src/commands/replaceRange.ts index 94330bb0..dbb9be77 100644 --- a/packages/core/src/commands/replaceRange.ts +++ b/packages/core/src/commands/replaceRange.ts @@ -16,15 +16,15 @@ declare module '@tiptap/core' { export const replaceRange: RawCommands['replaceRange'] = (range, typeOrName, attributes = {}) => ({ tr, state, dispatch }) => { const type = getNodeType(typeOrName, state.schema) const { from, to } = range - const $from = tr.doc.resolve(from) - const index = $from.index() + // const $from = tr.doc.resolve(from) + // const index = $from.index() - if (!$from.parent.canReplaceWith(index, index, type)) { - return false - } + // if (!$from.parent.canReplaceWith(index, index, type)) { + // return false + // } if (dispatch) { - tr.replaceWith(from, to, type.create(attributes)) + tr.replaceRangeWith(from, to, type.create(attributes)) } return true