Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanPaulvanderHam authored Apr 11, 2024
1 parent 1761b5f commit 2a1ae5a
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,14 @@
document.querySelector('#webchat > *').focus();

// Create a custom input box
const inputBox = document.createElement('textarea');
const inputBox = document.createElement('input');
inputBox.type = 'text';
inputBox.id = 'customInputBox';
inputBox.style.width = '450px'; // Set the width
inputBox.style.height = 'auto'; // Set the height to auto
inputBox.style.overflow = 'hidden'; // Hide the overflow
inputBox.style.resize = 'none'; // Disable manual resize
inputBox.style.width = 'auto'; // Set the width
inputBox.style.height = '30px'; // Set the height
inputBox.style.marginLeft = '20px'; // Move the box to the right
document.body.appendChild(inputBox);

// Adjust the height of the input box based on its content
inputBox.addEventListener('input', function (event) {
this.style.height = 'auto';
this.style.height = (this.scrollHeight) + 'px';
});

// Handle the Enter key press event
inputBox.addEventListener('keydown', function (event) {
if (event.key === 'Enter') {
Expand Down Expand Up @@ -119,10 +112,33 @@
});

// Clear the input box
this.value = '';
this.style.height = 'auto'; // Reset the height
event.target.value = '';
}
});

// Create a send button
const sendButton = document.createElement('button');
sendButton.id = 'customSendButton';
sendButton.textContent = 'Vraag tattaTeun';
sendButton.style.marginLeft = '10px'; // Move the button to the right
document.body.appendChild(sendButton);

// Handle the click event
sendButton.addEventListener('click', function () {
let inputText = inputBox.value;

// ... rest of your code ...

// When the button is clicked, send the message
store.dispatch({
type: 'WEB_CHAT/SEND_MESSAGE',
payload: { text: `%${inputText}%` } // Use inputText here instead of event.target.value
});

// Clear the input box
inputBox.value = '';
});

})().catch(err => console.error(err));
</script>
</body>
Expand Down

0 comments on commit 2a1ae5a

Please sign in to comment.