mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
fix: chars missing when pasting copied content
(fixes streetwriters/notesnook#782)
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user