From 03f88df66ed72852a61586213c26550b1685af56 Mon Sep 17 00:00:00 2001 From: nostradamos Date: Tue, 2 Jan 2018 22:44:18 +0100 Subject: [PATCH 1/3] Make the scrolling compatible with our riot-web fix for https://github.com/vector-im/riot-web/issues/4821 --- src/components/views/rooms/MessageComposerInput.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index aa019de091..01432a06eb 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -525,7 +525,8 @@ export default class MessageComposerInput extends React.Component { // composer. For some reason the editor won't scroll automatically if we paste // blocks of text in or insert newlines. if (textContent.slice(selection.start).indexOf("\n") === -1) { - this.refs.editor.refs.editor.scrollTop = this.refs.editor.refs.editor.scrollHeight; + this.refs.editor.refs.editor.parentNode.parentNode.scrollTop = this. + refs.editor.refs.editor.parentNode.parentNode.scrollHeight; } }); } From e543f5557235e748bbc2414efcec6a875322d645 Mon Sep 17 00:00:00 2001 From: nostradamos Date: Wed, 3 Jan 2018 01:50:03 +0100 Subject: [PATCH 2/3] refactored code --- src/components/views/rooms/MessageComposerInput.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 23e8d807c7..300d25b589 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -512,8 +512,9 @@ export default class MessageComposerInput extends React.Component { // composer. For some reason the editor won't scroll automatically if we paste // blocks of text in or insert newlines. if (textContent.slice(selection.start).indexOf("\n") === -1) { - this.refs.editor.refs.editor.parentNode.parentNode.scrollTop = this. - refs.editor.refs.editor.parentNode.parentNode.scrollHeight; + let editorRoot = this.refs.editor.refs.editor.parentNode.parentNode; + console.log(editorRoot, editorRoot.scrollHeight); + editorRoot.scrollTop = editorRoot.scrollHeight; } }); } From 2189fe92564028997238139d9719980e62deb169 Mon Sep 17 00:00:00 2001 From: nostradamos Date: Wed, 3 Jan 2018 01:52:02 +0100 Subject: [PATCH 3/3] removed console.log --- src/components/views/rooms/MessageComposerInput.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 300d25b589..005a63607d 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -513,7 +513,6 @@ export default class MessageComposerInput extends React.Component { // blocks of text in or insert newlines. if (textContent.slice(selection.start).indexOf("\n") === -1) { let editorRoot = this.refs.editor.refs.editor.parentNode.parentNode; - console.log(editorRoot, editorRoot.scrollHeight); editorRoot.scrollTop = editorRoot.scrollHeight; } });