From d3d5bdf26973e0648c62ced2ed60e740a034188a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6kay=20=C5=9Eat=C4=B1r?= Date: Mon, 16 Oct 2023 19:28:36 +0300 Subject: [PATCH] Hide the newly added comment. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also add a check for failed attempts of new comments. Signed-off-by: Gökay Şatır Change-Id: I50a9981cf51475d6008e936e6e28573156a8383a --- browser/src/layer/tile/CalcTileLayer.js | 4 ++++ browser/src/layer/tile/CommentListSection.ts | 2 ++ 2 files changed, 6 insertions(+) diff --git a/browser/src/layer/tile/CalcTileLayer.js b/browser/src/layer/tile/CalcTileLayer.js index b53b179d0..ccf27ca66 100644 --- a/browser/src/layer/tile/CalcTileLayer.js +++ b/browser/src/layer/tile/CalcTileLayer.js @@ -39,6 +39,10 @@ L.CalcTileLayer = L.CanvasTileLayer.extend({ dateTime: new Date().toDateString(), author: this._map.getViewName(this._viewId) }; + + if (app.sectionContainer.doesSectionExist(newComment.name)) // If adding a new comment has failed, we need to remove the leftover. + app.sectionContainer.removeSection(newComment.name); + comment = app.sectionContainer.getSectionWithName(L.CSections.CommentList.name).add(newComment); comment.show(); } diff --git a/browser/src/layer/tile/CommentListSection.ts b/browser/src/layer/tile/CommentListSection.ts index 348f4a4a8..15efbfdee 100644 --- a/browser/src/layer/tile/CommentListSection.ts +++ b/browser/src/layer/tile/CommentListSection.ts @@ -1140,6 +1140,8 @@ export class CommentSection extends CanvasSectionObject { this.adjustComment(obj.comment); annotation = this.add(obj.comment); this.adjustParentAdd(annotation); + if (this.sectionProperties.docLayer._docType === 'spreadsheet') + annotation.hide(); } if (this.sectionProperties.selectedComment && !this.sectionProperties.selectedComment.isEdit()) { this.map.focus();