From e6932e78e54457391a07e70bc85fc1f4f792e22f Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Thu, 22 Oct 2020 22:46:03 +0800 Subject: presBox restoring undoBatch for remove docs --- src/client/views/nodes/PresBox.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 39e1ec58b..80cf848e5 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -690,14 +690,14 @@ export class PresBox extends ViewBoxBaseComponent switch (e.key) { case "Backspace": if (this.layoutDoc.presStatus === "edit") { - runInAction(() => { + undoBatch(action(() => { for (const doc of this._selectedArray) { this.removeDocument(doc); } this._selectedArray = []; this._eleArray = []; this._dragArray = []; - }); + }))(); handled = true; } break; @@ -1827,7 +1827,7 @@ export class PresBox extends ViewBoxBaseComponent
-
{presKeyEvents ? "Key events are active" : "Keys are not active - click anywhere on the presentation trail to activate keys"}
}> +
{presKeyEvents ? "Key are active" : "Keys are not active - click anywhere on the presentation trail to activate keys"}
}>
-- cgit v1.2.3-70-g09d2 From 73719c344b15cf778b2ca66c41a5e89d57d68d1a Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Thu, 22 Oct 2020 23:29:04 +0800 Subject: Fixed key events not working anymore --- src/client/views/nodes/PresBox.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 411c4f541..d05674d69 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -152,6 +152,8 @@ export class PresBox extends ViewBoxBaseComponent updateCurrentPresentation = () => { Doc.UserDoc().activePresentation = this.rootDoc; + document.addEventListener("keydown", this.keyEvents, true); + this.selectPres(); PresBox.Instance = this; } @@ -186,7 +188,7 @@ export class PresBox extends ViewBoxBaseComponent activeItem.playNow = false; // Case 3: No more frames in current doc and next slide is defined, therefore move to next slide } else if (this.childDocs[this.itemIndex + 1] !== undefined) { - if (activeNext.presPinView) setTimeout(() => this.selectPres(), 0); + if (activeNext.presPinView || activeNext.presentationTargetDoc === this.layoutDoc.presCollection) setTimeout(() => this.updateCurrentPresentation(), 0); else this.selectPres(); const nextSelected = this.itemIndex + 1; if (targetDoc.type === DocumentType.AUDIO) { if (AudioBox.Instance._ele) AudioBox.Instance.pause(); } @@ -218,7 +220,7 @@ export class PresBox extends ViewBoxBaseComponent const prevTargetDoc = Cast(prevItem.presentationTargetDoc, Doc, null); const lastFrame = Cast(targetDoc.lastFrame, "number", null); const curFrame = NumCast(targetDoc._currentFrame); - if (prevItem.presPinView) setTimeout(() => this.selectPres(), 0); + if (prevItem.presPinView || prevTargetDoc === this.layoutDoc.presCollection) { setTimeout(() => this.updateCurrentPresentation(), 0); } else this.selectPres(); if (lastFrame !== undefined && curFrame >= 1) { this.prevKeyframe(targetDoc, activeItem); @@ -636,7 +638,7 @@ export class PresBox extends ViewBoxBaseComponent @action selectElement = (doc: Doc) => { this.gotoDocument(this.childDocs.indexOf(doc), NumCast(this.itemIndex)); - if (doc.presPinView) setTimeout(() => this.selectPres(), 0); + if (doc.presPinView || doc.presentationTargetDoc === this.layoutDoc.presCollection) setTimeout(() => this.updateCurrentPresentation(), 0); else this.selectPres(); } -- cgit v1.2.3-70-g09d2 From b5901af1296d63d8930afb218ff05fe57a1e4e6e Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Thu, 22 Oct 2020 23:37:19 +0800 Subject: small fix/addition --- src/client/views/nodes/PresBox.tsx | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index d05674d69..7d29a4f41 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -153,6 +153,7 @@ export class PresBox extends ViewBoxBaseComponent updateCurrentPresentation = () => { Doc.UserDoc().activePresentation = this.rootDoc; document.addEventListener("keydown", this.keyEvents, true); + this._presKeyEventsActive = true; this.selectPres(); PresBox.Instance = this; } -- cgit v1.2.3-70-g09d2 From a3565f9837f416b0b782bbe644c8a10a3ce5b47c Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Thu, 22 Oct 2020 23:39:12 +0800 Subject: remove last chagne --- src/client/views/nodes/PresBox.tsx | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 7d29a4f41..d05674d69 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -153,7 +153,6 @@ export class PresBox extends ViewBoxBaseComponent updateCurrentPresentation = () => { Doc.UserDoc().activePresentation = this.rootDoc; document.addEventListener("keydown", this.keyEvents, true); - this._presKeyEventsActive = true; this.selectPres(); PresBox.Instance = this; } -- cgit v1.2.3-70-g09d2