diff options
Diffstat (limited to 'src/ui/ChatWindowMessage.ts')
-rw-r--r-- | src/ui/ChatWindowMessage.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ui/ChatWindowMessage.ts b/src/ui/ChatWindowMessage.ts index 5bafa4ab..60538dd5 100644 --- a/src/ui/ChatWindowMessage.ts +++ b/src/ui/ChatWindowMessage.ts @@ -7,6 +7,8 @@ import LinkHandlerGeo from '@src/LinkHandlerGeo'; import Color from '@util/Color'; import Translation from '@util/Translation'; import messageHistory from './dialogs/messageHistory'; +import MenuComponent from './MenuComponent'; +import onLongPress from './util/LongPress'; let chatWindowMessageTemplate = require('../../template/chat-window-message.hbs'); @@ -27,6 +29,8 @@ export default class ChatWindowMessage { this.generateElement(); this.registerHooks(); + + this.initMenu(); } public getElement() { @@ -237,6 +241,22 @@ export default class ChatWindowMessage { } } + private initMenu() { + if (this.message.isSystem()) { + return; + } + + const messageMenu = this.chatWindow.getAccount().getChatMessageMenu(); + const menuType = this.message.isOutgoing() ? 'vertical-right' : 'vertical-left'; + const menu = new MenuComponent('more', menuType, messageMenu, [this.chatWindow.getContact(), this.message]); + + this.element.append(menu.getElement()); + + onLongPress(this.element, () => { + menu.toggle(); + }); + } + private registerHooks() { this.message.registerHook('replacedBy', () => { const chatWindowMessageReplacement = new ChatWindowMessage(this.originalMessage, this.chatWindow); |