The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix copy to clipboard
Terry Sutton7bae34e1760c
diff --git a/studio/lib/helpers.ts b/studio/lib/helpers.tsindex cc98c0d2b48..65c39154eda 100644--- a/studio/lib/helpers.ts+++ b/studio/lib/helpers.ts@@ -160,22 +160,19 @@ export const snakeToCamel = (str: string) =>* Safari doesn't support write text into clipboard async, so if you need to load* text content async before coping, please use Promise<string> for the 1st arg.*/-export const copyToClipboard = async (- str: string,- callback: () => void = () => {}-): Promise<void> => {+export const copyToClipboard = async (str: string | Promise<string>, callback = () => {}) => {const focused = window.document.hasFocus()if (focused) {if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {- try {- await navigator.clipboard.writeText(str)- callback()- } catch (error) {- console.warn('Unable to copy to clipboard')- }- } else {- console.warn('Clipboard writeText method not supported')+ const text = await Promise.resolve(str)+ Promise.resolve(window.navigator?.clipboard?.writeText(text)).then(callback)++ return}++ Promise.resolve(str)+ .then((text) => window.navigator?.clipboard?.writeText(text))+ .then(callback)} else {console.warn('Unable to copy to clipboard')}