feat: add copy to clipboard when you press c on a message, stripping the newline at the end

This commit is contained in:
root
2025-03-03 16:57:03 +01:00
parent 18ebd0a6b8
commit dc0db147de
3 changed files with 6 additions and 0 deletions

BIN
frontend/public/copy.wav Normal file

Binary file not shown.

View File

@@ -3,6 +3,7 @@ const audioContext = new AudioContext();
const soundFiles = {
intro: 'intro.wav',
login: 'login.wav',
copy: 'copy.wav',
uploadFailed: 'uploadfail.wav'
} as const;

View File

@@ -247,6 +247,11 @@ export class MainView extends View {
this.openMessageDialog(message);
})
itm.onKeyDown(async(key: string, alt: boolean | undefined, shift: boolean | undefined, ctrl: boolean | undefined) => {
if (key === "c") {
navigator.clipboard.writeText(message.content.trim());
playSound("copy");
}
if (key === "Delete") {
await this.removeMessage(message.id);
if (this.messageList.children.length === 0) {