From f124caedb3c63ba2cb97fb0d0ead1dcf65018df8 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Fri, 19 Jan 2024 09:30:42 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20tiptap=20renderText=20warn?= =?UTF-8?q?ings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mainInput/MentionExtension.ts | 40 ------------------- gui/src/components/mainInput/TipTapEditor.tsx | 2 +- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/gui/src/components/mainInput/MentionExtension.ts b/gui/src/components/mainInput/MentionExtension.ts index 88fbda1ee..4de688508 100644 --- a/gui/src/components/mainInput/MentionExtension.ts +++ b/gui/src/components/mainInput/MentionExtension.ts @@ -5,10 +5,6 @@ import Suggestion, { SuggestionOptions } from "@tiptap/suggestion"; export type MentionOptions = { HTMLAttributes: Record; - renderText: (props: { - options: MentionOptions; - node: ProseMirrorNode; - }) => string; renderHTML: (props: { options: MentionOptions; node: ProseMirrorNode; @@ -24,9 +20,6 @@ export const Mention = Node.create({ addOptions() { return { HTMLAttributes: {}, - renderText({ options, node }) { - return `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`; - }, renderHTML({ options, node }) { return [ "span", @@ -152,23 +145,6 @@ export const Mention = Node.create({ }, renderHTML({ node, HTMLAttributes }) { - if (this.options.renderText !== undefined) { - console.warn( - "renderText is deprecated use renderText and renderHTML instead" - ); - return [ - "span", - mergeAttributes( - { "data-type": this.name }, - this.options.HTMLAttributes, - HTMLAttributes - ), - this.options.renderText({ - options: this.options, - node, - }), - ]; - } const html = this.options.renderHTML({ options: this.options, node, @@ -188,22 +164,6 @@ export const Mention = Node.create({ return html; }, - renderText({ node }) { - if (this.options.renderText !== undefined) { - console.warn( - "renderText is deprecated use renderText and renderHTML instead" - ); - return this.options.renderText({ - options: this.options, - node, - }); - } - return this.options.renderText({ - options: this.options, - node, - }); - }, - addKeyboardShortcuts() { return { Backspace: () => diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index 889263df3..2400ab4b5 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -193,7 +193,7 @@ function TipTapEditor(props: TipTapEditorProps) { onOpen, inSubmenuRef ), - renderText: (props) => { + renderHTML: (props) => { return `@${props.node.attrs.label || props.node.attrs.id}`; }, }),