mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
editor: fix incorrect paragraph formatting in copied text (#1299)
Signed-off-by: Muhammad Ali <alihamuh@gmail.com>
This commit is contained in:
@@ -43,8 +43,7 @@ export const ClipboardTextSerializer = Extension.create({
|
||||
|
||||
function getTextBetween(slice: Slice, schema: Schema): string {
|
||||
const range = { from: 0, to: slice.size };
|
||||
const separator = (node: ProseMirrorNode) =>
|
||||
node.attrs.spacing === "single" ? "\n" : "\n\n";
|
||||
const separator = "\n";
|
||||
let text = "";
|
||||
let separated = true;
|
||||
|
||||
@@ -54,7 +53,7 @@ function getTextBetween(slice: Slice, schema: Schema): string {
|
||||
|
||||
if (textSerializer) {
|
||||
if (node.isBlock && !separated) {
|
||||
text += separator(node);
|
||||
text += separator;
|
||||
separated = true;
|
||||
}
|
||||
|
||||
@@ -70,8 +69,8 @@ function getTextBetween(slice: Slice, schema: Schema): string {
|
||||
} else if (node.isText) {
|
||||
text += node?.text;
|
||||
separated = false;
|
||||
} else if (node.isBlock && !separated) {
|
||||
text += separator(node);
|
||||
} else if (node.isBlock) {
|
||||
text += separator;
|
||||
separated = true;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user