FIX: Revert to old hashtag style for hashtag-raw (#19145)
This fix changes the hashtag-raw hashtags, which are the ones that do not actually match anything, back to the old style which does not look like mentions.
This commit is contained in:
parent
d7b7660061
commit
564292bfc1
|
@ -105,7 +105,9 @@ export function linkSeenHashtagsInContext(
|
||||||
if (hashtagSpans.length === 0) {
|
if (hashtagSpans.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const slugs = [...hashtagSpans.mapBy("innerText")];
|
const slugs = [
|
||||||
|
...hashtagSpans.map((span) => span.innerText.replace("#", "")),
|
||||||
|
];
|
||||||
|
|
||||||
hashtagSpans.forEach((hashtagSpan, index) => {
|
hashtagSpans.forEach((hashtagSpan, index) => {
|
||||||
_findAndReplaceSeenHashtagPlaceholder(
|
_findAndReplaceSeenHashtagPlaceholder(
|
||||||
|
|
|
@ -75,22 +75,9 @@ function addHashtag(buffer, matches, state) {
|
||||||
token.attrs = [["class", "hashtag-raw"]];
|
token.attrs = [["class", "hashtag-raw"]];
|
||||||
buffer.push(token);
|
buffer.push(token);
|
||||||
|
|
||||||
token = new state.Token("svg_open", "svg", 1);
|
|
||||||
token.block = false;
|
|
||||||
token.attrs = [["class", `fa d-icon d-icon-hashtag svg-icon svg-node`]];
|
|
||||||
buffer.push(token);
|
|
||||||
|
|
||||||
token = new state.Token("use_open", "use", 1);
|
|
||||||
token.block = false;
|
|
||||||
token.attrs = [["href", `#hashtag`]];
|
|
||||||
buffer.push(token);
|
|
||||||
|
|
||||||
buffer.push(new state.Token("use_close", "use", -1));
|
|
||||||
buffer.push(new state.Token("svg_close", "svg", -1));
|
|
||||||
|
|
||||||
token = new state.Token("span_open", "span", 1);
|
token = new state.Token("span_open", "span", 1);
|
||||||
token = new state.Token("text", "", 0);
|
token = new state.Token("text", "", 0);
|
||||||
token.content = matches[0].replace("#", "");
|
token.content = matches[0];
|
||||||
buffer.push(token);
|
buffer.push(token);
|
||||||
token = new state.Token("span_close", "span", -1);
|
token = new state.Token("span_close", "span", -1);
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,19 @@ a.hashtag {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.hashtag-cooked {
|
||||||
|
@include mention;
|
||||||
|
|
||||||
|
&:visited,
|
||||||
|
&:hover {
|
||||||
|
color: var(--primary-high-or-secondary-low);
|
||||||
|
}
|
||||||
|
|
||||||
|
.d-icon {
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.hashtag-autocomplete {
|
.hashtag-autocomplete {
|
||||||
.hashtag-autocomplete__option {
|
.hashtag-autocomplete__option {
|
||||||
.hashtag-autocomplete__link {
|
.hashtag-autocomplete__link {
|
||||||
|
@ -31,17 +44,3 @@ a.hashtag {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.hashtag-raw,
|
|
||||||
.hashtag-cooked {
|
|
||||||
@include mention;
|
|
||||||
|
|
||||||
&:visited,
|
|
||||||
&:hover {
|
|
||||||
color: var(--primary-high-or-secondary-low);
|
|
||||||
}
|
|
||||||
|
|
||||||
.d-icon {
|
|
||||||
margin-right: 3px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1463,7 +1463,7 @@ RSpec.describe PrettyText do
|
||||||
cooked = PrettyText.cook(" #unknown::tag #known #known::tag #testing", user_id: user.id)
|
cooked = PrettyText.cook(" #unknown::tag #known #known::tag #testing", user_id: user.id)
|
||||||
|
|
||||||
[
|
[
|
||||||
"<span class=\"hashtag-raw\"><svg class=\"fa d-icon d-icon-hashtag svg-icon svg-node\"><use href=\"#hashtag\"></use></svg>unknown::tag</span>",
|
"<span class=\"hashtag-raw\">#unknown::tag</span>",
|
||||||
"<a class=\"hashtag-cooked\" href=\"#{category2.url}\" data-type=\"category\" data-slug=\"known\"><svg class=\"fa d-icon d-icon-folder svg-icon svg-node\"><use href=\"#folder\"></use></svg><span>known</span></a>",
|
"<a class=\"hashtag-cooked\" href=\"#{category2.url}\" data-type=\"category\" data-slug=\"known\"><svg class=\"fa d-icon d-icon-folder svg-icon svg-node\"><use href=\"#folder\"></use></svg><span>known</span></a>",
|
||||||
"<a class=\"hashtag-cooked\" href=\"/tag/known\" data-type=\"tag\" data-slug=\"known\"><svg class=\"fa d-icon d-icon-tag svg-icon svg-node\"><use href=\"#tag\"></use></svg><span>known</span></a>",
|
"<a class=\"hashtag-cooked\" href=\"/tag/known\" data-type=\"tag\" data-slug=\"known\"><svg class=\"fa d-icon d-icon-tag svg-icon svg-node\"><use href=\"#tag\"></use></svg><span>known</span></a>",
|
||||||
"<a class=\"hashtag-cooked\" href=\"#{category.url}\" data-type=\"category\" data-slug=\"testing\"><svg class=\"fa d-icon d-icon-folder svg-icon svg-node\"><use href=\"#folder\"></use></svg><span>testing</span></a>"
|
"<a class=\"hashtag-cooked\" href=\"#{category.url}\" data-type=\"category\" data-slug=\"testing\"><svg class=\"fa d-icon d-icon-folder svg-icon svg-node\"><use href=\"#folder\"></use></svg><span>testing</span></a>"
|
||||||
|
|
Loading…
Reference in New Issue