fix: chars missing when pasting copied content

(fixes streetwriters/notesnook#782)
This commit is contained in:
thecodrr
2022-08-15 11:55:37 +05:00
parent 927ecf18c4
commit b8cf9dfb7d

View File

@@ -24,7 +24,6 @@ export const ClipboardTextSerializer = Extension.create({
function getTextBetween(slice: Slice, schema: Schema): string { function getTextBetween(slice: Slice, schema: Schema): string {
const range = { from: 0, to: slice.size }; const range = { from: 0, to: slice.size };
const { from, to } = range;
const separator = (node: ProseMirrorNode) => const separator = (node: ProseMirrorNode) =>
node.attrs.spacing === "single" ? "\n" : "\n\n"; node.attrs.spacing === "single" ? "\n" : "\n\n";
let text = ""; let text = "";
@@ -50,7 +49,7 @@ function getTextBetween(slice: Slice, schema: Schema): string {
}); });
} }
} else if (node.isText) { } else if (node.isText) {
text += node?.text?.slice(Math.max(from, pos) - pos, to - pos); // eslint-disable-line text += node?.text;
separated = false; separated = false;
} else if (node.isBlock && !separated) { } else if (node.isBlock && !separated) {
text += separator(node); text += separator(node);