From a1d2209fc7260e765d0843e61632bfde5ab3511a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 9 Oct 2022 15:25:42 +0530 Subject: [PATCH] E-book viewer: Fix copy to clipboard not ignoring text from elements that are marked as non user selectable. Fixes #1991504 [Copy text does not respect user-select: none](https://bugs.launchpad.net/calibre/+bug/1991504) Apparently the bug in webengine where it does not copy HTML to the clipbaord is no more, so we can go back to relying on the native copy which does exclude such text automatically. --- src/pyj/read_book/iframe.pyj | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pyj/read_book/iframe.pyj b/src/pyj/read_book/iframe.pyj index 4bd81a7a63..dd627b823e 100644 --- a/src/pyj/read_book/iframe.pyj +++ b/src/pyj/read_book/iframe.pyj @@ -951,12 +951,11 @@ class IframeBoss: select_crw(crw) def copy_selection(self): - if not runtime.is_standalone_viewer: - try: - if document.execCommand('copy'): - return - except: - pass + try: + if document.execCommand('copy'): + return + except: + pass s = window.getSelection() text = s.toString()