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

YUI Editor - Getting Selected Text

Expand Messages
  • Cisy
    I m using YUI 2.6.0. Is there a way to get the selected (highlighted) text in YUI Editor? Either that, or if there s a way to insert a string/text before and
    Message 1 of 4 , Feb 5, 2009
    • 0 Attachment
      I'm using YUI 2.6.0. Is there a way to get the selected (highlighted)
      text in YUI Editor? Either that, or if there's a way to insert a
      string/text before and after that selected text.

      I have been using the execCommand('inserthtml'), however if I want to
      wrap the selected text with something, this function does not work,
      since it will just replace the selected text.

      I looked over the API, but couldn't seem to find such a feature.
    • Dav Glass
      Cisy -- This thread and example shows that: http://tech.groups.yahoo.com/group/ydn-javascript/message/43908 Does that help? dav -- Dav Glass davglass@gmail.com
      Message 2 of 4 , Feb 5, 2009
      • 0 Attachment
        Cisy --

        This thread and example shows that:
        http://tech.groups.yahoo.com/group/ydn-javascript/message/43908

        Does that help?
        dav

        --
        Dav Glass
        davglass@...
        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  +


        On Thu, Feb 5, 2009 at 5:40 PM, Cisy <cisy1105@...> wrote:

        I'm using YUI 2.6.0. Is there a way to get the selected (highlighted)
        text in YUI Editor? Either that, or if there's a way to insert a
        string/text before and after that selected text.

        I have been using the execCommand('inserthtml'), however if I want to
        wrap the selected text with something, this function does not work,
        since it will just replace the selected text.

        I looked over the API, but couldn't seem to find such a feature.


      • Cisy
        Hi Dav, Thanks for the reply. After reading the whole conversation linked and checking the code linked there, I found that the piece of code I need is only:
        Message 3 of 4 , Feb 6, 2009
        • 0 Attachment
          Hi Dav,

          Thanks for the reply.

          After reading the whole conversation linked and checking the code
          linked there, I found that the piece of code I need is only:
          myEditor._getSelection(). Using this, I can get the selected text,
          wrap it with the string I want, then post it back using
          myEditor.execCommand('inserthtml', newstring);

          Is the _getSelection() and myEditor._hasSelection() documented
          somewhere in the API docs? I couldn't seem to find it.

          Thanks again for the help.

          -Cisy




          --- In ydn-javascript@yahoogroups.com, Dav Glass <davglass@...> wrote:
          >
          > Cisy --
          >
          > This thread and example shows that:
          > http://tech.groups.yahoo.com/group/ydn-javascript/message/43908
          >
          > Does that help?
          > dav
          >
          > --
          > Dav Glass
          > davglass@...
          > 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 +
          >
          >
          > On Thu, Feb 5, 2009 at 5:40 PM, Cisy <cisy1105@...> wrote:
          >
          > > I'm using YUI 2.6.0. Is there a way to get the selected
          (highlighted)
          > > text in YUI Editor? Either that, or if there's a way to insert a
          > > string/text before and after that selected text.
          > >
          > > I have been using the execCommand('inserthtml'), however if I want to
          > > wrap the selected text with something, this function does not work,
          > > since it will just replace the selected text.
          > >
          > > I looked over the API, but couldn't seem to find such a feature.
          > >
          > >
          > >
          >
        • Dav Glass
          They are documented, however you need to check the checkboxes at the top of the page. They are private/protected methods so they don t show up in the docs
          Message 4 of 4 , Feb 6, 2009
          • 0 Attachment
            They are documented, however you need to check the checkboxes at the top of the page. They are private/protected methods so they don't show up in the docs unless you check those boxes ;)

            Dav

            --
            Dav Glass
            davglass@...
            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  +


            On Fri, Feb 6, 2009 at 9:49 AM, Cisy <cisy1105@...> wrote:

            Hi Dav,

            Thanks for the reply.

            After reading the whole conversation linked and checking the code
            linked there, I found that the piece of code I need is only:
            myEditor._getSelection(). Using this, I can get the selected text,
            wrap it with the string I want, then post it back using
            myEditor.execCommand('inserthtml', newstring);

            Is the _getSelection() and myEditor._hasSelection() documented
            somewhere in the API docs? I couldn't seem to find it.

            Thanks again for the help.

            -Cisy



            --- In ydn-javascript@yahoogroups.com, Dav Glass <davglass@...> wrote:
            >
            > Cisy --
            >
            > This thread and example shows that:
            > http://tech.groups.yahoo.com/group/ydn-javascript/message/43908
            >
            > Does that help?
            > dav
            >
            > --
            > Dav Glass
            > davglass@...

            > 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 +
            >
            >
            > On Thu, Feb 5, 2009 at 5:40 PM, Cisy <cisy1105@...> wrote:
            >
            > > I'm using YUI 2.6.0. Is there a way to get the selected
            (highlighted)
            > > text in YUI Editor? Either that, or if there's a way to insert a
            > > string/text before and after that selected text.
            > >
            > > I have been using the execCommand('inserthtml'), however if I want to
            > > wrap the selected text with something, this function does not work,
            > > since it will just replace the selected text.
            > >
            > > I looked over the API, but couldn't seem to find such a feature.
            > >
            > >
            > >
            >


          Your message has been successfully submitted and would be delivered to recipients shortly.