[jQuery] Re: re-establish user selection in a div with designmode=true

2009-06-07 Thread Dean
OK, now I got it to work... I needed to re-establish the range inside my ajax call. Cool. One wierd thing I did notice though is that sometimes the insertion cursor disappears. Its in the right place, its just not visible until you start to type. Thanks again for the suggestions.

[jQuery] Re: re-establish user selection in a div with designmode=true

2009-06-07 Thread Dean
Sidenote: Now this is truly weird. I commented out my code. After I reload the div I have it select all the contents of the div, like this: $('#right div.text').each(function() { window.getSelection().removeAllRanges(); var range = document.createRange();

[jQuery] Re: re-establish user selection in a div with designmode=true

2009-06-07 Thread Dean
Thanks. I took your advice and thought I had everything working nicely. Before I "update" the div my code recursively descends into the div so that I can turn a "range component" (refNode + offset) into an offset in a paragraph number. I tested this in firebug and it works fine. After the div is r

[jQuery] Re: re-establish user selection in a div with designmode=true

2009-06-05 Thread mkmanning
For FF: window.getSelection().removeAllRanges(); range = document.createRange() range.setStart(YOUR_ELEMENT, start_position); range.setEnd(YOUR_ELEMENT, end_position); //0 window.getSelection().addRange(range); For IE the equivalent is something like: get the range with document.body.createTextRa

[jQuery] Re: re-establish user selection in a div with designmode=true

2009-06-05 Thread Dean
I will try to create an example of what I am trying to do. Bear in mind that the actual manipulation is being done in javascript/jquery but I do not see the need to show the code to explain the problem. Suppose I have created a div that appears like a regular textarea (it is editable), with the ad

[jQuery] Re: re-establish user selection in a div with designmode=true

2009-06-05 Thread Gustavo Salomé
Im not sure if i get what you want to do but try this: $div=$('#div'); div.data('old',div.html()); 2009/6/5 dhoover > > I have a web app where I have created a div to masquerade at a > textarea so I can add highlighting according to so rules. I rely on > setting designmode=true. After certain am