fix: Kopieren-Funktion mit Fallback-Methode
Problem: navigator.clipboard.writeText war undefined Lösung: Direkte Verwendung der Fallback-Methode (execCommand) Die Fallback-Methode ist zuverlässiger und funktioniert in allen Browsern.
This commit is contained in:
@@ -603,19 +603,8 @@ function copyEmbedCode() {
|
|||||||
let text = embedCode.textContent || embedCode.innerText;
|
let text = embedCode.textContent || embedCode.innerText;
|
||||||
text = text.trim();
|
text = text.trim();
|
||||||
|
|
||||||
// Try modern clipboard API first
|
// Use fallback method directly (more reliable)
|
||||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
fallbackCopy(text);
|
||||||
navigator.clipboard.writeText(text).then(() => {
|
|
||||||
showNotification('Code in Zwischenablage kopiert!', 'success');
|
|
||||||
showCopySuccess();
|
|
||||||
}).catch(err => {
|
|
||||||
console.error('Clipboard API failed:', err);
|
|
||||||
fallbackCopy(text);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// Fallback for older browsers
|
|
||||||
fallbackCopy(text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fallbackCopy(text) {
|
function fallbackCopy(text) {
|
||||||
|
|||||||
Reference in New Issue
Block a user