Resolves #109, File Tree Lines can be Added to Exclude/Include Pattern Through Click (#153)

* Add ability to click tree lines to exlcude / include in pattern input
* Support visual change for swapping between include and exclude pattern

Co-authored-by: Romain Courtois <romain@coderamp.io>
This commit is contained in:
David Ulloa 2025-02-03 20:46:47 -05:00 committed by GitHub
parent a91191b3d5
commit 11d3f399d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 78 additions and 6 deletions

View file

@ -1,11 +1,24 @@
// Copy functionality
function copyText(className) {
const textarea = document.querySelector('.' + className);
let textToCopy;
if (className === 'directory-structure') {
// For directory structure, get the hidden input value
const hiddenInput = document.getElementById('directory-structure-content');
if (!hiddenInput) return;
textToCopy = hiddenInput.value;
} else {
// For other elements, get the textarea value
const textarea = document.querySelector('.' + className);
if (!textarea) return;
textToCopy = textarea.value;
}
const button = document.querySelector(`button[onclick="copyText('${className}')"]`);
if (!textarea || !button) return;
if (!button) return;
// Copy text
navigator.clipboard.writeText(textarea.value)
navigator.clipboard.writeText(textToCopy)
.then(() => {
// Store original content
const originalContent = button.innerHTML;
@ -110,7 +123,7 @@ function handleSubmit(event, showLoading = false) {
}
function copyFullDigest() {
const directoryStructure = document.querySelector('.directory-structure').value;
const directoryStructure = document.getElementById('directory-structure-content').value;
const filesContent = document.querySelector('.result-text').value;
const fullDigest = `${directoryStructure}\n\nFiles Content:\n\n${filesContent}`;
const button = document.querySelector('[onclick="copyFullDigest()"]');