Skip to content

Commit

Permalink
[se] Unite cell CCollaborativeEditing
Browse files Browse the repository at this point in the history
  • Loading branch information
konovalovsergey committed Jan 12, 2025
1 parent 8f60106 commit 088215a
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 95 deletions.
167 changes: 89 additions & 78 deletions cell/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,14 @@ var editor;
this.collaborativeEditing.setFast(bFast);
}
};
spreadsheet_api.prototype.initCollaborativeEditing = function()
{
if (AscCommon.CollaborativeEditing)
return;

this._coAuthoringInitCollaborativeEditing();
AscCommon.CollaborativeEditing = this.collaborativeEditing;
};

spreadsheet_api.prototype.asc_setThumbnailStylesSizes = function (width, height) {
this.styleThumbnailWidth = width;
Expand Down Expand Up @@ -2612,84 +2620,87 @@ var editor;
/////////////////////////////////////////////////////////////////////////
///////////////////CoAuthoring and Chat api//////////////////////////////
/////////////////////////////////////////////////////////////////////////
spreadsheet_api.prototype._coAuthoringInitEnd = function() {
var t = this;
this.collaborativeEditing = this.CollaborativeEditing = new AscCommonExcel.CCollaborativeEditing(/*handlers*/{
"askLock": function() {
t.CoAuthoringApi.askLock.apply(t.CoAuthoringApi, arguments);
},
"releaseLocks": function() {
t.CoAuthoringApi.releaseLocks.apply(t.CoAuthoringApi, arguments);
},
"sendChanges": function() {
t._onSaveChanges.apply(t, arguments);
},
"applyChanges": function() {
t._onApplyChanges.apply(t, arguments);
},
"updateAfterApplyChanges": function() {
t._onUpdateAfterApplyChanges.apply(t, arguments);
},
"drawSelection": function() {
t._onDrawSelection.apply(t, arguments);
},
"drawFrozenPaneLines": function() {
t._onDrawFrozenPaneLines.apply(t, arguments);
},
"updateAllSheetsLock": function() {
t._onUpdateAllSheetsLock.apply(t, arguments);
},
"showDrawingObjects": function() {
t._onShowDrawingObjects.apply(t, arguments);
},
"showComments": function() {
t._onShowComments.apply(t, arguments);
},
"cleanSelection": function() {
t._onCleanSelection.apply(t, arguments);
},
"updateDocumentCanSave": function() {
t._onUpdateDocumentCanSave();
},
"checkCommentRemoveLock": function(lockElem) {
return t._onCheckCommentRemoveLock(lockElem);
},
"unlockDefName": function() {
t._onUnlockDefName.apply(t, arguments);
},
"checkDefNameLock": function(lockElem) {
return t._onCheckDefNameLock(lockElem);
},
"updateAllLayoutsLock": function() {
t._onUpdateAllLayoutsLock.apply(t, arguments);
},
"updateAllHeaderFooterLock": function() {
t._onUpdateAllHeaderFooterLock.apply(t, arguments);
},
"updateAllPrintScaleLock": function() {
t._onUpdateAllPrintScaleLock.apply(t, arguments);
},
"updateAllSheetViewLock": function() {
if (t._onUpdateAllSheetViewLock) {
t._onUpdateAllSheetViewLock.apply(t, arguments);
}
},
"unlockCF": function() {
t._onUnlockCF.apply(t, arguments);
},
"checkCFRemoveLock": function(lockElem) {
return t._onCheckCFRemoveLock(lockElem);
},
"unlockProtectedRange": function() {
t._onUnlockProtectedRange.apply(t, arguments);
},
"checkProtectedRangeRemoveLock": function(lockElem) {
return t._onCheckProtectedRangeRemoveLock(lockElem);
},
"unlockUserProtectedRanges": function() {
t._onUnlockUserProtectedRanges.apply(t, arguments);
}
}, this.getViewMode());
spreadsheet_api.prototype._coAuthoringInitCollaborativeEditing = function() {
var t = this;
this.collaborativeEditing = this.CollaborativeEditing = new AscCommonExcel.CCollaborativeEditing(/*handlers*/{
"askLock": function() {
t.CoAuthoringApi.askLock.apply(t.CoAuthoringApi, arguments);
},
"releaseLocks": function() {
t.CoAuthoringApi.releaseLocks.apply(t.CoAuthoringApi, arguments);
},
"sendChanges": function() {
t._onSaveChanges.apply(t, arguments);
},
"applyChanges": function() {
t._onApplyChanges.apply(t, arguments);
},
"updateAfterApplyChanges": function() {
t._onUpdateAfterApplyChanges.apply(t, arguments);
},
"drawSelection": function() {
t._onDrawSelection.apply(t, arguments);
},
"drawFrozenPaneLines": function() {
t._onDrawFrozenPaneLines.apply(t, arguments);
},
"updateAllSheetsLock": function() {
t._onUpdateAllSheetsLock.apply(t, arguments);
},
"showDrawingObjects": function() {
t._onShowDrawingObjects.apply(t, arguments);
},
"showComments": function() {
t._onShowComments.apply(t, arguments);
},
"cleanSelection": function() {
t._onCleanSelection.apply(t, arguments);
},
"updateDocumentCanSave": function() {
t._onUpdateDocumentCanSave();
},
"checkCommentRemoveLock": function(lockElem) {
return t._onCheckCommentRemoveLock(lockElem);
},
"unlockDefName": function() {
t._onUnlockDefName.apply(t, arguments);
},
"checkDefNameLock": function(lockElem) {
return t._onCheckDefNameLock(lockElem);
},
"updateAllLayoutsLock": function() {
t._onUpdateAllLayoutsLock.apply(t, arguments);
},
"updateAllHeaderFooterLock": function() {
t._onUpdateAllHeaderFooterLock.apply(t, arguments);
},
"updateAllPrintScaleLock": function() {
t._onUpdateAllPrintScaleLock.apply(t, arguments);
},
"updateAllSheetViewLock": function() {
if (t._onUpdateAllSheetViewLock) {
t._onUpdateAllSheetViewLock.apply(t, arguments);
}
},
"unlockCF": function() {
t._onUnlockCF.apply(t, arguments);
},
"checkCFRemoveLock": function(lockElem) {
return t._onCheckCFRemoveLock(lockElem);
},
"unlockProtectedRange": function() {
t._onUnlockProtectedRange.apply(t, arguments);
},
"checkProtectedRangeRemoveLock": function(lockElem) {
return t._onCheckProtectedRangeRemoveLock(lockElem);
},
"unlockUserProtectedRanges": function() {
t._onUnlockUserProtectedRanges.apply(t, arguments);
}
}, this.getViewMode());
}
spreadsheet_api.prototype._coAuthoringInitEnd = function() {
var t = this;

this.CoAuthoringApi.onConnectionStateChanged = function(e) {
if (true === AscCommon.CollaborativeEditing.Is_Fast() && false === e['state']) {
Expand Down
1 change: 1 addition & 0 deletions cell/model/CollaborativeEditing.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
this.m_bFast = false;

this.m_aForeignCursorsData = {};
this.WaitImages = {};//cell/model/DrawingObjects/GlobalCounters.js

this.init();

Expand Down
17 changes: 2 additions & 15 deletions cell/model/DrawingObjects/GlobalCounters.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,8 @@

(function(window, undefined){

/**
*
* @constructor
* @extends {AscCommon.CCollaborativeEditingBase}
*/
function CCollaborativeEditing()
{
AscCommon.CCollaborativeEditingBase.call(this);
this.WaitImages = {};
}

CCollaborativeEditing.prototype = Object.create(AscCommon.CCollaborativeEditingBase.prototype);
CCollaborativeEditing.prototype.constructor = CCollaborativeEditing;

let CCollaborativeEditing = AscCommonExcel.CCollaborativeEditing;
//constructor in cell/model/CollaborativeEditing.js
CCollaborativeEditing.prototype.GetEditorApi = function()
{
return Asc.editor;
Expand Down Expand Up @@ -348,5 +336,4 @@
};
//--------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].CollaborativeEditing = new CCollaborativeEditing();
})(window);
2 changes: 1 addition & 1 deletion common/collaborativeHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@
{
let _oChange = oChange.Copy();

if (this.CommuteRelated(_oChange, nPosition + nCount))
if (this.CommuteRelated(oClass, _oChange, nPosition + nCount))
{
arrChanges.push(_oChange);
}
Expand Down
2 changes: 1 addition & 1 deletion configs/cell.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"cell/view/HandlerList.js",
"common/collaborativeHistory.js",
"common/CollaborativeEditingBase.js",
"cell/model/DrawingObjects/GlobalCounters.js",
"cell/model/CollaborativeEditing.js",
"cell/model/DrawingObjects/GlobalCounters.js",
"common/macros.js",
"common/apiBase.js",
"common/apiBase_plugins.js",
Expand Down

0 comments on commit 088215a

Please sign in to comment.