Fixed typos in create_post.jsx resizing code
Этот коммит содержится в:
@@ -51,7 +51,7 @@ export default class CreatePost extends React.Component {
|
|||||||
submitting: false,
|
submitting: false,
|
||||||
initialText: draft.messageText,
|
initialText: draft.messageText,
|
||||||
windowWidth: Utils.windowWidth(),
|
windowWidth: Utils.windowWidth(),
|
||||||
windowHeigth: Utils.windowHeight()
|
windowHeight: Utils.windowHeight()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
handleResize() {
|
handleResize() {
|
||||||
@@ -71,7 +71,7 @@ export default class CreatePost extends React.Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prevState.windowWidth !== this.state.windowWidth || prevState.windowHeight !== this.state.windowHeigth) {
|
if (prevState.windowWidth !== this.state.windowWidth || prevState.windowHeight !== this.state.windowHeight) {
|
||||||
this.resizePostHolder();
|
this.resizePostHolder();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ export default class CreatePost extends React.Component {
|
|||||||
PostStore.storeCurrentDraft(draft);
|
PostStore.storeCurrentDraft(draft);
|
||||||
}
|
}
|
||||||
resizePostHolder() {
|
resizePostHolder() {
|
||||||
const height = this.state.windowHeigth - $(ReactDOM.findDOMNode(this.refs.topDiv)).height() - 50;
|
const height = this.state.windowHeight - $(ReactDOM.findDOMNode(this.refs.topDiv)).height() - 50;
|
||||||
$('.post-list-holder-by-time').css('height', `${height}px`);
|
$('.post-list-holder-by-time').css('height', `${height}px`);
|
||||||
if (this.state.windowWidth > 960) {
|
if (this.state.windowWidth > 960) {
|
||||||
$('#post_textbox').focus();
|
$('#post_textbox').focus();
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ export default class PostList extends React.Component {
|
|||||||
this.loadFirstPosts(this.props.channelId);
|
this.loadFirstPosts(this.props.channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.handleResize();
|
this.resizePostList();
|
||||||
this.onChange();
|
this.onChange();
|
||||||
this.scrollToBottom();
|
this.scrollToBottom();
|
||||||
}
|
}
|
||||||
@@ -172,6 +172,13 @@ export default class PostList extends React.Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prevState.windowHeight !== this.state.windowHeight) {
|
||||||
|
this.resizePostList();
|
||||||
|
if (!this.scrolled) {
|
||||||
|
this.scrollToBottom();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$('.post-list__content div .post').removeClass('post--last');
|
$('.post-list__content div .post').removeClass('post--last');
|
||||||
$('.post-list__content div:last-child .post').addClass('post--last');
|
$('.post-list__content div:last-child .post').addClass('post--last');
|
||||||
|
|
||||||
@@ -218,10 +225,6 @@ export default class PostList extends React.Component {
|
|||||||
} else {
|
} else {
|
||||||
this.scrollTo(this.prevScrollTop);
|
this.scrollTo(this.prevScrollTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prevState.windowHeight !== this.state.windowHeight) {
|
|
||||||
this.handleResize();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
componentWillUpdate() {
|
componentWillUpdate() {
|
||||||
var postHolder = $(ReactDOM.findDOMNode(this.refs.postlist));
|
var postHolder = $(ReactDOM.findDOMNode(this.refs.postlist));
|
||||||
@@ -238,11 +241,6 @@ export default class PostList extends React.Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
windowHeight: Utils.windowHeight()
|
windowHeight: Utils.windowHeight()
|
||||||
});
|
});
|
||||||
|
|
||||||
this.resizePostList();
|
|
||||||
if (!this.scrolled) {
|
|
||||||
this.scrollToBottom();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
resizePostList() {
|
resizePostList() {
|
||||||
const postHolder = $(ReactDOM.findDOMNode(this.refs.postlist));
|
const postHolder = $(ReactDOM.findDOMNode(this.refs.postlist));
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user