From 2d770c0afbf67728b2fcfddc03c6fab8e58a3db9 Mon Sep 17 00:00:00 2001 From: arkohut <39525455+arkohut@users.noreply.github.com> Date: Mon, 29 Jul 2024 18:55:25 +0800 Subject: [PATCH] feat(web): support clip metadata item to clipboard --- web/src/lib/Figure.svelte | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/web/src/lib/Figure.svelte b/web/src/lib/Figure.svelte index 8ce74c9..8b25453 100644 --- a/web/src/lib/Figure.svelte +++ b/web/src/lib/Figure.svelte @@ -80,6 +80,18 @@ return true; } + + /** + * Copy text to clipboard + * @param {string} text + */ + function copyToClipboard(text) { + navigator.clipboard.writeText(text).then(() => { + console.log('Text copied to clipboard'); + }).catch(err => { + console.error('Failed to copy text: ', err); + }); + }
@@ -154,7 +166,15 @@
{#each metadata_entries as entry}
- {entry.key}: + + {entry.key} + + {#if typeof entry.value === 'object'} {#if isValidOCRDataStructure(entry.value)}