Fix comments: scroll to edit buttons, update height after closing edit box and adding reply.
This commit is contained in:
parent
2272e6e7bb
commit
fbd59eaf24
|
@ -196,7 +196,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
parentView.scroller.scrollTop(scrollPos);
|
parentView.scroller.scrollTop(scrollPos);
|
||||||
view.autoScrollToEditButtons();
|
parentView.autoScrollToEditButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textBox && textBox.length) {
|
if (textBox && textBox.length) {
|
||||||
|
@ -216,23 +216,6 @@ define([
|
||||||
this.textBox.unbind('input propertychange');
|
this.textBox.unbind('input propertychange');
|
||||||
this.textBox = undefined;
|
this.textBox = undefined;
|
||||||
}
|
}
|
||||||
},
|
|
||||||
autoScrollToEditButtons: function () {
|
|
||||||
var button = $('#id-comments-change-popover'), // TODO: add to cache
|
|
||||||
btnBounds = null,
|
|
||||||
contentBounds = this.el.getBoundingClientRect(),
|
|
||||||
moveY = 0,
|
|
||||||
padding = 7;
|
|
||||||
|
|
||||||
if (button.length) {
|
|
||||||
btnBounds = button.get(0).getBoundingClientRect();
|
|
||||||
if (btnBounds && contentBounds) {
|
|
||||||
moveY = contentBounds.bottom - (btnBounds.bottom + padding);
|
|
||||||
if (moveY < 0) {
|
|
||||||
parentView.scroller.scrollTop(parentView.scroller.getScrollTop() - moveY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})());
|
})());
|
||||||
|
@ -328,7 +311,7 @@ define([
|
||||||
|
|
||||||
me.hookTextBox();
|
me.hookTextBox();
|
||||||
|
|
||||||
this.autoScrollToEditButtons();
|
me.autoScrollToEditButtons();
|
||||||
this.setFocusToTextBox();
|
this.setFocusToTextBox();
|
||||||
} else {
|
} else {
|
||||||
if (!showEditBox) {
|
if (!showEditBox) {
|
||||||
|
@ -347,7 +330,7 @@ define([
|
||||||
|
|
||||||
me.hookTextBox();
|
me.hookTextBox();
|
||||||
|
|
||||||
this.autoScrollToEditButtons();
|
me.autoScrollToEditButtons();
|
||||||
this.setFocusToTextBox();
|
this.setFocusToTextBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,7 +363,7 @@ define([
|
||||||
this.autoHeightTextBox();
|
this.autoHeightTextBox();
|
||||||
me.hookTextBox();
|
me.hookTextBox();
|
||||||
|
|
||||||
this.autoScrollToEditButtons();
|
me.autoScrollToEditButtons();
|
||||||
this.setFocusToTextBox();
|
this.setFocusToTextBox();
|
||||||
} else if (btn.hasClass('btn-reply', false)) {
|
} else if (btn.hasClass('btn-reply', false)) {
|
||||||
if (showReplyBox) {
|
if (showReplyBox) {
|
||||||
|
@ -388,6 +371,7 @@ define([
|
||||||
|
|
||||||
me.fireEvent('comment:addReply', [commentId, this.getActiveTextBoxVal()]);
|
me.fireEvent('comment:addReply', [commentId, this.getActiveTextBoxVal()]);
|
||||||
me.fireEvent('comment:closeEditing');
|
me.fireEvent('comment:closeEditing');
|
||||||
|
me.calculateSizeOfContent();
|
||||||
|
|
||||||
readdresolves();
|
readdresolves();
|
||||||
}
|
}
|
||||||
|
@ -774,6 +758,8 @@ define([
|
||||||
sdkBoundsTopPos = 0;
|
sdkBoundsTopPos = 0;
|
||||||
|
|
||||||
if (commentsView && arrowView && commentsView.get(0)) {
|
if (commentsView && arrowView && commentsView.get(0)) {
|
||||||
|
var scrollPos = this.scroller.getScrollTop();
|
||||||
|
|
||||||
commentsView.css({height: '100%'});
|
commentsView.css({height: '100%'});
|
||||||
|
|
||||||
contentBounds = commentsView.get(0).getBoundingClientRect();
|
contentBounds = commentsView.get(0).getBoundingClientRect();
|
||||||
|
@ -813,6 +799,7 @@ define([
|
||||||
arrowPosY = Math.min(arrowPosY, sdkBoundsHeight - (sdkPanelHeight + this.arrow.margin + this.arrow.width));
|
arrowPosY = Math.min(arrowPosY, sdkBoundsHeight - (sdkPanelHeight + this.arrow.margin + this.arrow.width));
|
||||||
|
|
||||||
arrowView.css({top: arrowPosY + 'px'});
|
arrowView.css({top: arrowPosY + 'px'});
|
||||||
|
this.scroller.scrollTop(scrollPos);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
outerHeight = windowHeight;
|
outerHeight = windowHeight;
|
||||||
|
@ -922,6 +909,24 @@ define([
|
||||||
return this.popover;
|
return this.popover;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
autoScrollToEditButtons: function () {
|
||||||
|
var button = $('#id-comments-change-popover'), // TODO: add to cache
|
||||||
|
btnBounds = null,
|
||||||
|
contentBounds = this.$window[0].getBoundingClientRect(),
|
||||||
|
moveY = 0,
|
||||||
|
padding = 7;
|
||||||
|
|
||||||
|
if (button.length) {
|
||||||
|
btnBounds = button.get(0).getBoundingClientRect();
|
||||||
|
if (btnBounds && contentBounds) {
|
||||||
|
moveY = contentBounds.bottom - (btnBounds.bottom + padding);
|
||||||
|
if (moveY < 0) {
|
||||||
|
this.scroller.scrollTop(this.scroller.getScrollTop() - moveY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
textAddReply : 'Add Reply',
|
textAddReply : 'Add Reply',
|
||||||
textAdd : "Add",
|
textAdd : "Add",
|
||||||
textCancel : 'Cancel',
|
textCancel : 'Cancel',
|
||||||
|
|
Loading…
Reference in a new issue