Disable textarea button for comments
This commit is contained in:
parent
169c39a58f
commit
1394b55c54
|
@ -968,11 +968,11 @@ define([
|
||||||
|
|
||||||
if (!comment) continue;
|
if (!comment) continue;
|
||||||
|
|
||||||
if (this.subEditStrings[saveTxtId] && !hint) {
|
if (this.subEditStrings[saveTxtId] && (comment.get('fullInfoInHint') || !hint)) {
|
||||||
comment.set('editTextInPopover', true);
|
comment.set('editTextInPopover', true);
|
||||||
text = this.subEditStrings[saveTxtId];
|
text = this.subEditStrings[saveTxtId];
|
||||||
}
|
}
|
||||||
else if (this.subEditStrings[saveTxtReplyId] && !hint) {
|
else if (this.subEditStrings[saveTxtReplyId] && (comment.get('fullInfoInHint') || !hint)) {
|
||||||
comment.set('showReplyInPopover', true);
|
comment.set('showReplyInPopover', true);
|
||||||
text = this.subEditStrings[saveTxtReplyId];
|
text = this.subEditStrings[saveTxtReplyId];
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getEncodedName(parsedName) %>
|
<div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getEncodedName(parsedName) %>
|
||||||
</div>
|
</div>
|
||||||
<div class="user-date"><%=date%></div>
|
<div class="user-date"><%=date%></div>
|
||||||
<% if (!editTextInPopover || hint || scope.viewmode) { %>
|
<% if (!editTextInPopover || (hint && !fullInfoInHint) || scope.viewmode) { %>
|
||||||
<div oo_editor_input="true" tabindex="-1" class="user-message user-select"><%=scope.pickLink(comment)%></div>
|
<div oo_editor_input="true" tabindex="-1" class="user-message user-select"><%=scope.pickLink(comment)%></div>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<div class="inner-edit-ct">
|
<div class="inner-edit-ct">
|
||||||
|
|
|
@ -98,6 +98,17 @@ define([
|
||||||
var text = $(this.el).find('textarea');
|
var text = $(this.el).find('textarea');
|
||||||
return (text && text.length) ? text.val().trim() : '';
|
return (text && text.length) ? text.val().trim() : '';
|
||||||
},
|
},
|
||||||
|
disableTextBoxButton: function(textboxEl) {
|
||||||
|
var button = $(textboxEl.siblings('#id-comments-change')[0]);
|
||||||
|
|
||||||
|
if(textboxEl.val().length > 0) {
|
||||||
|
button.removeAttr('disabled');
|
||||||
|
button.removeClass('disabled');
|
||||||
|
} else {
|
||||||
|
button.attr('disabled', true);
|
||||||
|
button.addClass('disabled');
|
||||||
|
}
|
||||||
|
},
|
||||||
autoHeightTextBox: function () {
|
autoHeightTextBox: function () {
|
||||||
var view = this,
|
var view = this,
|
||||||
textBox = $(this.el).find('textarea'),
|
textBox = $(this.el).find('textarea'),
|
||||||
|
@ -127,13 +138,19 @@ define([
|
||||||
view.autoScrollToEditButtons();
|
view.autoScrollToEditButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onTextareaInput(event) {
|
||||||
|
updateTextBoxHeight();
|
||||||
|
view.disableTextBoxButton($(event.target));
|
||||||
|
}
|
||||||
|
|
||||||
if (textBox && textBox.length) {
|
if (textBox && textBox.length) {
|
||||||
domTextBox = textBox.get(0);
|
domTextBox = textBox.get(0);
|
||||||
|
|
||||||
|
view.disableTextBoxButton(textBox);
|
||||||
if (domTextBox) {
|
if (domTextBox) {
|
||||||
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
|
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
|
||||||
updateTextBoxHeight();
|
updateTextBoxHeight();
|
||||||
textBox.bind('input propertychange', updateTextBoxHeight)
|
textBox.bind('input propertychange', onTextareaInput)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +188,7 @@ define([
|
||||||
|
|
||||||
addCommentHeight: 45,
|
addCommentHeight: 45,
|
||||||
newCommentHeight: 110,
|
newCommentHeight: 110,
|
||||||
textBoxAutoSizeLocked: undefined, // disable autosize textbox
|
textBoxAutoSizeLocked: undefined, // disable autoHeightTextBoxsize textbox
|
||||||
viewmode: false,
|
viewmode: false,
|
||||||
|
|
||||||
_commentsViewOnItemClick: function (picker, item, record, e) {
|
_commentsViewOnItemClick: function (picker, item, record, e) {
|
||||||
|
@ -694,7 +711,17 @@ define([
|
||||||
this.layout.setResizeValue(0, container.height() - this.addCommentHeight);
|
this.layout.setResizeValue(0, container.height() - this.addCommentHeight);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
disableTextBoxButton: function(textboxEl) {
|
||||||
|
var button = $(textboxEl.parent().siblings('.add')[0]);
|
||||||
|
|
||||||
|
if(textboxEl.val().length > 0) {
|
||||||
|
button.removeAttr('disabled');
|
||||||
|
button.removeClass('disabled');
|
||||||
|
} else {
|
||||||
|
button.attr('disabled', true);
|
||||||
|
button.addClass('disabled');
|
||||||
|
}
|
||||||
|
},
|
||||||
autoHeightTextBox: function () {
|
autoHeightTextBox: function () {
|
||||||
var me = this, domTextBox = null, lineHeight = 0, minHeight = 44;
|
var me = this, domTextBox = null, lineHeight = 0, minHeight = 44;
|
||||||
var textBox = $('#comment-msg-new', this.el);
|
var textBox = $('#comment-msg-new', this.el);
|
||||||
|
@ -736,9 +763,15 @@ define([
|
||||||
Math.min(height - contentHeight - textBoxMinHeightIndent, height - me.newCommentHeight)));
|
Math.min(height - contentHeight - textBoxMinHeightIndent, height - me.newCommentHeight)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onTextareaInput(event) {
|
||||||
|
updateTextBoxHeight();
|
||||||
|
me.disableTextBoxButton($(event.target));
|
||||||
|
}
|
||||||
|
|
||||||
|
me.disableTextBoxButton(textBox);
|
||||||
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
|
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
|
||||||
updateTextBoxHeight();
|
updateTextBoxHeight();
|
||||||
textBox.bind('input propertychange', updateTextBoxHeight);
|
textBox.bind('input propertychange', onTextareaInput);
|
||||||
|
|
||||||
this.textBox = textBox;
|
this.textBox = textBox;
|
||||||
},
|
},
|
||||||
|
|
|
@ -173,6 +173,17 @@ define([
|
||||||
var text = $(this.el).find('textarea');
|
var text = $(this.el).find('textarea');
|
||||||
return (text && text.length) ? text.val().trim() : '';
|
return (text && text.length) ? text.val().trim() : '';
|
||||||
},
|
},
|
||||||
|
disableTextBoxButton: function(textboxEl) {
|
||||||
|
var button = $(textboxEl.siblings('#id-comments-change-popover')[0]);
|
||||||
|
|
||||||
|
if(textboxEl.val().length > 0) {
|
||||||
|
button.removeAttr('disabled');
|
||||||
|
button.removeClass('disabled');
|
||||||
|
} else {
|
||||||
|
button.attr('disabled', true);
|
||||||
|
button.addClass('disabled');
|
||||||
|
}
|
||||||
|
},
|
||||||
autoHeightTextBox: function () {
|
autoHeightTextBox: function () {
|
||||||
var view = this,
|
var view = this,
|
||||||
textBox = this.$el.find('textarea'),
|
textBox = this.$el.find('textarea'),
|
||||||
|
@ -183,6 +194,7 @@ define([
|
||||||
oldHeight = 0,
|
oldHeight = 0,
|
||||||
newHeight = 0;
|
newHeight = 0;
|
||||||
|
|
||||||
|
|
||||||
function updateTextBoxHeight() {
|
function updateTextBoxHeight() {
|
||||||
scrollPos = parentView.scroller.getScrollTop();
|
scrollPos = parentView.scroller.getScrollTop();
|
||||||
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
|
if (domTextBox.scrollHeight > domTextBox.clientHeight) {
|
||||||
|
@ -211,13 +223,20 @@ define([
|
||||||
parentView.autoScrollToEditButtons();
|
parentView.autoScrollToEditButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onTextareaInput(event) {
|
||||||
|
updateTextBoxHeight();
|
||||||
|
view.disableTextBoxButton($(event.target));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (textBox && textBox.length && parentView.scroller) {
|
if (textBox && textBox.length && parentView.scroller) {
|
||||||
domTextBox = textBox.get(0);
|
domTextBox = textBox.get(0);
|
||||||
|
|
||||||
|
view.disableTextBoxButton(textBox);
|
||||||
if (domTextBox) {
|
if (domTextBox) {
|
||||||
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
|
lineHeight = parseInt(textBox.css('lineHeight'), 10) * 0.25;
|
||||||
updateTextBoxHeight();
|
updateTextBoxHeight();
|
||||||
textBox.bind('input propertychange', updateTextBoxHeight)
|
textBox.bind('input propertychange', onTextareaInput)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,8 +538,10 @@ define([
|
||||||
},
|
},
|
||||||
'animate:before': function () {
|
'animate:before': function () {
|
||||||
var text = me.$window.find('textarea');
|
var text = me.$window.find('textarea');
|
||||||
if (text && text.length)
|
if (text && text.length){
|
||||||
text.focus();
|
text.focus();
|
||||||
|
me.commentsView.disableTextBoxButton(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue