From f82b0fef26782f6a871da036a6bd9a6670444509 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 27 Jul 2022 15:51:00 -0400
Subject: fixed document leak related to capturedVariables in scripts.  
 changed capturedVariables to be a string encoding the captured variables
 instead of a Doc.

---
 src/client/views/DocumentDecorations.tsx | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

(limited to 'src/client/views/DocumentDecorations.tsx')

diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 432dd360a..c53e61699 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -157,6 +157,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
     @action
     onBackgroundMove = (dragTitle: boolean, e: PointerEvent): boolean => {
         const dragDocView = SelectionManager.Views()[0];
+        if (DocListCast(Doc.MyOverlayDocs.data).includes(dragDocView.rootDoc)) return false;
         const { left, top } = dragDocView.getBounds() || { left: 0, top: 0 };
         const dragData = new DragManager.DocumentDragData(
             SelectionManager.Views().map(dv => dv.props.Document),
@@ -639,21 +640,21 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
         );
 
         const colorScheme = StrCast(Doc.ActiveDashboard?.colorScheme);
-        const titleArea = hideTitle ? null : this._editingTitle ? (
+        const titleArea = this._editingTitle ? (
             <input
                 ref={this._keyinput}
                 className={`documentDecorations-title${colorScheme}`}
                 type="text"
                 name="dynbox"
                 autoComplete="on"
-                value={this._accumulatedTitle}
-                onBlur={e => this.titleBlur()}
-                onChange={action(e => (this._accumulatedTitle = e.target.value))}
-                onKeyDown={this.titleEntered}
+                value={hideTitle ? '' : this._accumulatedTitle}
+                onBlur={e => !hideTitle && this.titleBlur()}
+                onChange={action(e => !hideTitle && (this._accumulatedTitle = e.target.value))}
+                onKeyDown={hideTitle ? emptyFunction : this.titleEntered}
             />
         ) : (
             <div className="documentDecorations-title" key="title" onPointerDown={this.onTitleDown}>
-                <span className={`documentDecorations-titleSpan${colorScheme}`}>{`${this.selectionTitle}`}</span>
+                <span className={`documentDecorations-titleSpan${colorScheme}`}>{`${hideTitle ? '' : this.selectionTitle}`}</span>
             </div>
         );
 
@@ -710,7 +711,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
                                 height: bounds.b - bounds.y + this._resizeBorderWidth + this._titleHeight + 'px',
                             }}>
                             {hideDeleteButton ? <div /> : topBtn('close', this.hasIcons ? 'times' : 'window-maximize', undefined, e => this.onCloseClick(this.hasIcons ? true : undefined), 'Close')}
-                            {hideTitle ? null : titleArea}
+                            {titleArea}
                             {hideOpenButton ? null : topBtn('open', 'external-link-alt', this.onMaximizeDown, undefined, 'Open in Tab (ctrl: as alias, shift: in new collection)')}
                             {hideResizers ? null : (
                                 <>
-- 
cgit v1.2.3-70-g09d2

