diff options
| author | Even Oscar Andersen <even.oscar.andersen@qt.io> | 2025-04-24 06:37:52 +0200 |
|---|---|---|
| committer | Even Oscar Andersen <even.oscar.andersen@qt.io> | 2025-04-29 06:39:42 +0200 |
| commit | a27bc0a70db3d1f16ba3347ca08173018f4c5138 (patch) | |
| tree | 0bae62d7345a04a2a3f3e9c6d70f3ce94d38a75c /src/plugins/platforms/wasm/qwasmclipboard.cpp | |
| parent | 6f67925799407216b999709d86ac180c1106fa9e (diff) | |
wasm: Make sure typing with window focus does not produce characters
contenteditable on the window caused characters to be inserted.
Instead create a div as a child element, and set contenteditable
on that.
Fixes: QTBUG-136050
Change-Id: I4ccf3589ea19876f68bb9c7077c3a13ae5f989e6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmclipboard.cpp')
| -rw-r--r-- | src/plugins/platforms/wasm/qwasmclipboard.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/platforms/wasm/qwasmclipboard.cpp b/src/plugins/platforms/wasm/qwasmclipboard.cpp index e5392f33cd7..ff681398315 100644 --- a/src/plugins/platforms/wasm/qwasmclipboard.cpp +++ b/src/plugins/platforms/wasm/qwasmclipboard.cpp @@ -86,6 +86,20 @@ void QWasmClipboard::paste(val event) QWasmIntegration::get()->getWasmClipboard()->sendClipboardData(event); } +void QWasmClipboard::beforeInput(emscripten::val event) +{ + event.call<void>("preventDefault"); + event.call<void>("stopPropagation"); +} + +void QWasmClipboard::input(emscripten::val event) +{ + event.call<void>("preventDefault"); + event.call<void>("stopPropagation"); + event["target"].set("innerHTML", std::string()); + event["target"].set("value", std::string()); +} + QWasmClipboard::QWasmClipboard() { val clipboard = val::global("navigator")["clipboard"]; |
