From e2b01b5a79b138c5047fd18a64071092ca1d6798 Mon Sep 17 00:00:00 2001
From: Nathan Bockisch <nbockisc@nrao.edu>
Date: Fri, 16 Jun 2023 11:24:10 -0600
Subject: [PATCH] WS-1813: Add save and save and close buttons to editor

---
 .../src/app/workspaces/components/editor/editor.component.html | 3 ++-
 .../src/app/workspaces/components/editor/editor.component.ts   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/apps/web/src/app/workspaces/components/editor/editor.component.html b/apps/web/src/app/workspaces/components/editor/editor.component.html
index b2598b405..7632636af 100644
--- a/apps/web/src/app/workspaces/components/editor/editor.component.html
+++ b/apps/web/src/app/workspaces/components/editor/editor.component.html
@@ -31,6 +31,7 @@
     <div class="modal-footer">
         <button type="button" class="btn btn-outline-secondary mr-auto" (click)="undoEditChanges()">Revert Changes</button>
         <button type="button" class="btn btn-secondary" (click)="modal.close('exit')">Cancel</button>
-        <button type="button" class="btn btn-primary" mdbBtn (click)="modal.close('save')">Save</button>
+        <button type="button" class="btn btn-primary" mdbBtn (click)="this.newEditEvent.emit(this.editedData)">Save</button>
+        <button type="button" class="btn btn-primary" mdbBtn (click)="modal.close('save-and-close')">Save and Close</button>
     </div>
 </ng-template>
diff --git a/apps/web/src/app/workspaces/components/editor/editor.component.ts b/apps/web/src/app/workspaces/components/editor/editor.component.ts
index 93c884195..83209fe82 100644
--- a/apps/web/src/app/workspaces/components/editor/editor.component.ts
+++ b/apps/web/src/app/workspaces/components/editor/editor.component.ts
@@ -51,7 +51,7 @@ export class EditorComponent implements OnInit {
     this.toggleEditorOpen()
     this.modalService.open(content, { ariaLabelledBy: "modal-title", centered: true, size: "lg" }).result.then(
       (result) => {
-        if (result === "save" && this.editedData) {
+        if (result === "save-and-close" && this.editedData) {
           // "Save" button clicked; emit edited data to parent component
           this.newEditEvent.emit(this.editedData)
           this.toggleEditorOpen()
-- 
GitLab