Commit 17f3d4e2 authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented save/restore selection state in footnotes for undo/redo.

parent 94675b97
...@@ -384,6 +384,19 @@ CCollaborativeEditingBase.prototype.Apply_Changes = function() ...@@ -384,6 +384,19 @@ CCollaborativeEditingBase.prototype.Apply_Changes = function()
this.Add_DocumentPosition(DocState.StartPos); this.Add_DocumentPosition(DocState.StartPos);
if (DocState.EndPos) if (DocState.EndPos)
this.Add_DocumentPosition(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);
} }
this.Clear_NewImages(); this.Clear_NewImages();
...@@ -406,6 +419,20 @@ CCollaborativeEditingBase.prototype.Apply_Changes = function() ...@@ -406,6 +419,20 @@ CCollaborativeEditingBase.prototype.Apply_Changes = function()
if (DocState.EndPos) if (DocState.EndPos)
this.Update_DocumentPosition(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); LogicDocument.Load_DocumentStateAfterLoadChanges(DocState);
this.Refresh_ForeignCursors(); this.Refresh_ForeignCursors();
} }
......
...@@ -2198,12 +2198,46 @@ CFootnotesController.prototype.UpdateSelectionState = function() ...@@ -2198,12 +2198,46 @@ CFootnotesController.prototype.UpdateSelectionState = function()
}; };
CFootnotesController.prototype.GetSelectionState = function() CFootnotesController.prototype.GetSelectionState = function()
{ {
// TODO: Реализовать var arrResult = [];
return [];
var oState = {
Footnotes : {},
Use : this.Selection.Use,
Start : this.Selection.Start.Footnote,
End : this.Selection.End.Footnote,
Direction : this.Selection.Direction,
CurFootnote : this.CurFootnote
};
for (var sId in this.Selection.Footnotes)
{
var oFootnote = this.Selection.Footnotes[sId];
oState.Footnotes[sId] =
{
Footnote : oFootnote,
State : oFootnote.Get_SelectionState()
};
}
arrResult.push(oState);
return arrResult;
}; };
CFootnotesController.prototype.SetSelectionState = function(State, StateIndex) CFootnotesController.prototype.SetSelectionState = function(State, StateIndex)
{ {
// TODO: Реализовать var oState = State[StateIndex];
this.Selection.Use = oState.Use;
this.Selection.Start.Footnote = oState.Start;
this.Selection.End.Footnote = oState.End;
this.Selection.Direction = oState.Direction;
this.CurFootnote = oState.CurFootnote;
this.Selection.Footnotes = {};
for (var sId in oState.Footnotes)
{
this.Selection.Footnotes[sId] = oState.Footnotes[sId].Footnote;
this.Selection.Footnotes[sId].Set_SelectionState(oState.Footnotes[sId].State, oState.Footnotes[sId].State.length - 1);
}
}; };
CFootnotesController.prototype.AddHyperlink = function(Props) CFootnotesController.prototype.AddHyperlink = function(Props)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment