Skip to content

Commit

Permalink
[pdf] Fixed adding comment to annot via context menu. Fixes for saving.
Browse files Browse the repository at this point in the history
  • Loading branch information
KhromovNikita committed Oct 11, 2023
1 parent 0e9e6f3 commit 1c8c90d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pdf/src/annotations/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,8 @@
if (oDoc.History.UndoRedoInProgress == false && oViewer.IsOpenAnnotsInProgress == false) {
oDoc.History.Add(new CChangesPDFAnnotReplies(this, this._replies, aReplies));
}
this.SetWasChanged(true);

this._replies = aReplies;
};
CAnnotationBase.prototype.GetReply = function(nPos) {
Expand Down
9 changes: 8 additions & 1 deletion pdf/src/annotations/freeText.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*/
function CAnnotationFreeText(sName, nPage, aRect, oDoc)
{
AscPDF.CAnnotationBase.call(this, sName, AscPDF.ANNOTATIONS_TYPES.Line, nPage, aRect, oDoc);
AscPDF.CAnnotationBase.call(this, sName, AscPDF.ANNOTATIONS_TYPES.FreeText, nPage, aRect, oDoc);

this._popupOpen = false;
this._popupRect = undefined;
Expand Down Expand Up @@ -148,11 +148,16 @@
}
};
CAnnotationFreeText.prototype.AddReply = function(oReply) {
let oDoc = this.GetDocument();
oDoc.CreateNewHistoryPoint();

oReply.SetReplyTo(this);

let aNewReplies = [].concat(this._replies);
aNewReplies.push(oReply);
this.SetReplies(aNewReplies);

oDoc.TurnOffHistory();
};
CAnnotationFreeText.prototype.RemoveComment = function() {
let oDoc = this.GetDocument();
Expand Down Expand Up @@ -189,6 +194,8 @@
this._OnAfterSetReply();
else
editor.sync_RemoveComment(this.GetId());

this.SetWasChanged(true);
};
CAnnotationFreeText.prototype.GetAscCommentData = function() {
let oAscCommData = new Asc["asc_CCommentDataWord"](null);
Expand Down
5 changes: 3 additions & 2 deletions pdf/src/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -1646,11 +1646,12 @@ var CPresentation = CPresentation || function(){};
this.anchorPositionToAdd = null;

let oAnnot;
if (this.mouseDownAnnot && this.mouseDownAnnot.IsComment() == false) {
if (this.mouseDownAnnot) {
oAnnot = CreateAnnotByProps(oProps, this);
oAnnot.SetApIdx(this.GetMaxApIdx() + 2);

if (this.mouseDownAnnot.GetReply()) {
if ((this.mouseDownAnnot.GetContents() && this.mouseDownAnnot.GetType() != AscPDF.ANNOTATIONS_TYPES.FreeText) ||
this.mouseDownAnnot.GetReply(0) != null) {
let newCommentData = new AscCommon.CCommentData();
newCommentData.Read_FromAscCommentData(AscCommentData);

Expand Down

0 comments on commit 1c8c90d

Please sign in to comment.