Merge pull request #4748 from matrix-org/t3chguy/macos-bitmap
Prioritize text on the clipboard over filepull/21833/head
commit
d3a3b54a82
|
@ -31,7 +31,7 @@ import LogoutDialog from "../views/dialogs/LogoutDialog";
|
||||||
import SettingsStore, {SettingLevel} from "../../settings/SettingsStore";
|
import SettingsStore, {SettingLevel} from "../../settings/SettingsStore";
|
||||||
import {getCustomTheme} from "../../theme";
|
import {getCustomTheme} from "../../theme";
|
||||||
import {getHostingLink} from "../../utils/HostingLink";
|
import {getHostingLink} from "../../utils/HostingLink";
|
||||||
import AccessibleButton from "../views/elements/AccessibleButton";
|
import AccessibleButton, {ButtonEvent} from "../views/elements/AccessibleButton";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ export default class UserMenuButton extends React.Component<IProps, IState> {
|
||||||
SettingsStore.setValue("theme", null, SettingLevel.ACCOUNT, newTheme);
|
SettingsStore.setValue("theme", null, SettingLevel.ACCOUNT, newTheme);
|
||||||
};
|
};
|
||||||
|
|
||||||
private onSettingsOpen = (ev: React.MouseEvent, tabId: string) => {
|
private onSettingsOpen = (ev: ButtonEvent, tabId: string) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ export default class UserMenuButton extends React.Component<IProps, IState> {
|
||||||
this.setState({menuDisplayed: false}); // also close the menu
|
this.setState({menuDisplayed: false}); // also close the menu
|
||||||
};
|
};
|
||||||
|
|
||||||
private onShowArchived = (ev: React.MouseEvent) => {
|
private onShowArchived = (ev: ButtonEvent) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ export default class UserMenuButton extends React.Component<IProps, IState> {
|
||||||
console.log("TODO: Show archived rooms");
|
console.log("TODO: Show archived rooms");
|
||||||
};
|
};
|
||||||
|
|
||||||
private onProvideFeedback = (ev: React.MouseEvent) => {
|
private onProvideFeedback = (ev: ButtonEvent) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ export default class UserMenuButton extends React.Component<IProps, IState> {
|
||||||
this.setState({menuDisplayed: false}); // also close the menu
|
this.setState({menuDisplayed: false}); // also close the menu
|
||||||
};
|
};
|
||||||
|
|
||||||
private onSignOutClick = (ev: React.MouseEvent) => {
|
private onSignOutClick = (ev: ButtonEvent) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@ import React from 'react';
|
||||||
import {Key} from '../../../Keyboard';
|
import {Key} from '../../../Keyboard';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
|
export type ButtonEvent = React.MouseEvent<Element> | React.KeyboardEvent<Element>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* children: React's magic prop. Represents all children given to the element.
|
* children: React's magic prop. Represents all children given to the element.
|
||||||
* element: (optional) The base element type. "div" by default.
|
* element: (optional) The base element type. "div" by default.
|
||||||
|
@ -37,7 +39,7 @@ interface IProps extends React.InputHTMLAttributes<Element> {
|
||||||
tabIndex?: number;
|
tabIndex?: number;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
onClick?(e?: React.MouseEvent<Element> | React.KeyboardEvent<Element>): void;
|
onClick?(e?: ButtonEvent): void;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IAccessibleButtonProps extends React.InputHTMLAttributes<Element> {
|
interface IAccessibleButtonProps extends React.InputHTMLAttributes<Element> {
|
||||||
|
|
|
@ -21,7 +21,7 @@ import React, { createRef } from "react";
|
||||||
import { Room } from "matrix-js-sdk/src/models/room";
|
import { Room } from "matrix-js-sdk/src/models/room";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { RovingTabIndexWrapper } from "../../../accessibility/RovingTabIndex";
|
import { RovingTabIndexWrapper } from "../../../accessibility/RovingTabIndex";
|
||||||
import AccessibleButton from "../../views/elements/AccessibleButton";
|
import AccessibleButton, {ButtonEvent} from "../../views/elements/AccessibleButton";
|
||||||
import RoomAvatar from "../../views/avatars/RoomAvatar";
|
import RoomAvatar from "../../views/avatars/RoomAvatar";
|
||||||
import dis from '../../../dispatcher/dispatcher';
|
import dis from '../../../dispatcher/dispatcher';
|
||||||
import { Key } from "../../../Keyboard";
|
import { Key } from "../../../Keyboard";
|
||||||
|
@ -123,7 +123,7 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
this.setState({generalMenuDisplayed: false});
|
this.setState({generalMenuDisplayed: false});
|
||||||
};
|
};
|
||||||
|
|
||||||
private onTagRoom = (ev: React.MouseEvent, tagId: TagID) => {
|
private onTagRoom = (ev: ButtonEvent, tagId: TagID) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private onLeaveRoomClick = (ev: React.MouseEvent) => {
|
private onLeaveRoomClick = (ev: ButtonEvent) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
this.setState({generalMenuDisplayed: false}); // hide the menu
|
this.setState({generalMenuDisplayed: false}); // hide the menu
|
||||||
};
|
};
|
||||||
|
|
||||||
private onOpenRoomSettings = (ev: React.MouseEvent) => {
|
private onOpenRoomSettings = (ev: ButtonEvent) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
|
||||||
|
|
|
@ -427,7 +427,9 @@ export default class SendMessageComposer extends React.Component {
|
||||||
|
|
||||||
_onPaste = (event) => {
|
_onPaste = (event) => {
|
||||||
const {clipboardData} = event;
|
const {clipboardData} = event;
|
||||||
if (clipboardData.files.length) {
|
// Prioritize text on the clipboard over files as Office on macOS puts a bitmap
|
||||||
|
// in the clipboard as well as the content being copied.
|
||||||
|
if (clipboardData.files.length && !clipboardData.types.some(t => t === "text/plain")) {
|
||||||
// This actually not so much for 'files' as such (at time of writing
|
// This actually not so much for 'files' as such (at time of writing
|
||||||
// neither chrome nor firefox let you paste a plain file copied
|
// neither chrome nor firefox let you paste a plain file copied
|
||||||
// from Finder) but more images copied from a different website
|
// from Finder) but more images copied from a different website
|
||||||
|
|
Loading…
Reference in New Issue