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
dd4a173c
Commit
dd4a173c
authored
Dec 15, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed problem with positions of cursor/select after a new undo.
parent
addf2669
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
74 deletions
+94
-74
common/CollaborativeEditingBase.js
common/CollaborativeEditingBase.js
+73
-66
word/Editor/CollaborativeEditing.js
word/Editor/CollaborativeEditing.js
+12
-7
word/Editor/Paragraph.js
word/Editor/Paragraph.js
+9
-1
No files found.
common/CollaborativeEditingBase.js
View file @
dd4a173c
...
...
@@ -341,78 +341,14 @@ CCollaborativeEditingBase.prototype.Apply_Changes = function()
editor
.
sync_StartAction
(
Asc
.
c_oAscAsyncActionType
.
BlockInteraction
,
Asc
.
c_oAscAsyncAction
.
ApplyChanges
);
var
LogicDocument
=
editor
.
WordControl
.
m_oLogicDocument
;
var
DocState
;
if
(
true
!==
this
.
Is_Fast
())
{
DocState
=
LogicDocument
.
Get_SelectionState2
();
this
.
m_aCursorsToUpdate
=
{};
}
else
{
DocState
=
LogicDocument
.
Save_DocumentStateBeforeLoadChanges
();
this
.
Clear_DocumentPositions
();
if
(
DocState
.
Pos
)
this
.
Add_DocumentPosition
(
DocState
.
Pos
);
if
(
DocState
.
StartPos
)
this
.
Add_DocumentPosition
(
DocState
.
StartPos
);
if
(
DocState
.
EndPos
)
this
.
Add_DocumentPosition
(
DocState
.
EndPos
);
if
(
DocState
.
FootnotesStart
&&
DocState
.
FootnotesStart
.
Pos
)
this
.
Add_DocumentPosition
(
DocState
.
FootnotesStart
.
Pos
);
if
(
DocState
.
FootnotesStart
&&
DocState
.
FootnotesStart
.
StartPos
)
this
.
Add_DocumentPosition
(
DocState
.
FootnotesStart
.
StartPos
);
if
(
DocState
.
FootnotesStart
&&
DocState
.
FootnotesStart
.
EndPos
)
this
.
Add_DocumentPosition
(
DocState
.
FootnotesStart
.
EndPos
);
if
(
DocState
.
FootnotesEnd
&&
DocState
.
FootnotesEnd
.
Pos
)
this
.
Add_DocumentPosition
(
DocState
.
FootnotesEnd
.
Pos
);
if
(
DocState
.
FootnotesEnd
&&
DocState
.
FootnotesEnd
.
StartPos
)
this
.
Add_DocumentPosition
(
DocState
.
FootnotesEnd
.
StartPos
);
if
(
DocState
.
FootnotesEnd
&&
DocState
.
FootnotesEnd
.
EndPos
)
this
.
Add_DocumentPosition
(
DocState
.
FootnotesEnd
.
EndPos
);
}
var
DocState
=
this
.
private_SaveDocumentState
();
this
.
Clear_NewImages
();
this
.
Apply_OtherChanges
();
// После того как мы приняли чужие изменения, мы должны залочить новые объекты, которые были залочены
this
.
Lock_NeedLock
();
if
(
true
!==
this
.
Is_Fast
())
{
LogicDocument
.
Set_SelectionState2
(
DocState
);
}
else
{
if
(
DocState
.
Pos
)
this
.
Update_DocumentPosition
(
DocState
.
Pos
);
if
(
DocState
.
StartPos
)
this
.
Update_DocumentPosition
(
DocState
.
StartPos
);
if
(
DocState
.
EndPos
)
this
.
Update_DocumentPosition
(
DocState
.
EndPos
);
if
(
DocState
.
FootnotesStart
&&
DocState
.
FootnotesStart
.
Pos
)
this
.
Update_DocumentPosition
(
DocState
.
FootnotesStart
.
Pos
);
if
(
DocState
.
FootnotesStart
&&
DocState
.
FootnotesStart
.
StartPos
)
this
.
Update_DocumentPosition
(
DocState
.
FootnotesStart
.
StartPos
);
if
(
DocState
.
FootnotesStart
&&
DocState
.
FootnotesStart
.
EndPos
)
this
.
Update_DocumentPosition
(
DocState
.
FootnotesStart
.
EndPos
);
if
(
DocState
.
FootnotesEnd
&&
DocState
.
FootnotesEnd
.
Pos
)
this
.
Update_DocumentPosition
(
DocState
.
FootnotesEnd
.
Pos
);
if
(
DocState
.
FootnotesEnd
&&
DocState
.
FootnotesEnd
.
StartPos
)
this
.
Update_DocumentPosition
(
DocState
.
FootnotesEnd
.
StartPos
);
if
(
DocState
.
FootnotesEnd
&&
DocState
.
FootnotesEnd
.
EndPos
)
this
.
Update_DocumentPosition
(
DocState
.
FootnotesEnd
.
EndPos
);
LogicDocument
.
Load_DocumentStateAfterLoadChanges
(
DocState
);
this
.
Refresh_ForeignCursors
();
}
this
.
private_RestoreDocumentState
(
DocState
);
this
.
OnStart_Load_Objects
();
}
};
...
...
@@ -749,6 +685,77 @@ CCollaborativeEditingBase.prototype.InitMemory = function() {
this
.
m_oMemory
=
new
AscCommon
.
CMemory
();
}
};
CCollaborativeEditingBase
.
prototype
.
private_SaveDocumentState
=
function
()
{
var
LogicDocument
=
editor
.
WordControl
.
m_oLogicDocument
;
var
DocState
;
if
(
true
!==
this
.
Is_Fast
())
{
DocState
=
LogicDocument
.
Get_SelectionState2
();
this
.
m_aCursorsToUpdate
=
{};
}
else
{
DocState
=
LogicDocument
.
Save_DocumentStateBeforeLoadChanges
();
this
.
Clear_DocumentPositions
();
if
(
DocState
.
Pos
)
this
.
Add_DocumentPosition
(
DocState
.
Pos
);
if
(
DocState
.
StartPos
)
this
.
Add_DocumentPosition
(
DocState
.
StartPos
);
if
(
DocState
.
EndPos
)
this
.
Add_DocumentPosition
(
DocState
.
EndPos
);
if
(
DocState
.
FootnotesStart
&&
DocState
.
FootnotesStart
.
Pos
)
this
.
Add_DocumentPosition
(
DocState
.
FootnotesStart
.
Pos
);
if
(
DocState
.
FootnotesStart
&&
DocState
.
FootnotesStart
.
StartPos
)
this
.
Add_DocumentPosition
(
DocState
.
FootnotesStart
.
StartPos
);
if
(
DocState
.
FootnotesStart
&&
DocState
.
FootnotesStart
.
EndPos
)
this
.
Add_DocumentPosition
(
DocState
.
FootnotesStart
.
EndPos
);
if
(
DocState
.
FootnotesEnd
&&
DocState
.
FootnotesEnd
.
Pos
)
this
.
Add_DocumentPosition
(
DocState
.
FootnotesEnd
.
Pos
);
if
(
DocState
.
FootnotesEnd
&&
DocState
.
FootnotesEnd
.
StartPos
)
this
.
Add_DocumentPosition
(
DocState
.
FootnotesEnd
.
StartPos
);
if
(
DocState
.
FootnotesEnd
&&
DocState
.
FootnotesEnd
.
EndPos
)
this
.
Add_DocumentPosition
(
DocState
.
FootnotesEnd
.
EndPos
);
}
return
DocState
;
};
CCollaborativeEditingBase
.
prototype
.
private_RestoreDocumentState
=
function
(
DocState
)
{
var
LogicDocument
=
editor
.
WordControl
.
m_oLogicDocument
;
if
(
true
!==
this
.
Is_Fast
())
{
LogicDocument
.
Set_SelectionState2
(
DocState
);
}
else
{
if
(
DocState
.
Pos
)
this
.
Update_DocumentPosition
(
DocState
.
Pos
);
if
(
DocState
.
StartPos
)
this
.
Update_DocumentPosition
(
DocState
.
StartPos
);
if
(
DocState
.
EndPos
)
this
.
Update_DocumentPosition
(
DocState
.
EndPos
);
if
(
DocState
.
FootnotesStart
&&
DocState
.
FootnotesStart
.
Pos
)
this
.
Update_DocumentPosition
(
DocState
.
FootnotesStart
.
Pos
);
if
(
DocState
.
FootnotesStart
&&
DocState
.
FootnotesStart
.
StartPos
)
this
.
Update_DocumentPosition
(
DocState
.
FootnotesStart
.
StartPos
);
if
(
DocState
.
FootnotesStart
&&
DocState
.
FootnotesStart
.
EndPos
)
this
.
Update_DocumentPosition
(
DocState
.
FootnotesStart
.
EndPos
);
if
(
DocState
.
FootnotesEnd
&&
DocState
.
FootnotesEnd
.
Pos
)
this
.
Update_DocumentPosition
(
DocState
.
FootnotesEnd
.
Pos
);
if
(
DocState
.
FootnotesEnd
&&
DocState
.
FootnotesEnd
.
StartPos
)
this
.
Update_DocumentPosition
(
DocState
.
FootnotesEnd
.
StartPos
);
if
(
DocState
.
FootnotesEnd
&&
DocState
.
FootnotesEnd
.
EndPos
)
this
.
Update_DocumentPosition
(
DocState
.
FootnotesEnd
.
EndPos
);
LogicDocument
.
Load_DocumentStateAfterLoadChanges
(
DocState
);
this
.
Refresh_ForeignCursors
();
}
};
//----------------------------------------------------------------------------------------------------------------------
// Private area
//----------------------------------------------------------------------------------------------------------------------
...
...
word/Editor/CollaborativeEditing.js
View file @
dd4a173c
...
...
@@ -726,19 +726,14 @@ CWordCollaborativeEditing.prototype.Undo = function()
oLogicDocument
.
DrawingDocument
.
EndTrackTable
(
null
,
true
);
oLogicDocument
.
DrawingObjects
.
TurnOffCheckChartSelection
();
var
DocState
=
this
.
private_SaveDocumentState
();
for
(
var
nIndex
=
0
,
nCount
=
arrReverseChanges
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
arrReverseChanges
[
nIndex
].
Load
();
this
.
m_aAllChanges
.
push
(
arrReverseChanges
[
nIndex
]);
}
oLogicDocument
.
DrawingObjects
.
TurnOnCheckChartSelection
();
oLogicDocument
.
Recalculate
(
false
,
false
,
AscCommon
.
History
.
Get_RecalcData
(
null
,
arrReverseChanges
));
oLogicDocument
.
Document_UpdateSelectionState
();
oLogicDocument
.
Document_UpdateInterfaceState
();
oLogicDocument
.
Document_UpdateRulersState
();
var
oBinaryWriter
=
History
.
BinaryWriter
;
var
aSendingChanges
=
[];
for
(
var
nIndex
=
0
,
nCount
=
arrReverseChanges
.
length
;
nIndex
<
nCount
;
++
nIndex
)
...
...
@@ -758,6 +753,16 @@ CWordCollaborativeEditing.prototype.Undo = function()
aSendingChanges
.
push
(
oChange
.
m_pData
);
}
editor
.
CoAuthoringApi
.
saveChanges
(
aSendingChanges
,
0
,
null
);
this
.
private_RestoreDocumentState
(
DocState
);
oLogicDocument
.
DrawingObjects
.
TurnOnCheckChartSelection
();
oLogicDocument
.
Recalculate
(
false
,
false
,
AscCommon
.
History
.
Get_RecalcData
(
null
,
arrReverseChanges
));
oLogicDocument
.
Document_UpdateSelectionState
();
oLogicDocument
.
Document_UpdateInterfaceState
();
oLogicDocument
.
Document_UpdateRulersState
();
};
CWordCollaborativeEditing
.
prototype
.
CanUndo
=
function
()
{
...
...
word/Editor/Paragraph.js
View file @
dd4a173c
...
...
@@ -11826,6 +11826,14 @@ Paragraph.prototype.Set_ContentPosition = function(DocPos, Depth, Flag)
}
}
// TODO: Как только разберемся с ParaEnd, исправить здесь.
if
(
Pos
===
this
.
Content
.
length
-
1
&&
this
.
Content
.
length
>
1
)
{
Pos
=
this
.
Content
.
length
-
2
;
_Flag
=
-
1
;
_DocPos
=
null
;
}
this
.
CurPos
.
ContentPos
=
Pos
;
if
(
this
.
Content
[
Pos
]
&&
this
.
Content
[
Pos
].
Set_ContentPosition
)
this
.
Content
[
Pos
].
Set_ContentPosition
(
_DocPos
,
Depth
+
1
,
_Flag
);
...
...
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