From 2329abe7dd5fd7398d1f214defe8272d2ab4caca Mon Sep 17 00:00:00 2001 From: Palanikannan1437 <73993394+Palanikannan1437@users.noreply.github.com> Date: Thu, 10 Aug 2023 03:40:01 +0530 Subject: [PATCH] added ts fix for node types --- apps/app/components/tiptap/extensions/index.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/apps/app/components/tiptap/extensions/index.tsx b/apps/app/components/tiptap/extensions/index.tsx index 5af141586..6eed0108a 100644 --- a/apps/app/components/tiptap/extensions/index.tsx +++ b/apps/app/components/tiptap/extensions/index.tsx @@ -75,18 +75,16 @@ export const TiptapExtensions = [ return [ new InputRule({ find: /^(?:---|—-|___\s|\*\*\*\s)$/, - handler: ({ state, range }) => { - const attributes = {}; + handler: ({ state, range, commands }) => { + commands.splitBlock(); + const attributes = {}; const { tr } = state; const start = range.from; const end = range.to; - const node = this.type.create(attributes) as unknown as ProseMirrorNode; - tr.insert(start - 1, node).delete( - tr.mapping.map(start), - tr.mapping.map(end), - ); - }, + // @ts-ignore + tr.replaceWith(start - 1, end, this.type.create(attributes)); + } }), ]; },