mirror of https://github.com/vector-im/riot-web
Use the resize observer polyfill consistently (#7796)
parent
0cf15d27dc
commit
6793ef33ba
|
@ -24,6 +24,7 @@ import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||||
import { ActionPayload } from "../../../dispatcher/payloads";
|
import { ActionPayload } from "../../../dispatcher/payloads";
|
||||||
|
import { ResizeObserverPolyfill } from "../../../stores/UIStore";
|
||||||
|
|
||||||
export const getPersistKey = (appId: string) => 'widget_' + appId;
|
export const getPersistKey = (appId: string) => 'widget_' + appId;
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ export default class PersistedElement extends React.Component<IProps> {
|
||||||
constructor(props: IProps) {
|
constructor(props: IProps) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.resizeObserver = new ResizeObserver(this.repositionChild);
|
this.resizeObserver = new ResizeObserverPolyfill(this.repositionChild);
|
||||||
// Annoyingly, a resize observer is insufficient, since we also care
|
// Annoyingly, a resize observer is insufficient, since we also care
|
||||||
// about when the element moves on the screen without changing its
|
// about when the element moves on the screen without changing its
|
||||||
// dimensions. Doesn't look like there's a ResizeObserver equivalent
|
// dimensions. Doesn't look like there's a ResizeObserver equivalent
|
||||||
|
|
|
@ -27,6 +27,7 @@ import InfoTooltip, { InfoTooltipKind } from '../elements/InfoTooltip';
|
||||||
import AccessibleTooltipButton from '../elements/AccessibleTooltipButton';
|
import AccessibleTooltipButton from '../elements/AccessibleTooltipButton';
|
||||||
import { formatCallTime } from "../../../DateUtils";
|
import { formatCallTime } from "../../../DateUtils";
|
||||||
import Clock from "../audio_messages/Clock";
|
import Clock from "../audio_messages/Clock";
|
||||||
|
import { ResizeObserverPolyfill } from "../../../stores/UIStore";
|
||||||
|
|
||||||
const MAX_NON_NARROW_WIDTH = 450 / 70 * 100;
|
const MAX_NON_NARROW_WIDTH = 450 / 70 * 100;
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ export default class CallEvent extends React.PureComponent<IProps, IState> {
|
||||||
this.props.callEventGrouper.addListener(CallEventGrouperEvent.SilencedChanged, this.onSilencedChanged);
|
this.props.callEventGrouper.addListener(CallEventGrouperEvent.SilencedChanged, this.onSilencedChanged);
|
||||||
this.props.callEventGrouper.addListener(CallEventGrouperEvent.LengthChanged, this.onLengthChanged);
|
this.props.callEventGrouper.addListener(CallEventGrouperEvent.LengthChanged, this.onLengthChanged);
|
||||||
|
|
||||||
this.resizeObserver = new ResizeObserver(this.resizeObserverCallback);
|
this.resizeObserver = new ResizeObserverPolyfill(this.resizeObserverCallback);
|
||||||
this.wrapperElement.current && this.resizeObserver.observe(this.wrapperElement.current);
|
this.wrapperElement.current && this.resizeObserver.observe(this.wrapperElement.current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,9 @@ import ResizeObserverEntry from 'resize-observer-polyfill/src/ResizeObserverEntr
|
||||||
|
|
||||||
// XXX: resize-observer-polyfill has types that now conflict with typescript's
|
// XXX: resize-observer-polyfill has types that now conflict with typescript's
|
||||||
// own DOM types: https://github.com/que-etc/resize-observer-polyfill/issues/80
|
// own DOM types: https://github.com/que-etc/resize-observer-polyfill/issues/80
|
||||||
// Using require here rather than import is a horrenous workaround. We should
|
// Using require here rather than import is a horrendous workaround. We should
|
||||||
// be able to remove the polyfill once Safari 14 is released.
|
// be able to remove the polyfill once Safari 14 is released.
|
||||||
const ResizeObserverPolyfill = require('resize-observer-polyfill'); // eslint-disable-line @typescript-eslint/no-var-requires
|
export const ResizeObserverPolyfill = require('resize-observer-polyfill'); // eslint-disable-line @typescript-eslint/no-var-requires
|
||||||
|
|
||||||
export enum UI_EVENTS {
|
export enum UI_EVENTS {
|
||||||
Resize = "resize"
|
Resize = "resize"
|
||||||
|
|
Loading…
Reference in New Issue