fix: share copy to clipboard + alert
This commit is contained in:
parent
2bb45afe5f
commit
8d3ba2a8cd
4 changed files with 104 additions and 2 deletions
|
|
@ -23,6 +23,7 @@ import { settingPatterns } from '../settings.mjs';
|
|||
import { code2hash, hash2code } from './helpers.mjs';
|
||||
import { isTauri } from '../tauri.mjs';
|
||||
import { useWidgets } from '@strudel.cycles/react/src/hooks/useWidgets.mjs';
|
||||
import { writeText } from '@tauri-apps/api/clipboard';
|
||||
|
||||
const { latestCode } = settingsMap.get();
|
||||
|
||||
|
|
@ -270,7 +271,11 @@ export function Repl({ embedded = false }) {
|
|||
if (!error) {
|
||||
setLastShared(activeCode || code);
|
||||
// copy shareUrl to clipboard
|
||||
await navigator.clipboard.writeText(shareUrl);
|
||||
if (isTauri()) {
|
||||
await writeText(shareUrl);
|
||||
} else {
|
||||
await navigator.clipboard.writeText(shareUrl);
|
||||
}
|
||||
const message = `Link copied to clipboard: ${shareUrl}`;
|
||||
alert(message);
|
||||
// alert(message);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue