kosei-n 2 лет назад
Родитель
Сommit
6b8ca3c3ac
1 измененных файлов с 2 добавлено и 10 удалено
  1. 2 10
      packages/editor/src/services/paste-util/paste-markdown-util.ts

+ 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;
 
-  if (text.match(indentAndMarkRE)) {
+  if (text.match(indentAndMarkRE) && strFromBol.match(indentAndMarkRE)) {
     const matchResult = strFromBol.match(indentAndMarkRE);
     const indent = matchResult ? matchResult[1] : '';
 
@@ -35,15 +35,7 @@ export const adjustPasteData = (strFromBol: string, text: string): string => {
       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)) {