- Apr 1, 2008rsewar2 --
You should look at this from another angle.
Before you have them click the upload button, add the placeholder element to the editor before the upload.
Then you have a reference to the element that was inserted, after the upload is done all you have to do is mod the element that was created before the upload..
Similar to the way the Insert Image button works..
Does that make sense?
+ Windows: n. - The most successful computer virus, ever. +
+ A computer without a Microsoft operating system is like a dog
without bricks tied to its head +
+ A Microsoft Certified Systems Engineer is to computing what a
McDonalds Certified Food Specialist is to fine cuisine +
----- Original Message ----
From: rsewar2 <rsewar2@...>
Sent: Tuesday, April 1, 2008 4:11:39 AM
I'm using the editor as part of a small CMS I'm putting together. I've
added a file input element to the page. When a user selects a file, it
is uploaded to our server via AJAX, and a link to the file is returned
which gets inserted into the editor (using the execCommand
insertHTML). This works fine, except that in IE7, when the user clicks
the file input's 'browse' button, the cursor position in the text
editor is lost and the link just gets added to the beginning of the
text, rather than at the last place in the editor that the user clicked.
Looking through the editor's .js file, I see that there are private
functions such as '_getselection' and '_getrange' that have obviously
have had a lot of time spent on them to make them cross-browser
compatible. I'm thinking of using one of these as part of a
'getCursorPosition' function, which I can use to record the cursor
position before it gets lost.
Does this sound do-able, and am I going about this the right way? Can
you give me any pointers to get started, or is there already a
function which does something similar that I've not noticed?
Thanks for your help!
Yahoo! Groups Links
- << Previous post in topic