Fix the screenshot button on the right panel card
This commit is contained in:
parent
b46f58274e
commit
9377306b81
1 changed files with 12 additions and 3 deletions
|
@ -39,6 +39,8 @@ import {AppTileActionPayload} from "../../../dispatcher/payloads/AppTileActionPa
|
||||||
import {Capability} from "../../../widgets/WidgetApi";
|
import {Capability} from "../../../widgets/WidgetApi";
|
||||||
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
|
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
import dis from "../../../dispatcher/dispatcher";
|
||||||
|
import { WidgetMessagingStore } from "../../../stores/widgets/WidgetMessagingStore";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
room: Room;
|
room: Room;
|
||||||
|
@ -77,10 +79,17 @@ const WidgetCard: React.FC<IProps> = ({ room, widgetId, onClose }) => {
|
||||||
let contextMenu;
|
let contextMenu;
|
||||||
if (menuDisplayed) {
|
if (menuDisplayed) {
|
||||||
let snapshotButton;
|
let snapshotButton;
|
||||||
// TODO: [TravisR] Fix this
|
const widgetMessaging = WidgetMessagingStore.instance.getMessagingForId(app.id);
|
||||||
if (ActiveWidgetStore.widgetHasCapability(app.id, Capability.Screenshot)) {
|
if (widgetMessaging?.hasCapability(Capability.Screenshot)) {
|
||||||
const onSnapshotClick = () => {
|
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();
|
closeMenu();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue