Mentions refactoring: add placeholder to comment textarea, set mentions on adding reply, clear external users when change document access rights

This commit is contained in:
Julia Radzhabova 2019-06-26 14:04:02 +03:00
parent 632b3c554c
commit f19597a9cb
12 changed files with 28 additions and 8 deletions

View file

@ -199,6 +199,7 @@
_config.editorConfig.canRename = _config.events && !!_config.events.onRequestRename; _config.editorConfig.canRename = _config.events && !!_config.events.onRequestRename;
_config.editorConfig.canMakeActionLink = _config.events && !!_config.events.onMakeActionLink; _config.editorConfig.canMakeActionLink = _config.events && !!_config.events.onMakeActionLink;
_config.editorConfig.canRequestUsers = _config.events && !!_config.events.onRequestUsers; _config.editorConfig.canRequestUsers = _config.events && !!_config.events.onRequestUsers;
_config.editorConfig.canRequestSendNotify = _config.events && !!_config.events.onRequestSendNotify;
_config.editorConfig.mergeFolderUrl = _config.editorConfig.mergeFolderUrl || _config.editorConfig.saveAsUrl; _config.editorConfig.mergeFolderUrl = _config.editorConfig.mergeFolderUrl || _config.editorConfig.saveAsUrl;
_config.frameEditorId = placeholderId; _config.frameEditorId = placeholderId;

View file

@ -494,6 +494,7 @@ define([
ascComment.asc_addReply(addReply); ascComment.asc_addReply(addReply);
me.api.asc_changeComment(id, ascComment); me.api.asc_changeComment(id, ascComment);
me.mode && me.mode.canRequestUsers && me.view.pickEMail(id, replyVal);
return true; return true;
} }
@ -1125,7 +1126,8 @@ define([
this.popover = Common.Views.ReviewPopover.prototype.getPopover({ this.popover = Common.Views.ReviewPopover.prototype.getPopover({
commentsStore : this.popoverComments, commentsStore : this.popoverComments,
renderTo : this.sdkViewName, renderTo : this.sdkViewName,
canRequestUsers: (this.mode) ? this.mode.canRequestUsers : undefined canRequestUsers: (this.mode) ? this.mode.canRequestUsers : undefined,
canRequestSendNotify: (this.mode) ? this.mode.canRequestSendNotify : undefined
}); });
this.popover.setCommentsStore(this.popoverComments); this.popover.setCommentsStore(this.popoverComments);
} }

View file

@ -10,7 +10,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"><%=comment%></textarea> <textarea class="msg-reply user-select" 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 { %>

View file

@ -723,7 +723,6 @@ define([
pickEMail: function (commentId, message) { pickEMail: function (commentId, message) {
var arr = Common.Utils.String.htmlEncode(message).match(/\B[@+][A-Z0-9._%+-]+@[A-Z0-9._]+\.[A-Z]+\b/gi); var arr = Common.Utils.String.htmlEncode(message).match(/\B[@+][A-Z0-9._%+-]+@[A-Z0-9._]+\.[A-Z]+\b/gi);
console.log(arr); // send e-mails
arr = _.map(arr, function(str){ arr = _.map(arr, function(str){
return str.slice(1, str.length); return str.slice(1, str.length);
}); });

View file

@ -120,8 +120,10 @@ define([
_onMessage: function(msg) { _onMessage: function(msg) {
if (msg && msg.Referer == "onlyoffice") { if (msg && msg.Referer == "onlyoffice") {
if (msg.needUpdate) if (msg.needUpdate) {
this.trigger('accessrights', this, msg.sharingSettings); this.trigger('accessrights', this, msg.sharingSettings);
Common.NotificationCenter.trigger('mentions:clearusers', this);
}
Common.NotificationCenter.trigger('window:close', this); Common.NotificationCenter.trigger('window:close', this);
} }
}, },

View file

@ -101,6 +101,7 @@ define([
this.commentsStore = options.commentsStore; this.commentsStore = options.commentsStore;
this.reviewStore = options.reviewStore; this.reviewStore = options.reviewStore;
this.canRequestUsers = options.canRequestUsers; this.canRequestUsers = options.canRequestUsers;
this.canRequestSendNotify = options.canRequestSendNotify;
this.externalUsers = []; this.externalUsers = [];
this._state = {commentsVisible: false, reviewVisible: false}; this._state = {commentsVisible: false, reviewVisible: false};
@ -111,7 +112,10 @@ define([
Common.UI.Window.prototype.initialize.call(this, _options); Common.UI.Window.prototype.initialize.call(this, _options);
this.canRequestUsers && Common.Gateway.on('setusers', _.bind(this.setUsers, this)); if (this.canRequestUsers) {
Common.Gateway.on('setusers', _.bind(this.setUsers, this));
Common.NotificationCenter.on('mentions:clearusers', _.bind(this.clearUsers, this));
}
return this; return this;
}, },
@ -126,7 +130,7 @@ define([
minHeight: '', minHeight: '',
overflow: 'hidden', overflow: 'hidden',
position: 'absolute', position: 'absolute',
zIndex: '990' zIndex: '1001'
}); });
var body = window.find('.body'); var body = window.find('.body');
@ -239,7 +243,8 @@ define([
textEdit: me.textEdit, textEdit: me.textEdit,
textReply: me.textReply, textReply: me.textReply,
textClose: me.textClose, textClose: me.textClose,
maxCommLength: Asc.c_oAscMaxCellOrCommentLength maxCommLength: Asc.c_oAscMaxCellOrCommentLength,
textMention: me.canRequestSendNotify ? me.textMention : ''
}) })
) )
}); });
@ -970,6 +975,10 @@ define([
this._state.emailSearch = null; this._state.emailSearch = null;
}, },
clearUsers: function() {
this.externalUsers = [];
},
getPopover: function(options) { getPopover: function(options) {
if (!this.popover) if (!this.popover)
this.popover = new Common.Views.ReviewPopover(options); this.popover = new Common.Views.ReviewPopover(options);
@ -1103,7 +1112,8 @@ define([
textClose : 'Close', textClose : 'Close',
textResolve : 'Resolve', textResolve : 'Resolve',
textOpenAgain : "Open Again", textOpenAgain : "Open Again",
textLoading : 'Loading' textLoading : 'Loading',
textMention : '+mention will provide access to the document and send an email'
}, Common.Views.ReviewPopover || {})) }, Common.Views.ReviewPopover || {}))
}); });

View file

@ -341,6 +341,7 @@ define([
this.plugins = this.editorConfig.plugins; this.plugins = this.editorConfig.plugins;
this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink; this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink;
this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers; this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers;
this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify;
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header'); appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '') appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')

View file

@ -276,6 +276,7 @@
"Common.Views.ReviewPopover.textCancel": "Cancel", "Common.Views.ReviewPopover.textCancel": "Cancel",
"Common.Views.ReviewPopover.textClose": "Close", "Common.Views.ReviewPopover.textClose": "Close",
"Common.Views.ReviewPopover.textEdit": "OK", "Common.Views.ReviewPopover.textEdit": "OK",
"Common.Views.ReviewPopover.textMention": "+mention will provide access to the document and send an email",
"Common.Views.ReviewPopover.textOpenAgain": "Open Again", "Common.Views.ReviewPopover.textOpenAgain": "Open Again",
"Common.Views.ReviewPopover.textReply": "Reply", "Common.Views.ReviewPopover.textReply": "Reply",
"Common.Views.ReviewPopover.textResolve": "Resolve", "Common.Views.ReviewPopover.textResolve": "Resolve",

View file

@ -320,6 +320,7 @@ define([
this.appOptions.canPlugins = false; this.appOptions.canPlugins = false;
this.plugins = this.editorConfig.plugins; this.plugins = this.editorConfig.plugins;
this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers; this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers;
this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify;
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header'); appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '') appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')

View file

@ -198,6 +198,7 @@
"Common.Views.ReviewPopover.textCancel": "Cancel", "Common.Views.ReviewPopover.textCancel": "Cancel",
"Common.Views.ReviewPopover.textClose": "Close", "Common.Views.ReviewPopover.textClose": "Close",
"Common.Views.ReviewPopover.textEdit": "OK", "Common.Views.ReviewPopover.textEdit": "OK",
"Common.Views.ReviewPopover.textMention": "+mention will provide access to the document and send an email",
"Common.Views.ReviewPopover.textOpenAgain": "Open Again", "Common.Views.ReviewPopover.textOpenAgain": "Open Again",
"Common.Views.ReviewPopover.textReply": "Reply", "Common.Views.ReviewPopover.textReply": "Reply",
"Common.Views.ReviewPopover.textResolve": "Resolve", "Common.Views.ReviewPopover.textResolve": "Resolve",

View file

@ -326,6 +326,7 @@ define([
this.appOptions.canPlugins = false; this.appOptions.canPlugins = false;
this.plugins = this.editorConfig.plugins; this.plugins = this.editorConfig.plugins;
this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers; this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers;
this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify;
this.headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header'); this.headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header');
this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '') this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')

View file

@ -188,6 +188,7 @@
"Common.Views.ReviewPopover.textCancel": "Cancel", "Common.Views.ReviewPopover.textCancel": "Cancel",
"Common.Views.ReviewPopover.textClose": "Close", "Common.Views.ReviewPopover.textClose": "Close",
"Common.Views.ReviewPopover.textEdit": "OK", "Common.Views.ReviewPopover.textEdit": "OK",
"Common.Views.ReviewPopover.textMention": "+mention will provide access to the document and send an email",
"Common.Views.ReviewPopover.textOpenAgain": "Open Again", "Common.Views.ReviewPopover.textOpenAgain": "Open Again",
"Common.Views.ReviewPopover.textReply": "Reply", "Common.Views.ReviewPopover.textReply": "Reply",
"Common.Views.ReviewPopover.textResolve": "Resolve", "Common.Views.ReviewPopover.textResolve": "Resolve",