Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
export async function writeTextToClipboard(text: string): Promise<boolean> {
const clipboard = globalThis.navigator?.clipboard;
if (clipboard?.writeText) {
try {
await clipboard.writeText(text);
return true;
} catch {
// Fall through to the legacy fallback below.
}
}
if (typeof document === "undefined") {
return false;
}
const textarea = document.createElement("textarea");
textarea.value = text;
textarea.style.position = "fixed";
textarea.style.opacity = "0";
document.body.appendChild(textarea);
textarea.select();
try {
return document.execCommand("copy"); // NOSONAR
} catch {
return false;
} finally {
textarea.remove();
}
}