Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
disable editor history/persistence when in grid to avoid pesky bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bwindels committed Dec 13, 2018
1 parent f593bff commit c824335
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/structures/RoomView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,7 @@ module.exports = React.createClass({
<MessageComposer
roomViewStore={this.props.roomViewStore}
room={this.state.room}
isGrid={this.props.isGrid}
onResize={this.onChildResize}
uploadFile={this.uploadFile}
callState={this.state.callState}
Expand Down
1 change: 1 addition & 0 deletions src/components/views/rooms/MessageComposer.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ export default class MessageComposer extends React.Component {
roomViewStore={this.props.roomViewStore}
ref={(c) => this.messageComposerInput = c}
key="controls_input"
isGrid={this.props.isGrid}
onResize={this.props.onResize}
room={this.props.room}
placeholder={placeholderText}
Expand Down
21 changes: 20 additions & 1 deletion src/components/views/rooms/MessageComposerInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ function rangeEquals(a: Range, b: Range): boolean {
&& a.isBackward === b.isBackward);
}

class NoopHistoryManager {
getItem() {}
save() {}

get currentIndex() { return 0; }
set currentIndex(_) {}

get history() { return []; }
set history(_) {}
}


/*
* The textInput part of the MessageComposer
*/
Expand Down Expand Up @@ -343,7 +355,14 @@ export default class MessageComposerInput extends React.Component {

componentWillMount() {
this.dispatcherRef = this.props.roomViewStore.getDispatcher().register(this.onAction);
this.historyManager = new ComposerHistoryManager(this.props.room.roomId, 'mx_slate_composer_history_');
if (this.props.isGrid) {



this.historyManager = new NoopHistoryManager();
} else {
this.historyManager = new ComposerHistoryManager(this.props.room.roomId, 'mx_slate_composer_history_');
}
}

componentWillUnmount() {
Expand Down

0 comments on commit c824335

Please sign in to comment.