From 246295386b22f258dd7bea7033fd60ceeeb5f0aa Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 28 Jun 2021 14:51:32 +0300 Subject: [PATCH] [SSE] Show user's cursor on co-editing --- .../main/app/controller/DocumentHolder.js | 80 ++++++++++++++++--- 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 657726150..1efa49d4b 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -114,6 +114,8 @@ define([ me._currentParaObjDisabled = false; me._isDisabled = false; me._state = {}; + me.fastcoauthtips = []; + me._TtHeight = 20; /** coauthoring begin **/ this.wrapEvents = { apiHideComment: _.bind(this.onApiHideComment, this) @@ -332,6 +334,9 @@ define([ this.api.asc_registerCallback('asc_onTableTotalMenu', _.bind(this.onTableTotalMenu, this)); this.api.asc_registerCallback('asc_onShowPivotGroupDialog', _.bind(this.onShowPivotGroupDialog, this)); } + this.api.asc_registerCallback('asc_onShowForeignCursorLabel', _.bind(this.onShowForeignCursorLabel, this)); + this.api.asc_registerCallback('asc_onHideForeignCursorLabel', _.bind(this.onHideForeignCursorLabel, this)); + return this; }, @@ -1129,17 +1134,6 @@ define([ } } // show tooltips - /** coauthoring begin **/ - var getUserName = function(id){ - var usersStore = SSE.getCollection('Common.Collections.Users'); - if (usersStore){ - var rec = usersStore.findUser(id); - if (rec) - return AscCommon.UserInfoParser.getParsedName(rec.get('username')); - } - return me.guestText; - }; - /** coauthoring end **/ if (index_hyperlink) { if (!hyperlinkTip.parentEl) { @@ -1305,7 +1299,7 @@ define([ if (showPoint[1] >= coAuthTip.XY[1] && showPoint[1] + coAuthTip.ttHeight < coAuthTip.XY[1] + coAuthTip.apiHeight) { - src.text(getUserName(data.asc_getUserId())); + src.text(me.getUserName(data.asc_getUserId())); if (coAuthTip.bodyWidth - showPoint[0] < coAuthTip.ref.width() ) { src.css({ visibility : 'visible', @@ -3617,7 +3611,67 @@ define([ win.setActiveCategory(2); } }, - + + onShowForeignCursorLabel: function(UserId, X, Y, color) { + /** coauthoring begin **/ + var src; + var me = this; + for (var i=0; i