libreoffice-online/browser/js
Miklos Vajna a161ee30f4 cool#9072 browser: better error handling when navigator.clipboard.write is advertised but fails
In case an integration doesn't allow clipboard interaction via
<https://sdk.collaboraonline.com/docs/advanced_integration.html#allow-the-clipboard-permission-query>,
we end up in a situation where navigator.clipboard.write is not
undefined, but is broken.

By the time navigator.clipboard.write() fails, it's too late to fall
back to the old copy code, as the security context is already gone.

Fix the problem by improving the failure handling: show the popup to try
again copying, remember that navigator.clipboard.write() failed and
prefetch the text selection, so next time a copy is tried (via the
keyboard), the selection doesn't need re-creating. (Normally the
selection change would trigger the prefetch, so select->copy->copy-again
would still fail.)

Note that paste doesn't have a similar problem, since there we always
try the old paste code first, and only use the new paste code if the old
one fails.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I12ea4810395970421000d213744d1838213c7a07
2024-05-21 09:47:54 +01:00
..
Autolinker.js
global.js cool#9072 browser: better error handling when navigator.clipboard.write is advertised but fails 2024-05-21 09:47:54 +01:00
l10n.js
ResizeObserverPolyfill.js Revert "Remove unused file." 2024-02-26 10:49:31 -05:00
sanitize-url.js
select2.js