revert commit 161bd0ee3d
(Bug 35896)
This commit is contained in:
parent
12c8e28d52
commit
0af418dced
|
@ -317,7 +317,7 @@
|
|||
var deltaX = e.deltaX * e.deltaFactor || deprecatedDeltaX,
|
||||
deltaY = e.deltaY * e.deltaFactor || deprecatedDeltaY;
|
||||
|
||||
if (e && e.target && (e.target.type === 'textarea' && !e.target.hasAttribute('readonly') || e.target.type === 'input')) {
|
||||
if (e && e.target && (e.target.type === 'textarea' || e.target.type === 'input')) {
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div class="user-name"><%=scope.getUserName(username)%></div>
|
||||
<div class="user-date"><%=date%></div>
|
||||
<% if (!editTextInPopover || hint) { %>
|
||||
<textarea readonly class="user-message user-select" style="overflow: hidden;" maxlength="maxCommLength"><%=scope.pickLink(comment)%></textarea>
|
||||
<div class="user-message"><%=scope.pickLink(comment)%></div>
|
||||
<% } else { %>
|
||||
<div class="inner-edit-ct">
|
||||
<textarea class="msg-reply user-select" maxlength="maxCommLength"><%=comment%></textarea>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<div class="user-name"><%=scope.getUserName(item.get("username"))%></div>
|
||||
<div class="user-date"><%=item.get("date")%></div>
|
||||
<% if (!item.get("editTextInPopover")) { %>
|
||||
<textarea readonly class="user-message user-select" maxlength="maxCommLength" style="overflow: hidden;"><%=scope.pickLink(item.get("reply"))%></textarea>
|
||||
<div class="user-message"><%=scope.pickLink(item.get("reply"))%></div>
|
||||
<% if (!hint) { %>
|
||||
<div class="btns-reply-ct">
|
||||
<% if (item.get("editable")) { %>
|
||||
|
|
|
@ -152,11 +152,11 @@ define([
|
|||
},
|
||||
|
||||
getTextBox: function () {
|
||||
var text = $(this.el).find('textarea:not(.user-message)');
|
||||
var text = $(this.el).find('textarea');
|
||||
return (text && text.length) ? text : undefined;
|
||||
},
|
||||
setFocusToTextBox: function (blur) {
|
||||
var text = $(this.el).find('textarea:not(.user-message)');
|
||||
var text = $(this.el).find('textarea');
|
||||
if (blur) {
|
||||
text.blur();
|
||||
} else {
|
||||
|
@ -169,16 +169,15 @@ define([
|
|||
}
|
||||
},
|
||||
getActiveTextBoxVal: function () {
|
||||
var text = $(this.el).find('textarea:not(.user-message)');
|
||||
var text = $(this.el).find('textarea');
|
||||
return (text && text.length) ? text.val().trim() : '';
|
||||
},
|
||||
autoHeightTextBox: function () {
|
||||
var view = this,
|
||||
textBox = this.$el.find('textarea'),
|
||||
domTextBox = null,
|
||||
$domTextBox = null,
|
||||
lineHeight = 0,
|
||||
minHeight = 50,
|
||||
lineHeight = 0,
|
||||
scrollPos = 0,
|
||||
oldHeight = 0,
|
||||
newHeight = 0;
|
||||
|
@ -187,17 +186,17 @@ define([
|
|||
scrollPos = $(view.scroller.el).scrollTop();
|
||||
|
||||
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
|
||||
$domTextBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'});
|
||||
textBox.css({height: (domTextBox.scrollHeight + lineHeight) + 'px'});
|
||||
|
||||
parentView.calculateSizeOfContent();
|
||||
} else {
|
||||
oldHeight = domTextBox.clientHeight;
|
||||
if (oldHeight >= minHeight) {
|
||||
$domTextBox.css({height: minHeight + 'px'});
|
||||
textBox.css({height: minHeight + 'px'});
|
||||
|
||||
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
|
||||
newHeight = Math.max(domTextBox.scrollHeight + lineHeight, minHeight);
|
||||
$domTextBox.css({height: newHeight + 'px'});
|
||||
textBox.css({height: newHeight + 'px'});
|
||||
}
|
||||
|
||||
parentView.calculateSizeOfContent();
|
||||
|
@ -210,23 +209,17 @@ define([
|
|||
view.autoScrollToEditButtons();
|
||||
}
|
||||
|
||||
this.textBox = undefined;
|
||||
if (textBox && textBox.length) {
|
||||
textBox.each(function(idx, item){
|
||||
if (item) {
|
||||
domTextBox = item;
|
||||
$domTextBox = $(item);
|
||||
var isEdited = !$domTextBox.hasClass('user-message');
|
||||
lineHeight = isEdited ? parseInt($domTextBox.css('lineHeight'), 10) * 0.25 : 0;
|
||||
minHeight = isEdited ? 50 : 24;
|
||||
updateTextBoxHeight();
|
||||
if (isEdited) {
|
||||
$domTextBox.bind('input propertychange', updateTextBoxHeight);
|
||||
view.textBox = $domTextBox;
|
||||
}
|
||||
}
|
||||
});
|
||||
domTextBox = textBox.get(0);
|
||||
|
||||
if (domTextBox) {
|
||||
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
|
||||
updateTextBoxHeight();
|
||||
textBox.bind('input propertychange', updateTextBoxHeight)
|
||||
}
|
||||
}
|
||||
|
||||
this.textBox = textBox;
|
||||
},
|
||||
clearTextBoxBind: function () {
|
||||
if (this.textBox) {
|
||||
|
@ -383,7 +376,6 @@ define([
|
|||
t.fireEvent('comment:closeEditing');
|
||||
|
||||
readdresolves();
|
||||
this.autoHeightTextBox();
|
||||
|
||||
} else if (btn.hasClass('user-reply')) {
|
||||
t.fireEvent('comment:closeEditing');
|
||||
|
@ -408,7 +400,6 @@ define([
|
|||
t.fireEvent('comment:closeEditing');
|
||||
|
||||
readdresolves();
|
||||
this.autoHeightTextBox();
|
||||
}
|
||||
} else if (btn.hasClass('btn-close', false)) {
|
||||
t.fireEvent('comment:closeEditing', [commentId]);
|
||||
|
@ -416,7 +407,6 @@ define([
|
|||
t.fireEvent('comment:show', [commentId]);
|
||||
|
||||
readdresolves();
|
||||
this.autoHeightTextBox();
|
||||
|
||||
} else if (btn.hasClass('btn-inner-edit', false)) {
|
||||
|
||||
|
@ -447,7 +437,6 @@ define([
|
|||
}
|
||||
|
||||
readdresolves();
|
||||
this.autoHeightTextBox();
|
||||
|
||||
} else if (btn.hasClass('btn-inner-close', false)) {
|
||||
if (record.get('dummy')) {
|
||||
|
@ -459,8 +448,11 @@ define([
|
|||
me.saveText();
|
||||
record.set('hideAddReply', false);
|
||||
this.getTextBox().val(me.textVal);
|
||||
this.autoHeightTextBox();
|
||||
} else {
|
||||
|
||||
this.clearTextBoxBind();
|
||||
|
||||
t.fireEvent('comment:closeEditing', [commentId]);
|
||||
}
|
||||
|
||||
|
@ -471,7 +463,6 @@ define([
|
|||
me.calculateSizeOfContent();
|
||||
|
||||
readdresolves();
|
||||
this.autoHeightTextBox();
|
||||
|
||||
} else if (btn.hasClass('btn-resolve', false)) {
|
||||
var tip = btn.data('bs.tooltip');
|
||||
|
@ -480,7 +471,6 @@ define([
|
|||
t.fireEvent('comment:resolve', [commentId]);
|
||||
|
||||
readdresolves();
|
||||
this.autoHeightTextBox();
|
||||
} else if (btn.hasClass('btn-resolve-check', false)) {
|
||||
var tip = btn.data('bs.tooltip');
|
||||
if (tip) tip.dontShow = true;
|
||||
|
@ -488,21 +478,20 @@ define([
|
|||
t.fireEvent('comment:resolve', [commentId]);
|
||||
|
||||
readdresolves();
|
||||
this.autoHeightTextBox();
|
||||
}
|
||||
}
|
||||
});
|
||||
me.on({
|
||||
'show': function () {
|
||||
me.$window.find('textarea:not(.user-message)').keydown(function (event) {
|
||||
me.commentsView.autoHeightTextBox();
|
||||
me.$window.find('textarea').keydown(function (event) {
|
||||
if (event.keyCode == Common.UI.Keys.ESC) {
|
||||
me.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
'animate:before': function () {
|
||||
me.commentsView.autoHeightTextBox();
|
||||
var text = me.$window.find('textarea:not(.user-message)');
|
||||
var text = me.$window.find('textarea');
|
||||
if (text && text.length)
|
||||
text.focus();
|
||||
}
|
||||
|
@ -910,11 +899,11 @@ define([
|
|||
},
|
||||
|
||||
getTextBox: function () {
|
||||
var text = $(this.el).find('textarea:not(.user-message)');
|
||||
var text = $(this.el).find('textarea');
|
||||
return (text && text.length) ? text : undefined;
|
||||
},
|
||||
setFocusToTextBox: function () {
|
||||
var text = $(this.el).find('textarea:not(.user-message)');
|
||||
var text = $(this.el).find('textarea');
|
||||
if (text && text.length) {
|
||||
var val = text.val();
|
||||
text.focus();
|
||||
|
@ -923,7 +912,7 @@ define([
|
|||
}
|
||||
},
|
||||
getActiveTextBoxVal: function () {
|
||||
var text = $(this.el).find('textarea:not(.user-message)');
|
||||
var text = $(this.el).find('textarea');
|
||||
return (text && text.length) ? text.val().trim() : '';
|
||||
},
|
||||
autoHeightTextBox: function () {
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
overflow: hidden;
|
||||
color: @gray-darker;
|
||||
|
||||
textarea:not(.user-message) {
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
resize: none;
|
||||
|
@ -171,14 +171,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
textarea.user-message {
|
||||
border: none;
|
||||
resize: none;
|
||||
width: 100%;
|
||||
line-height: 15px;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.user-reply {
|
||||
color: @black;
|
||||
margin-top: 10px;
|
||||
|
|
Loading…
Reference in a new issue