Explorar o código

fix conditional branches

kosei-n %!s(int64=2) %!d(string=hai) anos
pai
achega
6b8ca3c3ac

+ 2 - 10
packages/editor/src/services/paste-util/paste-markdown-util.ts

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