aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/trails/PresElementBox.tsx
diff options
context:
space:
mode:
authorJenny Yu <jennyyu212@outlook.com>2022-06-08 21:20:01 -0700
committerJenny Yu <jennyyu212@outlook.com>2022-06-08 21:20:01 -0700
commite08c690dbeca3e58b1bc0d387df0287f60f58b7a (patch)
tree964f8cdaac5767371c917e10b71719c826730aa2 /src/client/views/nodes/trails/PresElementBox.tsx
parent80bffa352450c384538dedad626d5a52b7950bc4 (diff)
fix: remove recording from overlay when deleting slide
Diffstat (limited to 'src/client/views/nodes/trails/PresElementBox.tsx')
-rw-r--r--src/client/views/nodes/trails/PresElementBox.tsx24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/client/views/nodes/trails/PresElementBox.tsx b/src/client/views/nodes/trails/PresElementBox.tsx
index f56ca5471..a2d76978a 100644
--- a/src/client/views/nodes/trails/PresElementBox.tsx
+++ b/src/client/views/nodes/trails/PresElementBox.tsx
@@ -261,11 +261,12 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
@undoBatch
removeItem = action((e: React.MouseEvent) => {
+ e.stopPropagation();
this.props.removeDocument?.(this.rootDoc);
if (PresBox.Instance._selectedArray.has(this.rootDoc)) {
PresBox.Instance._selectedArray.delete(this.rootDoc);
}
- e.stopPropagation();
+ this.removeAllRecordingInOverlay()
});
// set the value/title of the individual pres element
@@ -318,10 +319,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
return isInOverlay
}
- @undoBatch
- @action
- hideRecording = (e: React.PointerEvent) => {
- e.stopPropagation()
+ removeAllRecordingInOverlay = () => {
DocListCast((Doc.UserDoc().myOverlayDocs as Doc).data).forEach((doc) => {
if (doc.slides === this.rootDoc) {
Doc.RemoveDocFromList((Doc.UserDoc().myOverlayDocs as Doc), undefined, doc);
@@ -331,13 +329,15 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
@undoBatch
@action
+ hideRecording = (e: React.PointerEvent) => {
+ e.stopPropagation()
+ this.removeAllRecordingInOverlay()
+ }
+
+ @undoBatch
+ @action
showRecording = (activeItem: Doc) => {
- // Remove every recording that already exists in overlay view
- DocListCast((Doc.UserDoc().myOverlayDocs as Doc).data).forEach((doc) => {
- if (doc.slides !== null) {
- Doc.RemoveDocFromList((Doc.UserDoc().myOverlayDocs as Doc), undefined, doc);
- }
- })
+ this.removeAllRecordingInOverlay()
if (activeItem.recording) {
// if we already have an existing recording
Doc.AddDocToList((Doc.UserDoc().myOverlayDocs as Doc), undefined, Cast(activeItem.recording, Doc, null));
@@ -363,7 +363,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
// if we dont have any recording
const recording = Docs.Create.WebCamDocument("", {
_width: 400, _height: 200,
- hideDocumentButtonBar: true,
+ // hideDocumentButtonBar: true,
hideDecorationTitle: true,
hideOpenButton: true,
// hideDeleteButton: true,