PLT-6890 Fix various scrolling issues (#6727)

* Fix various scrolling issues

* Move reaction scrolling to reaction list

* Handle scrolling when RHS opens

* Only run scroll update code when posts change
Этот коммит содержится в:
Joram Wilander
2017-06-23 12:09:56 -04:00
коммит произвёл GitHub
родитель b01da39887
Коммит ca8d57c4db
14 изменённых файлов: 179 добавлений и 187 удалений

Просмотреть файл

@@ -1,7 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import keyMirror from 'key-mirror/keyMirror.js';
import keyMirror from 'key-mirror';
import audioIcon from 'images/icons/audio.png';
import videoIcon from 'images/icons/video.png';

8
webapp/utils/event_types.jsx Обычный файл
Просмотреть файл

@@ -0,0 +1,8 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import keyMirror from 'key-mirror';
export default keyMirror({
POST_LIST_SCROLL_CHANGE: null
});

27
webapp/utils/global_event_emitter.jsx Обычный файл
Просмотреть файл

@@ -0,0 +1,27 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
import EventEmitter from 'events';
import EventTypes from 'utils/event_types.jsx';
class GlobalEventEmitterClass extends EventEmitter {
constructor() {
super();
this.dispatchToken = AppDispatcher.register(this.handleEventPayload);
}
handleEventPayload = (payload) => {
const {type, value, ...args} = payload.action; //eslint-disable-line no-use-before-define
switch (type) {
case EventTypes.POST_LIST_SCROLL_CHANGE:
this.emit(type, value, args);
break;
}
}
}
const GlobalEventEmitter = new GlobalEventEmitterClass();
export default GlobalEventEmitter;

Просмотреть файл

@@ -4,11 +4,11 @@
import * as TextFormatting from './text_formatting.jsx';
import * as SyntaxHighlighting from './syntax_highlighting.jsx';
import {postListScrollChange} from 'actions/global_actions.jsx';
import marked from 'marked';
import katex from 'katex';
import ScrollStore from 'stores/scroll_store.jsx';
function markdownImageLoaded(image) {
if (image.hasAttribute('height') && image.attributes.height.value !== 'auto') {
const maxHeight = parseInt(global.getComputedStyle(image).maxHeight, 10);
@@ -22,7 +22,8 @@ function markdownImageLoaded(image) {
} else {
image.style.height = 'auto';
}
ScrollStore.emitPostScroll();
postListScrollChange();
}
global.markdownImageLoaded = markdownImageLoaded;