Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

docs(ui): Improves comment explaining plainText() usage Explains why we need to call plainText() to strip markdown syntax from editor.getText() in markdown mode

widal00121649cbb3513
diff --git a/public/components/common/form/CommentEditor.tsx b/public/components/common/form/CommentEditor.tsx
index d162ac4b7..46d4cfb93 100644
--- a/public/components/common/form/CommentEditor.tsx
+++ b/public/components/common/form/CommentEditor.tsx
@@ -336,7 +336,8 @@ const Tiptap: React.FunctionComponent<CommentEditorProps> = (props) => {
const updated = ({ editor }: { editor: Editor; transaction: any }): void => {
// Get the current markdown content
const markdown = isRawMarkdownMode ? editor.getText() : editor.storage.markdown.getMarkdown()
- // Get plain text by processing the markdown content to strip markdown syntax
+ // In markdown mode, the tiptap markdown extension isn't loaded, which means editor.getText()
+ // includes markdown syntax, so we need to use plainText() to remove it.
const plainTextContent = plainText(editor.getText())
// Pass both markdown and plain text to parent