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