Fix clipboard functionality in web version using Web Clipboard API #2471
+164
−1,341
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes the clipboard functionality in the web version of ImHex by implementing proper Web Clipboard API integration for Emscripten builds.
Problem
Issue #2465 reported that users are unable to paste content in the web version of ImHex. This is because the standard clipboard operations don't work in web browsers without proper Web Clipboard API integration.
Solution
WebClipboardclass for handling clipboard operations in web buildsnavigator.clipboard.writeText()for copyingnavigator.clipboard.readText()for pastingFiles Changed
lib/libimhex/include/hex/helpers/web_clipboard.hpp- Header for web clipboard functionalitylib/libimhex/source/helpers/web_clipboard.cpp- Implementation using Web Clipboard APIweb_clipboard_integration.patch- Integration patch for window.cppTesting
The implementation:
navigator.clipboardavailabilityBrowser Compatibility
Fixes #2465