Skip to content

Commit

Permalink
fix: add dropup handler to thread tools menu, updated how post tools …
Browse files Browse the repository at this point in the history
…menu adds dropup handler
  • Loading branch information
julianlam committed Aug 26, 2022
1 parent b424ba4 commit c1936e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 6 additions & 0 deletions public/src/client/topic.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ define('forum/topic', [
Topic.applyDropup.call(this);
}
});
hooks.onPage('action:topic.tools.load', ({ element }) => {
Topic.applyDropup.call(element.get(0).parentNode);
});
hooks.onPage('action:post.tools.load', ({ element }) => {
Topic.applyDropup.call(element.get(0).parentNode);
});
}

function addRepliesHandler() {
Expand Down
8 changes: 3 additions & 5 deletions public/src/client/topic/postTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ define('forum/topic/postTools', [

function renderMenu() {
$('[component="topic"]').on('show.bs.dropdown', '.moderator-tools', function () {
const self = this;
const $this = $(this);
const dropdownMenu = $this.find('.dropdown-menu');
if (dropdownMenu.html()) {
Expand All @@ -50,15 +49,14 @@ define('forum/topic/postTools', [

const html = await app.parseAndTranslate('partials/topic/post-menu-list', data);
const clipboard = require('clipboard');
// eslint-disable-next-line import/no-unresolved
const topic = require('forum/topic');

dropdownMenu.html(html);
dropdownMenu.get(0).classList.toggle('hidden', false);
topic.applyDropup.call(self);
new clipboard('[data-clipboard-text]');

hooks.fire('action:post.tools.load');
hooks.fire('action:post.tools.load', {
element: dropdownMenu,
});
});
});
}
Expand Down

0 comments on commit c1936e8

Please sign in to comment.