simon-git: puzzles (main): Ben Harris

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Wed Jul 5 21:24:40 BST 2023


TL;DR:
  ad7042d js: Copy-to-clipboard support

Repository:     https://git.tartarus.org/simon/puzzles.git
On the web:     https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer:      Ben Harris <bjh21 at bjh21.me.uk>
Date:           2023-07-05 21:24:40

commit ad7042db989eb525defea9298b2b14d564498473
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=ad7042db989eb525defea9298b2b14d564498473;hp=c8cc4a5f387774c35e3e8f924d4200c0908c9d5a
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date:   Wed Jul 5 19:39:57 2023 +0100

    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 <canvas> while Chromium targets the
    <body>.  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 +++
 emcc.c                           | 12 ++++++++++++
 emccpre.js                       | 20 ++++++++++++++++++++
 3 files changed, 35 insertions(+)



More information about the tartarus-commits mailing list