I need to read cursor position and selection length in RichTextArea.
Any suggestions how to do this?
On Oct 8, 2:49 pm, "efreetm...@gmail.com" <efreetm...@gmail.com>
wrote:
*99% GWT, 1% JSNI
Good work ..
I am also interested in doing suck kind of think.If you want any help
let me know
thanks
On Oct 9, 3:50 am, Axel Kittenberger <axe...@gmail.com> wrote:
> While there is possible JSNI browser interface to determine a
> selection, AFAIK the browser generally don't provide an interface to
> get much of the cursor information. Firfox maybe has some XUL commands
> for this, but thats it. Nevertheless I will seize the opportunity plug
> my project AceArea --http://code.google.com/p/acearea/-- it's an
public native int getSelectionStart(Element elem)/*-{
return
elem.contentWindow.getSelection().getRangeAt(0).startOffset;
}-*/;
public native int getSelectionLength(Element elem)/*-{
return
elem.contentWindow.getSelection().getRangeAt(0).toString().length;
}-*/;
public native int getSelectionStartNode(Element elem)/*-{
var
node=elem.contentWindow.getSelection().getRangeAt(0).startContainer;
if(node.parentNode.nodeName != 'BODY')
{
node = node.parentNode;
}
var nodes = node.parentNode.childNodes;
i = 0;
while(node.previousSibling != null)
{
node = node.previousSibling;
i++;
}
return i;
}-*/;
On Oct 9, 2:46 pm, "efreetm...@gmail.com" <efreetm...@gmail.com>
wrote:
I realize its difficult to drop into a alpha-status project, as oposed
to this in release state projects you normally start by using it, and
enhancing it for a specific need. Also its not my style to tell anyone
what to do, there are just so many things to change/enhance, in fact a
friend of mine every week he comes with another idea whats now
possible to do with this widget, what wasn't possible before. Right
now I'm working on block/selection/copy/paste/clipboard support,
together with an undo/redo machanism its IMHO the last step to be a
useful text editor at least.
Also important to note what I'm proud of, altough a monospaced font is
now default, is it works not only with monospaced fonts but also with
dynamic ones.
Things on the general TOWISH list are:
* Opera support (right now only the issues with Firefox and IE are
handled, I chose these 2 as the majority of the market, and not
depending on any browser specific enhancements)
* Safari support, I I have not right now easy access to a safari
browser, and well other reasons see opera.
* RichText support:
** Bold, Italic, Colored fonts, Links, Other font style/size etc.
** Table editing
** Inline picture support
on the other side than the WYSIWYG path is:
* a syntax highliting for diverse languages like java/javascript/c/
etc.
* spellchecking. Obviously we can't expect the client to hold the
dictionary, so a AJAX mechanism would make sense, having the server
checking spelling in background.
* Exception handling: bad stuff happens, it would be wishable to catch
all exceptions, and provide the user a feedback, why the application
stopped working properly, and having an option to try to retrieve his
work in progress.
* Integration of AceArea in wikipedia as user script
* optimize the cursor position finding algorithmn
and so on, generally I take "customizeable" seriously and constructed
the whole thing with an internal message handling, so it should be
able for users to extend without having to change the widget code
itself, however its alway possible to do so! As possible extensions I
have my own "big picture" of e.g. collaberative editing, wiki
integration in the editor etc.
also I try to take documentation seriously, starting with trying to do
good source code comments. There isn't yet a "big picture"
documentation, but if you don't understand something I gladly expalin
it, and use the opportunity to document it at the same moment.
On Oct 9, 7:30 am, param <singh.prab...@gmail.co> wrote:
> Hi Alex,
>
> Good work ..
> I am also interested in doing suck kind of think.If you want any help
> let me know
>
> thanks
>
> On Oct 9, 3:50 am, Axel Kittenberger <axe...@gmail.com> wrote:
>
> > While there is possible JSNI browser interface to determine a
> > selection, AFAIK the browser generally don't provide an interface to
> > get much of the cursor information. Firfox maybe has some XUL commands
> > for this, but thats it. Nevertheless I will seize the opportunity plug
> > my project AceArea --http://code.google.com/p/acearea/--it's an
> > editor completly* writen in GWT, that does not use the browser
> > internal editor like almost all the editors including RichTextArea do,
> > but implements it all in javascript, this gives the coder absolute
> > control. However while it has gone a far way, and even is already
> > useable enough for me to use it myself, I cannot recommend it yet in a
> > production environment nor are RichText elements like bold, italics,
> > yet implemented....
>
> > *99% GWT, 1% JSNI
>
> > On Oct 8, 10:57 pm, s4nTuZz0 <squattr...@gmail.com> wrote:
>
> > > Hi, i'm interested to your same questions. i've spent a lot of time
> > > above, unsuccesfully. anyone can give us any help ? :-) thanks.
>
> > > On Oct 8, 2:49 pm, "efreetm...@gmail.com" <efreetm...@gmail.com>
> > > wrote:
>
> > > > Hey,
>
> > > > I need to read cursor position and selection length in RichTextArea.
> > > > Any suggestions how to do this?d
Because:
1) I have very limited knowledge on javascript.
2) I need to know the selection start relating to the document and not
the node (startContainer).
I would be very happy if you could show me simpler way of doing this..
On Oct 9, 3:30 pm, Axel Kittenberger <axe...@gmail.com> wrote:
> Things on the general TOWISH list are:
> .............
> * Safari support, I I have not right now easy access to a safari
> browser, and well other reasons see opera.
you're probably on Windows machine so you can use Safari 3.0 beta for
Windows and WebKit nightly builds:
http://nightly.webkit.org/
I'm using it for testing on Windows machine when I'm off of my mac
(WebKit has really decent inspector tool you could find useful to gif
your html layout and other things at runtime),
regards,
Peter
On Oct 10, 1:31 am, Peter Blazejewicz <peter.blazejew...@gmail.com>
wrote: