Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Fixed issue with adding links from the button.

Matt Roberts30acddf08933
diff --git a/public/components/common/form/CommentEditor.tsx b/public/components/common/form/CommentEditor.tsx
index a36a8ce5f..6e3c879a5 100644
--- a/public/components/common/form/CommentEditor.tsx
+++ b/public/components/common/form/CommentEditor.tsx
@@ -416,7 +416,16 @@ const Tiptap: React.FunctionComponent<CommentEditorProps> = (props) => {
const handleInsertLink = (text: string, url: string) => {
if (!editor) return
- editor.chain().focus().insertContent(`<a href="${url}" target="_blank" rel="noopener nofollow">${text}</a>`).run()
+ editor
+ .chain()
+ .focus()
+ .insertContent({
+ type: "text",
+ text: text,
+ marks: [{ type: "link", attrs: { href: url, target: "_blank", rel: "noopener nofollow" } }],
+ })
+ .unsetMark("link")
+ .run()
}
// Handle keyboard shortcuts