коммит произвёл
Joram Wilander
родитель
4da45c0e76
Коммит
c60d4fe04b
@@ -3,11 +3,9 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import $ from 'jquery';
|
|
||||||
import * as Emoji from 'utils/emoji.jsx';
|
import * as Emoji from 'utils/emoji.jsx';
|
||||||
import EmojiStore from 'stores/emoji_store.jsx';
|
import EmojiStore from 'stores/emoji_store.jsx';
|
||||||
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||||
import ReactDOM from 'react-dom';
|
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
import ReactOutsideEvent from 'react-outside-event';
|
import ReactOutsideEvent from 'react-outside-event';
|
||||||
import {FormattedMessage} from 'react-intl';
|
import {FormattedMessage} from 'react-intl';
|
||||||
@@ -110,11 +108,11 @@ class EmojiPicker extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleScroll() {
|
handleScroll() {
|
||||||
const items = $(ReactDOM.findDOMNode(this.refs.items));
|
const items = this.refs.items;
|
||||||
|
const contentTop = items.scrollTop;
|
||||||
const contentTop = items.scrollTop();
|
const itemsPaddingTop = getComputedStyle(items).paddingTop;
|
||||||
const contentTopPadding = parseInt(items.css('padding-top'), 10);
|
const contentTopPadding = parseInt(itemsPaddingTop, 10);
|
||||||
const scrollPct = (contentTop / (items[0].scrollHeight - items[0].clientHeight)) * 100.0;
|
const scrollPct = (contentTop / (items.scrollHeight - items.clientHeight)) * 100.0;
|
||||||
|
|
||||||
if (scrollPct > 99.0) {
|
if (scrollPct > 99.0) {
|
||||||
this.setState({category: 'custom'});
|
this.setState({category: 'custom'});
|
||||||
@@ -122,9 +120,12 @@ class EmojiPicker extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const category of CATEGORIES) {
|
for (const category of CATEGORIES) {
|
||||||
const header = $(ReactDOM.findDOMNode(this.refs[category]));
|
const header = this.refs[category];
|
||||||
const headerBottomMargin = parseInt(header.css('margin-bottom'), 10) + parseInt(header.css('padding-bottom'), 10);
|
const headerStyle = getComputedStyle(header);
|
||||||
const headerBottom = header[0].offsetTop + header.height() + headerBottomMargin;
|
const headerBottomMargin = parseInt(headerStyle.marginBottom, 10);
|
||||||
|
const headerBottomPadding = parseInt(headerStyle.paddingBottom, 10);
|
||||||
|
const headerBottomSpace = headerBottomMargin + headerBottomPadding;
|
||||||
|
const headerBottom = header.offsetTop + header.offsetHeight + headerBottomSpace;
|
||||||
|
|
||||||
// If category is the first one visible, highlight it in the bar at the top
|
// If category is the first one visible, highlight it in the bar at the top
|
||||||
if (headerBottom - contentTopPadding >= contentTop) {
|
if (headerBottom - contentTopPadding >= contentTop) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user