diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js index b40f63117..19745f013 100644 --- a/apps/common/mobile/lib/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -93,6 +93,8 @@ define([ this.api.asc_registerCallback('asc_onRemoveComment', _.bind(this.onApiRemoveComment, this)); this.api.asc_registerCallback('asc_onRemoveComments', _.bind(this.onApiRemoveComments, this)); this.api.asc_registerCallback('asc_onShowComment', _.bind(this.apiShowComments, this)); + this.api.asc_registerCallback('asc_onHideComment', _.bind(this.apiHideComments, this)); + if (editor === 'DE') { this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.changeReview, this)); } @@ -751,6 +753,36 @@ define([ } }); } + if ($('.container-view-comment').length > 0) { + me.indexCurrentComment = 0; + me.updateViewComment(); + } + }, + + apiHideComments: function() { + if ($('.container-view-comment').length > 0) { + uiApp.closeModal(); + $('.container-view-comment').remove(); + } + }, + + disabledViewComments: function(disabled) { + if ($('.container-view-comment').length > 0) { + if (disabled) { + $('.comment-resolve, .comment-menu, .add-reply').addClass('disabled'); + if (!$('.prev-comment').hasClass('disabled')) { + $('.prev-comment').addClass('disabled'); + } + if (!$('.next-comment').hasClass('disabled')) { + $('.next-comment').addClass('disabled'); + } + } else { + $('.comment-resolve, .comment-menu, .add-reply').removeClass('disabled'); + if (this.showComments.length > 1) { + $('.prev-comment, .next-comment').removeClass('disabled'); + } + } + } }, updateViewComment: function() { @@ -758,6 +790,9 @@ define([ $('.comment-menu').single('click', _.bind(this.initMenuComments, this)); $('.reply-menu').single('click', _.bind(this.initReplyMenu, this)); $('.comment-resolve').single('click', _.bind(this.onClickResolveComment, this, false)); + if (this.showComments.length === 1) { + $('.prev-comment, .next-comment').addClass('disabled'); + } }, showCommentModal: function() { @@ -989,6 +1024,7 @@ define([ ); $('.popup').css('z-index', '20000'); } else { + me.disabledViewComments(true); $('.container-view-comment .toolbar').find('a.prev-comment, a.next-comment, a.add-reply').css('display', 'none'); var template = _.template('' + me.textDone + ''); $('.container-view-comment .button-right').append(template); @@ -1003,6 +1039,10 @@ define([ color = me.currentUser.asc_getColor(); me.getView('Common.Views.Collaboration').renderAddReply(name, color, me.getInitials(name), date); } + _.defer(function () { + var $textarea = $('.reply-textarea')[0]; + $textarea.focus(); + }); $('#add-new-reply').single('click', _.bind(function (uid) { var reply = $('.reply-textarea')[0].value; if ($('.container-view-comment').length > 0) { @@ -1016,6 +1056,7 @@ define([ } else { uiApp.closeModal($$(addReplyView)); } + this.disabledViewComments(false); } } else if ($('.container-collaboration').length > 0) { this.addReply(uid, reply); @@ -1029,6 +1070,7 @@ define([ } $viewComment.find('a#add-new-reply, a.cancel-reply').css('display', 'none'); $viewComment.find('a.prev-comment, a.next-comment, a.add-reply').css('display', 'flex'); + this.disabledViewComments(false); }, me)); } }, @@ -1118,50 +1160,91 @@ define([ }, initMenuComments: function(e) { - var $comment = $(e.currentTarget).closest('.comment'); - var idComment = $comment.data('uid'); - if (_.isNumber(idComment)) { - idComment = idComment.toString(); + if ($('.actions-modal').length < 1) { + var $comment = $(e.currentTarget).closest('.comment'); + var idComment = $comment.data('uid'); + if (_.isNumber(idComment)) { + idComment = idComment.toString(); + } + var comment = this.findComment(idComment); + if ($('.actions-modal').length === 0 && comment) { + var me = this; + _.delay(function () { + var _menuItems = []; + _menuItems.push({ + caption: me.textEdit, + event: 'edit' + }); + if (!comment.resolved) { + _menuItems.push({ + caption: me.textResolve, + event: 'resolve' + }); + } else { + _menuItems.push({ + caption: me.textReopen, + event: 'resolve' + }); + } + if ($('.container-collaboration').length > 0) { + _menuItems.push({ + caption: me.textAddReply, + event: 'addreply' + }); + } + _menuItems.push({ + caption: me.textDeleteComment, + event: 'delete', + color: 'red' + }); + _.each(_menuItems, function (item) { + item.text = item.caption; + item.onClick = function () { + me.onCommentMenuClick(item.event, idComment) + } + }); + + me.menuComments = uiApp.actions([_menuItems, [ + { + text: me.textCancel, + bold: true, + onClick: function () { + me.onCommentMenuClick(); + } + } + ]]); + }, 100); + } + this.disabledViewComments(true); } - var comment = this.findComment(idComment); - if ($('.actions-modal').length === 0 && comment) { + }, + + initReplyMenu: function(event) { + if ($('.actions-modal').length < 1) { var me = this; + var ind = $(event.currentTarget).parent().parent().data('ind'); + var idComment = $(event.currentTarget).closest('.comment').data('uid'); + if (_.isNumber(idComment)) { + idComment = idComment.toString(); + } _.delay(function () { var _menuItems = []; _menuItems.push({ caption: me.textEdit, - event: 'edit' + event: 'editreply' }); - if (!comment.resolved) { - _menuItems.push({ - caption: me.textResolve, - event: 'resolve' - }); - } else { - _menuItems.push({ - caption: me.textReopen, - event: 'resolve' - }); - } - if ($('.container-collaboration').length > 0) { - _menuItems.push({ - caption: me.textAddReply, - event: 'addreply' - }); - } _menuItems.push({ - caption: me.textDeleteComment, - event: 'delete', + caption: me.textDeleteReply, + event: 'deletereply', color: 'red' }); _.each(_menuItems, function (item) { item.text = item.caption; item.onClick = function () { - me.onCommentMenuClick(item.event, idComment) + me.onCommentMenuClick(item.event, idComment, ind); } }); - - me.menuComments = uiApp.actions([_menuItems, [ + uiApp.actions([_menuItems, [ { text: me.textCancel, bold: true, @@ -1171,45 +1254,10 @@ define([ } ]]); }, 100); + this.disabledViewComments(true); } }, - initReplyMenu: function(event) { - var me = this; - var ind = $(event.currentTarget).parent().parent().data('ind'); - var idComment = $(event.currentTarget).closest('.comment').data('uid'); - if (_.isNumber(idComment)) { - idComment = idComment.toString(); - } - _.delay(function () { - var _menuItems = []; - _menuItems.push({ - caption: me.textEdit, - event: 'editreply' - }); - _menuItems.push({ - caption: me.textDeleteReply, - event: 'deletereply', - color: 'red' - }); - _.each(_menuItems, function (item) { - item.text = item.caption; - item.onClick = function () { - me.onCommentMenuClick(item.event, idComment, ind); - } - }); - uiApp.actions([_menuItems, [ - { - text: me.textCancel, - bold: true, - onClick: function () { - me.onCommentMenuClick(); - } - } - ]]); - }, 100); - }, - onCommentMenuClick: function(action, idComment, indReply) { var me = this; function addOverlay () { @@ -1228,10 +1276,12 @@ define([ case 'resolve': addOverlay(); me.onClickResolveComment(idComment); + me.disabledViewComments(false); break; case 'delete': addOverlay(); me.onDeleteComment(idComment); + me.disabledViewComments(false); break; case 'editreply': addOverlay(); @@ -1240,12 +1290,14 @@ define([ case 'deletereply': addOverlay(); me.onDeleteReply(idComment, indReply); + me.disabledViewComments(false); break; case 'addreply': addOverlay(); me.onClickAddReply(idComment); default: addOverlay(); + me.disabledViewComments(false); break; } }, @@ -1435,6 +1487,7 @@ define([ $viewComment.find('a.prev-comment, a.next-comment, a.add-reply').css('display', 'flex'); } this.updateViewComment(); + this.disabledViewComments(false); } else if ($('.container-collaboration').length > 0) { rootView.router.back(); } @@ -1445,6 +1498,7 @@ define([ $viewComment.find('a.done-edit-comment, a.cancel-edit-comment, .comment-textarea').remove(); $viewComment.find('.comment-text span').css('display', 'block'); $viewComment.find('a.prev-comment, a.next-comment, a.add-reply').css('display', 'flex'); + this.disabledViewComments(false); }, me)); } }, @@ -1503,11 +1557,11 @@ define([ me.getView('Common.Views.Collaboration').showPage('#comments-edit-reply-view', false); me.getView('Common.Views.Collaboration').renderEditReply(reply); } - _.delay(function () { + _.defer(function () { var $textarea = $('.edit-reply-textarea')[0]; $textarea.focus(); $textarea.selectionStart = $textarea.value.length; - }, 100); + }); $('#edit-reply').single('click', _.bind(function (comment, indReply) { var value = $('.edit-reply-textarea')[0].value; if (value && value.length > 0) { @@ -1526,12 +1580,14 @@ define([ this.onChangeComment(comment); rootView.router.back(); } + this.disabledViewComments(false); } }, me, comment, indReply)); $('.cancel-reply').single('click', _.bind(function () { $viewComment.find('a#edit-reply, a.cancel-reply, .edit-reply-textarea').remove(); $reply.find('.reply-text').css('display', 'block'); $viewComment.find('a.prev-comment, a.next-comment, a.add-reply').css('display', 'flex'); + this.disabledViewComments(false); }, me)); } } diff --git a/apps/common/mobile/resources/less/ios/_collaboration.less b/apps/common/mobile/resources/less/ios/_collaboration.less index 448112b20..112fba932 100644 --- a/apps/common/mobile/resources/less/ios/_collaboration.less +++ b/apps/common/mobile/resources/less/ios/_collaboration.less @@ -115,6 +115,9 @@ .list-reply { padding-left: 26px; } + .reply-textarea, .comment-textarea, .edit-reply-textarea { + resize: vertical; + } .user-name { font-size: 17px; line-height: 22px; diff --git a/apps/common/mobile/resources/less/material/_collaboration.less b/apps/common/mobile/resources/less/material/_collaboration.less index 624d2c303..5ac455060 100644 --- a/apps/common/mobile/resources/less/material/_collaboration.less +++ b/apps/common/mobile/resources/less/material/_collaboration.less @@ -113,6 +113,9 @@ .list-reply { padding-left: 26px; } + .reply-textarea, .comment-textarea, .edit-reply-textarea { + resize: vertical; + } .user-name { font-size: 16px; line-height: 22px; @@ -447,7 +450,7 @@ .navbar { .right { height: 100%; - #add-reply, #edit-comment, #edit-reply { + #add-new-reply, #edit-comment, #edit-reply { display: flex; align-items: center; padding-left: 16px; diff --git a/apps/documenteditor/mobile/app/view/add/AddOther.js b/apps/documenteditor/mobile/app/view/add/AddOther.js index 76bfaeb07..8e030be93 100644 --- a/apps/documenteditor/mobile/app/view/add/AddOther.js +++ b/apps/documenteditor/mobile/app/view/add/AddOther.js @@ -162,6 +162,10 @@ define([ comment: comment }); $commentInfo.html(insert); + _.defer(function () { + var $textarea = $('.comment-textarea')[0]; + $textarea.focus(); + }); }, renderNumFormat: function (dataFormat, selectFormat) { diff --git a/apps/documenteditor/mobile/resources/css/app-ios.css b/apps/documenteditor/mobile/resources/css/app-ios.css index 480f2f293..305972301 100644 --- a/apps/documenteditor/mobile/resources/css/app-ios.css +++ b/apps/documenteditor/mobile/resources/css/app-ios.css @@ -6541,6 +6541,35 @@ html.pixel-ratio-3 .document-menu .list-block li:last-child li .item-inner:after .page-edit-reply .list-reply { padding-left: 26px; } +.page-comments .reply-textarea, +.add-comment .reply-textarea, +.page-view-comments .reply-textarea, +.container-edit-comment .reply-textarea, +.container-add-reply .reply-textarea, +.view-comment .reply-textarea, +.page-edit-comment .reply-textarea, +.page-add-reply .reply-textarea, +.page-edit-reply .reply-textarea, +.page-comments .comment-textarea, +.add-comment .comment-textarea, +.page-view-comments .comment-textarea, +.container-edit-comment .comment-textarea, +.container-add-reply .comment-textarea, +.view-comment .comment-textarea, +.page-edit-comment .comment-textarea, +.page-add-reply .comment-textarea, +.page-edit-reply .comment-textarea, +.page-comments .edit-reply-textarea, +.add-comment .edit-reply-textarea, +.page-view-comments .edit-reply-textarea, +.container-edit-comment .edit-reply-textarea, +.container-add-reply .edit-reply-textarea, +.view-comment .edit-reply-textarea, +.page-edit-comment .edit-reply-textarea, +.page-add-reply .edit-reply-textarea, +.page-edit-reply .edit-reply-textarea { + resize: vertical; +} .page-comments .user-name, .add-comment .user-name, .page-view-comments .user-name, diff --git a/apps/documenteditor/mobile/resources/css/app-material.css b/apps/documenteditor/mobile/resources/css/app-material.css index 941217e68..5c5c3fb8b 100644 --- a/apps/documenteditor/mobile/resources/css/app-material.css +++ b/apps/documenteditor/mobile/resources/css/app-material.css @@ -6131,6 +6131,35 @@ html.phone .document-menu .list-block .item-link { .page-edit-reply .list-reply { padding-left: 26px; } +.page-comments .reply-textarea, +.page-add-comment .reply-textarea, +.page-view-comments .reply-textarea, +.container-edit-comment .reply-textarea, +.container-add-reply .reply-textarea, +.view-comment .reply-textarea, +.page-edit-comment .reply-textarea, +.page-add-reply .reply-textarea, +.page-edit-reply .reply-textarea, +.page-comments .comment-textarea, +.page-add-comment .comment-textarea, +.page-view-comments .comment-textarea, +.container-edit-comment .comment-textarea, +.container-add-reply .comment-textarea, +.view-comment .comment-textarea, +.page-edit-comment .comment-textarea, +.page-add-reply .comment-textarea, +.page-edit-reply .comment-textarea, +.page-comments .edit-reply-textarea, +.page-add-comment .edit-reply-textarea, +.page-view-comments .edit-reply-textarea, +.container-edit-comment .edit-reply-textarea, +.container-add-reply .edit-reply-textarea, +.view-comment .edit-reply-textarea, +.page-edit-comment .edit-reply-textarea, +.page-add-reply .edit-reply-textarea, +.page-edit-reply .edit-reply-textarea { + resize: vertical; +} .page-comments .user-name, .page-add-comment .user-name, .page-view-comments .user-name, @@ -6631,9 +6660,9 @@ html.phone .document-menu .list-block .item-link { .page-edit-reply .navbar .right { height: 100%; } -.page-edit-comment .navbar .right #add-reply, -.page-add-reply .navbar .right #add-reply, -.page-edit-reply .navbar .right #add-reply, +.page-edit-comment .navbar .right #add-new-reply, +.page-add-reply .navbar .right #add-new-reply, +.page-edit-reply .navbar .right #add-new-reply, .page-edit-comment .navbar .right #edit-comment, .page-add-reply .navbar .right #edit-comment, .page-edit-reply .navbar .right #edit-comment, diff --git a/apps/presentationeditor/mobile/resources/css/app-ios.css b/apps/presentationeditor/mobile/resources/css/app-ios.css index f95047727..3915440f2 100644 --- a/apps/presentationeditor/mobile/resources/css/app-ios.css +++ b/apps/presentationeditor/mobile/resources/css/app-ios.css @@ -6541,6 +6541,35 @@ html.pixel-ratio-3 .document-menu .list-block li:last-child li .item-inner:after .page-edit-reply .list-reply { padding-left: 26px; } +.page-comments .reply-textarea, +.add-comment .reply-textarea, +.page-view-comments .reply-textarea, +.container-edit-comment .reply-textarea, +.container-add-reply .reply-textarea, +.view-comment .reply-textarea, +.page-edit-comment .reply-textarea, +.page-add-reply .reply-textarea, +.page-edit-reply .reply-textarea, +.page-comments .comment-textarea, +.add-comment .comment-textarea, +.page-view-comments .comment-textarea, +.container-edit-comment .comment-textarea, +.container-add-reply .comment-textarea, +.view-comment .comment-textarea, +.page-edit-comment .comment-textarea, +.page-add-reply .comment-textarea, +.page-edit-reply .comment-textarea, +.page-comments .edit-reply-textarea, +.add-comment .edit-reply-textarea, +.page-view-comments .edit-reply-textarea, +.container-edit-comment .edit-reply-textarea, +.container-add-reply .edit-reply-textarea, +.view-comment .edit-reply-textarea, +.page-edit-comment .edit-reply-textarea, +.page-add-reply .edit-reply-textarea, +.page-edit-reply .edit-reply-textarea { + resize: vertical; +} .page-comments .user-name, .add-comment .user-name, .page-view-comments .user-name, diff --git a/apps/presentationeditor/mobile/resources/css/app-material.css b/apps/presentationeditor/mobile/resources/css/app-material.css index bc395fc6a..b6dd3c3ec 100644 --- a/apps/presentationeditor/mobile/resources/css/app-material.css +++ b/apps/presentationeditor/mobile/resources/css/app-material.css @@ -6131,6 +6131,35 @@ html.phone .document-menu .list-block .item-link { .page-edit-reply .list-reply { padding-left: 26px; } +.page-comments .reply-textarea, +.page-add-comment .reply-textarea, +.page-view-comments .reply-textarea, +.container-edit-comment .reply-textarea, +.container-add-reply .reply-textarea, +.view-comment .reply-textarea, +.page-edit-comment .reply-textarea, +.page-add-reply .reply-textarea, +.page-edit-reply .reply-textarea, +.page-comments .comment-textarea, +.page-add-comment .comment-textarea, +.page-view-comments .comment-textarea, +.container-edit-comment .comment-textarea, +.container-add-reply .comment-textarea, +.view-comment .comment-textarea, +.page-edit-comment .comment-textarea, +.page-add-reply .comment-textarea, +.page-edit-reply .comment-textarea, +.page-comments .edit-reply-textarea, +.page-add-comment .edit-reply-textarea, +.page-view-comments .edit-reply-textarea, +.container-edit-comment .edit-reply-textarea, +.container-add-reply .edit-reply-textarea, +.view-comment .edit-reply-textarea, +.page-edit-comment .edit-reply-textarea, +.page-add-reply .edit-reply-textarea, +.page-edit-reply .edit-reply-textarea { + resize: vertical; +} .page-comments .user-name, .page-add-comment .user-name, .page-view-comments .user-name, @@ -6631,9 +6660,9 @@ html.phone .document-menu .list-block .item-link { .page-edit-reply .navbar .right { height: 100%; } -.page-edit-comment .navbar .right #add-reply, -.page-add-reply .navbar .right #add-reply, -.page-edit-reply .navbar .right #add-reply, +.page-edit-comment .navbar .right #add-new-reply, +.page-add-reply .navbar .right #add-new-reply, +.page-edit-reply .navbar .right #add-new-reply, .page-edit-comment .navbar .right #edit-comment, .page-add-reply .navbar .right #edit-comment, .page-edit-reply .navbar .right #edit-comment, diff --git a/apps/spreadsheeteditor/mobile/resources/css/app-ios.css b/apps/spreadsheeteditor/mobile/resources/css/app-ios.css index db6e90d77..a568ed13a 100644 --- a/apps/spreadsheeteditor/mobile/resources/css/app-ios.css +++ b/apps/spreadsheeteditor/mobile/resources/css/app-ios.css @@ -6541,6 +6541,35 @@ html.pixel-ratio-3 .document-menu .list-block li:last-child li .item-inner:after .page-edit-reply .list-reply { padding-left: 26px; } +.page-comments .reply-textarea, +.add-comment .reply-textarea, +.page-view-comments .reply-textarea, +.container-edit-comment .reply-textarea, +.container-add-reply .reply-textarea, +.view-comment .reply-textarea, +.page-edit-comment .reply-textarea, +.page-add-reply .reply-textarea, +.page-edit-reply .reply-textarea, +.page-comments .comment-textarea, +.add-comment .comment-textarea, +.page-view-comments .comment-textarea, +.container-edit-comment .comment-textarea, +.container-add-reply .comment-textarea, +.view-comment .comment-textarea, +.page-edit-comment .comment-textarea, +.page-add-reply .comment-textarea, +.page-edit-reply .comment-textarea, +.page-comments .edit-reply-textarea, +.add-comment .edit-reply-textarea, +.page-view-comments .edit-reply-textarea, +.container-edit-comment .edit-reply-textarea, +.container-add-reply .edit-reply-textarea, +.view-comment .edit-reply-textarea, +.page-edit-comment .edit-reply-textarea, +.page-add-reply .edit-reply-textarea, +.page-edit-reply .edit-reply-textarea { + resize: vertical; +} .page-comments .user-name, .add-comment .user-name, .page-view-comments .user-name, diff --git a/apps/spreadsheeteditor/mobile/resources/css/app-material.css b/apps/spreadsheeteditor/mobile/resources/css/app-material.css index 3b14df50c..473708f41 100644 --- a/apps/spreadsheeteditor/mobile/resources/css/app-material.css +++ b/apps/spreadsheeteditor/mobile/resources/css/app-material.css @@ -6141,6 +6141,35 @@ html.phone .document-menu .list-block .item-link { .page-edit-reply .list-reply { padding-left: 26px; } +.page-comments .reply-textarea, +.page-add-comment .reply-textarea, +.page-view-comments .reply-textarea, +.container-edit-comment .reply-textarea, +.container-add-reply .reply-textarea, +.view-comment .reply-textarea, +.page-edit-comment .reply-textarea, +.page-add-reply .reply-textarea, +.page-edit-reply .reply-textarea, +.page-comments .comment-textarea, +.page-add-comment .comment-textarea, +.page-view-comments .comment-textarea, +.container-edit-comment .comment-textarea, +.container-add-reply .comment-textarea, +.view-comment .comment-textarea, +.page-edit-comment .comment-textarea, +.page-add-reply .comment-textarea, +.page-edit-reply .comment-textarea, +.page-comments .edit-reply-textarea, +.page-add-comment .edit-reply-textarea, +.page-view-comments .edit-reply-textarea, +.container-edit-comment .edit-reply-textarea, +.container-add-reply .edit-reply-textarea, +.view-comment .edit-reply-textarea, +.page-edit-comment .edit-reply-textarea, +.page-add-reply .edit-reply-textarea, +.page-edit-reply .edit-reply-textarea { + resize: vertical; +} .page-comments .user-name, .page-add-comment .user-name, .page-view-comments .user-name, @@ -6641,9 +6670,9 @@ html.phone .document-menu .list-block .item-link { .page-edit-reply .navbar .right { height: 100%; } -.page-edit-comment .navbar .right #add-reply, -.page-add-reply .navbar .right #add-reply, -.page-edit-reply .navbar .right #add-reply, +.page-edit-comment .navbar .right #add-new-reply, +.page-add-reply .navbar .right #add-new-reply, +.page-edit-reply .navbar .right #add-new-reply, .page-edit-comment .navbar .right #edit-comment, .page-add-reply .navbar .right #edit-comment, .page-edit-reply .navbar .right #edit-comment,