| Sean McCullough | 86b5686 | 2025-04-18 13:04:03 -0700 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
| 3 | <title>sketch-chat-input demo</title> |
| 4 | <link rel="stylesheet" href="demo.css" /> |
| Philip Zeyliger | 72682df | 2025-04-23 13:09:46 -0700 | [diff] [blame] | 5 | <script type="module" src="../sketch-chat-input.ts"></script> |
| Sean McCullough | 86b5686 | 2025-04-18 13:04:03 -0700 | [diff] [blame] | 6 | |
| 7 | <script> |
| 8 | document.addEventListener("DOMContentLoaded", () => { |
| Sean McCullough | 71941bd | 2025-04-18 13:31:48 -0700 | [diff] [blame] | 9 | const chatInput = document.querySelector("sketch-chat-input"); |
| Sean McCullough | 86b5686 | 2025-04-18 13:04:03 -0700 | [diff] [blame] | 10 | console.log("chatInput: ", chatInput); |
| 11 | chatInput.content = "hi"; |
| 12 | chatInput.addEventListener("send-chat", (evt) => { |
| Sean McCullough | 71941bd | 2025-04-18 13:31:48 -0700 | [diff] [blame] | 13 | console.log("send chat event: ", evt); |
| Sean McCullough | 86b5686 | 2025-04-18 13:04:03 -0700 | [diff] [blame] | 14 | const msgDiv = document.querySelector("#chat-messages"); |
| 15 | const newDiv = document.createElement("div"); |
| Sean McCullough | 71941bd | 2025-04-18 13:31:48 -0700 | [diff] [blame] | 16 | newDiv.innerText = evt.detail.message; |
| Sean McCullough | 86b5686 | 2025-04-18 13:04:03 -0700 | [diff] [blame] | 17 | msgDiv.append(newDiv); |
| Sean McCullough | 71941bd | 2025-04-18 13:31:48 -0700 | [diff] [blame] | 18 | chatInput.content = ""; |
| Sean McCullough | 86b5686 | 2025-04-18 13:04:03 -0700 | [diff] [blame] | 19 | }); |
| 20 | }); |
| 21 | </script> |
| Sean McCullough | 86b5686 | 2025-04-18 13:04:03 -0700 | [diff] [blame] | 22 | </head> |
| 23 | <body> |
| 24 | <h1>sketch-chat-input demo</h1> |
| 25 | |
| 26 | <div id="chat-messages"></div> |
| 27 | |
| 28 | <sketch-chat-input></sketch-chat-input> |
| Sean McCullough | 86b5686 | 2025-04-18 13:04:03 -0700 | [diff] [blame] | 29 | </body> |
| Sean McCullough | 71941bd | 2025-04-18 13:31:48 -0700 | [diff] [blame] | 30 | </html> |