pgadmin4/web/pgadmin/static/js/clipboard.js
Aditya Toshniwal dcfef154ce
- Set the browser target to ES6 and reduce the JS bundle size considerably
- Upgrade ESLint to v9.x and migrate the .eslintrc.js file to make it work
2024-07-04 18:25:47 +05:30

16 lines
381 B
JavaScript

import pgAdmin from 'sources/pgadmin';
export async function copyToClipboard(text) {
try {
await navigator.clipboard.writeText(text);
} catch {
/* Suppress error */
pgAdmin.Browser.notifier.error('Does not have clipboard access');
}
localStorage.setItem('clipboard', text);
}
export function getFromClipboard() {
return localStorage.getItem('clipboard');
}