diff options
Diffstat (limited to 'src/client/views/DashboardView.tsx')
| -rw-r--r-- | src/client/views/DashboardView.tsx | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/client/views/DashboardView.tsx b/src/client/views/DashboardView.tsx index 716653ea5..37a70f165 100644 --- a/src/client/views/DashboardView.tsx +++ b/src/client/views/DashboardView.tsx @@ -14,6 +14,7 @@ import { DocumentManager } from "../util/DocumentManager"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ContextMenuProps } from "./ContextMenuItem"; import { simulateMouseClick } from "../../Utils"; +import { SharingManager } from "../util/SharingManager"; enum DashboardGroup { MyDashboards, SharedDashboards @@ -60,12 +61,6 @@ export class DashboardView extends React.Component { this.abortCreateNewDashboard(); } - showContextMenu = (e: React.MouseEvent) => { - // DocumentViewInternal.SelectAfterContextMenu = false; - // simulateMouseClick(this._docRef?.ContentDiv, e.clientX, e.clientY + 30, e.screenX, e.screenY + 30); - // DocumentViewInternal.SelectAfterContextMenu = true; - } - @computed get namingInterface() { return <div> @@ -78,7 +73,7 @@ export class DashboardView extends React.Component { _downX: number = 0; _downY: number = 0; @action - onContextMenu = (e?: React.MouseEvent, pageX?: number, pageY?: number) => { + onContextMenu = (dashboard: Doc, e?: React.MouseEvent, pageX?: number, pageY?: number) => { // the touch onContextMenu is button 0, the pointer onContextMenu is button 2 if (e) { e.preventDefault(); @@ -91,12 +86,12 @@ export class DashboardView extends React.Component { const cm = ContextMenu.Instance; cm.addItem({ description: "Share Dashboard", event: async () => { - // ... + SharingManager.Instance.open(undefined, dashboard) }, icon: "edit" }); cm.addItem({ description: "Delete Dashboard", event: async () => { - // ... + CurrentUserUtils.removeDashboard(dashboard) }, icon: "trash" }); cm.displayMenu((e?.pageX || pageX || 0) - 15, (e?.pageY || pageY || 0) - 15); @@ -116,7 +111,7 @@ export class DashboardView extends React.Component { {this.getDashboards().map((dashboard) => { const href = ImageCast((dashboard.thumb as Doc)?.data)?.url.href; return <div className="dashboard-container" key={dashboard[Id]} - onContextMenu={this.onContextMenu} + onContextMenu={(e) => {this.onContextMenu(dashboard, e)}} onClick={e => this.clickDashboard(e, dashboard)}> <img src={href ?? "https://media.istockphoto.com/photos/hot-air-balloons-flying-over-the-botan-canyon-in-turkey-picture-id1297349747?b=1&k=20&m=1297349747&s=170667a&w=0&h=oH31fJty_4xWl_JQ4OIQWZKP8C6ji9Mz7L4XmEnbqRU="}></img> <div className="info"> @@ -124,7 +119,9 @@ export class DashboardView extends React.Component { <div className="more" onPointerDown={e => { this._downX = e.clientX; this._downY = e.clientY; - }} onClick={this.onContextMenu}> + }} + onContextMenu={(e) => {this.onContextMenu(dashboard, e)}} + > <FontAwesomeIcon color="black" size="lg" icon="bars" /> </div> </div> |
