Skip to content

Commit

Permalink
[de] Remove all permission range marks when copying selected content
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillovIlya committed Nov 21, 2024
1 parent e62f642 commit 6495312
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
12 changes: 12 additions & 0 deletions word/Editor/Paragraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,18 @@ Paragraph.prototype.GetAllParaMaths = function(arrParaMaths)

return arrParaMaths;
};
Paragraph.prototype.GetAllPermRangeMarks = function(marks)
{
if (!marks)
marks = [];

for (let i = 0, count = this.Content.length; i < count; ++i)
{
this.Content[i].GetAllPermRangeMarks(marks);
}

return marks;
};

Paragraph.prototype.GetAllSeqFieldsByType = function(sType, aFields)
{
Expand Down
17 changes: 17 additions & 0 deletions word/Editor/ParagraphContentBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,11 @@ CParagraphContentBase.prototype.createDuplicateForSmartArt = function(oPr)
*/
CParagraphContentBase.prototype.CalculateTextToTable = function(oEngine){};

CParagraphContentBase.prototype.GetAllPermRangeMarks = function(marks)
{
return [];
};

/**
* Это базовый класс для элементов содержимого(контент) параграфа, у которых есть свое содержимое.
* @constructor
Expand Down Expand Up @@ -2409,6 +2414,18 @@ CParagraphContentWithParagraphLikeContent.prototype.Get_Text = function(Text)
this.Content[CurPos].Get_Text( Text );
}
};
CParagraphContentWithParagraphLikeContent.prototype.GetAllPermRangeMarks = function(marks)
{
if (!marks)
marks = [];

for (let i = 0, count = this.Content.length; i < count; ++i)
{
this.Content[i].GetAllPermRangeMarks(marks);
}

return marks;
};
CParagraphContentWithParagraphLikeContent.prototype.GetAllParagraphs = function(Props, ParaArray)
{
var ContentLen = this.Content.length;
Expand Down
15 changes: 15 additions & 0 deletions word/Editor/SelectedContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
this.Comments = [];
this.CommentsMarks = {};
this.Maths = [];
this.PermRangeMarks = [];

this.LogicDocument = null;

Expand Down Expand Up @@ -91,6 +92,7 @@
this.DrawingObjects = [];
this.Comments = [];
this.Maths = [];
this.PermRangeMarks = [];


this.MoveDrawing = false;
Expand All @@ -104,6 +106,7 @@
this.private_CollectObjects();
this.private_CheckComments(oLogicDocument);
this.private_CheckTrackMove(oLogicDocument);
this.private_CheckPermRangeMarks(oLogicDocument);
};
CSelectedContent.prototype.SetNewCommentsGuid = function(isNew)
{
Expand Down Expand Up @@ -534,6 +537,7 @@
oParagraph.GetAllDrawingObjects(this.DrawingObjects);
oParagraph.GetAllComments(this.Comments);
oParagraph.GetAllMaths(this.Maths);
oParagraph.GetAllPermRangeMarks(this.PermRangeMarks);
}

if (oElement.IsParagraph() && nCount > 1)
Expand Down Expand Up @@ -678,6 +682,17 @@
oLogicDocument.TrackMoveId = null;
}
};
CSelectedContent.prototype.private_CheckPermRangeMarks = function(logicDocument)
{
// TODO: Пока мы удаляем все метки. В будущем надо сделать, что если скопированы начало и конец, то мы
// приписываем им новый id диапазона, а если скопировано только начала или конец, то удаляем такие метки

for (let markIndex = 0, markCount = this.PermRangeMarks.length; markIndex < markCount; ++markIndex)
{
let mark = this.PermRangeMarks[markIndex];
mark.removeMark();
}
};
CSelectedContent.prototype.private_CreateNewCommentsGuid = function()
{
let oManager = this.LogicDocument.GetCommentsManager();
Expand Down
4 changes: 4 additions & 0 deletions word/Editor/annotations/paragraph-perm.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
CParagraphContentBase.prototype.SetParagraph.call(this, p);
AscWord.registerPermRangeMark(this);
};
ParagraphPermBase.prototype.GetAllPermRangeMarks = function(marks)
{
marks.push(this);
};
ParagraphPermBase.prototype.isPermMark = function()
{
return true;
Expand Down

0 comments on commit 6495312

Please sign in to comment.