forge
Explore
Log in

Don't you dare go Hollow

the share link stops hiding: the live row shows the whole address as wrapping text (the family's member-link shape, no more clipped one-line field) and one click on it — or the button — puts the exact URL on the clipboard, while a legacy row, whose address is gone by design, keeps its masked field and stays unclickable so nothing useless lands on the clipboard; the people picker stretches to the modal's full width with the permission select and Share button on their own right-aligned row below, instead of a left-pinned panel with controls floating beside it — one flex-wrap was the whole difference

Browse files at this commit

e90391d53d28bef04e56557f7502c22bc01b02baAhmet Kaan GümüşParent: 48c1deb
crates/in-web/src/settings.rsmodified+1 -1
@@ -477,7 +477,7 @@ async fn settings(cx: &Cx) -> Result {
477477 // the sealing.
478478 <div class="share-link-row">
479479 if let Some(url) = url {
480- <input class="field-input share-link-url" readonly="" value=(url.clone()) aria-label=(t(language, Key::ShareLink))>
480+ <p class="member-link-value share-link-url" aria-label=(t(language, Key::ShareLink))>(url.clone())</p>
481481 <button class="quiet share-copy" type="button" data-copied-label=(t(language, Key::Copied))>(t(language, Key::CopyLink))</button>
482482 } else {
483483 <input class="field-input share-link-url" readonly="" value=(format!("{origin}/s/…")) aria-label=(t(language, Key::ShareLink))>
crates/in-web/src/share.rsmodified+21 -10
@@ -1559,7 +1559,7 @@ pub(crate) async fn share_modal(
15591559 if let Some(token) = created {
15601560 <p class="field-note share-modal-note">(t(language, Key::CopyLinkOnce))</p>
15611561 <div class="share-link-row">
1562- <input class="field-input share-link-url" readonly="" value=(format!("{origin}/s/{token}")) aria-label=(t(language, Key::ShareLink))>
1562+ <p class="member-link-value share-link-url" aria-label=(t(language, Key::ShareLink))>(format!("{origin}/s/{token}"))</p>
15631563 <button class="quiet share-copy" type="button" data-copied-label=(t(language, Key::Copied))>(t(language, Key::CopyLink))</button>
15641564 </div>
15651565 }
@@ -1645,7 +1645,7 @@ pub(crate) async fn share_modal(
16451645 </div>
16461646 <div class="share-link-row">
16471647 if let Some(url) = url {
1648- <input class="field-input share-link-url" readonly="" value=(url) aria-label=(t(language, Key::ShareLink))>
1648+ <p class="member-link-value share-link-url" aria-label=(t(language, Key::ShareLink))>(url)</p>
16491649 <button class="quiet share-copy" type="button" data-copied-label=(t(language, Key::Copied))>(t(language, Key::CopyLink))</button>
16501650 } else {
16511651 <input class="field-input share-link-url" readonly="" value=(format!("{origin}/s/…")) aria-label=(t(language, Key::ShareLink))>
@@ -1666,8 +1666,12 @@ pub(crate) async fn share_modal(
16661666 }?))
16671667 }
16681668
1669-/// The copy button's client half: one delegated listener, idempotent across
1670-/// the modal's re-renders (the `share-modal-copy` class marks a wired row).
1669+/// The link row's copy client: one delegated listener, idempotent across
1670+/// re-renders (`window.__inShareCopy` guards it), so the `in:wire` morph
1671+/// needs no per-element re-init. A click on the copy button or on the
1672+/// wrapping link text itself copies the full address — and only where a
1673+/// copy button is present: the masked legacy rows carry none, so their
1674+/// placeholder can never reach a clipboard.
16711675 pub(crate) async fn share_copy_script(cx: &Cx) -> Result {
16721676 use topcoat::view::Unescaped;
16731677 const JS: &str = "\
@@ -1675,13 +1679,20 @@ pub(crate) async fn share_copy_script(cx: &Cx) -> Result {
16751679 if (window.__inShareCopy) { return; } \
16761680 window.__inShareCopy = true; \
16771681 document.addEventListener('click', function (e) { \
1678- var b = e.target.closest ? e.target.closest('.share-copy') : null; \
1679- if (!b) { return; } \
1680- var u = b.parentNode.querySelector('.share-link-url'); \
1681- if (!u) { return; } \
1682- u.select(); \
1682+ if (!e.target || !e.target.closest) { return; } \
1683+ var hit = e.target.closest('.share-copy, .share-link-url'); \
1684+ if (!hit) { return; } \
1685+ var row = hit.closest('.share-link-row'); \
1686+ if (!row) { return; } \
1687+ var b = row.querySelector('.share-copy'); \
1688+ var u = row.querySelector('.share-link-url'); \
1689+ if (!b || !u) { return; } \
1690+ if (document.createRange && window.getSelection) { \
1691+ var r = document.createRange(); r.selectNodeContents(u); \
1692+ var s = window.getSelection(); s.removeAllRanges(); s.addRange(r); \
1693+ } \
16831694 var done = function () { b.textContent = b.getAttribute('data-copied-label'); }; \
1684- if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(u.value).then(done, done); } \
1695+ if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(u.textContent).then(done, done); } \
16851696 else { try { document.execCommand('copy'); } catch (err) {} done(); } \
16861697 }); \
16871698 })();";
crates/in-web/tests/http.rsmodified+2 -2
@@ -2197,7 +2197,7 @@ async fn created_link_is_revisible_and_copyable_everywhere() {
21972197 assert_eq!(page.status, StatusCode::OK, "{}", page.text());
21982198 let text = page.text();
21992199 assert!(
2200- text.contains(&format!("value=\"{url}\"")),
2200+ text.contains(&format!("\">{url}</p>")),
22012201 "no full url in the modal: {text}"
22022202 );
22032203 assert!(
@@ -2214,7 +2214,7 @@ async fn created_link_is_revisible_and_copyable_everywhere() {
22142214 assert_eq!(page.status, StatusCode::OK, "{}", page.text());
22152215 let text = page.text();
22162216 assert!(
2217- text.contains(&format!("value=\"{url}\"")),
2217+ text.contains(&format!("\">{url}</p>")),
22182218 "no full url in settings: {text}"
22192219 );
22202220 assert!(
style/main.scssmodified+8 -3
@@ -5098,10 +5098,13 @@ div.member-row + div.member-row {
50985098 .share-modal-note {
50995099 margin: 0 0 10px;
51005100 }
5101-// The add-people row and the link row: input takes the room, controls pin
5102-// right — one line each, like the reference design.
5101+// The add-people row and the link row: the address takes the room, controls
5102+// pin right. In the add form the picker panel owns a full row of its own —
5103+// wrap plus its 100% basis — and the access select and Share button drop to
5104+// a right-aligned row beneath it.
51035105 .share-add {
51045106 display: flex;
5107+ flex-wrap: wrap;
51055108 gap: 8px;
51065109 margin: 0 0 16px;
51075110
@@ -5170,7 +5173,9 @@ div.member-row + div.member-row {
51705173 align-items: center;
51715174 margin: 6px 0 4px;
51725175
5173- .share-link-url { flex: 1; min-width: 0; color: var(--muted); }
5176+ .share-link-url { flex: 1; min-width: 0; margin: 0; color: var(--muted); }
5177+ // The wrapping value text doubles as the copy field.
5178+ .member-link-value { cursor: pointer; }
51745179 .pop-row-form { flex: none; }
51755180 }
51765181