Fix Citation modal responsiveness and clipboard copy (#29799)

The modal was broken in two ways:

- On small screens, the input box was partially hanging outside the
modal. Fixed with flexbox and increased modal width.
- The clipboard copy was not working because the modal had both
`data-clipboard-text` and `data-clipboard-target`, while we only support
one of those. Made a small tweak in clipboard as well so that it will
still fall back to target if text is empty.

(cherry picked from commit 94512ee0628dc0d2b697441a4355ace54b6515cd)
This commit is contained in:
silverwind 2024-03-15 03:38:13 +01:00 committed by Earl Warren
parent 5a16c9d9c0
commit ca39d74363
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
4 changed files with 12 additions and 20 deletions

View file

@ -15,10 +15,8 @@ export function initGlobalCopyToClipboardListener() {
e.preventDefault();
let text;
if (target.hasAttribute('data-clipboard-text')) {
text = target.getAttribute('data-clipboard-text');
} else {
let text = target.getAttribute('data-clipboard-text');
if (!text) {
text = document.querySelector(target.getAttribute('data-clipboard-target'))?.value;
}