Skip to content

Commit

Permalink
annotation: avoid marking comment autosave if its not saved
Browse files Browse the repository at this point in the history
problem:
After entering the comment modify mode and clicking somewhere else,
to lose comment focus, comment cannot be closed by clicking cancel.

Signed-off-by: Pranam Lashkari <[email protected]>
Change-Id: I05ce2b4f6dcba47d40095bb16fdb56ce5b9c20cf
  • Loading branch information
lpranam authored and Rash419 committed Oct 27, 2023
1 parent c1db537 commit 2c720a6
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions browser/src/layer/tile/CommentSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -844,22 +844,15 @@ export class Comment extends CanvasSectionObject {
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
public onLostFocus (e: any): void {
if (!this.sectionProperties.isRemoved) {
if (!this.sectionProperties.nodeModifyText.value &&
!this.sectionProperties.contentText.origText)
return;
app.view.commentAutoSave = this;
if (this.sectionProperties.contentText.origText !== this.sectionProperties.nodeModifyText.value) {
app.view.commentAutoSave = this;
this.onSaveComment(e);
}
else {
if (!this.containerObject.testing) // eslint-disable-line no-lonely-if
this.onCancelClick(e);
else {
var insertButton = document.getElementById('menu-insertcomment');
if (insertButton) {
if (window.getComputedStyle(insertButton).display === 'none') {
this.onCancelClick(e);
}
else if (this.containerObject.testing) {
var insertButton = document.getElementById('menu-insertcomment');
if (insertButton) {
if (window.getComputedStyle(insertButton).display === 'none') {
this.onCancelClick(e);
}
}
}
Expand Down

0 comments on commit 2c720a6

Please sign in to comment.