pgadmin4/web/pgadmin/static/js/clipboard.js
Aditya Toshniwal 306b184e11 1. Fixed an issue where Alt-Shift-Q didn't work after creating a new query. Fixes #7575
2. Fixed an issue where the Query Editor loses focus when saving a query (Alt+s). Fixes #7521
3. Ensure that an error is thrown if clipboard access is not provided and change the copy rows shortcut. Fixes #7452
2022-08-17 17:23:44 +05:30

16 lines
375 B
JavaScript

import Notifier from './helpers/Notifier';
export async function copyToClipboard(text) {
try {
await navigator.clipboard.writeText(text);
} catch(err) {
/* Suppress error */
Notifier.error('Does not have clipboard acccess');
}
localStorage.setItem('clipboard', text);
}
export function getFromClipboard() {
return localStorage.getItem('clipboard');
}