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

Re: [ydn-javascript] multiple calls to setBody seems to accumulate content in an editorwindow

Expand Messages
  • Dav Glass
    Jassem -- Looks like you found a bug ;) setBody should update the content of the window, but it currently doesn t :( You should be able to save a reference to
    Message 1 of 5 , Nov 30, 2008
      Jassem --

      Looks like you found a bug ;) setBody should update the content of the window, but it currently doesn't :(

      You should be able to save a reference to the body reference and update that when you need to.

      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 Sun, Nov 30, 2008 at 3:27 PM, jassem.shahrani <jassem.shahrani@...> wrote:

      Hello,

      first - Dav - awesome editor!!! learning my way through "hacking it"

      saw the thread you and peter had - specifically needing to catch
      windowRender and add the window/name to Editor._windows so it can be
      prerendered in 2.6.0.

      I'll ask my question, then describe what i'm doing to try to get the
      effect i'm hoping for, and the results.

      Question:
      Can I dynamically change the contents/body of an EditorWindow?

      What I'm Doing:
      that said, i have two basic steps and some behavior i'm hoping to
      better understand:

      step 1: catch windowRender and do the 2.6.0 duties
      a). Editor._windows.mynewwindowname = {};
      b). Editor._windows.mynewwindowname.body = myDomReference;
      c). Note: seems I don't HAVE to set the display property to none here

      step 2: catch my new toolbar button's "dynamic" Click event
      a). create and inject a new element into the editor
      b). set Editor.currentElement[0] = the new element
      c). create the EditorWindow instance with mynewwindowname
      d). set the Header and Footer with setHeader + setFooter.
      e). attempt to redefine the window body using setBody()

      Behavior I'm Seeing:

      Case 1: exactly as above
      - window works and always has the body contents defined in step 1b;
      the step 2e call to setBody() has no effect.

      Case 2: remove step 1b
      - now setBody() defines the new window body, BUT each time i click my
      new button, it APPENDS the content/dom i pass to setBody(), instead of
      redefining it. the effect is to accumulate content in the window each
      time i click my button.

      Case 3: remove step 1b, and replace step 2e with explicity body set
      - here instead of using setBody() in 2e, i use a similar statement as
      1b. that is, if myWindow is what i created in step 2c, then step 2e
      becomes: myWindow.body = newDomRef;
      - the effect however is exactly the same as Case 2.

      Why am I asking this?
      I'm wondering about this because I'd like to add functionality where I
      click on the object I inject and reopen the window (as some examples
      do). But when that happens, I'll inevitably change some of the
      contents (at least update some values or so). Wondering if this is
      going to be an issue since I can't seem to override those contents.

      Thanks!

      Jassem


    • jassem.shahrani
      Thanks so much for the quick reply! Awesome - as you indidcated, can get around that no problem. In practice, the primary use case is to update inputs within -
      Message 2 of 5 , Nov 30, 2008
        Thanks so much for the quick reply!

        Awesome - as you indidcated, can get around that no problem.

        In practice, the primary use case is to update inputs within - better
        to do that just ref'ing those elements anyway :)

        I still need to explore searching and filing bugs here so I can
        address such things "properly" in the future.

        I plan to be active here as I dig deeper.

        Thanks again, and completely awesome editor!!!

        Jassem


        --- In ydn-javascript@yahoogroups.com, "Dav Glass" <davglass@...> wrote:
        >
        > Jassem --
        >
        > Looks like you found a bug ;) setBody should update the content of the
        > window, but it currently doesn't :(
        >
        > You should be able to save a reference to the body reference and
        update that
        > when you need to.
        >
        > 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 Sun, Nov 30, 2008 at 3:27 PM, jassem.shahrani
        > <jassem.shahrani@...>wrote:
        >
        > > Hello,
        > >
        > > first - Dav - awesome editor!!! learning my way through "hacking it"
        > >
        > > saw the thread you and peter had - specifically needing to catch
        > > windowRender and add the window/name to Editor._windows so it can be
        > > prerendered in 2.6.0.
        > >
        > > I'll ask my question, then describe what i'm doing to try to get the
        > > effect i'm hoping for, and the results.
        > >
        > > Question:
        > > Can I dynamically change the contents/body of an EditorWindow?
        > >
        > > What I'm Doing:
        > > that said, i have two basic steps and some behavior i'm hoping to
        > > better understand:
        > >
        > > step 1: catch windowRender and do the 2.6.0 duties
        > > a). Editor._windows.mynewwindowname = {};
        > > b). Editor._windows.mynewwindowname.body = myDomReference;
        > > c). Note: seems I don't HAVE to set the display property to none here
        > >
        > > step 2: catch my new toolbar button's "dynamic" Click event
        > > a). create and inject a new element into the editor
        > > b). set Editor.currentElement[0] = the new element
        > > c). create the EditorWindow instance with mynewwindowname
        > > d). set the Header and Footer with setHeader + setFooter.
        > > e). attempt to redefine the window body using setBody()
        > >
        > > Behavior I'm Seeing:
        > >
        > > Case 1: exactly as above
        > > - window works and always has the body contents defined in step 1b;
        > > the step 2e call to setBody() has no effect.
        > >
        > > Case 2: remove step 1b
        > > - now setBody() defines the new window body, BUT each time i click my
        > > new button, it APPENDS the content/dom i pass to setBody(), instead of
        > > redefining it. the effect is to accumulate content in the window each
        > > time i click my button.
        > >
        > > Case 3: remove step 1b, and replace step 2e with explicity body set
        > > - here instead of using setBody() in 2e, i use a similar statement as
        > > 1b. that is, if myWindow is what i created in step 2c, then step 2e
        > > becomes: myWindow.body = newDomRef;
        > > - the effect however is exactly the same as Case 2.
        > >
        > > Why am I asking this?
        > > I'm wondering about this because I'd like to add functionality where I
        > > click on the object I inject and reopen the window (as some examples
        > > do). But when that happens, I'll inevitably change some of the
        > > contents (at least update some values or so). Wondering if this is
        > > going to be an issue since I can't seem to override those contents.
        > >
        > > Thanks!
        > >
        > > Jassem
        > >
        > >
        > >
        >
      • peterredding@ymail.com
        ... update that ... Hi, I ve just encountered this problem as well but I m not sure what you mean by saving a reference to the body reference. Could you
        Message 3 of 5 , Feb 25, 2009
          --- In ydn-javascript@yahoogroups.com, "Dav Glass" <davglass@...> wrote:
          >
          > Jassem --
          >
          > Looks like you found a bug ;) setBody should update the content of the
          > window, but it currently doesn't :(
          >
          > You should be able to save a reference to the body reference and
          update that
          > when you need to.
          >
          > 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 +
          >
          >

          Hi,

          I've just encountered this problem as well but I'm not sure what you
          mean by saving a reference to the body reference. Could you possibly
          elaborate?

          Thank you very much,

          Peter
        • peterredding@ymail.com
          Hi, Sorry if this gets posted twice however I can t see my first reply from about an hour ago. I m having the same problem where my editor window appends the
          Message 4 of 5 , Feb 25, 2009
            Hi,

            Sorry if this gets posted twice however I can't see my first reply
            from about an hour ago.

            I'm having the same problem where my editor window appends the new
            content to the old content however I'm not sure what you mean by "save
            a reference to the body reference". Could you possibly elaborate for
            me please?

            Thank you very much,

            Peter.



            --- In ydn-javascript@yahoogroups.com, "Dav Glass" <davglass@...> wrote:
            >
            > Jassem --
            >
            > Looks like you found a bug ;) setBody should update the content of the
            > window, but it currently doesn't :(
            >
            > You should be able to save a reference to the body reference and
            update that
            > when you need to.
            >
            > 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 +
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.