Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: Copy content avoids multiple consecutive newlines

shuai89df65c88466
diff --git a/ui/src/components/Editor/ToolBars/image.tsx b/ui/src/components/Editor/ToolBars/image.tsx
index 766301f2..c9950b06 100644
--- a/ui/src/components/Editor/ToolBars/image.tsx
+++ b/ui/src/components/Editor/ToolBars/image.tsx
@@ -285,6 +285,10 @@ const Image = ({ editorInstance }) => {
traverse(body);
+ markdownText = markdownText.replace(/[\n\s]+/g, (match) => {
+ return match.length > 1 ? '\n\n' : match;
+ });
+
editor.replaceSelection(markdownText);
};
const handleClick = () => {