This is an automated email from the ASF dual-hosted git repository.

shuai pushed a commit to branch test
in repository https://gitbox.apache.org/repos/asf/answer.git


The following commit(s) were added to refs/heads/test by this push:
     new 89df65c8 fix: Copy content avoids multiple consecutive newlines
89df65c8 is described below

commit 89df65c8846625538df527c804dc24a843260959
Author: shuai <[email protected]>
AuthorDate: Tue May 20 15:33:46 2025 +0800

    fix: Copy content avoids multiple consecutive newlines
---
 ui/src/components/Editor/ToolBars/image.tsx | 4 ++++
 1 file changed, 4 insertions(+)

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 = () => {

Reply via email to