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 {
477 // the sealing.477 // the sealing.
478 <div class="share-link-row">478 <div class="share-link-row">
479 if let Some(url) = url {479 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>
481 <button class="quiet share-copy" type="button" data-copied-label=(t(language, Key::Copied))>(t(language, Key::CopyLink))</button>481 <button class="quiet share-copy" type="button" data-copied-label=(t(language, Key::Copied))>(t(language, Key::CopyLink))</button>
482 } else {482 } else {
483 <input class="field-input share-link-url" readonly="" value=(format!("{origin}/s/…")) aria-label=(t(language, Key::ShareLink))>483 <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(
1559 if let Some(token) = created {1559 if let Some(token) = created {
1560 <p class="field-note share-modal-note">(t(language, Key::CopyLinkOnce))</p>1560 <p class="field-note share-modal-note">(t(language, Key::CopyLinkOnce))</p>
1561 <div class="share-link-row">1561 <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>
1563 <button class="quiet share-copy" type="button" data-copied-label=(t(language, Key::Copied))>(t(language, Key::CopyLink))</button>1563 <button class="quiet share-copy" type="button" data-copied-label=(t(language, Key::Copied))>(t(language, Key::CopyLink))</button>
1564 </div>1564 </div>
1565 }1565 }
@@ -1645,7 +1645,7 @@ pub(crate) async fn share_modal(
1645 </div>1645 </div>
1646 <div class="share-link-row">1646 <div class="share-link-row">
1647 if let Some(url) = url {1647 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>
1649 <button class="quiet share-copy" type="button" data-copied-label=(t(language, Key::Copied))>(t(language, Key::CopyLink))</button>1649 <button class="quiet share-copy" type="button" data-copied-label=(t(language, Key::Copied))>(t(language, Key::CopyLink))</button>
1650 } else {1650 } else {
1651 <input class="field-input share-link-url" readonly="" value=(format!("{origin}/s/…")) aria-label=(t(language, Key::ShareLink))>1651 <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(
1666 }?))1666 }?))
1667 }1667 }
1668 1668
1669-/// The copy button's client half: one delegated listener, idempotent across1669+/// The link row's copy client: one delegated listener, idempotent across
1670-/// the modal's re-renders (the `share-modal-copy` class marks a wired row).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.
1671 pub(crate) async fn share_copy_script(cx: &Cx) -> Result {1675 pub(crate) async fn share_copy_script(cx: &Cx) -> Result {
1672 use topcoat::view::Unescaped;1676 use topcoat::view::Unescaped;
1673 const JS: &str = "\1677 const JS: &str = "\
@@ -1675,13 +1679,20 @@ pub(crate) async fn share_copy_script(cx: &Cx) -> Result {
1675 if (window.__inShareCopy) { return; } \1679 if (window.__inShareCopy) { return; } \
1676 window.__inShareCopy = true; \1680 window.__inShareCopy = true; \
1677 document.addEventListener('click', function (e) { \1681 document.addEventListener('click', function (e) { \
1678- var b = e.target.closest ? e.target.closest('.share-copy') : null; \1682+ if (!e.target || !e.target.closest) { return; } \
1679- if (!b) { return; } \1683+ var hit = e.target.closest('.share-copy, .share-link-url'); \
1680- var u = b.parentNode.querySelector('.share-link-url'); \1684+ if (!hit) { return; } \
1681- if (!u) { return; } \1685+ var row = hit.closest('.share-link-row'); \
1682- u.select(); \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+ } \
1683 var done = function () { b.textContent = b.getAttribute('data-copied-label'); }; \1694 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); } \
1685 else { try { document.execCommand('copy'); } catch (err) {} done(); } \1696 else { try { document.execCommand('copy'); } catch (err) {} done(); } \
1686 }); \1697 }); \
1687 })();";1698 })();";
crates/in-web/tests/http.rsmodified+2 -2
@@ -2197,7 +2197,7 @@ async fn created_link_is_revisible_and_copyable_everywhere() {
2197 assert_eq!(page.status, StatusCode::OK, "{}", page.text());2197 assert_eq!(page.status, StatusCode::OK, "{}", page.text());
2198 let text = page.text();2198 let text = page.text();
2199 assert!(2199 assert!(
2200- text.contains(&format!("value=\"{url}\"")),2200+ text.contains(&format!("\">{url}</p>")),
2201 "no full url in the modal: {text}"2201 "no full url in the modal: {text}"
2202 );2202 );
2203 assert!(2203 assert!(
@@ -2214,7 +2214,7 @@ async fn created_link_is_revisible_and_copyable_everywhere() {
2214 assert_eq!(page.status, StatusCode::OK, "{}", page.text());2214 assert_eq!(page.status, StatusCode::OK, "{}", page.text());
2215 let text = page.text();2215 let text = page.text();
2216 assert!(2216 assert!(
2217- text.contains(&format!("value=\"{url}\"")),2217+ text.contains(&format!("\">{url}</p>")),
2218 "no full url in settings: {text}"2218 "no full url in settings: {text}"
2219 );2219 );
2220 assert!(2220 assert!(
style/main.scssmodified+8 -3
@@ -5098,10 +5098,13 @@ div.member-row + div.member-row {
5098 .share-modal-note {5098 .share-modal-note {
5099 margin: 0 0 10px;5099 margin: 0 0 10px;
5100 }5100 }
5101-// The add-people row and the link row: input takes the room, controls pin5101+// The add-people row and the link row: the address takes the room, controls
5102-// right — one line each, like the reference design.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.
5103 .share-add {5105 .share-add {
5104 display: flex;5106 display: flex;
5107+ flex-wrap: wrap;
5105 gap: 8px;5108 gap: 8px;
5106 margin: 0 0 16px;5109 margin: 0 0 16px;
5107 5110
@@ -5170,7 +5173,9 @@ div.member-row + div.member-row {
5170 align-items: center;5173 align-items: center;
5171 margin: 6px 0 4px;5174 margin: 6px 0 4px;
5172 5175
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; }
5174 .pop-row-form { flex: none; }5179 .pop-row-form { flex: none; }
5175 }5180 }
5176 5181