Trigger auto save of patchset level comment when reply dialog closes

When user types some text and then presses Cancel then the changes
should be saved, however GrComment is not able to trigger auto
save within that time and the comment ends up not being cleared.

Release-Notes: skip
Google-bug-id: b/245519439
Change-Id: Icaa73737fa96689a913357d86242600587f97d8c
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
index b786f21..37db6d9 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
@@ -1974,7 +1974,7 @@
     this.cancel();
   }
 
-  cancel() {
+  async cancel() {
     assertIsDefined(this.change, 'change');
     if (!this.change?.owner) throw new Error('missing required owner property');
     this.dispatchEvent(
@@ -1983,7 +1983,19 @@
         bubbles: false,
       })
     );
-    queryAndAssert<GrTextarea>(this, 'gr-textarea').closeDropdown();
+    if (
+      this.flagsService.isEnabled(
+        KnownExperimentId.PATCHSET_LEVEL_COMMENT_USES_GRCOMMENT
+      )
+    ) {
+      const patchsetLevelComment = queryAndAssert<GrComment>(
+        this,
+        '#patchsetLevelComment'
+      );
+      await patchsetLevelComment.save();
+    } else {
+      queryAndAssert<GrTextarea>(this, 'gr-textarea').closeDropdown();
+    }
     this.rebuildReviewerArrays();
   }