vg-coder-cli 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -636,13 +636,16 @@ API sẽ:
|
|
|
636
636
|
resetButton(copyBtn);
|
|
637
637
|
}
|
|
638
638
|
|
|
639
|
-
// Copy to clipboard
|
|
639
|
+
// Copy to clipboard using ClipboardItem (like reference code)
|
|
640
640
|
try {
|
|
641
|
-
|
|
641
|
+
const blob = new Blob([lastAnalyzeResult], { type: 'text/plain' });
|
|
642
|
+
const item = new ClipboardItem({ 'text/plain': blob });
|
|
643
|
+
await navigator.clipboard.write([item]);
|
|
644
|
+
|
|
642
645
|
copyBtn.classList.add('copied');
|
|
643
646
|
copyIcon.textContent = '✓';
|
|
644
647
|
copyText.textContent = 'Copied!';
|
|
645
|
-
showToast('✅ Đã copy vào clipboard!', 'success');
|
|
648
|
+
showToast('✅ Đã copy project.txt vào clipboard!', 'success');
|
|
646
649
|
|
|
647
650
|
setTimeout(() => {
|
|
648
651
|
copyBtn.classList.remove('copied');
|
|
@@ -650,7 +653,22 @@ API sẽ:
|
|
|
650
653
|
copyText.textContent = 'Copy to Clipboard';
|
|
651
654
|
}, 2000);
|
|
652
655
|
} catch (err) {
|
|
653
|
-
|
|
656
|
+
// Fallback to writeText if ClipboardItem fails
|
|
657
|
+
try {
|
|
658
|
+
await navigator.clipboard.writeText(lastAnalyzeResult);
|
|
659
|
+
copyBtn.classList.add('copied');
|
|
660
|
+
copyIcon.textContent = '✓';
|
|
661
|
+
copyText.textContent = 'Copied!';
|
|
662
|
+
showToast('✅ Đã copy project.txt vào clipboard!', 'success');
|
|
663
|
+
|
|
664
|
+
setTimeout(() => {
|
|
665
|
+
copyBtn.classList.remove('copied');
|
|
666
|
+
copyIcon.textContent = '📋';
|
|
667
|
+
copyText.textContent = 'Copy to Clipboard';
|
|
668
|
+
}, 2000);
|
|
669
|
+
} catch (fallbackErr) {
|
|
670
|
+
showToast('❌ Lỗi copy: ' + fallbackErr.message, 'error');
|
|
671
|
+
}
|
|
654
672
|
}
|
|
655
673
|
}
|
|
656
674
|
|