feat: implement whisper, (double)click on avatar
Users can insert a mention by clicking, and initiate a whisper by double-clicking on the avatar on a user's chat message
This commit is contained in:
@@ -1,11 +1,20 @@
|
||||
<script lang="ts">
|
||||
import { tick } from "svelte"
|
||||
import { send } from "./chat";
|
||||
import { send, whisper } from "./chat";
|
||||
|
||||
let input = "";
|
||||
export let input = "";
|
||||
async function keydown(e: KeyboardEvent) {
|
||||
if(e.key === "Enter") {
|
||||
send(input);
|
||||
console.log(e);
|
||||
const tokens = input.trim().split(" ");
|
||||
|
||||
if(tokens[0] === '/w') {
|
||||
const who = tokens[1];
|
||||
const m = tokens.slice(2).join(' ');
|
||||
whisper(who, m);
|
||||
} else {
|
||||
send(input);
|
||||
}
|
||||
e.preventDefault();
|
||||
await tick();
|
||||
input = "";
|
||||
|
Reference in New Issue
Block a user