fix: input commands

This commit is contained in:
Timothy J. Baek 2024-10-19 13:40:20 -07:00
parent 211c41843c
commit 3436523b79

View File

@ -25,13 +25,13 @@
}; };
let command = ''; let command = '';
$: command = (prompt?.trim() ?? '').split(' ')?.at(-1) ?? ''; $: command = prompt.split(' ')?.at(-1) ?? '';
</script> </script>
{#if ['/', '#', '@'].includes(command?.charAt(0)) || '\\#' === command.slice(0, 2)} {#if ['/', '#', '@'].includes(command?.charAt(0)) || '\\#' === command.slice(0, 2)}
{#if command?.charAt(0) === '/'} {#if command?.charAt(0) === '/'}
<Prompts bind:this={commandElement} bind:prompt bind:files {command} /> <Prompts bind:this={commandElement} bind:prompt bind:files {command} />
{:else if command?.charAt(0) === '#' || '\\#' === command.slice(0, 2)} {:else if (command?.charAt(0) === '#' && command.startsWith('#') && !command.includes('# ')) || ('\\#' === command.slice(0, 2) && command.startsWith('#') && !command.includes('# '))}
<Knowledge <Knowledge
bind:this={commandElement} bind:this={commandElement}
bind:prompt bind:prompt