Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Broken hashtags on embed and publish pages #24210

Merged
merged 1 commit into from Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/assets/javascripts/discourse/scripts/embed-application.js
Expand Up @@ -62,5 +62,12 @@
names[i].innerHTML = new BreakString(username).break();
}
}

// Use a # for hashtags since we don't have the JS and icons needed here to render the proper icon.
let hashtags = document.querySelectorAll(".cooked a.hashtag-cooked");
for (i = 0; i < hashtags.length; i++) {
hashtags[i].querySelector(".hashtag-icon-placeholder .d-icon").remove();
hashtags[i].querySelector(".hashtag-icon-placeholder").innerText = "#";
}
};
})();
12 changes: 12 additions & 0 deletions app/assets/javascripts/discourse/scripts/publish.js
@@ -0,0 +1,12 @@
(function () {
window.onload = function () {
// Use a # for hashtags since we don't have the JS and icons needed here to render the proper icon.
let hashtags = document.querySelectorAll(
".published-page-content-body a.hashtag-cooked"
);
for (let i = 0; i < hashtags.length; i++) {
hashtags[i].querySelector(".hashtag-icon-placeholder .d-icon").remove();
hashtags[i].querySelector(".hashtag-icon-placeholder").innerText = "#";
}
};
})();
10 changes: 10 additions & 0 deletions app/assets/stylesheets/embed.scss
Expand Up @@ -3,6 +3,7 @@
@import "./common/foundation/base";
@import "./color_definitions";
@import "./common/components/buttons";
@import "./common/components/hashtag";

article.post {
border-bottom: 1px solid var(--primary-low);
Expand Down Expand Up @@ -73,6 +74,15 @@ article.post {
p {
margin: 0 0 1em 0;
}

.hashtag-cooked {
padding: 0.2em 0.5em;

.hashtag-icon-placeholder {
font-weight: bold;
margin-right: 0;
}
}
}
}

Expand Down
11 changes: 11 additions & 0 deletions app/assets/stylesheets/publish.scss
Expand Up @@ -81,4 +81,15 @@
max-width: 100%;
height: auto;
}

.hashtag-cooked {
padding: 0.1em 0.5em;
font-size: 0.85em;

.hashtag-icon-placeholder {
font-weight: bold;
font-size: inherit;
margin-right: 0;
}
}
}
1 change: 1 addition & 0 deletions app/views/layouts/publish.html.erb
Expand Up @@ -7,6 +7,7 @@
<%= render partial: "common/discourse_publish_stylesheet" %>
<%= render_google_tag_manager_head_code %>
<%= render_google_universal_analytics_code %>
<%= preload_script 'publish' %>
</head>
<body class="<%= @body_classes.to_a.join(' ') %>">
<%= theme_lookup("header") %>
Expand Down