diff --git a/src/components/views/right_panel/WidgetCard.tsx b/src/components/views/right_panel/WidgetCard.tsx index b0eefb0fed..6bb45df109 100644 --- a/src/components/views/right_panel/WidgetCard.tsx +++ b/src/components/views/right_panel/WidgetCard.tsx @@ -39,6 +39,8 @@ import {AppTileActionPayload} from "../../../dispatcher/payloads/AppTileActionPa import {Capability} from "../../../widgets/WidgetApi"; import AccessibleTooltipButton from "../elements/AccessibleTooltipButton"; import classNames from "classnames"; +import dis from "../../../dispatcher/dispatcher"; +import { WidgetMessagingStore } from "../../../stores/widgets/WidgetMessagingStore"; interface IProps { room: Room; @@ -77,10 +79,17 @@ const WidgetCard: React.FC = ({ room, widgetId, onClose }) => { let contextMenu; if (menuDisplayed) { let snapshotButton; - // TODO: [TravisR] Fix this - if (ActiveWidgetStore.widgetHasCapability(app.id, Capability.Screenshot)) { + const widgetMessaging = WidgetMessagingStore.instance.getMessagingForId(app.id); + if (widgetMessaging?.hasCapability(Capability.Screenshot)) { const onSnapshotClick = () => { - WidgetUtils.snapshotWidget(app); + widgetMessaging.takeScreenshot().then(data => { + dis.dispatch({ + action: 'picture_snapshot', + file: data.screenshot, + }); + }).catch(err => { + console.error("Failed to take screenshot: ", err); + }); closeMenu(); };