From ad7042db989eb525defea9298b2b14d564498473 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 5 Jul 2023 19:39:57 +0100 Subject: js: Copy-to-clipboard support Now using the browser's "copy" operation while the focus is in the puzzle will copy the puzzle state to the clipboard. Browsers seem to have odd ideas about whate element to target with the "copy" event: Firefox targets the parent of the while Chromium targets the . To cope with these and possible future weirdness I attach the event handler to the document and then look to see if it's plausibly related to the canvas. Arguably we might want to handle a wider range of "copy" events, maybe any where the selection isn't empty. I'm not sure, though, so we'll start with the minimal change. --- cmake/platforms/emscripten.cmake | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cmake/platforms/emscripten.cmake') diff --git a/cmake/platforms/emscripten.cmake b/cmake/platforms/emscripten.cmake index b7e9c7d..e13366f 100644 --- a/cmake/platforms/emscripten.cmake +++ b/cmake/platforms/emscripten.cmake @@ -35,6 +35,9 @@ set(emcc_export_list _timer_callback # Callback from button presses in the UI outside the canvas _command + # Text-formatting for copying to clipboard + _get_text_format + _free_text_format # Game-saving and game-loading functions _get_save_file _free_save_file -- cgit v1.1