From 3f5fb2e5dc258312e10698f3223239815959d7b6 Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Sun, 18 Oct 2020 00:56:01 +0800 Subject: test commit of changes that might clash with merge --- .../views/presentationview/PresElementBox.tsx | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/client/views/presentationview') diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx index 9a6e4313d..41a8f899c 100644 --- a/src/client/views/presentationview/PresElementBox.tsx +++ b/src/client/views/presentationview/PresElementBox.tsx @@ -22,6 +22,8 @@ import { DragManager } from "../../util/DragManager"; import { CurrentUserUtils } from "../../util/CurrentUserUtils"; import { undoBatch } from "../../util/UndoManager"; import { EditableView } from "../EditableView"; +import { DocUtils } from "../../documents/Documents"; +import { DateField } from "../../../fields/DateField"; export const presSchema = createSchema({ presentationTargetDoc: Doc, @@ -175,8 +177,30 @@ export class PresElementBox extends ViewBoxBaseComponent { + dropDoc && !dropDoc.creationDate && (dropDoc.creationDate = new DateField); + dropDoc instanceof Doc && DocUtils.MakeLinkToActiveAudio(dropDoc); + return dropDoc; + }; + const finishDrag = (e: DragManager.DragCompleteEvent) => { + const docDragData = e.docDragData; + activeItem.dragging = false; + if (docDragData && !docDragData.droppedDocuments.length) { + docDragData.dropAction = dragData.userDropAction || dragData.dropAction; + docDragData.droppedDocuments = + dragData.draggedDocuments.map(d => !dragData.isSelectionMove && !dragData.userDropAction && ScriptCast(d.onDragStart) ? addAudioTag(ScriptCast(d.onDragStart).script.run({ this: d }).result) : + docDragData.dropAction === "alias" ? Doc.MakeAlias(d) : + docDragData.dropAction === "copy" ? Doc.MakeClone(d) : d); + docDragData.dropAction !== "same" && docDragData.droppedDocuments.forEach((drop: Doc, i: number) => { + const dragProps = Cast(dragData.draggedDocuments[i].removeDropProperties, listSpec("string"), []); + const remProps = (dragData?.removeDropProperties || []).concat(Array.from(dragProps)); + remProps.map(prop => drop[prop] = undefined); + }); + } + return e; + }; if (activeItem) { - DragManager.StartDocumentDrag(dragItem.map(ele => ele), dragData, e.clientX, e.clientY); + DragManager.StartDrag(dragItem.map(ele => ele), dragData, e.clientX, e.clientY, undefined, finishDrag); activeItem.dragging = true; return true; } -- cgit v1.2.3-70-g09d2