From 4ffbbe9f841b016cb3ec956c4b80db9211cdc042 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Wed, 1 Nov 2023 13:20:27 +0100 Subject: [PATCH] UX: Improve copy to clipboard event handler in photo edit dialog Signed-off-by: Michael Mayer --- frontend/src/dialog/photo/edit/files.vue | 16 +++++++--------- frontend/src/dialog/photo/edit/info.vue | 22 +++++++++++++++++----- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/frontend/src/dialog/photo/edit/files.vue b/frontend/src/dialog/photo/edit/files.vue index 825fcce45..888b6c36a 100644 --- a/frontend/src/dialog/photo/edit/files.vue +++ b/frontend/src/dialog/photo/edit/files.vue @@ -77,25 +77,25 @@ UID - {{ file.UID | uppercase }} + {{ file.UID | uppercase }} Instance ID - {{ file.InstanceID | uppercase }} + {{ file.InstanceID | uppercase }} Hash - {{ file.Hash }} + {{ file.Hash }} Filename - {{ file.Name }} + {{ file.Name }} @@ -107,7 +107,7 @@ Original Name - {{ file.OriginalName }} + {{ file.OriginalName }} @@ -332,14 +332,12 @@ export default { }, computed: {}, methods: { - async copyText(ev) { - if (!ev || !ev.target) { + async copyText(text) { + if (!text) { return; } try { - const el = ev.target; - const text = el.innerText || el.textContent; await Util.copyToMachineClipboard(text); this.$notify.success(this.$gettext("Copied to clipboard")); } catch (error) { diff --git a/frontend/src/dialog/photo/edit/info.vue b/frontend/src/dialog/photo/edit/info.vue index a7c86d6c7..47b696504 100644 --- a/frontend/src/dialog/photo/edit/info.vue +++ b/frontend/src/dialog/photo/edit/info.vue @@ -6,11 +6,11 @@ UID - {{ model.UID | uppercase }} + {{ model.UID | uppercase }} Document ID - {{ model.DocumentID | uppercase }} + {{ model.DocumentID | uppercase }} @@ -34,13 +34,13 @@ Folder - {{ model.Path }} + {{ model.Path }} Name - {{ model.Name }} + {{ model.Name }} @@ -64,7 +64,7 @@ check - {{ model.Title }} + {{ model.Title }} insert_drive_file @@ -340,6 +340,18 @@ export default { }, }, methods: { + async copyText(text) { + if (!text) { + return; + } + + try { + await Util.copyToMachineClipboard(text); + this.$notify.success(this.$gettext("Copied to clipboard")); + } catch (error) { + this.$notify.error(this.$gettext("Failed copying to clipboard")); + } + }, sourceName(s) { switch (s) { case "":