Skip to content

Commit

Permalink
ran prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
dtraleigh committed Jan 21, 2025
1 parent be25238 commit d8f01e3
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions assets/javascripts/discourse/initializers/retort-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class EmojiPickerComponent extends Component {
const post = this.post;
const emojiPicker = document.querySelector(".emoji-picker");
const retortButton = document.querySelector(
`article[data-post-id="${post.id}"] .post-controls .retort`
`article[data-post-id="${post.id}"] .post-controls .retort`,
);

if (!emojiPicker || !retortButton) {
Expand All @@ -48,7 +48,8 @@ class EmojiPickerComponent extends Component {
}

if (this.limited) {
const emojis = this.retort.siteSettings.retort_allowed_emojis.split("|");
const emojis =
this.retort.siteSettings.retort_allowed_emojis.split("|");

emojiPicker.innerHTML = `
<div class='limited-emoji-set'>
Expand All @@ -60,7 +61,7 @@ class EmojiPickerComponent extends Component {
width=40
height=40
title='${code}'
class='emoji' />`
class='emoji' />`,
)
.join("")}
</div>
Expand Down Expand Up @@ -105,7 +106,7 @@ class EmojiPickerComponent extends Component {
@action
onCategorySelection(sectionName) {
const section = document.querySelector(
`.emoji-picker-emoji-area .section[data-section="${sectionName}"]`
`.emoji-picker-emoji-area .section[data-section="${sectionName}"]`,
);
section &&
section.scrollIntoView({
Expand Down Expand Up @@ -151,19 +152,22 @@ function initializePlugin(api) {

api.modifyClass("component:emoji-picker", EmojiPickerComponent);

api.registerValueTransformer("post-menu-buttons", ({ value: dag, context }) => {
const postId = context.post.id;
const retort = api.container.lookup("service:retort");

if (!retort.disabledFor(postId)) {
dag.add("retort", EmojiPickerComponent, {
post: context.post,
onClick: () => {
retort.openPicker(context.post);
},
});
}
});
api.registerValueTransformer(
"post-menu-buttons",
({ value: dag, context }) => {
const postId = context.post.id;
const retort = api.container.lookup("service:retort");

if (!retort.disabledFor(postId)) {
dag.add("retort", EmojiPickerComponent, {
post: context.post,
onClick: () => {
retort.openPicker(context.post);
},
});
}
},
);
}

export default {
Expand Down

0 comments on commit d8f01e3

Please sign in to comment.