diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index 885851e8e6..3809090bbd 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -2025,6 +2025,7 @@ export default class RoomView extends React.Component { manageReadReceipts={!this.state.isPeeking} sendReadReceiptOnLoad={!this.state.wasContextSwitch} manageReadMarkers={!this.state.isPeeking} + manageComposerDispatches={true} hidden={hideMessagePanel} highlightedEventId={highlightedEventId} eventId={this.state.initialEventId} diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 03d0b5c6d7..a1e8fa7ded 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -72,6 +72,8 @@ class TimelinePanel extends React.Component { manageReadReceipts: PropTypes.bool, sendReadReceiptOnLoad: PropTypes.bool, manageReadMarkers: PropTypes.bool, + // with this enabled it'll listen and react to Action.ComposerInsert and `edit_event` + manageComposerDispatches: PropTypes.bool, // true to give the component a 'display: none' style. hidden: PropTypes.bool, @@ -446,29 +448,33 @@ class TimelinePanel extends React.Component { break; case "edit_event": { - const editState = payload.event ? new EditorStateTransfer(payload.event) : null; - this.setState({editState}, () => { - if (payload.event && this._messagePanel.current) { - this._messagePanel.current.scrollToEventIfNeeded( - payload.event.getId(), - ); - } - }); + if (this.props.manageComposerDispatches) { + const editState = payload.event ? new EditorStateTransfer(payload.event) : null; + this.setState({editState}, () => { + if (payload.event && this._messagePanel.current) { + this._messagePanel.current.scrollToEventIfNeeded( + payload.event.getId(), + ); + } + }); + } break; } case Action.ComposerInsert: { - // re-dispatch to the correct composer - if (this.state.editState) { - dis.dispatch({ - ...payload, - action: "edit_composer_insert", - }); - } else { - dis.dispatch({ - ...payload, - action: "send_composer_insert", - }); + if (this.props.manageComposerDispatches) { + // re-dispatch to the correct composer + if (this.state.editState) { + dis.dispatch({ + ...payload, + action: "edit_composer_insert", + }); + } else { + dis.dispatch({ + ...payload, + action: "send_composer_insert", + }); + } } break; }