From bff5a298df61f96fbdcbbb7ebd6a5a441c85151c Mon Sep 17 00:00:00 2001
From: geireann <geireann.lindfield@gmail.com>
Date: Thu, 18 Jul 2024 15:31:13 -0400
Subject: starting to remove anys

---
 src/client/views/nodes/DocumentView.tsx | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

(limited to 'src/client/views/nodes/DocumentView.tsx')

diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index ce7cfa5f4..5bb12d890 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -7,7 +7,7 @@ import { IReactionDisposer, action, computed, makeObservable, observable, reacti
 import { observer } from 'mobx-react';
 import * as React from 'react';
 import { Fade, JackInTheBox } from 'react-awesome-reveal';
-import { ClientUtils, DivWidth, isTargetChildOf as isParentOf, lightOrDark, returnFalse, returnVal, simulateMouseClick } from '../../../ClientUtils';
+import { ClientUtils, DivWidth, isTargetChildOf as isParentOf, lightOrDark, returnFalse, returnVal, simMouseEvent, simulateMouseClick } from '../../../ClientUtils';
 import { Utils, emptyFunction } from '../../../Utils';
 import { Doc, DocListCast, Field, FieldType, Opt, StrListCast } from '../../../fields/Doc';
 import { AclAdmin, AclEdit, AclPrivate, Animation, AudioPlay, DocData, DocViews } from '../../../fields/DocSymbols';
@@ -89,7 +89,7 @@ export interface DocumentViewProps extends FieldViewSharedProps {
     dragStarting?: () => void;
     dragEnding?: () => void;
 
-    parent?: any; // parent React component view (see CollectionFreeFormDocumentView)
+    reactParent?: React.Component; // parent React component view (see CollectionFreeFormDocumentView)
 }
 @observer
 export class DocumentViewInternal extends DocComponent<FieldViewProps & DocumentViewProps>() {
@@ -105,7 +105,7 @@ export class DocumentViewInternal extends DocComponent<FieldViewProps & Document
 
     private _disposers: { [name: string]: IReactionDisposer } = {};
     private _doubleClickTimeout: NodeJS.Timeout | undefined;
-    private _singleClickFunc: undefined | (() => any);
+    private _singleClickFunc: undefined | (() => void);
     private _longPressSelector: NodeJS.Timeout | undefined;
     private _downX: number = 0;
     private _downY: number = 0;
@@ -224,7 +224,7 @@ export class DocumentViewInternal extends DocComponent<FieldViewProps & Document
             { fireImmediately: true }
         );
         this._disposers.pointerevents = reaction(
-            () => this.style(this.Document, StyleProp.PointerEvents),
+            () => this.style(this.Document, StyleProp.PointerEvents) as ("all" | "none" | "visiblePainted" | undefined),
             pointerevents => {
                 this._pointerEvents = pointerevents;
             },
@@ -450,7 +450,7 @@ export class DocumentViewInternal extends DocComponent<FieldViewProps & Document
         if (this.Document === Doc.ActiveDashboard) {
             e.stopPropagation();
             e.preventDefault();
-            alert((e.target as any)?.closest?.('*.lm_content') ? "You can't perform this move most likely because you didn't drag the document's title bar to enable embedding in a different document." : 'Linking to document tabs not yet supported.');
+            alert((e.target as HTMLElement)?.closest?.('*.lm_content') ? "You can't perform this move most likely because you didn't drag the document's title bar to enable embedding in a different document." : 'Linking to document tabs not yet supported.');
             return true;
         }
         const annoData = de.complete.annoDragData;
@@ -532,9 +532,9 @@ export class DocumentViewInternal extends DocComponent<FieldViewProps & Document
         }
 
         const cm = ContextMenu.Instance;
-        if (!cm || (e as any)?.nativeEvent?.SchemaHandled || SnappingManager.ExploreMode) return;
+        if (!cm || SnappingManager.ExploreMode) return;
 
-        if (e && !(e.nativeEvent as any).dash) {
+        if (e && !(e.nativeEvent instanceof simMouseEvent ? e.nativeEvent.dash : false)) {
             const onDisplay = () => {
                 if (this.Document.type !== DocumentType.MAP) DocumentViewInternal.SelectAfterContextMenu && this._props.select(false); // on a mac, the context menu is triggered on mouse down, but a YouTube video becaomes interactive when selected which means that the context menu won't show up.  by delaying the selection until hopefully after the pointer up, the context menu will appear.
                 setTimeout(() => simulateMouseClick(document.elementFromPoint(e.clientX, e.clientY), e.clientX, e.clientY, e.screenX, e.screenY));
@@ -710,7 +710,7 @@ export class DocumentViewInternal extends DocComponent<FieldViewProps & Document
     };
 
     rootSelected = () => this._rootSelected;
-    panelHeight = () => this._props.PanelHeight() - this.headerMargin;
+    panelHeight = () => this._props.PanelHeight() - Number(this.headerMargin);
     screenToLocalContent = () => this._props.ScreenToLocalTransform().translate(0, -this.headerMargin);
     onClickFunc = this.disableClickScriptFunc ? undefined : () => this.onClickHdlr;
     setHeight = (height: number) => { !this._props.suppressSetHeight && (this.layoutDoc._height = Math.min(NumCast(this.layoutDoc._maxHeight, Number.MAX_SAFE_INTEGER), height)); } // prettier-ignore
@@ -722,7 +722,7 @@ export class DocumentViewInternal extends DocComponent<FieldViewProps & Document
 
     anchorPanelWidth = () => this._props.PanelWidth() || 1;
     anchorPanelHeight = () => this._props.PanelHeight() || 1;
-    anchorStyleProvider = (doc: Opt<Doc>, props: Opt<FieldViewProps>, property: string): any => {
+    anchorStyleProvider = (doc: Opt<Doc>, props: Opt<FieldViewProps>, property: string) => {
         // prettier-ignore
         switch (property.split(':')[0]) {
             case StyleProp.ShowTitle:     return '';
@@ -770,7 +770,7 @@ export class DocumentViewInternal extends DocComponent<FieldViewProps & Document
     captionStyleProvider = (doc: Opt<Doc>, props: Opt<FieldViewProps>, property: string) => this._props?.styleProvider?.(doc, props, property + ':caption');
     fieldsDropdown = (placeholder: string) => (
         <div
-            ref={action((r: any) => { r && (this._titleDropDownInnerWidth = DivWidth(r));} )} // prettier-ignore
+            ref=r => { r && runInAction(() => (this._titleDropDownInnerWidth = DivWidth(r);}) )} // prettier-ignore
             onPointerDown={action(() => { this._changingTitleField = true; })} // prettier-ignore
             style={{ width: 'max-content', background: SnappingManager.userBackgroundColor, color: SnappingManager.userColor, transformOrigin: 'left', transform: `scale(${this.titleHeight / 30 /* height of Dropdown */})` }}>
             <FieldsDropdown
@@ -1426,7 +1426,7 @@ export class DocumentView extends DocComponent<DocumentViewProps>() {
                 <div className="documentView-htmlOverlayInner" style={{ transition: `all 500ms`, opacity: this._enableHtmlOverlayTransitions ? 0.9 : 0 }}>
                     {DocumentViewInternal.AnimationEffect(
                         <div className="webBox-textHighlight">
-                            <ObserverJsxParser autoCloseVoidElements key={42} onError={(e: any) => console.log('PARSE error', e)} renderInWrapper={false} jsx={StrCast(this._htmlOverlayText)} />
+                            <ObserverJsxParser autoCloseVoidElements key={42} onError={e=> console.log('PARSE error', e)} renderInWrapper={false} jsx={StrCast(this._htmlOverlayText)} />
                         </div>,
                         { ...(this._htmlOverlayEffect ?? {}), presentation_effect: effect ?? PresEffect.Expand } as any as Doc,
                         this.Document
@@ -1461,7 +1461,7 @@ export class DocumentView extends DocComponent<DocumentViewProps>() {
                         }}>
                         <DocumentViewInternal
                             {...this._props}
-                            parent={undefined}
+                            reactParent={undefined}
                             isHovering={this.isHovering}
                             fieldKey={this.LayoutFieldKey}
                             DataTransition={this.DataTransition}
-- 
cgit v1.2.3-70-g09d2

