MCPcopy Create free account
hub / github.com/RioArisk/claudecode_api_RemoteControl / initInput

Function initInput

app/src/modules/input.js:234–279  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

232}
233
234export function initInput() {
235 $input.addEventListener('input', () => {
236 $input.style.height = 'auto';
237 $input.style.height = Math.min($input.scrollHeight, 120) + 'px';
238 updateSendBtn();
239
240 const val = $input.value;
241 if (val.startsWith('/') && !val.includes(' ') && val.length > 0) {
242 showCmdMenu(val);
243 } else {
244 hideCmdMenu();
245 }
246 });
247
248 $input.addEventListener('keydown', e => {
249 if (cmdMenuOpen) {
250 const items = $('cmd-menu').querySelectorAll('.cmd-item');
251 if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
252 e.preventDefault();
253 items[cmdActiveIdx]?.classList.remove('active');
254 if (e.key === 'ArrowDown') cmdActiveIdx = Math.min(cmdActiveIdx + 1, items.length - 1);
255 else cmdActiveIdx = Math.max(cmdActiveIdx - 1, 0);
256 items[cmdActiveIdx]?.classList.add('active');
257 return;
258 }
259 if (e.key === 'Enter') {
260 e.preventDefault();
261 const active = items[cmdActiveIdx];
262 if (active) execCmd(active.dataset.cmd);
263 return;
264 }
265 if (e.key === 'Escape') {
266 e.preventDefault();
267 hideCmdMenu();
268 return;
269 }
270 }
271 if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); send(); }
272 });
273
274 $('btn-send').addEventListener('click', send);
275 $('btn-scroll').addEventListener('click', () => {
276 const chat = $('chat-area');
277 chat.scrollTop = chat.scrollHeight;
278 });
279}

Callers

nothing calls this directly

Calls 6

$Function · 0.90
updateSendBtnFunction · 0.70
showCmdMenuFunction · 0.70
hideCmdMenuFunction · 0.70
execCmdFunction · 0.70
sendFunction · 0.70

Tested by

no test coverage detected