From 4b4d77f99bd55e6de0593c3acd1cf5798ae038bf Mon Sep 17 00:00:00 2001 From: bobzel Date: Fri, 10 May 2024 14:05:01 -0400 Subject: added an always option for OpenWhere lightbox. cleaned up/fixed making collections capable of being a lightbox. --- src/client/views/nodes/DocumentView.tsx | 16 ++++------------ src/client/views/nodes/OpenWhere.ts | 2 ++ 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 3e154aead..14feca0b5 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -151,12 +151,9 @@ export class DocumentViewInternal extends DocComponent this.onDoubleClickHandler.script.run(scriptProps, console.log).result?.select && this._props.select(false), 'on double click: ' + this.Document.title); } else if (!Doc.IsSystem(this.Document) && defaultDblclick !== 'ignore') { - UndoManager.RunInBatch(() => this._props.addDocTab(this.Document, OpenWhere.lightbox), 'double tap'); + UndoManager.RunInBatch(() => this._props.addDocTab(this.Document, OpenWhere.lightboxAlways), 'double tap'); DocumentView.DeselectAll(); Doc.UnBrushDoc(this.Document); } else { @@ -334,12 +331,7 @@ export class DocumentViewInternal extends DocComponent any); if (!this.disableClickScriptFunc && this.onClickHandler?.script) { clickFunc = undoable(() => { - // use this view's add doc func to override method for following links to undisplayed documents. - // e.g., if this document is part of a labeled 'lightbox' container, then documents will be shown in this container of in the global lightbox - const oldFunc = DocumentViewInternal.addDocTabFunc; - DocumentViewInternal.addDocTabFunc = this._props.addDocTab; this.onClickHandler?.script.run(scriptProps, console.log).result?.select && this._props.select(false); - DocumentViewInternal.addDocTabFunc = oldFunc; }, 'click ' + this.Document.title); } else { // onDragStart implies a button doc that we don't want to select when clicking. RootDocument & isTemplateForField implies we're clicking on part of a template instance and we want to select the whole template, not the part diff --git a/src/client/views/nodes/OpenWhere.ts b/src/client/views/nodes/OpenWhere.ts index e2a5f1f2a..f7101b103 100644 --- a/src/client/views/nodes/OpenWhere.ts +++ b/src/client/views/nodes/OpenWhere.ts @@ -5,9 +5,11 @@ export enum OpenWhereMod { top = 'top', bottom = 'bottom', keyvalue = 'keyValue', + always = 'always', // forces the open location (lightbox) instead of using an existing open view (see DocumentDecorations) } export enum OpenWhere { lightbox = 'lightbox', + lightboxAlways = 'lightbox:always', add = 'add', addLeft = 'add:left', addRight = 'add:right', -- cgit v1.2.3-70-g09d2