make the 🔗 button copy branch links to clipboard

to accomplish this, I generalised emoji tooltips to a shared Tooltip class.
in the long run I'd like to transform all existing `title=""` tooltips into these for stylistic consistency with the rest of the website, but this is good enough for now.

I also ended up cleaning up some old code from before the /b rework.
This commit is contained in:
りき萌 2025-01-11 00:15:29 +01:00
parent c537eb844f
commit 74baa61122
8 changed files with 208 additions and 138 deletions

View file

@ -57,13 +57,13 @@ pub fn branch_to_html(
let linked_branch = if let Content::ResolvedLink(file_id) = &branch.attributes.content {
let path = treehouse.tree_path(*file_id).expect(".tree file expected");
format!(" data-th-link=\"{}\"", EscapeHtml(path.as_str()))
format!(" th-link=\"{}\"", EscapeHtml(path.as_str()))
} else {
String::new()
};
let do_not_persist = if branch.attributes.do_not_persist {
" data-th-do-not-persist=\"\""
" th-do-not-persist"
} else {
""
};
@ -165,7 +165,7 @@ pub fn branch_to_html(
} else {
write!(
s,
"<a class=\"icon icon-permalink\" href=\"/b?{}\" title=\"permalink\"></a>",
"<a th-p class=\"icon icon-permalink\" href=\"/b?{}\" title=\"permalink\"></a>",
EscapeAttribute(&branch.named_id)
)
.unwrap();