Fix widget resizing
There was a line of CSS that set pointer-events: none on widget iframes whilst they were being resized to stop iframes swallowing the mousemove/up events while dragging the resize handle, but a) all widgets are now in a persisted element wrapper and therefore not in the right place in the DOM to get that CSS and b) that only got set when resizing the whole aps drawer vertically, not dragging the handle between apps to change the width distribution. Add a pointer events prop to AppTile to allow the pointer-events style to be set by the parent, and set it when dragging either resize handle. Fixes https://github.com/vector-im/element-web/issues/16473
This commit is contained in:
parent
06ad9f0fb8
commit
e5b03488d8
3 changed files with 23 additions and 10 deletions
|
@ -328,6 +328,10 @@ export default class AppTile extends React.Component {
|
|||
const iframeFeatures = "microphone; camera; encrypted-media; autoplay; display-capture;";
|
||||
|
||||
const appTileBodyClass = 'mx_AppTileBody' + (this.props.miniMode ? '_mini ' : ' ');
|
||||
const appTileBodyStyles = {};
|
||||
if (this.props.pointerEvents) {
|
||||
appTileBodyStyles['pointer-events'] = this.props.pointerEvents;
|
||||
}
|
||||
|
||||
const loadingElement = (
|
||||
<div className="mx_AppLoading_spinner_fadeIn">
|
||||
|
@ -338,7 +342,7 @@ export default class AppTile extends React.Component {
|
|||
// only possible for room widgets, can assert this.props.room here
|
||||
const isEncrypted = MatrixClientPeg.get().isRoomEncrypted(this.props.room.roomId);
|
||||
appTileBody = (
|
||||
<div className={appTileBodyClass}>
|
||||
<div className={appTileBodyClass} style={appTileBodyStyles}>
|
||||
<AppPermission
|
||||
roomId={this.props.room.roomId}
|
||||
creatorUserId={this.props.creatorUserId}
|
||||
|
@ -350,20 +354,20 @@ export default class AppTile extends React.Component {
|
|||
);
|
||||
} else if (this.state.initialising) {
|
||||
appTileBody = (
|
||||
<div className={appTileBodyClass + (this.state.loading ? 'mx_AppLoading' : '')}>
|
||||
<div className={appTileBodyClass + (this.state.loading ? 'mx_AppLoading' : '')} style={appTileBodyStyles}>
|
||||
{ loadingElement }
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
if (this.isMixedContent()) {
|
||||
appTileBody = (
|
||||
<div className={appTileBodyClass}>
|
||||
<div className={appTileBodyClass} style={appTileBodyStyles}>
|
||||
<AppWarning errorMsg="Error - Mixed content" />
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
appTileBody = (
|
||||
<div className={appTileBodyClass + (this.state.loading ? 'mx_AppLoading' : '')}>
|
||||
<div className={appTileBodyClass + (this.state.loading ? 'mx_AppLoading' : '')} style={appTileBodyStyles}>
|
||||
{ this.state.loading && loadingElement }
|
||||
<iframe
|
||||
allow={iframeFeatures}
|
||||
|
@ -477,6 +481,8 @@ AppTile.propTypes = {
|
|||
showPopout: PropTypes.bool,
|
||||
// Is this an instance of a user widget
|
||||
userWidget: PropTypes.bool,
|
||||
// sets the pointer-events property on the iframe
|
||||
pointerEvents: PropTypes.string,
|
||||
};
|
||||
|
||||
AppTile.defaultProps = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue