소스 검색

add conditional branches

kosei-n 2 년 전
부모
커밋
e94d9aeb6c
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      packages/editor/src/services/paste-util/paste-markdown-util.ts

+ 9 - 1
packages/editor/src/services/paste-util/paste-markdown-util.ts

@@ -35,7 +35,15 @@ export const adjustPasteData = (strFromBol: string, text: string): string => {
       return indent + line;
     });
 
-    adjusted = replacedLines ? replacedLines.join('\n') : '';
+    if (replacedLines == null) {
+      adjusted = '';
+    }
+    else if (replacedLines.length === 1 && !matchResult) {
+      adjusted = `${replacedLines.join('')}\n`;
+    }
+    else {
+      adjusted = replacedLines.join('\n');
+    }
   }
 
   else if (strFromBol.match(indentAndMarkRE)) {