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

RTE, inserthtml and form tags

Expand Messages
  • Richard Benson
    Hi all, Trying to develope a plugin to stick the YUI RTE into movabletype as it s default rich editor and all seems to have been going very smoothly until I
    Message 1 of 3 , May 30, 2008
    • 0 Attachment
      Hi all,

      Trying to develope a plugin to stick the YUI RTE into movabletype as
      it's default rich editor and all seems to have been going very
      smoothly until I tired to hook into MT's image insert functions.

      MT is correctly sending a bunch of HTML to the RTE via the inserthtml
      exec command and i can see it going into the RTE window, however it's
      immediately removed.

      Now MT uses really funky HTML for it's image insertion, it wraps the
      image in <form> tags (Don't ask me why, but it does and I would
      rather not edit the core MT or YUI code so that what I make is a
      true "Plugin") so I am guessing the RTE is stripping the form tags
      and everything inbetween.

      My question therefore is either:

      a) how do I tell inserthtml to just insert the HTML exactly as sent
      to it?
      b) how do i make RTE strip the form tags but keep the contents (this
      case an image with styles attached)?
      c) How do I process the HTML sent back to strip the src from the img
      tag in there?

      I'm not a very good JS programmer, so apologies if this is really
      obvious!

      Example MT image HTML:
      <form mt:asset-id="37" class="mt-enclosure mt-enclosure-image"
      style="display: inline;"><img alt="COMPUTERS1.jpg"
      src="http://projectperu.dixcart.com/images/COMPUTERS1.jpg"
      width="286" height="431" class="mt-image-none" style="" /></form>

      Thanks for your time.

      Richard
    • Dav Glass
      Richard -- You could use the invalidHTML property: http://developer.yahoo.com/yui/docs/YAHOO.widget.SimpleEditor.html#property_invalidHTML The default
      Message 2 of 3 , May 30, 2008
      • 0 Attachment
        Richard --

        You could use the invalidHTML property:
        http://developer.yahoo.com/yui/docs/YAHOO.widget.SimpleEditor.html#property_invalidHTML


        The default invalidHTML config looks like this:
        invalidHTML: {
        form: true,
        input: true,
        button: true,
        select: true,
        link: true,
        html: true,
        body: true,
        iframe: true,
        script: true,
        style: true,
        textarea: true
        }

        You should be able to do one of these (haven't tested it):

        var myEditor = new YAHOO.widget.Editor('', { //});

        //This will remove the form tag, but leave the image
        myEditor.invalidHTML.form = { keepContents: true };

        //This line will keep it from stripping the form tag
        delete myEditor.invalidHTML.form;

        myEditor.render();

        Does that help?

        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: Richard Benson <me@...>
        To: ydn-javascript@yahoogroups.com
        Sent: Friday, May 30, 2008 11:18:01 AM
        Subject: [ydn-javascript] RTE, inserthtml and form tags

        Hi all,

        Trying to develope a plugin to stick the YUI RTE into movabletype as
        it's default rich editor and all seems to have been going very
        smoothly until I tired to hook into MT's image insert functions.

        MT is correctly sending a bunch of HTML to the RTE via the inserthtml
        exec command and i can see it going into the RTE window, however it's
        immediately removed.

        Now MT uses really funky HTML for it's image insertion, it wraps the
        image in <form> tags (Don't ask me why, but it does and I would
        rather not edit the core MT or YUI code so that what I make is a
        true "Plugin") so I am guessing the RTE is stripping the form tags
        and everything inbetween.

        My question therefore is either:

        a) how do I tell inserthtml to just insert the HTML exactly as sent
        to it?
        b) how do i make RTE strip the form tags but keep the contents (this
        case an image with styles attached)?
        c) How do I process the HTML sent back to strip the src from the img
        tag in there?

        I'm not a very good JS programmer, so apologies if this is really
        obvious!

        Example MT image HTML:
        <form mt:asset-id="37" class="mt-enclosure mt-enclosure-image"
        style="display: inline;"><img alt="COMPUTERS1.jpg"
        src="http://projectperu.dixcart.com/images/COMPUTERS1.jpg"
        width="286" height="431" class="mt-image-none" style="" /></form>

        Thanks for your time.

        Richard


        ------------------------------------

        Yahoo! Groups Links
      • Richard Benson
        Thanks Dav, that worked perfectly! I m still not sure what MT does with it s form tags, so it s good to have the option to leave them in, and it s good to know
        Message 3 of 3 , Jun 1, 2008
        • 0 Attachment
          Thanks Dav, that worked perfectly!

          I'm still not sure what MT does with it's form tags, so it's good to
          have the option to leave them in, and it's good to know what other tags
          are restricted.

          Thanks again, and also for making this editor in the first place, it's
          brilliant.

          Richard

          P.S. sorry for not replying sooner, Yahoo groups decided not to send me
          your response!


          --- In ydn-javascript@yahoogroups.com, Dav Glass <dav.glass@...> wrote:
          >
          > Richard --
          >
          > You could use the invalidHTML property:
          >
          http://developer.yahoo.com/yui/docs/YAHOO.widget.SimpleEditor.html#prope\
          rty_invalidHTML
          >
          >
          > The default invalidHTML config looks like this:
          > invalidHTML: {
          > form: true,
          > input: true,
          > button: true,
          > select: true,
          > link: true,
          > html: true,
          > body: true,
          > iframe: true,
          > script: true,
          > style: true,
          > textarea: true
          > }
          >
          > You should be able to do one of these (haven't tested it):
          >
          > var myEditor = new YAHOO.widget.Editor('', { //});
          >
          > //This will remove the form tag, but leave the image
          > myEditor.invalidHTML.form = { keepContents: true };
          >
          > //This line will keep it from stripping the form tag
          > delete myEditor.invalidHTML.form;
          >
          > myEditor.render();
          >
          > Does that help?
          >
          > 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: Richard Benson me@...
          > To: ydn-javascript@yahoogroups.com
          > Sent: Friday, May 30, 2008 11:18:01 AM
          > Subject: [ydn-javascript] RTE, inserthtml and form tags
          >
          > Hi all,
          >
          > Trying to develope a plugin to stick the YUI RTE into movabletype as
          > it's default rich editor and all seems to have been going very
          > smoothly until I tired to hook into MT's image insert functions.
          >
          > MT is correctly sending a bunch of HTML to the RTE via the inserthtml
          > exec command and i can see it going into the RTE window, however it's
          > immediately removed.
          >
          > Now MT uses really funky HTML for it's image insertion, it wraps the
          > image in <form> tags (Don't ask me why, but it does and I would
          > rather not edit the core MT or YUI code so that what I make is a
          > true "Plugin") so I am guessing the RTE is stripping the form tags
          > and everything inbetween.
          >
          > My question therefore is either:
          >
          > a) how do I tell inserthtml to just insert the HTML exactly as sent
          > to it?
          > b) how do i make RTE strip the form tags but keep the contents (this
          > case an image with styles attached)?
          > c) How do I process the HTML sent back to strip the src from the img
          > tag in there?
          >
          > I'm not a very good JS programmer, so apologies if this is really
          > obvious!
          >
          > Example MT image HTML:
          > <form mt:asset-id="37" class="mt-enclosure mt-enclosure-image"
          > style="display: inline;"><img alt="COMPUTERS1.jpg"
          > src="http://projectperu.dixcart.com/images/COMPUTERS1.jpg"
          > width="286" height="431" class="mt-image-none" style="" /></form>
          >
          > Thanks for your time.
          >
          > Richard
          >
          >
          > ------------------------------------
          >
          > Yahoo! Groups Links
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.