You've already forked matrix-react-sdk
							
							
				mirror of
				https://github.com/matrix-org/matrix-react-sdk.git
				synced 2025-11-04 11:51:45 +03:00 
			
		
		
		
	Merge pull request #5796 from panoschal/fix/save-editor-state-when-reply-is-open
Remember reply when switching rooms
This commit is contained in:
		@@ -472,12 +472,17 @@ export default class SendMessageComposer extends React.Component {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // should save state when editor has contents or reply is open
 | 
				
			||||||
 | 
					    _shouldSaveStoredEditorState = () => {
 | 
				
			||||||
 | 
					        return !this.model.isEmpty || this.props.replyToEvent;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _saveStoredEditorState = () => {
 | 
					    _saveStoredEditorState = () => {
 | 
				
			||||||
        if (this.model.isEmpty) {
 | 
					        if (this._shouldSaveStoredEditorState()) {
 | 
				
			||||||
            this._clearStoredEditorState();
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            const item = SendHistoryManager.createItem(this.model, this.props.replyToEvent);
 | 
					            const item = SendHistoryManager.createItem(this.model, this.props.replyToEvent);
 | 
				
			||||||
            localStorage.setItem(this._editorStateKey, JSON.stringify(item));
 | 
					            localStorage.setItem(this._editorStateKey, JSON.stringify(item));
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            this._clearStoredEditorState();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user