From 4ecac6f070759e79c254f4a356d02a871ac6abb5 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 17 Mar 2023 09:24:34 -0400
Subject: fixed copy paste to clone links if both anchors are copied.  adjusted
 API for clone to have a cloneLinks field.

---
 src/client/views/PreviewCursor.tsx | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

(limited to 'src/client/views/PreviewCursor.tsx')

diff --git a/src/client/views/PreviewCursor.tsx b/src/client/views/PreviewCursor.tsx
index 3712fff58..95ae65d7a 100644
--- a/src/client/views/PreviewCursor.tsx
+++ b/src/client/views/PreviewCursor.tsx
@@ -81,14 +81,8 @@ export class PreviewCursor extends React.Component<{}> {
 
                     const batch = UndoManager.StartBatch('cloning');
                     {
-                        const docs = await Promise.all(
-                            docids
-                                .filter((did, i) => i)
-                                .map(async did => {
-                                    const doc = Cast(await DocServer.GetRefField(did), Doc, null);
-                                    return clone ? (await Doc.MakeClone(doc)).clone : doc;
-                                })
-                        );
+                        const toCopy = await Promise.all(docids.slice(1).map(async did => Cast(await DocServer.GetRefField(did), Doc, null)));
+                        const docs = clone ? (await Promise.all(Doc.MakeClones(toCopy, false))).map(res => res.clone) : toCopy;
                         const firstx = docs.length ? NumCast(docs[0].x) + ptx - newPoint[0] : 0;
                         const firsty = docs.length ? NumCast(docs[0].y) + pty - newPoint[1] : 0;
                         docs.map(doc => {
-- 
cgit v1.2.3-70-g09d2

