[FIX] Slash command preview: Wrong item being selected, Horizontal scroll (#16750)

pull/16724/head^2
gabriellsh 5 years ago committed by GitHub
parent d70f79193f
commit 6c079dae00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      app/ui-message/client/popup/messagePopupSlashCommandPreview.js

@ -48,6 +48,8 @@ Template.messagePopupSlashCommandPreview.onCreated(function() {
this.selectorRegex = /(\/[\w\d\S]+ )([^]*)$/;
this.replaceRegex = /(\/[\w\d\S]+ )[^]*$/; // WHAT'S THIS
this.dragging = false;
const template = this;
template.fetchPreviews = _.debounce(function _previewFetcher(cmd, args) {
const command = cmd;
@ -281,7 +283,7 @@ Template.messagePopupSlashCommandPreview.onDestroyed(function() {
});
Template.messagePopupSlashCommandPreview.events({
'mouseenter .popup-item'(e) {
'mouseenter .popup-item, mousedown .popup-item, touchstart .popup-item'(e) {
if (e.currentTarget.className.includes('selected')) {
return;
}
@ -300,9 +302,19 @@ Template.messagePopupSlashCommandPreview.events({
},
'mouseup .popup-item, touchend .popup-item'() {
const template = Template.instance();
if (template.dragging) {
template.dragging = false;
return;
}
template.clickingItem = false;
template.enterKeyAction();
},
'touchmove .popup-item'(e) {
e.stopPropagation();
const template = Template.instance();
template.dragging = true;
},
});
Template.messagePopupSlashCommandPreview.helpers({

Loading…
Cancel
Save