diff --git a/crates/in-web/src/settings.rs b/crates/in-web/src/settings.rs index 3687ad2..d666619 100644 --- a/crates/in-web/src/settings.rs +++ b/crates/in-web/src/settings.rs @@ -477,7 +477,7 @@ async fn settings(cx: &Cx) -> Result { // the sealing.
(url.clone())
} else { diff --git a/crates/in-web/src/share.rs b/crates/in-web/src/share.rs index 8fb9669..b44cbd2 100644 --- a/crates/in-web/src/share.rs +++ b/crates/in-web/src/share.rs @@ -1559,7 +1559,7 @@ pub(crate) async fn share_modal( if let Some(token) = created {(t(language, Key::CopyLinkOnce))
(format!("{origin}/s/{token}"))
(url)
} else { @@ -1666,8 +1666,12 @@ pub(crate) async fn share_modal( }?)) } -/// The copy button's client half: one delegated listener, idempotent across -/// the modal's re-renders (the `share-modal-copy` class marks a wired row). +/// The link row's copy client: one delegated listener, idempotent across +/// re-renders (`window.__inShareCopy` guards it), so the `in:wire` morph +/// needs no per-element re-init. A click on the copy button or on the +/// wrapping link text itself copies the full address — and only where a +/// copy button is present: the masked legacy rows carry none, so their +/// placeholder can never reach a clipboard. pub(crate) async fn share_copy_script(cx: &Cx) -> Result { use topcoat::view::Unescaped; const JS: &str = "\ @@ -1675,13 +1679,20 @@ pub(crate) async fn share_copy_script(cx: &Cx) -> Result { if (window.__inShareCopy) { return; } \ window.__inShareCopy = true; \ document.addEventListener('click', function (e) { \ - var b = e.target.closest ? e.target.closest('.share-copy') : null; \ - if (!b) { return; } \ - var u = b.parentNode.querySelector('.share-link-url'); \ - if (!u) { return; } \ - u.select(); \ + if (!e.target || !e.target.closest) { return; } \ + var hit = e.target.closest('.share-copy, .share-link-url'); \ + if (!hit) { return; } \ + var row = hit.closest('.share-link-row'); \ + if (!row) { return; } \ + var b = row.querySelector('.share-copy'); \ + var u = row.querySelector('.share-link-url'); \ + if (!b || !u) { return; } \ + if (document.createRange && window.getSelection) { \ + var r = document.createRange(); r.selectNodeContents(u); \ + var s = window.getSelection(); s.removeAllRanges(); s.addRange(r); \ + } \ var done = function () { b.textContent = b.getAttribute('data-copied-label'); }; \ - if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(u.value).then(done, done); } \ + if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(u.textContent).then(done, done); } \ else { try { document.execCommand('copy'); } catch (err) {} done(); } \ }); \ })();"; diff --git a/crates/in-web/tests/http.rs b/crates/in-web/tests/http.rs index 25ea09a..7887860 100644 --- a/crates/in-web/tests/http.rs +++ b/crates/in-web/tests/http.rs @@ -2197,7 +2197,7 @@ async fn created_link_is_revisible_and_copyable_everywhere() { assert_eq!(page.status, StatusCode::OK, "{}", page.text()); let text = page.text(); assert!( - text.contains(&format!("value=\"{url}\"")), + text.contains(&format!("\">{url}")), "no full url in the modal: {text}" ); assert!( @@ -2214,7 +2214,7 @@ async fn created_link_is_revisible_and_copyable_everywhere() { assert_eq!(page.status, StatusCode::OK, "{}", page.text()); let text = page.text(); assert!( - text.contains(&format!("value=\"{url}\"")), + text.contains(&format!("\">{url}")), "no full url in settings: {text}" ); assert!( diff --git a/style/main.scss b/style/main.scss index 1ad75be..e0cf0d1 100644 --- a/style/main.scss +++ b/style/main.scss @@ -5098,10 +5098,13 @@ div.member-row + div.member-row { .share-modal-note { margin: 0 0 10px; } -// The add-people row and the link row: input takes the room, controls pin -// right — one line each, like the reference design. +// The add-people row and the link row: the address takes the room, controls +// pin right. In the add form the picker panel owns a full row of its own — +// wrap plus its 100% basis — and the access select and Share button drop to +// a right-aligned row beneath it. .share-add { display: flex; + flex-wrap: wrap; gap: 8px; margin: 0 0 16px; @@ -5170,7 +5173,9 @@ div.member-row + div.member-row { align-items: center; margin: 6px 0 4px; - .share-link-url { flex: 1; min-width: 0; color: var(--muted); } + .share-link-url { flex: 1; min-width: 0; margin: 0; color: var(--muted); } + // The wrapping value text doubles as the copy field. + .member-link-value { cursor: pointer; } .pop-row-form { flex: none; } }