From 45dc37a7eb8f2ed3c94e8300bdbacf07122754e6 Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Thu, 22 Oct 2020 00:29:03 +0800 Subject: minor undoBatch changes --- src/client/views/collections/CollectionStackingView.tsx | 1 + src/client/views/nodes/PresBox.tsx | 13 +++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx index d490b65a8..1ed7652e0 100644 --- a/src/client/views/collections/CollectionStackingView.tsx +++ b/src/client/views/collections/CollectionStackingView.tsx @@ -294,6 +294,7 @@ export class CollectionStackingView extends CollectionSubView this.filteredChildren.find((fdoc, i) => ndoc === fdoc && i <= insertInd) ? off + 1 : off, 0); newDocs.filter(ndoc => docs.indexOf(ndoc) !== -1).forEach(ndoc => docs.splice(docs.indexOf(ndoc), 1)); diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 53b2433e8..eabd57632 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -516,7 +516,6 @@ export class PresBox extends ViewBoxBaseComponent /** * The method called to open the presentation as a minimized view */ - @undoBatch @action updateMinimize = () => { const docView = DocumentManager.Instance.getDocumentView(this.layoutDoc); @@ -552,7 +551,7 @@ export class PresBox extends ViewBoxBaseComponent * Called when the user changes the view type * Either 'List' (stacking) or 'Slides' (carousel) */ - @undoBatch + // @undoBatch viewChanged = action((e: React.ChangeEvent) => { //@ts-ignore const viewType = e.target.selectedOptions[0].value as CollectionViewType; @@ -871,7 +870,6 @@ export class PresBox extends ViewBoxBaseComponent // } // Converts seconds to ms and updates presTransition - @undoBatch setTransitionTime = (number: String, change?: number) => { let timeInMS = Number(number) * 1000; if (change) timeInMS += change; @@ -883,7 +881,6 @@ export class PresBox extends ViewBoxBaseComponent } // Converts seconds to ms and updates presDuration - @undoBatch setDurationTime = (number: String, change?: number) => { let timeInMS = Number(number) * 1000; if (change) timeInMS += change; @@ -1000,10 +997,10 @@ export class PresBox extends ViewBoxBaseComponent onChange={action((e) => this.setTransitionTime(e.target.value))} /> s
-
this.setTransitionTime(String(transitionSpeed), 1000)}> +
this.setTransitionTime(String(transitionSpeed), 1000))}>
-
this.setTransitionTime(String(transitionSpeed), -1000)}> +
this.setTransitionTime(String(transitionSpeed), -1000))}>
@@ -1031,10 +1028,10 @@ export class PresBox extends ViewBoxBaseComponent onChange={action((e) => this.setDurationTime(e.target.value))} /> s
-
this.setDurationTime(String(duration), 1000)}> +
this.setDurationTime(String(duration), 1000))}>
-
this.setDurationTime(String(duration), -1000)}> +
this.setDurationTime(String(duration), -1000))}>
-- cgit v1.2.3-70-g09d2 From 5fa2d3442a9183c592c0bdae7212848c40e50b26 Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Thu, 22 Oct 2020 19:11:06 +0800 Subject: PresBox bug fixes and updates - Removed unessecary undoBatch - e.keyCode removed in favour of e.key - Added keys active button --- src/client/views/nodes/PresBox.tsx | 238 ++++++++++++++++++++----------------- 1 file changed, 129 insertions(+), 109 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 1b8f01d81..d4e6713ac 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -28,7 +28,6 @@ import { AudioBox } from "./AudioBox"; import { CollectionFreeFormDocumentView } from "./CollectionFreeFormDocumentView"; import { FieldView, FieldViewProps } from './FieldView'; import "./PresBox.scss"; -import { VideoBox } from "./VideoBox"; export enum PresMovement { Zoom = "zoom", @@ -69,6 +68,7 @@ export class PresBox extends ViewBoxBaseComponent @observable _isChildActive = false; @observable _moveOnFromAudio: boolean = true; @observable _presTimer!: NodeJS.Timeout; + @observable _presKeyEventsActive: boolean = false; @observable _selectedArray: Doc[] = []; @observable _sortedSelectedArray: Doc[] = []; @@ -129,6 +129,7 @@ export class PresBox extends ViewBoxBaseComponent componentWillUnmount() { document.removeEventListener("keydown", this.keyEvents, true); + runInAction(() => this._presKeyEventsActive = false); // Turn of progressivize editors this.turnOffEdit(true); } @@ -141,6 +142,7 @@ export class PresBox extends ViewBoxBaseComponent this.layoutDoc._gridGap = 0; this.layoutDoc._yMargin = 0; document.addEventListener("keydown", this.keyEvents, true); + runInAction(() => this._presKeyEventsActive = true); this.turnOffEdit(true); DocListCastAsync((Doc.UserDoc().myPresentations as Doc).data).then(pres => !pres?.includes(this.rootDoc) && Doc.AddDocToList(Doc.UserDoc().myPresentations as Doc, "data", this.rootDoc)); @@ -154,7 +156,6 @@ export class PresBox extends ViewBoxBaseComponent /** * Called when the user moves to the next slide in the presentation trail. */ - @undoBatch @action next = () => { this.updateCurrentPresentation(); @@ -206,7 +207,6 @@ export class PresBox extends ViewBoxBaseComponent * Design choice: If there are frames within the presentation, moving back will not * got back through the frames but instead directly to the next point in the presentation. */ - @undoBatch @action back = () => { this.updateCurrentPresentation(); @@ -426,7 +426,6 @@ export class PresBox extends ViewBoxBaseComponent //The function that starts or resets presentaton functionally, depending on presStatus of the layoutDoc - @undoBatch @action startAutoPres = (startSlide: number) => { this.updateCurrentPresentation(); @@ -560,52 +559,12 @@ export class PresBox extends ViewBoxBaseComponent if (viewType === CollectionViewType.Stacking) this.layoutDoc._gridGap = 0; }); - /** - * When the movement dropdown is changes - */ - @undoBatch - updateMovement = action((movement: any, all?: boolean) => { - if (all) { - this.childDocs.forEach((doc) => { - switch (movement) { - case PresMovement.Zoom: //Pan and zoom - doc.presMovement = PresMovement.Zoom; - break; - case PresMovement.Pan: //Pan - doc.presMovement = PresMovement.Pan; - break; - case PresMovement.Jump: //Jump Cut - doc.presJump = true; - doc.presMovement = PresMovement.Jump; - break; - case PresMovement.None: default: - doc.presMovement = PresMovement.None; - break; - } - }) - } else if (this._selectedArray) this._selectedArray.forEach((doc) => { - switch (movement) { - case PresMovement.Zoom: //Pan and zoom - doc.presMovement = PresMovement.Zoom; - break; - case PresMovement.Pan: //Pan - doc.presMovement = PresMovement.Pan; - break; - case PresMovement.Jump: //Jump Cut - doc.presJump = true; - doc.presMovement = PresMovement.Jump; - break; - case PresMovement.None: default: - doc.presMovement = PresMovement.None; - break; - } - }) - }); + setMovementName = action((movement: any, activeItem: Doc): string => { let output: string = 'none'; switch (movement) { - case PresMovement.Zoom: output = 'Zoom'; break; //Pan and zoom + case PresMovement.Zoom: output = 'Pan & Zoom'; break; //Pan and zoom case PresMovement.Pan: output = 'Pan'; break; //Pan case PresMovement.Jump: output = 'Jump cut'; break; //Jump Cut case PresMovement.None: output = 'None'; break; //None @@ -723,66 +682,74 @@ export class PresBox extends ViewBoxBaseComponent } // Key for when the presentaiton is active - @undoBatch - keyEvents = action((e: KeyboardEvent) => { + @action + keyEvents = (e: KeyboardEvent) => { if (e.target instanceof HTMLInputElement) return; let handled = false; const anchorNode = document.activeElement as HTMLDivElement; if (anchorNode && anchorNode.className?.includes("lm_title")) return; - if (e.keyCode === 27) { // Escape key - if (CurrentUserUtils.OverlayDocs.includes(this.layoutDoc)) { this.updateMinimize(); } - else if (this.layoutDoc.presStatus === "edit") { this._selectedArray = []; this._eleArray = []; this._dragArray = []; } - else this.layoutDoc.presStatus = "edit"; - if (this._presTimer) clearTimeout(this._presTimer); - handled = true; - } if ((e.metaKey || e.altKey) && e.keyCode === 65) { // Ctrl-A to select all - if (this.layoutDoc.presStatus === "edit") { - this._selectedArray = this.childDocs; + switch (e.key) { + case "Backspace": + if (this.layoutDoc.presStatus === "edit") { + undoBatch(action(() => { + for (const doc of this._selectedArray) { + this.removeDocument(doc); + } + this._selectedArray = []; + this._eleArray = []; + this._dragArray = []; + }))(); + handled = true; + } + break; + case "Escape": + if (CurrentUserUtils.OverlayDocs.includes(this.layoutDoc)) { this.updateMinimize(); } + else if (this.layoutDoc.presStatus === "edit") { this._selectedArray = []; this._eleArray = []; this._dragArray = []; } + else this.layoutDoc.presStatus = "edit"; + if (this._presTimer) clearTimeout(this._presTimer); handled = true; - } - } if (e.keyCode === 37 || e.keyCode === 38) { // left(37) / a(65) / up(38) to go back - this.back(); - if (this._presTimer) clearTimeout(this._presTimer); - handled = true; - } if (e.keyCode === 39 || e.keyCode === 40) { // right (39) / d(68) / down(40) to go to next - this.next(); - if (this._presTimer) clearTimeout(this._presTimer); - handled = true; - } if (e.keyCode === 32) { // spacebar to 'present' or autoplay - if (this.layoutDoc.presStatus === "manual") this.startAutoPres(this.itemIndex); - else if (this.layoutDoc.presStatus === "auto") if (this._presTimer) clearTimeout(this._presTimer); - handled = true; - } if (e.keyCode === 8) { // delete (backspace) selected items - if (this.layoutDoc.presStatus === "edit") { - runInAction(() => { - for (const doc of this._selectedArray) { - this.removeDocument(doc); - } - this._selectedArray = []; - this._eleArray = []; - this._dragArray = []; - }); + break; + case "Down": case "ArrowDown": + case "Right": case "ArrowRight": + if (e.shiftKey) { + this.rootDoc._itemIndex = NumCast(this.rootDoc._itemIndex) + 1; + this._selectedArray.push(this.childDocs[this.rootDoc._itemIndex]); + } else { + this.next(); + if (this._presTimer) clearTimeout(this._presTimer); + } handled = true; - } - } if (handled) { + break; + case "Up": case "ArrowUp": + case "Left": case "ArrowLeft": + if (e.shiftKey) { + this.rootDoc._itemIndex = NumCast(this.rootDoc._itemIndex) - 1; + this._selectedArray.push(this.childDocs[this.rootDoc._itemIndex]); + } else { + this.back(); + if (this._presTimer) clearTimeout(this._presTimer); + } + handled = true; + break; + case "Spacebar": case " ": + if (this.layoutDoc.presStatus === "manual") this.startAutoPres(this.itemIndex); + else if (this.layoutDoc.presStatus === "auto") if (this._presTimer) clearTimeout(this._presTimer); + handled = true; + break; + case "a": + if ((e.metaKey || e.altKey) && this.layoutDoc.presStatus === "edit") { + this._selectedArray = this.childDocs; + handled = true; + } + default: + console.log(e.key); + break; + } + if (handled) { e.stopPropagation(); e.preventDefault(); - } if ((e.keyCode === 37 || e.keyCode === 38) && e.shiftKey) { // left(37) / a(65) / up(38) to go back - if (this.layoutDoc.presStatus === "edit" && this._selectedArray.length > 0) { - const index = this.childDocs.indexOf(this._selectedArray[this._selectedArray.length]); - if ((index - 1) > 0) this._selectedArray.push(this.childDocs[index - 1]); - } - handled = true; - } if ((e.keyCode === 39 || e.keyCode === 40) && e.shiftKey) { // left(37) / a(65) / up(38) to go back - if (this.layoutDoc.presStatus === "edit" && this._selectedArray.length > 0) { - const index = this.childDocs.indexOf(this._selectedArray[this._selectedArray.length]); - if ((index + 1) < this._selectedArray.length) { - this._selectedArray.push(this.childDocs[index + 1]); - } - } - handled = true; } - }); + }; /** * @@ -801,7 +768,7 @@ export class PresBox extends ViewBoxBaseComponent this.childDocs.forEach((doc, index) => { const tagDoc = Cast(doc.presentationTargetDoc, Doc, null); const srcContext = Cast(tagDoc?.context, Doc, null); - const width = NumCast(tagDoc._width) / 10; + const width = NumCast(tagDoc?._width) / 10; const height = Math.max(NumCast(tagDoc._height) / 10, 15); const edge = Math.max(width, height); const fontSize = edge * 0.8; @@ -906,7 +873,51 @@ export class PresBox extends ViewBoxBaseComponent }) } + /** + * When the movement dropdown is changes + */ + @undoBatch + @action + updateMovement = (movement: any, all?: boolean) => { + if (all) { + this.childDocs.forEach((doc) => { + switch (movement) { + case PresMovement.Zoom: //Pan and zoom + doc.presMovement = PresMovement.Zoom; + break; + case PresMovement.Pan: //Pan + doc.presMovement = PresMovement.Pan; + break; + case PresMovement.Jump: //Jump Cut + doc.presJump = true; + doc.presMovement = PresMovement.Jump; + break; + case PresMovement.None: default: + doc.presMovement = PresMovement.None; + break; + } + }) + } else if (this._selectedArray) this._selectedArray.forEach((doc) => { + switch (movement) { + case PresMovement.Zoom: //Pan and zoom + doc.presMovement = PresMovement.Zoom; + break; + case PresMovement.Pan: //Pan + doc.presMovement = PresMovement.Pan; + break; + case PresMovement.Jump: //Jump Cut + doc.presJump = true; + doc.presMovement = PresMovement.Jump; + break; + case PresMovement.None: default: + doc.presMovement = PresMovement.None; + break; + } + }) + }; + @undoBatch + @action updateHideBefore = (activeItem: Doc) => { activeItem.presHideTillShownButton = !activeItem.presHideTillShownButton; this._selectedArray.forEach((doc) => { @@ -915,6 +926,7 @@ export class PresBox extends ViewBoxBaseComponent } @undoBatch + @action updateHideAfter = (activeItem: Doc) => { activeItem.presHideAfterButton = !activeItem.presHideAfterButton; this._selectedArray.forEach((doc) => { @@ -923,6 +935,7 @@ export class PresBox extends ViewBoxBaseComponent } @undoBatch + @action updateOpenDoc = (activeItem: Doc) => { activeItem.openDocument = !activeItem.openDocument; this._selectedArray.forEach((doc) => { @@ -931,6 +944,7 @@ export class PresBox extends ViewBoxBaseComponent } @undoBatch + @action updateEffect = (effect: any, all?: boolean) => { if (all) { this.childDocs.forEach((doc) => { @@ -999,7 +1013,7 @@ export class PresBox extends ViewBoxBaseComponent
e.stopPropagation()} style={{ display: this.openMovementDropdown ? "grid" : "none" }}>
e.stopPropagation()} onClick={() => this.updateMovement(PresMovement.None)}>None
-
e.stopPropagation()} onClick={() => this.updateMovement(PresMovement.Zoom)}>Pan and Zoom
+
e.stopPropagation()} onClick={() => this.updateMovement(PresMovement.Zoom)}>Pan {"&"} Zoom
e.stopPropagation()} onClick={() => this.updateMovement(PresMovement.Pan)}>Pan
e.stopPropagation()} onClick={() => this.updateMovement(PresMovement.Jump)}>Jump cut
@@ -1008,6 +1022,11 @@ export class PresBox extends ViewBoxBaseComponent
Transition Speed
console.log('onInput')} + onDrag={() => console.log('onDrag')} + onDragEnd={() => console.log('onDragEnd')} + onBlur={() => console.log('onBlur')} + onCompositionEnd={() => console.log('onCompEnd')} type="number" value={transitionSpeed} onChange={action((e) => this.setTransitionTime(e.target.value))} /> s
@@ -1039,7 +1058,6 @@ export class PresBox extends ViewBoxBaseComponent
document.removeEventListener("keydown", this.keyEvents, true)} onChange={action((e) => this.setDurationTime(e.target.value))} /> s
@@ -1372,10 +1390,10 @@ export class PresBox extends ViewBoxBaseComponent @computed get presentDropdown() { return (
e.stopPropagation()} onPointerUp={e => e.stopPropagation()} onPointerDown={e => e.stopPropagation()}> -
{ this.updateMinimize(); this.turnOffEdit(true); })))}> +
{ this.updateMinimize(); this.turnOffEdit(true); })}> Minimize
-
{ this.layoutDoc.presStatus = "manual"; this.turnOffEdit(true); })))}> +
{ this.layoutDoc.presStatus = "manual"; this.turnOffEdit(true); })}> Sidebar view
@@ -1383,7 +1401,6 @@ export class PresBox extends ViewBoxBaseComponent } // Case in which the document has keyframes to navigate to next key frame - @undoBatch @action nextKeyframe = (tagDoc: Doc, curDoc: Doc): void => { const childDocs = DocListCast(tagDoc[Doc.LayoutFieldKey(tagDoc)]); @@ -1399,7 +1416,6 @@ export class PresBox extends ViewBoxBaseComponent tagDoc.lastFrame = Math.max(NumCast(tagDoc._currentFrame), NumCast(tagDoc.lastFrame)); } - @undoBatch @action prevKeyframe = (tagDoc: Doc, actItem: Doc): void => { const childDocs = DocListCast(tagDoc[Doc.LayoutFieldKey(tagDoc)]); @@ -1721,7 +1737,6 @@ export class PresBox extends ViewBoxBaseComponent return tags; } - @undoBatch @action nextAppearFrame = (doc: Doc, i: number): void => { // const activeItem = Cast(this.childDocs[this.itemIndex], Doc, null); @@ -1734,7 +1749,6 @@ export class PresBox extends ViewBoxBaseComponent this.updateOpacityList(doc["opacity-indexed"], NumCast(doc.appearFrame)); } - @undoBatch @action prevAppearFrame = (doc: Doc, i: number): void => { // const activeItem = Cast(this.childDocs[this.itemIndex], Doc, null); @@ -1796,6 +1810,7 @@ export class PresBox extends ViewBoxBaseComponent const propTitle = CurrentUserUtils.propertiesWidth > 0 ? "Close Presentation Panel" : "Open Presentation Panel"; const mode = StrCast(this.rootDoc._viewType) as CollectionViewType; const isMini: boolean = this.toolbarWidth <= 100; + const presKeyEvents: boolean = (this.isPres && this._presKeyEventsActive && this.rootDoc === Doc.UserDoc().activePresentation) return (mode === CollectionViewType.Carousel3D) ? (null) : (
{/*
{"Add new slide"}
}>
this.newDocumentTools = !this.newDocumentTools)}> @@ -1819,6 +1834,11 @@ export class PresBox extends ViewBoxBaseComponent
+
{presKeyEvents ? "Key events are active" : "Keys are not active - click anywhere on the presentation trail to activate keys"}
}> +
+ +
+
{propTitle}
}>
0 ? '#AEDDF8' : 'white' }} /> @@ -1961,8 +1981,8 @@ export class PresBox extends ViewBoxBaseComponent {this.playButtonFrames}
- {this.props.PanelWidth() > 250 ?
{ this.layoutDoc.presStatus = "edit"; clearTimeout(this._presTimer); }))}>EXIT
- :
this.layoutDoc.presStatus = "edit"))}> + {this.props.PanelWidth() > 250 ?
{ this.layoutDoc.presStatus = "edit"; clearTimeout(this._presTimer); })}>EXIT
+ :
this.layoutDoc.presStatus = "edit")}>
}
); @@ -1994,7 +2014,7 @@ export class PresBox extends ViewBoxBaseComponent {this.playButtonFrames}
-
{ this.updateMinimize(); this.layoutDoc.presStatus = "edit"; clearTimeout(this._presTimer); }))}>EXIT
+
{ this.updateMinimize(); this.layoutDoc.presStatus = "edit"; clearTimeout(this._presTimer); })}>EXIT
: -- cgit v1.2.3-70-g09d2 From 35e33edd138009af5a9f3e22493e67bccccb251e Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Thu, 22 Oct 2020 19:21:45 +0800 Subject: Update PresBox.tsx presBox mini pres outline when keys active --- src/client/views/nodes/PresBox.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index d4e6713ac..0d2faa03a 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -711,7 +711,7 @@ export class PresBox extends ViewBoxBaseComponent break; case "Down": case "ArrowDown": case "Right": case "ArrowRight": - if (e.shiftKey) { + if (e.shiftKey) { // TODO: update to work properly this.rootDoc._itemIndex = NumCast(this.rootDoc._itemIndex) + 1; this._selectedArray.push(this.childDocs[this.rootDoc._itemIndex]); } else { @@ -722,7 +722,7 @@ export class PresBox extends ViewBoxBaseComponent break; case "Up": case "ArrowUp": case "Left": case "ArrowLeft": - if (e.shiftKey) { + if (e.shiftKey) { // TODO: update to work properly this.rootDoc._itemIndex = NumCast(this.rootDoc._itemIndex) - 1; this._selectedArray.push(this.childDocs[this.rootDoc._itemIndex]); } else { @@ -742,7 +742,6 @@ export class PresBox extends ViewBoxBaseComponent handled = true; } default: - console.log(e.key); break; } if (handled) { @@ -2000,9 +1999,10 @@ export class PresBox extends ViewBoxBaseComponent // needed to ensure that the childDocs are loaded for looking up fields this.childDocs.slice(); const mode = StrCast(this.rootDoc._viewType) as CollectionViewType; + const presKeyEvents: boolean = (this.isPres && this._presKeyEventsActive && this.rootDoc === Doc.UserDoc().activePresentation) return CurrentUserUtils.OverlayDocs.includes(this.rootDoc) ?
-
+
{"Loop"}
}>
this.layoutDoc.presLoop = !this.layoutDoc.presLoop}>
-- cgit v1.2.3-70-g09d2 From c7f91867035e4eaeb8cb0666c9fb181decc9c2a8 Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Thu, 22 Oct 2020 19:31:52 +0800 Subject: Update PresBox.tsx --- src/client/views/nodes/PresBox.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 344b944f8..5ca9fc269 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -1996,7 +1996,7 @@ export class PresBox extends ViewBoxBaseComponent const presKeyEvents: boolean = (this.isPres && this._presKeyEventsActive && this.rootDoc === Doc.UserDoc().activePresentation) return CurrentUserUtils.OverlayDocs.includes(this.rootDoc) ?
-
+
{"Loop"}
}>
this.layoutDoc.presLoop = !this.layoutDoc.presLoop}>
-- cgit v1.2.3-70-g09d2 From d09cf7ce455a45ad6a5e3e7096177bc500677bde Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 22 Oct 2020 10:12:53 -0400 Subject: restored undo for minimize/sidebar view of pres box --- src/client/views/nodes/PresBox.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 5ca9fc269..48b163a3a 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -1383,10 +1383,10 @@ export class PresBox extends ViewBoxBaseComponent @computed get presentDropdown() { return (
e.stopPropagation()} onPointerUp={e => e.stopPropagation()} onPointerDown={e => e.stopPropagation()}> -
{ this.updateMinimize(); this.turnOffEdit(true); })}> +
{ this.updateMinimize(); this.turnOffEdit(true); }))}> Minimize
-
{ this.layoutDoc.presStatus = "manual"; this.turnOffEdit(true); })}> +
{ this.layoutDoc.presStatus = "manual"; this.turnOffEdit(true); }))}> Sidebar view
@@ -1974,8 +1974,8 @@ export class PresBox extends ViewBoxBaseComponent {this.playButtonFrames}
- {this.props.PanelWidth() > 250 ?
{ this.layoutDoc.presStatus = "edit"; clearTimeout(this._presTimer); })}>EXIT
- :
this.layoutDoc.presStatus = "edit")}> + {this.props.PanelWidth() > 250 ?
{ this.layoutDoc.presStatus = "edit"; clearTimeout(this._presTimer); }))}>EXIT
+ :
this.layoutDoc.presStatus = "edit"))}>
}
); @@ -2008,7 +2008,7 @@ export class PresBox extends ViewBoxBaseComponent {this.playButtonFrames}
-
{ this.updateMinimize(); this.layoutDoc.presStatus = "edit"; clearTimeout(this._presTimer); })}>EXIT
+
{ this.updateMinimize(); this.layoutDoc.presStatus = "edit"; clearTimeout(this._presTimer); }))}>EXIT
: -- cgit v1.2.3-70-g09d2 From 4609f550fcc8c3e9c7fd176faa80671d0b55d427 Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 22 Oct 2020 10:16:19 -0400 Subject: fixed warnings --- src/client/views/collections/CollectionStackingView.tsx | 1 - src/client/views/nodes/PresBox.tsx | 6 +++--- src/client/views/nodes/WebBox.tsx | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx index 882a7fdec..4880d342c 100644 --- a/src/client/views/collections/CollectionStackingView.tsx +++ b/src/client/views/collections/CollectionStackingView.tsx @@ -294,7 +294,6 @@ export class CollectionStackingView extends CollectionSubView this.filteredChildren.find((fdoc, i) => ndoc === fdoc && i < insertInd) ? off + 1 : off, 0); newDocs.filter(ndoc => docs.indexOf(ndoc) !== -1).forEach(ndoc => docs.splice(docs.indexOf(ndoc), 1)); diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 48b163a3a..20106dc3d 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -747,7 +747,7 @@ export class PresBox extends ViewBoxBaseComponent e.stopPropagation(); e.preventDefault(); } - }; + } /** * @@ -1803,7 +1803,7 @@ export class PresBox extends ViewBoxBaseComponent const propTitle = CurrentUserUtils.propertiesWidth > 0 ? "Close Presentation Panel" : "Open Presentation Panel"; const mode = StrCast(this.rootDoc._viewType) as CollectionViewType; const isMini: boolean = this.toolbarWidth <= 100; - const presKeyEvents: boolean = (this.isPres && this._presKeyEventsActive && this.rootDoc === Doc.UserDoc().activePresentation) + const presKeyEvents: boolean = (this.isPres && this._presKeyEventsActive && this.rootDoc === Doc.UserDoc().activePresentation); return (mode === CollectionViewType.Carousel3D) ? (null) : (
{/*
{"Add new slide"}
}>
this.newDocumentTools = !this.newDocumentTools)}> @@ -1993,7 +1993,7 @@ export class PresBox extends ViewBoxBaseComponent // needed to ensure that the childDocs are loaded for looking up fields this.childDocs.slice(); const mode = StrCast(this.rootDoc._viewType) as CollectionViewType; - const presKeyEvents: boolean = (this.isPres && this._presKeyEventsActive && this.rootDoc === Doc.UserDoc().activePresentation) + const presKeyEvents: boolean = (this.isPres && this._presKeyEventsActive && this.rootDoc === Doc.UserDoc().activePresentation); return CurrentUserUtils.OverlayDocs.includes(this.rootDoc) ?
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx index 168fee807..787718aa0 100644 --- a/src/client/views/nodes/WebBox.tsx +++ b/src/client/views/nodes/WebBox.tsx @@ -83,7 +83,7 @@ export class WebBox extends ViewBoxAnnotatableComponent { - const href = (e.target as any)?.href; + const href = (e.target as any).href; if (href) { this._url = href.replace(Utils.prepend(""), Cast(this.dataDoc[this.fieldKey], WebField, null)?.url.origin); this.submitURL(); -- cgit v1.2.3-70-g09d2 From 11891ceacc7a1640dcb62dafac81b1acd040f333 Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Thu, 22 Oct 2020 22:24:10 +0800 Subject: Update PresBox.tsx --- src/client/views/nodes/PresBox.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 20106dc3d..39e1ec58b 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") { - undoBatch(action(() => { + runInAction(() => { for (const doc of this._selectedArray) { this.removeDocument(doc); } this._selectedArray = []; this._eleArray = []; this._dragArray = []; - }))(); + }); handled = true; } break; -- cgit v1.2.3-70-g09d2 From df6c56c3b9d527a0b6e7f79c09cb19ec2484feec Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 22 Oct 2020 10:24:29 -0400 Subject: minor code cleanup --- src/client/views/nodes/PresBox.tsx | 14 ++++++++------ src/client/views/nodes/WebBox.tsx | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx index 20106dc3d..4674982bb 100644 --- a/src/client/views/nodes/PresBox.tsx +++ b/src/client/views/nodes/PresBox.tsx @@ -127,14 +127,16 @@ export class PresBox extends ViewBoxBaseComponent } @computed get selectedDoc() { return this.selectedDocumentView?.rootDoc; } + @action componentWillUnmount() { document.removeEventListener("keydown", this.keyEvents, true); - runInAction(() => this._presKeyEventsActive = false); + this._presKeyEventsActive = false; // Turn of progressivize editors this.turnOffEdit(true); } - componentDidMount = async () => { + @action + componentDidMount = () => { this.rootDoc.presBox = this.rootDoc; this.rootDoc._forceRenderEngine = "timeline"; this.rootDoc._replacedChrome = "replaced"; @@ -142,7 +144,7 @@ export class PresBox extends ViewBoxBaseComponent this.layoutDoc._gridGap = 0; this.layoutDoc._yMargin = 0; document.addEventListener("keydown", this.keyEvents, true); - runInAction(() => this._presKeyEventsActive = true); + this._presKeyEventsActive = true; this.turnOffEdit(true); DocListCastAsync((Doc.UserDoc().myPresentations as Doc).data).then(pres => !pres?.includes(this.rootDoc) && Doc.AddDocToList(Doc.UserDoc().myPresentations as Doc, "data", this.rootDoc)); @@ -763,10 +765,10 @@ export class PresBox extends ViewBoxBaseComponent // Adds the index in the pres path graphically @computed get order() { const order: JSX.Element[] = []; - this.childDocs.forEach((doc, index) => { + this.childDocs.filter(doc => Cast(doc.presentationTargetDoc, Doc, null)).forEach((doc, index) => { const tagDoc = Cast(doc.presentationTargetDoc, Doc, null); - const srcContext = Cast(tagDoc?.context, Doc, null); - const width = NumCast(tagDoc?._width) / 10; + const srcContext = Cast(tagDoc.context, Doc, null); + const width = NumCast(tagDoc._width) / 10; const height = Math.max(NumCast(tagDoc._height) / 10, 15); const edge = Math.max(width, height); const fontSize = edge * 0.8; diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx index 787718aa0..de5546fa9 100644 --- a/src/client/views/nodes/WebBox.tsx +++ b/src/client/views/nodes/WebBox.tsx @@ -83,7 +83,7 @@ export class WebBox extends ViewBoxAnnotatableComponent { - const href = (e.target as any).href; + const href = e.target?.href; if (href) { this._url = href.replace(Utils.prepend(""), Cast(this.dataDoc[this.fieldKey], WebField, null)?.url.origin); this.submitURL(); -- cgit v1.2.3-70-g09d2