aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-11-08 19:11:22 -0500
committerbobzel <zzzman@gmail.com>2023-11-08 19:11:22 -0500
commit224a9162859d98a36c13eb72c4b88f38eb52e28d (patch)
tree51b459cb92932daf9f3f357ab74845a4623abb9e /src/client/views/nodes
parent601cb81824f99302eb4e4287304db33032f2aa0b (diff)
clean up of LightboxView
Diffstat (limited to 'src/client/views/nodes')
-rw-r--r--src/client/views/nodes/DocumentView.tsx9
-rw-r--r--src/client/views/nodes/formattedText/FormattedTextBox.tsx2
-rw-r--r--src/client/views/nodes/trails/PresBox.tsx36
3 files changed, 16 insertions, 31 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 943408010..0aaa9c538 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -468,7 +468,7 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
}, console.log );
UndoManager.RunInBatch(() => (func().result?.select === true ? this.props.select(false) : ''), 'on double click');
} else if (!Doc.IsSystem(this.rootDoc) && (defaultDblclick === undefined || defaultDblclick === 'default')) {
- UndoManager.RunInBatch(() => LightboxView.AddDocTab(this.rootDoc, OpenWhere.lightbox), 'double tap');
+ UndoManager.RunInBatch(() => LightboxView.Instance.AddDocTab(this.rootDoc, OpenWhere.lightbox), 'double tap');
SelectionManager.DeselectAll();
Doc.UnBrushDoc(this.props.Document);
} else {
@@ -760,7 +760,7 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
const appearanceItems: ContextMenuProps[] = appearance && 'subitems' in appearance ? appearance.subitems : [];
if (this.props.renderDepth === 0) {
- appearanceItems.push({ description: 'Open in Lightbox', event: () => LightboxView.SetLightboxDoc(this.rootDoc), icon: 'hand-point-right' });
+ appearanceItems.push({ description: 'Open in Lightbox', event: () => LightboxView.Instance.SetLightboxDoc(this.rootDoc), icon: 'hand-point-right' });
}
!Doc.noviceMode && templateDoc && appearanceItems.push({ description: 'Open Template ', event: () => this.props.addDocTab(templateDoc, OpenWhere.addRight), icon: 'eye' });
!appearance && appearanceItems.length && cm.addItem({ description: 'UI Controls...', subitems: appearanceItems, icon: 'compass' });
@@ -1415,7 +1415,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
const docId = Doc.CurrentUserEmail + Doc.GetProto(linkAnchor)[Id] + '-pivotish';
// prettier-ignore
DocServer.GetRefField(docId).then(docx =>
- LightboxView.SetLightboxDoc(
+ LightboxView.Instance.SetLightboxDoc(
(docx as Doc) ?? // reuse existing pivot view of documents, or else create a new collection
Docs.Create.StackingDocument([], { title: linkAnchor.title + '-pivot', _width: 500, _height: 500, target: linkAnchor, updateContentsScript: ScriptField.MakeScript('updateLinkCollection(self, self.target)') }, docId)
)
@@ -1701,8 +1701,7 @@ ScriptingGlobals.add(function deiconifyView(documentView: DocumentView) {
});
ScriptingGlobals.add(function deiconifyViewToLightbox(documentView: DocumentView) {
- //documentView.iconify(() =>
- LightboxView.AddDocTab(documentView.rootDoc, OpenWhere.lightbox, 'layout'); //, 0);
+ LightboxView.Instance.AddDocTab(documentView.rootDoc, OpenWhere.lightbox, 'layout'); //, 0);
});
ScriptingGlobals.add(function toggleDetail(dv: DocumentView, detailLayoutKeySuffix: string) {
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 515952ae4..7a175c9f6 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1936,7 +1936,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FieldViewProps
const color = !annotated ? Colors.WHITE : Colors.BLACK;
const backgroundColor = !annotated ? (this.sidebarWidth() ? Colors.MEDIUM_BLUE : Colors.BLACK) : this.props.styleProvider?.(this.rootDoc, this.props, StyleProp.WidgetColor + (annotated ? ':annotated' : ''));
- return !annotated && (!this.props.isContentActive() || SnappingManager.GetIsDragging()) ? null : (
+ return !annotated && (!this.props.isContentActive() || SnappingManager.GetIsDragging() || Doc.ActiveTool !== InkTool.None) ? null : (
<div
className="formattedTextBox-sidebar-handle"
onPointerDown={this.sidebarDown}
diff --git a/src/client/views/nodes/trails/PresBox.tsx b/src/client/views/nodes/trails/PresBox.tsx
index 3d7c68bcd..c4ef07123 100644
--- a/src/client/views/nodes/trails/PresBox.tsx
+++ b/src/client/views/nodes/trails/PresBox.tsx
@@ -204,16 +204,11 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
);
this._disposers.editing = reaction(
() => this.layoutDoc.presentation_status === PresStatus.Edit,
- editing => {
- if (editing) {
- this.childDocs.forEach(doc => {
- if (doc.presentation_indexed !== undefined) {
- this.progressivizedItems(doc)?.forEach(indexedDoc => (indexedDoc.opacity = undefined));
- doc.presentation_indexed = Math.min(this.progressivizedItems(doc)?.length ?? 0, 1);
- }
- });
- }
- }
+ editing => editing &&
+ this.childDocs.filter(doc => doc.presentation_indexed !== undefined).forEach(doc => {
+ this.progressivizedItems(doc)?.forEach(indexedDoc => (indexedDoc.opacity = undefined));
+ doc.presentation_indexed = Math.min(this.progressivizedItems(doc)?.length ?? 0, 1);
+ }) // prettier-ignore
);
}
@@ -283,19 +278,10 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
};
// go to documents chain
- runSubroutines = (childrenToRun: Doc[], normallyNextSlide: Doc) => {
- console.log(childrenToRun, normallyNextSlide, 'runSUBFUNC');
- if (childrenToRun === undefined) {
- console.log('children undefined');
- return;
+ runSubroutines = (childrenToRun: Opt<Doc[]>, normallyNextSlide: Doc) => {
+ if (childrenToRun && childrenToRun[0] !== normallyNextSlide) {
+ childrenToRun.forEach(child => DocumentManager.Instance.showDocument(child, {}));
}
- if (childrenToRun[0] === normallyNextSlide) {
- return;
- }
-
- childrenToRun.forEach(child => {
- DocumentManager.Instance.showDocument(child, {});
- });
};
// Called when the user activates 'next' - to move to the next part of the pres. trail
@@ -806,7 +792,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
if (activeItem.presentation_openInLightbox) {
const context = DocCast(targetDoc.annotationOn) ?? targetDoc;
if (!DocumentManager.Instance.getLightboxDocumentView(context)) {
- LightboxView.SetLightboxDoc(context);
+ LightboxView.Instance.SetLightboxDoc(context);
}
}
if (targetDoc) {
@@ -815,7 +801,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
DocumentManager.Instance.AddViewRenderedCb(LightboxView.LightboxDoc, dv => {
// if target or the doc it annotates is not in the lightbox, then close the lightbox
if (!DocumentManager.Instance.getLightboxDocumentView(DocCast(targetDoc.annotationOn) ?? targetDoc)) {
- LightboxView.SetLightboxDoc(undefined);
+ LightboxView.Instance.SetLightboxDoc(undefined);
}
DocumentManager.Instance.showDocument(targetDoc, options, finished);
});
@@ -909,7 +895,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
break;
}
});
- LightboxView.SetLightboxDoc(undefined);
+ LightboxView.Instance.SetLightboxDoc(undefined);
Doc.RemFromMyOverlay(this.rootDoc);
return PresStatus.Edit;
};