This commit is contained in:
Alexei Koshelev 2022-11-02 03:45:57 +03:00
parent 82a02c0f63
commit 80b1b32195
6 changed files with 24 additions and 24 deletions

View file

@ -58,6 +58,7 @@ define([
this.each(function(comment) { this.each(function(comment) {
comment.set('editText', false); comment.set('editText', false);
comment.set('editTextInPopover', false); comment.set('editTextInPopover', false);
comment.set('showBtnsInPopover', false);
comment.set('showReply', false); comment.set('showReply', false);
comment.set('showReplyInPopover', true); comment.set('showReplyInPopover', true);
comment.set('hideAddReply', false); comment.set('hideAddReply', false);

View file

@ -73,6 +73,7 @@ define([
time : 0, time : 0,
showReply : false, showReply : false,
showReplyInPopover : true, showReplyInPopover : true,
showBtnsInPopover : false,
editText : false, editText : false,
editTextInPopover : false, editTextInPopover : false,
last : undefined, last : undefined,

View file

@ -11,7 +11,7 @@
<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">
<textarea class="msg-reply user-select" maxlength="maxCommLength" spellcheck="false" <% if (!!dummy) { %> placeholder="textMention"<% } %>><%=comment%></textarea> <textarea class="msg-reply user-select<% if (!!dummy) { %> new-comment-textarea<% } %>" maxlength="maxCommLength" spellcheck="false" <% if (!!dummy) { %> placeholder="textMention"<% } %>><%=comment%></textarea>
<% if (hideAddReply) { %> <% if (hideAddReply) { %>
<button class="btn normal dlg-btn primary btn-inner-edit" id="id-comments-change-popover">textAdd</button> <button class="btn normal dlg-btn primary btn-inner-edit" id="id-comments-change-popover">textAdd</button>
<% } else { %> <% } else { %>
@ -64,9 +64,9 @@
<% if (showReplyInPopover && !hideAddReply && !hint && !scope.viewmode) { %> <% if (showReplyInPopover && !hideAddReply && !hint && !scope.viewmode) { %>
<div class="reply-ct"> <div class="reply-ct">
<textarea class="msg-reply user-select" placeholder="textAddReply" maxlength="maxCommLength" spellcheck="false"></textarea> <textarea class="msg-reply user-select" placeholder="textAddReply" maxlength="maxCommLength" spellcheck="false"></textarea>
<% if(true) { %> <% if(showBtnsInPopover) { %>
<button class="btn normal dlg-btn primary btn-reply" id="id-comments-change-popover" style="display:none">textReply</button> <button class="btn normal dlg-btn primary btn-reply" id="id-comments-change-popover">textReply</button>
<button class="btn normal dlg-btn btn-close" style="display:none">textClose</button> <button class="btn normal dlg-btn btn-close">textClose</button>
<% } %> <% } %>
</div> </div>
<% } %> <% } %>

View file

@ -102,7 +102,7 @@ define([
var view = this, var view = this,
textBox = $(this.el).find('textarea'), textBox = $(this.el).find('textarea'),
domTextBox = null, domTextBox = null,
minHeight = 21, minHeight = 55,
lineHeight = 0, lineHeight = 0,
scrollPos = 0, scrollPos = 0,
oldHeight = 0, oldHeight = 0,

View file

@ -140,10 +140,6 @@ define([
body.css('position', 'relative'); body.css('position', 'relative');
} }
me.$window.on('focus', 'textarea', function(e) { me.commentsView.onFocusTextarea(e.currentTarget) });
me.$window.on('blur', 'textarea', function(e) { me.commentsView.onBlurTextarea(e.currentTarget) });
var CommentsPopoverDataView = Common.UI.DataView.extend((function () { var CommentsPopoverDataView = Common.UI.DataView.extend((function () {
var parentView = me; var parentView = me;
@ -156,19 +152,6 @@ define([
template: _.template('<div class="dataview-ct inner" style="overflow-y: visible;"></div>') template: _.template('<div class="dataview-ct inner" style="overflow-y: visible;"></div>')
}, },
onFocusTextarea: function(textarea) {
if($(textarea).parent().hasClass('reply-ct'))
me.$window.find('.reply-ct button').show();
},
onBlurTextarea: function(textarea) {
if($(textarea).parent().hasClass('reply-ct')){
setTimeout(() => {
me.$window.find('.reply-ct button').hide();
}, 120);
}
},
getTextBox: function () { getTextBox: function () {
var text = $(this.el).find('textarea'); var text = $(this.el).find('textarea');
return (text && text.length) ? text : undefined; return (text && text.length) ? text : undefined;
@ -194,7 +177,7 @@ define([
var view = this, var view = this,
textBox = this.$el.find('textarea'), textBox = this.$el.find('textarea'),
domTextBox = null, domTextBox = null,
minHeight = 21, minHeight = parseFloat(textBox.css('height')),
lineHeight = 0, lineHeight = 0,
scrollPos = 0, scrollPos = 0,
oldHeight = 0, oldHeight = 0,
@ -478,6 +461,11 @@ define([
me.fireEvent('comment:resolve', [commentId]); me.fireEvent('comment:resolve', [commentId]);
readdresolves(); readdresolves();
} else if(btn.hasClass('msg-reply') && btn.parent().hasClass('reply-ct') && !record.get('showBtnsInPopover')) {
var val = $(e.target).val();
record.set('showBtnsInPopover', true);
this.setFocusToTextBox();
this.getTextBox().val(val);
} }
} }
}); });
@ -502,7 +490,6 @@ define([
me.on({ me.on({
'show': function (picker, item, record, e) { 'show': function (picker, item, record, e) {
me.commentsView.autoHeightTextBox();
me.$window.find('textarea').keydown(function (event) { me.$window.find('textarea').keydown(function (event) {
if (event.keyCode == Common.UI.Keys.ESC) { if (event.keyCode == Common.UI.Keys.ESC) {
me.hide(true); // clear text in dummy comment me.hide(true); // clear text in dummy comment
@ -510,6 +497,7 @@ define([
}); });
}, },
'animate:before': function () { 'animate:before': function () {
me.commentsView.autoHeightTextBox();
var text = me.$window.find('textarea'); var text = me.$window.find('textarea');
if (text && text.length && !$(text).parent().hasClass('reply-ct')){ if (text && text.length && !$(text).parent().hasClass('reply-ct')){
me.commentsView.setFocusToTextBox(); me.commentsView.setFocusToTextBox();

View file

@ -127,6 +127,10 @@
color: @border-preview-select-ie; color: @border-preview-select-ie;
color: @border-preview-select; color: @border-preview-select;
.new-comment-textarea {
height: 55px;
}
textarea { textarea {
width: 100%; width: 100%;
height: 21px; height: 21px;
@ -477,6 +481,12 @@
} }
} }
#comments-box {
textarea {
height: 55px;
}
}
.comments-caret { .comments-caret {
width: 7px; width: 7px;
height: 7px; height: 7px;