Skip to content

Commit

Permalink
Merge pull request #9185 from RocketChat/fix-reply-on-safari
Browse files Browse the repository at this point in the history
[FIX] Cursor position when reply on safari
  • Loading branch information
rodrigok committed Dec 20, 2017
1 parent 1a4ddaa commit d62ea9d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/rocketchat-lib/client/MessageAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,22 @@ Meteor.startup(function() {
const url = RocketChat.MessageAction.getPermaLink(message._id);
const roomInfo = RocketChat.models.Rooms.findOne(message.rid, { fields: { t: 1 } });
let text = `[ ](${ url }) `;
let inputValue = '';

if (roomInfo.t !== 'd' && message.u.username !== Meteor.user().username) {
text += `@${ message.u.username } `;
}

if (input.value && !input.value.endsWith(' ')) {
input.value += ' ';
inputValue += ' ';
}
input.value += text;
input.focus();
$(input).trigger('change').trigger('input');
inputValue += text;

$(input)
.focus()
.val(inputValue)
.trigger('change')
.trigger('input');
},
condition(message) {
if (RocketChat.models.Subscriptions.findOne({rid: message.rid}) == null) {
Expand Down

0 comments on commit d62ea9d

Please sign in to comment.