File tree 3 files changed +7
-5
lines changed
3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ const HUD = {
36
36
this . hudUI . toggleIframeElementClasses ( "vimiumUIComponentHidden" , "vimiumUIComponentVisible" ) ;
37
37
// Force the re-computation of styles, so Chrome sends a visibility change message to the child frame.
38
38
// See https://github.com/philc/vimium/pull/3277#issuecomment-487363284
39
+
40
+ // Allow to access the clipboard through iframes.
41
+ this . hudUI . iframeElement . allow = "clipboard-read" ;
39
42
getComputedStyle ( this . hudUI . iframeElement ) . display ;
40
43
} else {
41
44
this . hudUI . toggleIframeElementClasses ( "vimiumClickable" , "vimiumNonClickable" ) ;
Original file line number Diff line number Diff line change @@ -20,12 +20,11 @@ const Clipboard = {
20
20
} ,
21
21
22
22
// Returns a string representing the clipboard contents. Supports rich text clipboard values.
23
- paste ( ) {
23
+ async paste ( ) {
24
24
const textArea = this . _createTextArea ( "div" ) ; // Use a <div> so Firefox pastes rich text.
25
25
document . body . appendChild ( textArea ) ;
26
26
textArea . focus ( ) ;
27
- document . execCommand ( "Paste" ) ;
28
- const value = textArea . innerText ;
27
+ const value = await navigator . clipboard . readText ( ) ;
29
28
document . body . removeChild ( textArea ) ;
30
29
// When copying characters, they get converted to \xa0. Convert to space instead. See #2217.
31
30
return value . replace ( / \xa0 / g, " " ) ;
Original file line number Diff line number Diff line change @@ -153,9 +153,9 @@ const handlers = {
153
153
} ,
154
154
155
155
pasteFromClipboard ( ) {
156
- Utils . setTimeout ( TIME_TO_WAIT_FOR_IPC_MESSAGES , function ( ) {
156
+ Utils . setTimeout ( TIME_TO_WAIT_FOR_IPC_MESSAGES , async function ( ) {
157
157
const focusedElement = document . activeElement ;
158
- const data = Clipboard . paste ( ) ;
158
+ const data = await Clipboard . paste ( ) ;
159
159
if ( focusedElement != null )
160
160
focusedElement . focus ( ) ;
161
161
window . parent . focus ( ) ;
You can’t perform that action at this time.
0 commit comments