wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniele Dellafiore <ilde...@gmail.com>
Subject Re: [tinymce] problem adding/removing TinyMceBehavior dinamically
Date Sat, 03 Oct 2009 13:39:36 GMT
I get what the real problem is: tinyMce saves internally each "editor" that
is added to a page in a list called, well, editors.
When I remove the behavior from a textField, I should also call
tinyMce.remove passing the editors as a parameter.

I will try to do this but any help is appreciated :)

This is for the checkbox that enable/disable the tinyMce behavior.


I have a more subtle situation: I have a list of textFields and a button to
add more. When I add a new field, I refresh the list via AJAX to show the
new field. But, refreshing the list also causes the html id of any element
in the list to change!

So, when in the end I submit the form, tinyMce cannot find its editors
anymore cause the parent DIV of the INPUT field that has an associated
tinyMce editor just changed it's html id.
Given that the id will change and there is no alternatives, I have to find a
way to keep the associations or to clean all editors and recreate them at
every list refresh.

What is your suggesions?


On Wed, Sep 30, 2009 at 5:20 PM, bgooren <bas@iswd.nl> wrote:

>
> Well, that's what I meant with "preloading". You cannot use TinyMCE if
> you're
> loading its javascripts from your ajax request. If the TinyMCE scripts are
> loaded from the containing page, then it will work (as you say).
>
>
> nino martinez wael wrote:
> >
> > Actually AFAIK the resources just need to be on path, then you can pretty
> > much do whatever you want. Could be what your definition of preloading
> are
> > :)
> >
> > I have a panel that are added by ajax so I had to make sure the resources
> > used by that panel always where on the containing page.
> >
> > regards
> >
> > 2009/9/30 bgooren <bas@iswd.nl>
> >
> >>
> >> It's not possible to add TinyMCE dynamically due to the way TinyMCE
> >> works.
> >> What you can do however, is pre-load TinyMCE, and dynamically
> >> enable/disable
> >> it on a component.
> >>
> >> Daniele Dellafiore wrote:
> >> >
> >> > Hi. I have a problem with this example code:
> >> >
> >> >       tinyMceBehavior = new TinyMceBehavior();
> >> >       PropertyModel<Boolean> richProperty = new PropertyModel(model,
> >> > "rich");
> >> >       add(new AjaxCheckBox("switchRte", richProperty) {
> >> >
> >> >          @Override
> >> >          protected void onUpdate(AjaxRequestTarget target) {
> >> >             if (getModelObject()) {
> >> >                textArea.add(tinyMceBehavior);
> >> >             } else {
> >> >                textArea.remove(tinyMceBehavior);
> >> >                tinyMceBehavior = new TinyMceBehavior();
> >> >             }
> >> >             refresh(target);
> >> >          }
> >> >       });
> >> >
> >> > the purpose is to have a checkbox that add and remove the
> >> > TinyMceBehavior from a text area.
> >> > It works fine but I have this problem: when I Submit the form the
> >> > textArea is in after REMOVING the behavior, I have a javascript error:
> >> >
> >> > t.win.document is null
> >> >
> >> > firebug show the error in tiny_mce_src.js at line 5376
> >> >
> >> > if (!r)
> >> >    r = isIE ? t.win.document.body.createTextRange() :
> >> > t.win.document.createRange();
> >> >
> >> > I am using tinymce 3.2.7 but the same problem occurs with tinymce used
> >> > in trunk version of wicket-contrib-tinymce.
> >> >
> >> > the effect is that "submit" does not work.
> >> > if I click on checkbox again, everything continue to work.
> >> > Any idea?
> >> >
> >> > --
> >> > Daniele Dellafiore
> >> > http://blog.ildella.net
> >> > http://twitter.com/ildella
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25682644.html
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25683255.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Daniele Dellafiore
http://blog.ildella.net
http://twitter.com/ildella

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message