<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">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;</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 &lt;<a href="mailto:nicolaihess@gmail.com" target="_blank">nicolaihess@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi Bert,<br>
&gt;<br>
&gt; following observation:<br>
&gt;<br>
&gt; in squeak.js,<br>
&gt;     document.onkeypress = function(evt) {<br>
&gt;         if (!display.vm) return true;<br>
&gt;         // check for ctrl-x/c/v/r<br>
&gt;         if (/[CXVR]/.test(String.fromCharCode(evt.charCode + 64)))<br>
&gt;<br>
&gt; this test never holds (at least not with firefox on windows).<br>
&gt; The charCode is always the same, regardless whether ctrl-key is pressed or not, so it always handles those<br>
&gt; shortcuts as squeak-shortcuts (ctrl+v is handled as &quot;paste author initials&quot;, not as &quot;paste text to browser window&quot;)<br>
&gt; (this is not an issue for chrome, because it does not use keypress, but the keydown events for cut&amp;paste)<br>
&gt;<br>
&gt; changing this to<br>
&gt;<br>
&gt;         if (evt.ctrlKey &amp;&amp; /[cxvr]/.test(String.fromCharCode(evt.charCode)))<br>
&gt; makes it working.<br>
&gt;<br>
&gt; another issue is, that in firefox on windows, the &quot;paste event&quot; is never fired for non-editable htmlelements (it works for textareas and inputfields).<br>
&gt; But we can make the whole document &quot;editable&quot; with<br>
&gt; document.body.contentEditable = true<br>
&gt; (maybe it is enough to do this for the canvas elemement).<br>
&gt;<br>
&gt; with this changes, copy , cut &amp; 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 &quot;trick&quot; 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>