<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-01-04 21:51 GMT+01:00 Bert Freudenberg <span dir="ltr"><<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br>On 03.01.2016, at 14:32, Nicolai Hess <<a href="mailto:nicolaihess@gmail.com" target="_blank">nicolaihess@gmail.com</a>> wrote:<br>
><br>
> Hi Bert,<br>
><br>
> following observation:<br>
><br>
> in squeak.js,<br>
> document.onkeypress = function(evt) {<br>
> if (!display.vm) return true;<br>
> // check for ctrl-x/c/v/r<br>
> if (/[CXVR]/.test(String.fromCharCode(evt.charCode + 64)))<br>
><br>
> this test never holds (at least not with firefox on windows).<br>
> The charCode is always the same, regardless whether ctrl-key is pressed or not, so it always handles those<br>
> shortcuts as squeak-shortcuts (ctrl+v is handled as "paste author initials", not as "paste text to browser window")<br>
> (this is not an issue for chrome, because it does not use keypress, but the keydown events for cut&paste)<br>
><br>
> changing this to<br>
><br>
> if (evt.ctrlKey && /[cxvr]/.test(String.fromCharCode(evt.charCode)))<br>
> makes it working.<br>
><br>
> another issue is, that in firefox on windows, the "paste event" is never fired for non-editable htmlelements (it works for textareas and inputfields).<br>
> But we can make the whole document "editable" with<br>
> document.body.contentEditable = true<br>
> (maybe it is enough to do this for the canvas elemement).<br>
><br>
> with this changes, copy , cut & paste are working in firefox (only tested on windows).<br>
<br>
We may have to make this browser-dependent :(<br></blockquote><div><br></div><div>I was afraid of that. <br></div><div>Maybe this "trick" will work:<br><br><a href="http://andrewduthie.com/2015/08/29/capturing-a-paste-event-in-firefox/" target="_blank">http://andrewduthie.com/2015/08/29/capturing-a-paste-event-in-firefox/</a><br></div><div>adding somewhere a nonvisible div area with contentEditable=true.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
If we make the canvas content-editable then on iOS the browser will zoom into the canvas as soon as you tap it … which OTOH may not be worse than what we have now (but I do remember some problem which led me to disabling it again).<br>
<br>
Fabio started working on real keyboard support for touch devices but it’s not finished yet, see <a href="https://github.com/bertfreudenberg/SqueakJS/pull/42" rel="noreferrer" target="_blank">https://github.com/bertfreudenberg/SqueakJS/pull/42</a><br></blockquote><div><br></div><div>looks interesting.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
- Bert -<br>
<br>
<br>
<br>
<br></blockquote></div><br></div></div>