@nodebb/nodebb-plugin-reactions 2.1.8 → 2.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodebb/nodebb-plugin-reactions",
3
- "version": "2.1.8",
3
+ "version": "2.1.10",
4
4
  "nbbpm": {
5
5
  "compatibility": "^3.3.0"
6
6
  },
package/public/client.js CHANGED
@@ -15,9 +15,11 @@ $(document).ready(function () {
15
15
  }
16
16
  });
17
17
  // switchChat uses action:chat.loaded and not action:ajaxify.end
18
- hooks.on('action:chat.loaded', function () {
18
+ hooks.on('action:chat.loaded', function (container) {
19
19
  if (ajaxify.data.template.chats && ajaxify.data.roomId) {
20
- setupMessageReactions();
20
+ setupMessageReactions(container);
21
+ } else if (container.hasClass('chat-modal')) {
22
+ setupMessageReactions(container);
21
23
  }
22
24
  });
23
25
  });
@@ -81,10 +83,10 @@ $(document).ready(function () {
81
83
  });
82
84
  }
83
85
 
84
- function setupMessageReactions() {
86
+ function setupMessageReactions(container) {
85
87
  setupMessageReactionSockets();
86
88
 
87
- const messageContent = $('[component="chat/message/content"]');
89
+ const messageContent = container.find('[component="chat/message/content"]');
88
90
  messageContent.on('click', '[component="message/reaction"]', function () {
89
91
  var reactionElement = $(this);
90
92
  var mid = reactionElement.attr('data-mid');
@@ -257,7 +259,7 @@ $(document).ready(function () {
257
259
  }
258
260
 
259
261
  if (!utils.isTouchDevice()) {
260
- $('#content').on('mouseenter', '.reaction', function () {
262
+ $('body').on('mouseenter', '.reaction', function () {
261
263
  const $this = $(this);
262
264
  mouseOverReactionEl = $this;
263
265
  clearTooltipTimeout();
@@ -286,7 +288,7 @@ $(document).ready(function () {
286
288
  }
287
289
  }, 200);
288
290
  });
289
- $('#content').on('mouseleave', '.reaction', function () {
291
+ $('body').on('mouseleave', '.reaction', function () {
290
292
  clearTooltipTimeout();
291
293
  mouseOverReactionEl = null;
292
294
  disposeTooltip($(this));
@@ -1,5 +1,5 @@
1
1
  {{{ if config.enableMessageReactions }}}
2
- <button class="reaction-add btn btn-sm btn-link {{{ if ./maxReactionsReached }}}max-reactions{{{ end }}}" component="message/reaction/add" data-mid="{./mid}" title="[[reactions:add-reaction]]">
2
+ <button class="reaction-add btn btn-sm btn-link {{{ if messages.maxReactionsReached }}}max-reactions{{{ end }}}" component="message/reaction/add" data-mid="{messages.mid}" title="[[reactions:add-reaction]]">
3
3
  <i class="fa fa-face-smile"></i>
4
4
  </button>
5
5
  {{{ end }}}
@@ -1,6 +1,6 @@
1
1
  {{{ if config.enableMessageReactions }}}
2
- <div class="reactions {{{ if ./deleted}}}hidden{{{ end }}}" component="message/reactions" data-mid="{./mid}">
3
- {{{ each ./reactions }}}
2
+ <div class="reactions {{{ if messages.deleted}}}hidden{{{ end }}}" component="message/reactions" data-mid="{messages.mid}">
3
+ {{{ each messages.reactions }}}
4
4
  <!-- IMPORT partials/chats/reaction.tpl -->
5
5
  {{{ end }}}
6
6
  </div>