Adds a fallback mechanism and logs the error when the clipboard API fails.
try {
await navigator.clipboard.writeText(this.mermaidCode);
this.showNotification('Copied!');
- } catch (_error) {
+ } catch (error) {
// Fallback for older browsers or if clipboard API fails
+ console.error('Clipboard API copy failed, attempting fallback:', error);
const textArea = document.createElement('textarea');
textArea.value = this.mermaidCode;
// Style to make it invisible