|
|
@@ -16,6 +16,8 @@ export const getStrFromBol = (editor: EditorView): string => {
|
|
|
|
|
|
export const adjustPasteData = (indentAndMark: string, text: string): string => {
|
|
|
|
|
|
+ let adjusted;
|
|
|
+
|
|
|
if (text.match(indentAndMarkRE)) {
|
|
|
const matchResult = indentAndMark.match(indentAndMarkRE);
|
|
|
const indent = matchResult ? matchResult[1] : '';
|
|
|
@@ -31,10 +33,14 @@ export const adjustPasteData = (indentAndMark: string, text: string): string =>
|
|
|
return indent + line;
|
|
|
});
|
|
|
|
|
|
- const adjusted = replacedLines ? replacedLines.join('\n') : '';
|
|
|
+ adjusted = replacedLines ? replacedLines.join('\n') : '';
|
|
|
+ }
|
|
|
+
|
|
|
+ else {
|
|
|
+ const replacedText = text.replace(/(\r\n|\r|\n)/g, `$1${indentAndMark}`);
|
|
|
|
|
|
- return adjusted;
|
|
|
+ adjusted = replacedText;
|
|
|
}
|
|
|
|
|
|
- return text;
|
|
|
+ return adjusted;
|
|
|
};
|