aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/presentationview/PresElementBox.tsx
diff options
context:
space:
mode:
authorGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2020-10-18 00:56:01 +0800
committerGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2020-10-18 00:56:01 +0800
commit3f5fb2e5dc258312e10698f3223239815959d7b6 (patch)
treea8b965cb760b256af116e4ef13956d14516c3458 /src/client/views/presentationview/PresElementBox.tsx
parentf75b69dc91191636842c794d878572a143347b54 (diff)
test commit of changes that might clash with merge
Diffstat (limited to 'src/client/views/presentationview/PresElementBox.tsx')
-rw-r--r--src/client/views/presentationview/PresElementBox.tsx26
1 files changed, 25 insertions, 1 deletions
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<FieldViewProps, PresDoc
doc.className = "presItem-slide"
dragItem.push(doc);
});
+ const addAudioTag = (dropDoc: any) => {
+ 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;
}