mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-08-29 06:37:12 +02:00
Add a typed platform package to decouple the frontend from Tauri (#539)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
0068be9ffc
commit
2383f06e71
@@ -1,14 +1,14 @@
|
||||
import { clear, writeText } from "@tauri-apps/plugin-clipboard-manager";
|
||||
import { showToast } from "./toast";
|
||||
import { platform } from "@yaakapp-internal/platform";
|
||||
|
||||
export function copyToClipboard(
|
||||
text: string | null,
|
||||
{ disableToast }: { disableToast?: boolean } = {},
|
||||
) {
|
||||
if (text == null) {
|
||||
clear().catch(console.error);
|
||||
platform.clipboard.clear().catch(console.error);
|
||||
} else {
|
||||
writeText(text).catch(console.error);
|
||||
platform.clipboard.writeText(text).catch(console.error);
|
||||
}
|
||||
|
||||
if (text !== "" && !disableToast) {
|
||||
|
||||
Reference in New Issue
Block a user