feat: add copy to clipboard when you press c on a message, stripping the newline at the end
This commit is contained in:
BIN
frontend/public/copy.wav
Normal file
BIN
frontend/public/copy.wav
Normal file
Binary file not shown.
@@ -3,6 +3,7 @@ const audioContext = new AudioContext();
|
|||||||
const soundFiles = {
|
const soundFiles = {
|
||||||
intro: 'intro.wav',
|
intro: 'intro.wav',
|
||||||
login: 'login.wav',
|
login: 'login.wav',
|
||||||
|
copy: 'copy.wav',
|
||||||
uploadFailed: 'uploadfail.wav'
|
uploadFailed: 'uploadfail.wav'
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@@ -247,6 +247,11 @@ export class MainView extends View {
|
|||||||
this.openMessageDialog(message);
|
this.openMessageDialog(message);
|
||||||
})
|
})
|
||||||
itm.onKeyDown(async(key: string, alt: boolean | undefined, shift: boolean | undefined, ctrl: boolean | undefined) => {
|
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") {
|
if (key === "Delete") {
|
||||||
await this.removeMessage(message.id);
|
await this.removeMessage(message.id);
|
||||||
if (this.messageList.children.length === 0) {
|
if (this.messageList.children.length === 0) {
|
||||||
|
Reference in New Issue
Block a user