From 0e9a512020c145a11357aac8573dd6cb24197748 Mon Sep 17 00:00:00 2001 From: bobzel Date: Mon, 19 Apr 2021 19:17:17 -0400 Subject: fixed crash with lightboxview and stepping into an image. --- src/client/views/nodes/ImageBox.tsx | 44 ++++++++++++++++++------------------- src/client/views/nodes/VideoBox.tsx | 21 +++++++++--------- 2 files changed, 33 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index 1ab367395..c7067f313 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -1,14 +1,13 @@ -import { action, computed, IReactionDisposer, observable, reaction, runInAction, ObservableMap, untracked } from 'mobx'; +import { action, computed, IReactionDisposer, observable, ObservableMap, reaction, runInAction } from 'mobx'; import { observer } from "mobx-react"; -import { Dictionary } from 'typescript-collections'; import { DataSym, Doc, DocListCast, WidthSym } from '../../../fields/Doc'; import { documentSchema } from '../../../fields/documentSchemas'; import { Id } from '../../../fields/FieldSymbols'; import { List } from '../../../fields/List'; import { ObjectField } from '../../../fields/ObjectField'; -import { createSchema, listSpec, makeInterface } from '../../../fields/Schema'; +import { createSchema, makeInterface } from '../../../fields/Schema'; import { ComputedField } from '../../../fields/ScriptField'; -import { Cast, NumCast, StrCast } from '../../../fields/Types'; +import { Cast, NumCast } from '../../../fields/Types'; import { ImageField } from '../../../fields/URLField'; import { TraceMobx } from '../../../fields/util'; import { emptyFunction, OmitKeys, returnOne, Utils } from '../../../Utils'; @@ -59,8 +58,12 @@ export class ImageBox extends ViewBoxAnnotatableComponent { + + } // sets viewing information for a componentview, typically when following a link. 'preview' tells the view to use the values without writing to the document componentDidMount() { + this.props.setContentView?.(this); // bcz: do not remove this. without it, stepping into an image in the lightbox causes an infinite loop.... this._disposers.sizer = reaction(() => ( { forceFull: this.props.renderDepth < 1 || this.layoutDoc._showFullRes, @@ -315,6 +318,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent(); @computed get annotationLayer() { + TraceMobx(); return
; } @action @@ -331,7 +335,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent + scaling={returnOne} + whenChildContentsActiveChanged={this.whenChildContentsActiveChanged} + removeDocument={this.removeDocument} + moveDocument={this.moveDocument} + addDocument={this.addDocument}> {this.contentFunc} {this.annotationLayer} {!this._marqueeing || !this._mainCont.current || !this._annotationLayer.current ? (null) : -
+ addDocument={this.addDocWithTimecode}> {this.contentFunc}
@@ -591,16 +591,17 @@ export class VideoBox extends ViewBoxAnnotatableComponent}
); -- cgit v1.2.3-70-g09d2