Commit 42aa4261 authored by Ilya Kirillov's avatar Ilya Kirillov

Fixed bug #33826. Improved document correction after performing of an undo.

parent a59aab9e
...@@ -759,10 +759,11 @@ CWordCollaborativeEditing.prototype.Undo = function() ...@@ -759,10 +759,11 @@ CWordCollaborativeEditing.prototype.Undo = function()
for (var sId in mapDocumentContents) for (var sId in mapDocumentContents)
{ {
var oDocumentContent = mapDocumentContents[sId]; var oDocumentContent = mapDocumentContents[sId];
if (oDocumentContent.Content.length <= 0) var nContentLen = oDocumentContent.Content.length;
if (nContentLen <= 0 || type_Paragraph !== oDocumentContent.Content[nContentLen - 1].GetType())
{ {
var oNewParagraph = new AscCommonWord.Paragraph(oLogicDocument.Get_DrawingDocument(), oDocumentContent, 0, 0, 0, 0, 0, false); var oNewParagraph = new AscCommonWord.Paragraph(oLogicDocument.Get_DrawingDocument(), oDocumentContent, 0, 0, 0, 0, 0, false);
oDocumentContent.Add_ToContent(0, oNewParagraph); oDocumentContent.Add_ToContent(nContentLen, oNewParagraph);
} }
} }
for (var sId in mapParagraphs) for (var sId in mapParagraphs)
......
...@@ -5755,6 +5755,10 @@ ParaRun.prototype.Set_ContentPosition = function(DocPos, Depth, Flag) ...@@ -5755,6 +5755,10 @@ ParaRun.prototype.Set_ContentPosition = function(DocPos, Depth, Flag)
case 0: Pos = DocPos[Depth].Position; break; case 0: Pos = DocPos[Depth].Position; break;
} }
var nLen = this.Content.length;
if (nLen > 0 && Pos >= nLen && para_End === this.Content[nLen - 1].Type)
Pos = nLen - 1;
this.State.ContentPos = Pos; this.State.ContentPos = Pos;
}; };
ParaRun.prototype.Set_SelectionAtEndPos = function() ParaRun.prototype.Set_SelectionAtEndPos = function()
......
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