diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2019-02-23 09:40:30 +0100 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2019-03-04 08:21:28 +0000 |
commit | 070f75d3b0f5313a0f486fe5c811a8e40dd97967 (patch) | |
tree | 2cf6be297de04c7e52c730298edca812af50bab9 /src/plugins/platforms/wasm/wasm_shell.html | |
parent | 607338f98feaa2561340c7ff4249d470b36d0503 (diff) |
wasm: improve clipboard fallback path
This improves handling of cut/copy/paste clipboard events,
ands allows clipboard access via the common keyboard
shortcuts.
Make the canvas be eligible for clipboard events by
setting the contenteditable attribute. Install clipboard
event handlers directly on the canvas.
Suppress Ctrl+X/C/V key event handling in the keyboard
event handler in order to make the browser generate
clipboard events. Send synthetic key events from the
clipboard event handlers to make the app copy/paste
to Qt’s clipboard at the correct time.
Access the system clipboard data using event.clipboardData.
Task-number: QTBUG-64638
Change-Id: I584b78ffa2b755b1b76e477b970255c6e5522f6a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/plugins/platforms/wasm/wasm_shell.html')
-rw-r--r-- | src/plugins/platforms/wasm/wasm_shell.html | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/platforms/wasm/wasm_shell.html b/src/plugins/platforms/wasm/wasm_shell.html index 67bfcdfbdc..110d45e036 100644 --- a/src/plugins/platforms/wasm/wasm_shell.html +++ b/src/plugins/platforms/wasm/wasm_shell.html @@ -7,7 +7,11 @@ <style> html, body { padding: 0; margin : 0; overflow:hidden; height: 100% } /* the canvas *must not* have any border or padding, or mouse coords will be wrong */ - canvas { border: 0px none; background-color: white; height:100%; width:100%; } + canvas { border: 0px none; background-color: white; height:100%; width:100%; } + /* The contenteditable property is set to true for the canvas in order to support + clipboard events. Hide the resulting focus frame and set the cursor back to + the default cursor. */ + canvas { outline: 0px solid transparent; cursor:default } </style> </head> <body onload="init()"> @@ -19,7 +23,7 @@ <noscript>JavaScript is disabled. Please enable JavaScript to use this application.</noscript> </center> </figure> - <canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas> + <canvas id="canvas" oncontextmenu="event.preventDefault()" contenteditable="true"></canvas> <script type='text/javascript'> function init() { |