Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
5f3b1e41
Commit
5f3b1e41
authored
Mar 03, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworked algorithm of Undo in fast collaboration mode. Fixed bug #33883. Fixed bug #33884.
parent
3a65ee43
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
66 deletions
+65
-66
common/CollaborativeEditingBase.js
common/CollaborativeEditingBase.js
+53
-66
common/HistoryCommon.js
common/HistoryCommon.js
+12
-0
No files found.
common/CollaborativeEditingBase.js
View file @
5f3b1e41
...
...
@@ -884,11 +884,6 @@ CCollaborativeEditingBase.prototype.private_RestoreDocumentState = function(DocS
var
oIndexes
=
this
.
m_aOwnChangesIndexes
[
this
.
m_aOwnChangesIndexes
.
length
-
1
];
var
nPosition
=
oIndexes
.
Position
;
var
nCount
=
oIndexes
.
Count
;
var
nOverallCount
=
this
.
m_aAllChanges
.
length
;
var
oContentChangesMap
=
{
};
for
(
var
nIndex
=
nCount
-
1
;
nIndex
>=
0
;
--
nIndex
)
{
...
...
@@ -901,8 +896,10 @@ CCollaborativeEditingBase.prototype.private_RestoreDocumentState = function(DocS
{
var
_oChange
=
oChange
.
Copy
();
if
(
this
.
private_CommutateContentChanges
(
oContentChangesMap
,
oClass
,
_oChange
,
nPosition
+
nCount
))
if
(
this
.
private_CommutateContentChanges
(
_oChange
,
nPosition
+
nCount
))
arrChanges
.
push
(
_oChange
);
oChange
.
SetReverted
(
true
);
}
else
{
...
...
@@ -921,7 +918,10 @@ CCollaborativeEditingBase.prototype.private_RestoreDocumentState = function(DocS
{
var
oReverseChange
=
arrChanges
[
nIndex
].
CreateReverseChange
();
if
(
oReverseChange
)
{
arrReverseChanges
.
push
(
oReverseChange
);
oReverseChange
.
SetReverted
(
true
);
}
}
// Накатываем изменения в данном клиенте
...
...
@@ -1096,56 +1096,43 @@ CCollaborativeEditingBase.prototype.private_RestoreDocumentState = function(DocS
{
return
this
.
m_aOwnChangesIndexes
.
length
<=
0
?
false
:
true
;
};
CCollaborativeEditingBase
.
prototype
.
private_CommutateContentChanges
=
function
(
o
Map
,
oClass
,
o
Change
,
nStartPosition
)
CCollaborativeEditingBase
.
prototype
.
private_CommutateContentChanges
=
function
(
oChange
,
nStartPosition
)
{
var
arrOtherActions
=
[];
var
arrActions
=
oChange
.
ConvertToSimpleActions
();
var
arrCommutateActions
=
[];
if
(
oMap
[
oClass
.
Get_Id
()])
{
arrOtherActions
=
oMap
[
oClass
.
Get_Id
()];
}
else
for
(
var
nActionIndex
=
arrActions
.
length
-
1
;
nActionIndex
>=
0
;
--
nActionIndex
)
{
var
oAction
=
arrActions
[
nActionIndex
];
var
oResult
=
oAction
;
for
(
var
nIndex
=
nStartPosition
,
nOverallCount
=
this
.
m_aAllChanges
.
length
;
nIndex
<
nOverallCount
;
++
nIndex
)
{
var
oTempChange
=
this
.
m_aAllChanges
[
nIndex
];
if
(
!
oTempChange
)
continue
;
if
(
oChange
.
IsRelated
(
oTempChange
))
{
arrOtherActions
.
push
(
oTempChange
.
ConvertToSimpleActions
());
}
}
oMap
[
oClass
.
Get_Id
()]
=
arrOtherActions
;
}
var
arrActions
=
oChange
.
ConvertToSimpleActions
();
var
arrCommutateActions
=
[];
for
(
var
nActionIndex
=
arrActions
.
length
-
1
;
nActionIndex
>=
0
;
--
nActionIndex
)
{
var
oAction
=
arrActions
[
nActionIndex
];
var
oResult
=
oAction
;
for
(
var
nIndex
=
0
,
nOtherActionsCount
=
arrOtherActions
.
length
;
nIndex
<
nOtherActionsCount
;
++
nIndex
)
if
(
oChange
.
IsRelated
(
oTempChange
)
&&
true
!==
oTempChange
.
IsReverted
())
{
var
arrOActions
=
arrOtherActions
[
nIndex
]
;
for
(
var
nIndex2
=
0
,
nOtherActionsCount2
=
arrO
Actions
.
length
;
nIndex2
<
nOtherActionsCount2
;
++
nIndex2
)
var
arrOtherActions
=
oTempChange
.
ConvertToSimpleActions
()
;
for
(
var
nIndex2
=
0
,
nOtherActionsCount2
=
arrOther
Actions
.
length
;
nIndex2
<
nOtherActionsCount2
;
++
nIndex2
)
{
var
oOtherAction
=
arrO
Actions
[
nIndex2
];
var
oOtherAction
=
arrOther
Actions
[
nIndex2
];
if
(
false
===
this
.
private_Commutate
(
oAction
,
oOtherAction
))
{
arrO
Actions
.
splice
(
nIndex2
,
1
);
arrOther
Actions
.
splice
(
nIndex2
,
1
);
oResult
=
null
;
break
;
}
}
if
(
null
===
oResult
)
oTempChange
.
ConvertFromSimpleActions
(
arrOtherActions
);
}
if
(
!
oResult
)
break
;
}
if
(
null
!==
oResult
)
...
...
common/HistoryCommon.js
View file @
5f3b1e41
...
...
@@ -2898,6 +2898,8 @@
function
CChangesBase
(
Class
)
{
this
.
Class
=
Class
;
this
.
Reverted
=
false
;
}
CChangesBase
.
prototype
.
Type
=
window
[
'
AscDFH
'
].
historyitem_Unknown_Unknown
;
CChangesBase
.
prototype
.
Undo
=
function
()
...
...
@@ -2949,6 +2951,14 @@
{
return
false
;
};
CChangesBase
.
prototype
.
IsReverted
=
function
()
{
return
this
.
Reverted
;
};
CChangesBase
.
prototype
.
SetReverted
=
function
(
isReverted
)
{
this
.
Reverted
=
isReverted
;
};
window
[
'
AscDFH
'
].
CChangesBase
=
CChangesBase
;
/**
* Базовый класс для изменений, которые меняют содержимое родительского класса.*
...
...
@@ -2964,6 +2974,8 @@
this
.
UseArray
=
false
;
this
.
PosArray
=
[];
this
.
Add
=
isAdd
;
this
.
Reverted
=
false
;
}
AscCommon
.
extendClass
(
CChangesBaseContentChange
,
CChangesBase
);
CChangesBaseContentChange
.
prototype
.
IsContentChange
=
function
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment