From 3410e107435410a5635a70f12ee05e2d874ff01c Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 24 Feb 2021 22:04:31 -0500
Subject: cleaned up DocumentView's contentView api to be more general. fixed
 screenToLocal for freeformView's whenb _fitToBox is set.  moved webBox menu
 items out of CollectionMenu and into WebBox using the contentView API.

---
 src/client/views/collections/CollectionMenu.tsx | 57 +------------------------
 1 file changed, 1 insertion(+), 56 deletions(-)

(limited to 'src/client/views/collections/CollectionMenu.tsx')

diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx
index 423c94005..591b4161e 100644
--- a/src/client/views/collections/CollectionMenu.tsx
+++ b/src/client/views/collections/CollectionMenu.tsx
@@ -560,7 +560,6 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu
     @computed get isText() {
         return this.selectedDoc?.type === DocumentType.RTF || (RichTextMenu.Instance?.view as any) ? true : false;
     }
-    @computed get webBoxUrl() { return this.selectedDocumentView?.ComponentView?.url?.(); }
 
     @undoBatch
     @action
@@ -733,58 +732,6 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu
 
             </div>;
     }
-
-    onWebUrlDrop = (e: React.DragEvent) => {
-        const { dataTransfer } = e;
-        const html = dataTransfer.getData("text/html");
-        const uri = dataTransfer.getData("text/uri-list");
-        const url = uri || html || this.webBoxUrl || "";
-        const newurl = url.startsWith(window.location.origin) ?
-            url.replace(window.location.origin, this.webBoxUrl?.match(/http[s]?:\/\/[^\/]*/)?.[0] || "") : url;
-        this.submitWebUrl(newurl);
-        e.stopPropagation();
-    }
-    onWebUrlValueKeyDown = (e: React.KeyboardEvent) => {
-        e.key === "Enter" && this.submitWebUrl(this._keyInput.current!.value);
-        e.stopPropagation();
-    }
-    submitWebUrl = (url: string) => this.selectedDocumentView?.ComponentView?.submitURL?.(url);
-    webUrlForward = () => this.selectedDocumentView?.ComponentView?.forward?.();
-    webUrlBack = () => this.selectedDocumentView?.ComponentView?.back?.();
-
-    private _keyInput = React.createRef<HTMLInputElement>();
-
-    @computed get urlEditor() {
-        return (
-            <div className="collectionMenu-webUrlButtons" onDrop={this.onWebUrlDrop} onDragOver={e => e.preventDefault()} >
-                <input className="collectionMenu-urlInput" key={this.webBoxUrl}
-                    placeholder="ENTER URL"
-                    defaultValue={this.webBoxUrl}
-                    onDrop={this.onWebUrlDrop}
-                    onDragOver={e => e.preventDefault()}
-                    onKeyDown={this.onWebUrlValueKeyDown}
-                    onClick={(e) => {
-                        this._keyInput.current!.select();
-                        e.stopPropagation();
-                    }}
-                    ref={this._keyInput}
-                />
-                <div style={{ display: "flex", flexDirection: "row", justifyContent: "space-between", maxWidth: "250px", }}>
-                    <button className="submitUrl" onClick={() => this.submitWebUrl(this._keyInput.current!.value)} onDragOver={e => e.stopPropagation()} onDrop={this.onWebUrlDrop}>
-                        GO
-                    </button>
-                    <button className="submitUrl" onClick={this.webUrlBack}>
-                        <FontAwesomeIcon icon="caret-left" size="lg"></FontAwesomeIcon>
-                    </button>
-                    <button className="submitUrl" onClick={this.webUrlForward}>
-                        <FontAwesomeIcon icon="caret-right" size="lg"></FontAwesomeIcon>
-                    </button>
-                </div>
-            </div>
-        );
-    }
-
-
     @observable viewType = this.selectedDoc?._viewType;
 
     render() {
@@ -811,9 +758,7 @@ export class CollectionFreeFormViewChrome extends React.Component<CollectionMenu
                     </>
                     : null}
 
-                {!this.props.isOverlay || this.document.type !== DocumentType.WEB || this.isText || this.props.isDoc ? (null) :
-                    this.urlEditor
-                }
+                {!this.selectedDocumentView?.ComponentView?.menuControls ? (null) : this.selectedDocumentView?.ComponentView?.menuControls?.()}
                 {!this.isText ?
                     <>
                         {this.drawButtons}
-- 
cgit v1.2.3-70-g09d2

