Loading ...
Sorry, an error occurred while loading the content.

20379Re: YUI RTE does not get Selection in IE7

Expand Messages
  • rballou05
    Nov 2, 2007
    • 0 Attachment
      _createCurrentElement will pop the current selection into
      myEditor.currentElement[0]

      So you can send that back to the server using AJAX.

      Rob

      --- In ydn-javascript@yahoogroups.com, "merahul94538"
      <merahul94538@...> wrote:
      >
      > Rob,
      >
      > Thanks for responding.
      > Yeah, I figured that it is an object of type 'Text'
      > but I don't want the the whole text out of textartea, just the
      > selection.
      >
      > I looked at the example that Dav Glass provided but I believe I am
      > too new ot JS to understand to make it work. I spent time on it but
      > IE is not cooperating. I see that you struggled with similar thing in
      > past, I would appreciate if you can provide some pointers.
      > --- In ydn-javascript@yahoogroups.com, "rballou05" <rob.ballou@>
      > wrote:
      > >
      > > Both Firefox and IE return a selection object -- the difference is
      > > that Firefox has a handy toString() method which makes it look like
      > > the selection you received is a string. Run typeof() on it and you
      > > will see that they both return "object".
      > >
      > > That said, if you want to save everything you put into the editor,
      > you
      > > want to actually do this:
      > >
      > > myEditor.saveHTML()
      > >
      > > That will put the HTML back into the textarea that is associated
      > with
      > > the editor. Then you can use:
      > >
      > > myEditor.get('textarea').value
      > >
      > > To get the whole value of the textarea.
      > >
      > > If you actually want to get what is selected in the editor, I would
      > > look at this example provided by Dav Glass:
      > > http://blog.davglass.com/files/yui/editor6/
      > >
      > > Rob
      > >
      > > --- In ydn-javascript@yahoogroups.com, "merahul94538"
      > > <merahul94538@> wrote:
      > > >
      > > > Sorry for the confusion.
      > > >
      > > > Second point is correct
      > > >
      > > > User types some text in RTE, hit a button 'Save data',Then Save
      > Data
      > > > button OnClick will trigger a Javascript code, which gets
      > Selected
      > > > text from RTE. Once the text is received, then I save it to DB
      > with
      > > > AJAX.
      > > >
      > > > myEditor._getSelection() works for me in firefox and returns me
      > > > actual text selected. but IE7 returns me the object.
      > > > I just need selected text in IE as well.
      > > >
      > > > Thanks
      > > >
      > > >
      > > > --- In ydn-javascript@yahoogroups.com, dav.glass@ wrote:
      > > > >
      > > > > merahul94538 --
      > > > >
      > > > > I must be missing what you are trying to do.. Your first
      > message
      > > > said:
      > > > > "I am trying to get the selected text from RTE when a 'Select
      > > > Text' link is clicked. "
      > > > >
      > > > > Your next message says:
      > > > > "User types some text in RTE, hit a button top 'Save data',
      > after
      > > > that I need to get the selected text in RTE and save in the
      > system."
      > > > >
      > > > > I'm not sure what it is you are trying to do..
      > > > >
      > > > > Can you post an example that shows what you are trying to
      > > > accomplish?
      > > > >
      > > > > Dav
      > > > >
      > > > >
      > > > > Dav Glass
      > > > > dav.glass@
      > > > > blog.davglass.com
      > > > >
      > > > > + 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: merahul94538 <merahul94538@>
      > > > > To: ydn-javascript@yahoogroups.com
      > > > > Sent: Tuesday, October 30, 2007 9:47:39 PM
      > > > > Subject: [ydn-javascript] Re: YUI RTE does not get Selection in
      > IE7
      > > > >
      > > > >
      > > > > Thanks
      > > > > I looked at the example and was not able to figure out
      > anything.
      > > > > I am noobie to javascript so most probably I am doing anything
      > > > wrong.
      > > > > Here is what I am trying to do
      > > > > User types some text in RTE, hit a button top 'Save data',
      > after
      > > > that
      > > > > I need to get the selected text in RTE and save in the system.
      > > > > I can make it work with TinyMCE but i really want to make it
      > work
      > > > > with YUI RTE.
      > > > >
      > > > > Even the example link you mentioned did not work for me..
      > > > > Can you please give me specific example , if possible?
      > > > > appreciate any help
      > > > > thanks
      > > > > --- In ydn-javascript@yahoogroups.com, dav.glass@ wrote:
      > > > > >
      > > > > > merahul94538 --
      > > > > >
      > > > > > The _getSelection method is not intended to return the text
      > > > string
      > > > > of the selection. It returns a usable selection object:
      > > > > > http://developer.mozilla.org/en/docs/DOM:window.getSelection
      > > > > > http://msdn2.microsoft.com/en-us/library/ms535869.aspx
      > > > > >
      > > > > > This example should help you get what you need:
      > > > > > http://blog.davglass.com/files/yui/editor6/
      > > > > >
      > > > > > Let me know if you need anything else..
      > > > > >
      > > > > > Dav
      > > > > >
      > > > > > Dav Glass
      > > > > > dav.glass@
      > > > > > blog.davglass.com
      > > > > >
      > > > > > + 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: merahul94538 <merahul94538@>
      > > > > > To: ydn-javascript@yahoogroups.com
      > > > > > Sent: Tuesday, October 30, 2007 7:21:51 PM
      > > > > > Subject: [ydn-javascript] YUI RTE does not get Selection in
      > IE7
      > > > > >
      > > > > >
      > > > > > Hello all,
      > > > > >
      > > > > > I am trying to get the selected text from RTE when a 'Select
      > > > Text'
      > > > > > link is clicked.
      > > > > > MyEditor._getSelection() works fine for firefox but IE does
      > not.
      > > > > >
      > > > > > Any ideas please?
      > > > > >
      > > > > > thanks
      > > > > >
      > > > > >
      > > > > >
      > > > > >
      > > > > > Yahoo! Groups Links
      > > > > >
      > > > >
      > > > >
      > > > >
      > > > >
      > > > >
      > > > > Yahoo! Groups Links
      > > > >
      > > >
      > >
      >
    • Show all 8 messages in this topic