fix(web): allow copying text in photo viewer (#9705)

* fix(web): allow copying text in photo viewer

* use default browser copy

* revert changes

* fix lint
This commit is contained in:
Lukas 2024-05-24 10:56:36 +02:00 committed by GitHub
parent 69b5eb005f
commit b3b258f32f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -120,10 +120,11 @@
forceLoadOriginal = state.currentZoom > 1 && isWebCompatibleImage(asset) ? true : false;
});
const onCopyShortcut = () => {
const onCopyShortcut = (event: KeyboardEvent) => {
if (window.getSelection()?.type === 'Range') {
return;
}
event.preventDefault();
handlePromiseError(doCopy());
};
</script>
@ -132,8 +133,8 @@
on:copyImage={doCopy}
on:zoomImage={doZoomImage}
use:shortcuts={[
{ shortcut: { key: 'c', ctrl: true }, onShortcut: onCopyShortcut },
{ shortcut: { key: 'c', meta: true }, onShortcut: onCopyShortcut },
{ shortcut: { key: 'c', ctrl: true }, onShortcut: onCopyShortcut, preventDefault: false },
{ shortcut: { key: 'c', meta: true }, onShortcut: onCopyShortcut, preventDefault: false },
]}
/>
{#if imageError}