I'm experiencing the same problem... Makes it hard to create Add-ons that allow for insertion of text at the user's cursor position within the UI, something that has many use cases...
On Tuesday, September 11, 2012 12:00:05 PM UTC-4, [email protected] wrote: > > Status: New > Owner: ---- > Labels: Type-Defect Priority-Medium > > New issue 1521 by [email protected]: Why can't I use jQuery to > > select text in a TextArea or get the cursor position? > http://code.google.com/p/google-caja/issues/detail?id=1521 > > What revision of the cajoler exhibits the problem? On what browser and > OS? > > Caja Playground > Google Caja. Copyright (C) 2011, Google Inc. Rev 5002 built on 2012-08-02 > > 14:58:24. > (http://caja.appspot.com/) > > Chrome 21.0.1180.89 > Windows 7, Home Premium > > To do this test, I used RangyInputs... RangyInputs is a small > cross-browser > JavaScript library for obtaining and manipulating selections within > <textarea> and <input type="text"> HTML elements. > (http://code.google.com/p/rangyinputs/) > > What steps will reproduce the problem? > > 1. Copy the attached HTML into the Caja playground. > 2. Cajole it. > 3. See the server error 500. > > What is the expected output? What do you see instead? > > I expect to see a page like the RangyInputs demo page, where I can type > into a TextArea and manipulate it. > (http://rangyinputs.googlecode.com/svn/trunk/demos/textinputs_jquery.html) > > > Instead, I see a server error 500. > > Please provide any additional information below. > > I've added RangyInputs into Apps Script applications as well, where I can > > see more feed back from the server. I get the following message, which I > assume you'll see in your logs as well. > > TextInputs module for Rangy not supported in your browser. > Reason: No means of finding text input caret position > > So, why is the caret position (or even "selected text") being blocked by > Caja? > > Thanks in advance for your feedback on this issue. > > ++++++++++++ > > <html> > <head> > <title>Rangyinputs jQuery plugin demo</title> > <script type="text/javascript" > src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> > > > <script type="text/javascript" > src="http://rangyinputs.googlecode.com/files/textinputs_jquery.js"></script> > > <style type="text/css"> > p.inputcontainer { > background-color: lightgoldenrodyellow; > border: solid 1px darkblue; > padding: 0.3125em; > } > </style> > </head> > <body> > <h1>Rangy Text Inputs jQuery Demo</h1> > > <br><br> > > <p class="inputcontainer"> > <input type="button" class="unselectable" value="get selection range" > onmousedown="var sel = $('#ta').getSelection(); > alert(sel.start > + ',' + sel.end);"> > > <input type="button" class="unselectable" value="paste test text" > onmousedown="$('#ta').replaceSelectedText('**Test**')"> > > <input type="button" class="unselectable" value="extract selected > text" > onmousedown="alert($('#ta').extractSelectedText())"> > > <input type="button" class="unselectable" value="surround selected > text" > > onmousedown="$('#ta').surroundSelectedText('[Before]', '[After]', true); > $('#ta').focus()"> > > <input type="button" class="unselectable" value="replace selected > text" > onmousedown="$('#ta').replaceSelectedText('[Replacement > text]'); > $('#ta').focus()"> > > <input type="button" class="unselectable" value="collapse to start" > onmousedown="$('#ta').collapseSelection(true); > $('#ta').focus()"> > > <input type="button" class="unselectable" value="collapse to end" > onmousedown="$('#ta').collapseSelection(false); > $('#ta').focus()"> > > <input type="button" class="unselectable" value="set selection" > onmousedown="$('#ta').setSelection(+$('#ta_start')[0].value, > +$('#ta_end')[0].value); $('#ta').focus()"> > > Start: <input type="text" id="ta_start" size="3" value="5"> > End: <input type="text" id="ta_end" size="3" value="7"> > > <br><br> > <textarea rows="15" cols="80" id="ta">Some test text > That has > > Some line breaks, including some trailing ones > > > </textarea> > </p> > </body> > </html> > > -- --- You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
