Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add message action to copy message to input as reply #548

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/rocketchat-message-action/client/messageAction.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{/if}}

{{#if msg_in_chat_window}}
<button class="js-actionButton-sendMessage" value="{{msg}}">
<button class="{{jsActionButtonClassname msg_processing_type}}" value="{{msg}}">
<img class="image-button" src="{{image_url}}" />
</button>
{{/if}}
Expand All @@ -21,7 +21,7 @@
</a>
{{/if}}
{{#if msg_in_chat_window}}
<button class="text-button js-actionButton-sendMessage" value="{{msg}}">
<button class="text-button {{jsActionButtonClassname msg_processing_type}}" value="{{msg}}">
<span class="overflow-ellipsis">{{text}}</span>
</button>
{{/if}}
Expand Down
3 changes: 3 additions & 0 deletions packages/rocketchat-message-action/client/messageAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ Template.messageAction.helpers({
areButtonsHorizontal() {
return Template.parentData(1).button_alignment === 'horizontal';
},
jsActionButtonClassname(processingType) {
return `js-actionButton-${ processingType || 'sendMessage' }`;
},
});
12 changes: 12 additions & 0 deletions packages/rocketchat-ui/client/views/app/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,18 @@ Template.room.events({
Meteor.call('sendMessage', msgObject);
});
},
'click .js-actionButton-respondWithMessage'(event) {
const msg = event.currentTarget.value;
if (!msg) {
return;
}

const input = $('.messages-container .rc-message-box .rc-message-box__textarea').get(0);
input.value = msg;
setTimeout(() => {
input.focus();
}, 5);
},
});


Expand Down