public pages links

This commit is contained in:
Mateusz Gruszczyński
2026-08-06 14:20:38 +02:00
parent 017513db8a
commit 249e5a4fcd
4 changed files with 35 additions and 16 deletions
Generated
+1 -1
View File
@@ -2581,7 +2581,7 @@ dependencies = [
[[package]] [[package]]
name = "rustpad" name = "rustpad"
version = "0.2.50" version = "0.2.51"
dependencies = [ dependencies = [
"argon2", "argon2",
"aws-config", "aws-config",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "rustpad" name = "rustpad"
version = "0.2.50" version = "0.2.51"
edition = "2024" edition = "2024"
rust-version = "1.94" rust-version = "1.94"
description = "Collaborative Markdown notepad built with Axum, WebSockets and SQLite, PostgreSQL and MySQL" description = "Collaborative Markdown notepad built with Axum, WebSockets and SQLite, PostgreSQL and MySQL"
+31 -12
View File
@@ -7350,27 +7350,41 @@ dialog::backdrop {
scroll-margin-top: 88px; scroll-margin-top: 88px;
} }
/*
* The permalink occupies the same gutter slot as the regular source number.
* It stays invisible until the row is approached, then behaves like the
* clickable editor line number and remains visible briefly after copying.
*/
.public-content .public-permalink { .public-content .public-permalink {
position: absolute; position: absolute;
top: .08em; top: 0;
left: -1.55rem; left: var(--preview-line-left, -50px);
z-index: 3; z-index: 3;
display: inline-grid; display: block;
width: 1.25rem; width: 32px;
height: 1.25rem; height: 1.32em;
place-items: center; padding: 0 2px 0 0;
border-radius: 5px; border: 0;
color: var(--muted-2); border-radius: 4px;
font: 700 .86rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; background: transparent;
color: var(--gutter-text);
font: 400 .72rem/1.32 ui-monospace, SFMono-Regular, Consolas, monospace;
text-align: right;
text-decoration: none; text-decoration: none;
user-select: none; user-select: none;
cursor: copy;
opacity: 0; opacity: 0;
transform: translateX(3px); transform: translateX(3px);
transition: opacity .14s ease, transform .14s ease, background-color .14s ease, color .14s ease; transition: opacity .14s ease, transform .14s ease, background-color .14s ease, color .14s ease;
} }
.public-content .list-source-line > .public-permalink { .public-content .preview-source-line::before {
left: -2.35rem; transition: opacity .1s ease;
}
.public-content .preview-source-line:hover::before,
.public-content .preview-source-line:focus-within::before {
opacity: 0;
} }
.public-content .preview-source-line:hover > .public-permalink, .public-content .preview-source-line:hover > .public-permalink,
@@ -7382,7 +7396,7 @@ dialog::backdrop {
.public-content .public-permalink:hover, .public-content .public-permalink:hover,
.public-content .public-permalink:focus-visible { .public-content .public-permalink:focus-visible {
background: color-mix(in srgb, var(--accent) 16%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent);
color: var(--text); color: var(--text);
outline: none; outline: none;
} }
@@ -7391,6 +7405,7 @@ dialog::backdrop {
background: color-mix(in srgb, var(--success) 18%, transparent); background: color-mix(in srgb, var(--success) 18%, transparent);
color: var(--text); color: var(--text);
opacity: 1; opacity: 1;
transform: translateX(0);
} }
.public-content .is-public-link-target { .public-content .is-public-link-target {
@@ -7404,6 +7419,10 @@ dialog::backdrop {
opacity: .62; opacity: .62;
transform: none; transform: none;
} }
.public-content .preview-source-line::before {
opacity: 0;
}
} }
/* Per-user, per-note navigation-bar focus mode ---------------------------- */ /* Per-user, per-note navigation-bar focus mode ---------------------------- */
+2 -2
View File
@@ -152,9 +152,9 @@ function installPublicPermalinks() {
anchor.href = heading ? `#${encodeURIComponent(target.id)}` : `#L${line}`; anchor.href = heading ? `#${encodeURIComponent(target.id)}` : `#L${line}`;
anchor.dataset.line = String(line); anchor.dataset.line = String(line);
anchor.dataset.linkKind = heading ? "heading" : "line"; anchor.dataset.linkKind = heading ? "heading" : "line";
anchor.textContent = heading ? "¶" : "#"; anchor.textContent = String(line);
anchor.setAttribute("aria-label", heading ? `Copy link to heading on line ${line}` : `Copy link to line ${line}`); anchor.setAttribute("aria-label", heading ? `Copy link to heading on line ${line}` : `Copy link to line ${line}`);
anchor.title = heading ? "Copy link to this heading" : `Copy link to line ${line}`; anchor.title = heading ? `Copy link to this heading (line ${line})` : `Copy link to line ${line}`;
target.append(anchor); target.append(anchor);
}); });
} }