From 9904021744b4d7bb15b7b83bf44efca732840d6c Mon Sep 17 00:00:00 2001 From: mfish33 <32677537+mfish33@users.noreply.github.com> Date: Sat, 4 Dec 2021 16:49:52 -0800 Subject: [PATCH] Confirm when the browser window is closed and there is unsaved work (#397) * - browser confirmation on page exit - prompt to save a document when closed will only trigger when unsaved * add back select document for close prompt * - name -> displayname - add preventPropigation to middle click --- .../components/window/title-bar/TitleBar.vue | 2 +- frontend/src/components/workspace/Panel.vue | 19 ++++++++++++-- .../src/components/workspace/Workspace.vue | 8 +++++- frontend/src/main.ts | 4 ++- frontend/src/utilities/documents.ts | 26 ++++++++++++++----- frontend/src/utilities/input.ts | 9 +++++++ 6 files changed, 56 insertions(+), 12 deletions(-) diff --git a/frontend/src/components/window/title-bar/TitleBar.vue b/frontend/src/components/window/title-bar/TitleBar.vue index 40bc480d..28f74f61 100644 --- a/frontend/src/components/window/title-bar/TitleBar.vue +++ b/frontend/src/components/window/title-bar/TitleBar.vue @@ -4,7 +4,7 @@
- +
diff --git a/frontend/src/components/workspace/Panel.vue b/frontend/src/components/workspace/Panel.vue index c24dbd6f..f800338a 100644 --- a/frontend/src/components/workspace/Panel.vue +++ b/frontend/src/components/workspace/Panel.vue @@ -7,11 +7,26 @@ :class="{ active: tabIndex === tabActiveIndex }" v-for="(tabLabel, tabIndex) in tabLabels" :key="tabIndex" - @click.middle="closeDocumentWithConfirmation(tabIndex)" + @click.middle=" + (e) => { + e.stopPropagation(); + closeDocumentWithConfirmation(tabIndex); + } + " @click="panelType === 'Document' && selectDocument(tabIndex)" > {{ tabLabel }} - +
diff --git a/frontend/src/components/workspace/Workspace.vue b/frontend/src/components/workspace/Workspace.vue index c3a2c65d..3d7ac0e8 100644 --- a/frontend/src/components/workspace/Workspace.vue +++ b/frontend/src/components/workspace/Workspace.vue @@ -1,7 +1,13 @@