Files
supabase/apps/studio/components/grid/utils/common.ts
Ivan Vasilov 436bdb10ae chore: Move the studio app to apps/studio (#18915)
* Move all studio files from /studio to /apps/studio.

* Move studio specific prettier ignores.

* Fix the ui references from studio.

* Fix the css imports.

* Fix all package.json issues.

* Fix the prettier setup for the studio app.

* Add .turbo folder to prettierignore.

* Fix the github workflows.
2023-11-15 12:38:55 +01:00

25 lines
585 B
TypeScript

export function deepClone(obj: unknown) {
try {
return JSON.parse(JSON.stringify(obj))
} catch (e) {
throw e
}
}
export function formatClipboardValue(value: any) {
if (value === null) return ''
if (typeof value == 'object' || Array.isArray(value)) {
return JSON.stringify(value)
}
return value
}
export const copyToClipboard = (str: string, callback = () => {}) => {
const focused = window.document.hasFocus()
if (focused) {
window.navigator?.clipboard?.writeText(str).then(callback)
} else {
console.warn('Unable to copy to clipboard')
}
}