diff --git a/pdf/api.js b/pdf/api.js index 8357f99584..05d9dc2cc0 100644 --- a/pdf/api.js +++ b/pdf/api.js @@ -2121,6 +2121,16 @@ } Lock.Set_Type(NewType, true); + + if (NewType == AscCommon.c_oAscLockTypes.kLockTypeNone) { + Class.AddToRedraw && Class.AddToRedraw(); + if (Class.IsAnnot && Class.IsAnnot()) { + // if annot is comment or annot with comment then release locks for it too + if (Class.IsComment() || (Class.IsUseContentAsComment() && Class.GetContents() != undefined) || Class.GetReply(0) != null) { + Asc.editor.sync_UnLockComment(Class.Get_Id()); + } + } + } } diff --git a/pdf/src/document.js b/pdf/src/document.js index 6d1edde57d..f462899feb 100644 --- a/pdf/src/document.js +++ b/pdf/src/document.js @@ -3099,7 +3099,7 @@ var CPresentation = CPresentation || function(){}; else { oAnnot.RemoveComment(); } - }, AscDFH.historydescription_Pdf_RemoveComment, this); + }, AscDFH.historydescription_Pdf_RemoveComment, this, Id); }; CPDFDoc.prototype.RemoveAnnot = function(Id) { let oController = this.GetController(); @@ -6091,28 +6091,17 @@ var CPresentation = CPresentation || function(){}; break; } case AscCommon.changestype_2_Comment: { - let sCommentId = AdditionalData; + let oTargetAnnot = this.GetAnnotById(AdditionalData); - let selected_objects = oController.selectedObjects.slice(); - if (oController.selection.groupSelection) { - selected_objects.push(oController.selection.groupSelection); - } - if (this.mouseDownAnnot) { - selected_objects.push(this.mouseDownAnnot); - } + if (oTargetAnnot) { + let check_obj = { + "type": AscLockTypeElemPDF.Object, + "pageId": oCurPageInfo.GetId(), + "objId": oTargetAnnot.GetId(), + "guid": oTargetAnnot.GetId() + }; - for (let i = 0; i < selected_objects.length; ++i) { - if (selected_objects[i].GetId() == sCommentId) { - let check_obj = { - "type": AscLockTypeElemPDF.Object, - "pageId": oCurPageInfo.GetId(), - "objId": selected_objects[i].GetId(), - "guid": selected_objects[i].GetId() - }; - - selected_objects[i].Lock.Check(check_obj); - break; - } + oTargetAnnot.Lock.Check(check_obj); } break;