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
3ebed08c
Commit
3ebed08c
authored
Dec 27, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug with incorrect content of paragraph/document after collaboration undo.
parent
2cdd3350
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
0 deletions
+71
-0
word/Editor/CollaborativeEditing.js
word/Editor/CollaborativeEditing.js
+43
-0
word/Editor/History.js
word/Editor/History.js
+17
-0
word/Editor/Paragraph.js
word/Editor/Paragraph.js
+11
-0
No files found.
word/Editor/CollaborativeEditing.js
View file @
3ebed08c
...
...
@@ -734,6 +734,49 @@ CWordCollaborativeEditing.prototype.Undo = function()
this
.
m_aAllChanges
.
push
(
arrReverseChanges
[
nIndex
]);
}
// Может так случиться, что в каких-то классах DocumentContent удалились все элементы, либо
// в классе Paragraph удалился знак конца параграфа. Нам необходимо проверить все классы на корректность, и если
// нужно, добавить дополнительные изменения.
var
mapDocumentContents
=
{};
var
mapParagraphs
=
{};
for
(
var
nIndex
=
0
,
nCount
=
arrReverseChanges
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
var
oChange
=
arrReverseChanges
[
nIndex
];
var
oClass
=
oChange
.
GetClass
();
if
(
oClass
instanceof
CDocument
||
oClass
instanceof
CDocumentContent
)
mapDocumentContents
[
oClass
.
Get_Id
()]
=
oClass
;
else
if
(
oClass
instanceof
Paragraph
)
mapParagraphs
[
oClass
.
Get_Id
()]
=
oClass
;
else
if
(
oClass
instanceof
ParaRun
&&
true
===
oChange
.
IsContentChange
()
&&
oClass
.
Get_Paragraph
())
mapParagraphs
[
oClass
.
Get_Paragraph
().
Get_Id
()]
=
oClass
.
Get_Paragraph
();
}
// Создаем точку в истории. Делаем действия через обычные функции (с отключенным пересчетом), которые пишут в
// историю. Сохраняем список изменений в новой точке, удаляем данную точку.
var
oHistory
=
AscCommon
.
History
;
oHistory
.
CreateNewPointForCollectChanges
();
for
(
var
sId
in
mapDocumentContents
)
{
var
oDocumentContent
=
mapDocumentContents
[
sId
];
if
(
oDocumentContent
.
Content
.
length
<=
0
)
{
var
oNewParagraph
=
new
Paragraph
(
oLogicDocument
.
Get_DrawingDocument
(),
oDocumentContent
,
0
,
0
,
0
,
0
,
0
,
false
);
oDocumentContent
.
Add_ToContent
(
0
,
oNewParagraph
);
}
}
for
(
var
sId
in
mapParagraphs
)
{
var
oParagraph
=
mapParagraphs
[
sId
];
oParagraph
.
CheckParaEnd
();
}
var
oHistoryPoint
=
oHistory
.
Points
[
oHistory
.
Points
.
length
-
1
];
for
(
var
nIndex
=
0
,
nCount
=
oHistoryPoint
.
Items
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
arrReverseChanges
.
push
(
oHistoryPoint
.
Items
[
nIndex
].
Data
);
}
oHistory
.
Remove_LastPoint
();
var
oBinaryWriter
=
AscCommon
.
History
.
BinaryWriter
;
var
aSendingChanges
=
[];
for
(
var
nIndex
=
0
,
nCount
=
arrReverseChanges
.
length
;
nIndex
<
nCount
;
++
nIndex
)
...
...
word/Editor/History.js
View file @
3ebed08c
...
...
@@ -358,6 +358,23 @@ CHistory.prototype =
// Удаляем ненужные точки
this
.
Points
.
length
=
this
.
Index
+
1
;
},
/**
* Специальная функция, для создания точки, чтобы отловить все изменения, которые происходят. После использования
* данная точка ДОЛЖНА быть удалена через функцию Remove_LastPoint.
*/
CreateNewPointForCollectChanges
:
function
()
{
this
.
Points
[
++
this
.
Index
]
=
{
State
:
null
,
Items
:
[],
Time
:
null
,
Additional
:
{},
Description
:
-
1
};
this
.
Points
.
length
=
this
.
Index
+
1
;
},
Remove_LastPoint
:
function
()
{
...
...
word/Editor/Paragraph.js
View file @
3ebed08c
...
...
@@ -12193,6 +12193,17 @@ Paragraph.prototype.private_GetFootnoteRefsInLine = function(CurLine)
}
return
arrFootnotes
;
};
Paragraph
.
prototype
.
CheckParaEnd
=
function
()
{
// TODO (ParaEnd): Как избавимся от ParaEnd убрать эту проверку
if
(
this
.
Content
.
length
<=
0
||
para_Run
!==
this
.
Content
[
this
.
Content
.
length
-
1
].
Type
||
null
===
this
.
Content
[
this
.
Content
.
length
-
1
].
GetParaEnd
())
{
var
oEndRun
=
new
ParaRun
(
this
);
oEndRun
.
Set_Pr
(
this
.
TextPr
.
Value
.
Copy
());
oEndRun
.
Add_ToContent
(
0
,
new
ParaEnd
());
this
.
Add_ToContent
(
this
.
Content
.
length
,
oEndRun
);
}
};
var
pararecalc_0_All
=
0
;
var
pararecalc_0_None
=
1
;
...
...
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