Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-10-12 Thread bgooren
() );
     }
 
  As you can see I initialize TinyMCE, and then perform an
 mceAddControl
  command on the textarea I want to convert to a TinyMCE editor.
 
  Finally, I need to switch back to a textarea before unloading, so the
  correct contents are POSTed. To do so, I have added an
 AjaxCallDecorator
  to
  the close request, and allow implementations to override it:
 
  @Override
     protected IAjaxCallDecorator getCloseDecorator()
     {
         return new AjaxCallDecorator()
         {
 
            �...@override
             public CharSequence decorateScript( CharSequence script )
             {
                 return tinyMCE.execCommand('mceRemoveControl', false,
 '
 +
  editor.getMarkupId() + '); 
                         + super.decorateOnSuccessScript( script );
 
                 // Call to save contents back to textarea
                 // return tinyMCE.get(' + editor.getMarkupId() +
  ').save();  +
                 // super.decorateScript( script );
             }
 
         };
     }
 
  The above code removes TinyMCE from the given textarea, and saves the
 HTML
  back into the textarea. I have commented out the call to save(),
 since
 it
  was not necessary.
 
  Bas
 
 
  Daniele Dellafiore wrote:
  
   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?
  
   --
   Daniele Dellafiore
   http://blog.ildella.net
   http://twitter.com/ildella
  
  
 
  --
  View this message in context:
 
 http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25747314.html
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  --
  Daniele Dellafiore
  http://blog.ildella.net
  http://twitter.com/ildella
 



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

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 
 
 
 -- 
 Daniele Dellafiore
 http://blog.ildella.net
 http://twitter.com/ildella
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25857140.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-10-10 Thread Daniele Dellafiore
( CharSequence script )
             {
                 return tinyMCE.execCommand('mceRemoveControl', false, '
 +
  editor.getMarkupId() + '); 
                         + super.decorateOnSuccessScript( script );
 
                 // Call to save contents back to textarea
                 // return tinyMCE.get(' + editor.getMarkupId() +
  ').save();  +
                 // super.decorateScript( script );
             }
 
         };
     }
 
  The above code removes TinyMCE from the given textarea, and saves the
 HTML
  back into the textarea. I have commented out the call to save(), since
 it
  was not necessary.
 
  Bas
 
 
  Daniele Dellafiore wrote:
  
   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?
  
   --
   Daniele Dellafiore
   http://blog.ildella.net
   http://twitter.com/ildella
  
  
 
  --
  View this message in context:
 
 http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25747314.html
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  --
  Daniele Dellafiore
  http://blog.ildella.net
  http://twitter.com/ildella
 



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

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org






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

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-10-09 Thread Daniele Dellafiore
 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?
 
  --
  Daniele Dellafiore
  http://blog.ildella.net
  http://twitter.com/ildella
 
 

 --
 View this message in context:
 http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25747314.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




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




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

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-10-09 Thread Dane Laverty
();  +
 // super.decorateScript( script );
 }
 
 };
 }
 
  The above code removes TinyMCE from the given textarea, and saves the
 HTML
  back into the textarea. I have commented out the call to save(), since
 it
  was not necessary.
 
  Bas
 
 
  Daniele Dellafiore wrote:
  
   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?
  
   --
   Daniele Dellafiore
   http://blog.ildella.net
   http://twitter.com/ildella
  
  
 
  --
  View this message in context:
 
 http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25747314.html
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  --
  Daniele Dellafiore
  http://blog.ildella.net
  http://twitter.com/ildella
 



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

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-10-05 Thread bgooren

I'll show you some parts of my code so you get an idea of how I do things.

First of all, I have used AjaxEditableLabel from wicket-extensions as a
starting point.
TinyMCE's javascripts should always be loaded:

// Preload TinyMCE
add( new AbstractBehavior()
{

@Override
public void renderHead( IHeaderResponse response )
{
if( !tinyMCELoaded )
{
response.renderJavascriptReference(
TinyMCESettings.javaScriptReference() );

settings = buildTinyMCESettings();

tinyMCELoaded = true;
}
}

} );

In my case TinyMCE is loaded through an AJAX call:

@SuppressWarnings(unchecked)
@Override
protected void onEdit( AjaxRequestTarget target )
{
super.onEdit( target );

final String id = editor.getMarkupId( true );
final StringBuilder buf = new StringBuilder();

// Load plugins
buf.append( settings.getLoadPluginJavaScript() ).append( ;\n );

// Initialize tinyMCE
buf.append( tinyMCE.init({ ).append( settings.toJavaScript(
Mode.none, Collections.EMPTY_LIST ) ).append(  });\n );
buf.append( settings.getAdditionalPluginJavaScript() ).append( ;\n
);

// Setup editor
buf.append( tinyMCE.execCommand('mceAddControl',true,' ).append(
id ).append( '); );

// Request focus on editor
buf.append( setTimeout( function()
{tinyMCE.execCommand('mceFocus',true,' ).append( id ).append( ');}, 500
); );

target.appendJavascript( buf.toString() );
}

As you can see I initialize TinyMCE, and then perform an mceAddControl
command on the textarea I want to convert to a TinyMCE editor.

Finally, I need to switch back to a textarea before unloading, so the
correct contents are POSTed. To do so, I have added an AjaxCallDecorator to
the close request, and allow implementations to override it:

@Override
protected IAjaxCallDecorator getCloseDecorator()
{
return new AjaxCallDecorator()
{

@Override
public CharSequence decorateScript( CharSequence script )
{
return tinyMCE.execCommand('mceRemoveControl', false, ' +
editor.getMarkupId() + '); 
+ super.decorateOnSuccessScript( script );

// Call to save contents back to textarea
// return tinyMCE.get(' + editor.getMarkupId() +
').save();  +
// super.decorateScript( script );
}

};
}

The above code removes TinyMCE from the given textarea, and saves the HTML
back into the textarea. I have commented out the call to save(), since it
was not necessary.

Bas


Daniele Dellafiore wrote:
 
 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?
 
 -- 
 Daniele Dellafiore
 http://blog.ildella.net
 http://twitter.com/ildella
 
 

-- 
View this message in context: 
http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25747314.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-10-05 Thread Daniele Dellafiore
Hey Bas, thanks for answering.

Unfortunately it does not work.
Even if I run:

  String removeEditor = tinyMCE.execCommand('mceRemoveControl',
false, '
 + propertyPanel.getValueMarkupId() + ');;
   target.appendJavascript(removeEditor);

or simply remove the TinyMceBehavior from my TextField, the result is the
same: mce editor disappear correclty, but remains in tinyMCE.editors list so
Tiny tries to process it in a successive iteration.

I try to find help on tinyMCE forum


On Mon, Oct 5, 2009 at 10:59 AM, bgooren b...@iswd.nl wrote:


 I'll show you some parts of my code so you get an idea of how I do things.

 First of all, I have used AjaxEditableLabel from wicket-extensions as a
 starting point.
 TinyMCE's javascripts should always be loaded:

 // Preload TinyMCE
add( new AbstractBehavior()
{

@Override
public void renderHead( IHeaderResponse response )
{
if( !tinyMCELoaded )
{
response.renderJavascriptReference(
 TinyMCESettings.javaScriptReference() );

settings = buildTinyMCESettings();

tinyMCELoaded = true;
}
}

} );

 In my case TinyMCE is loaded through an AJAX call:

 @SuppressWarnings(unchecked)
@Override
protected void onEdit( AjaxRequestTarget target )
{
super.onEdit( target );

final String id = editor.getMarkupId( true );
final StringBuilder buf = new StringBuilder();

// Load plugins
buf.append( settings.getLoadPluginJavaScript() ).append( ;\n );

// Initialize tinyMCE
buf.append( tinyMCE.init({ ).append( settings.toJavaScript(
 Mode.none, Collections.EMPTY_LIST ) ).append(  });\n );
buf.append( settings.getAdditionalPluginJavaScript() ).append( ;\n
 );

// Setup editor
buf.append( tinyMCE.execCommand('mceAddControl',true,' ).append(
 id ).append( '); );

// Request focus on editor
buf.append( setTimeout( function()
 {tinyMCE.execCommand('mceFocus',true,' ).append( id ).append( ');}, 500
 ); );

target.appendJavascript( buf.toString() );
}

 As you can see I initialize TinyMCE, and then perform an mceAddControl
 command on the textarea I want to convert to a TinyMCE editor.

 Finally, I need to switch back to a textarea before unloading, so the
 correct contents are POSTed. To do so, I have added an AjaxCallDecorator to
 the close request, and allow implementations to override it:

 @Override
protected IAjaxCallDecorator getCloseDecorator()
{
return new AjaxCallDecorator()
{

@Override
public CharSequence decorateScript( CharSequence script )
{
return tinyMCE.execCommand('mceRemoveControl', false, ' +
 editor.getMarkupId() + '); 
+ super.decorateOnSuccessScript( script );

// Call to save contents back to textarea
// return tinyMCE.get(' + editor.getMarkupId() +
 ').save();  +
// super.decorateScript( script );
}

};
}

 The above code removes TinyMCE from the given textarea, and saves the HTML
 back into the textarea. I have commented out the call to save(), since it
 was not necessary.

 Bas


 Daniele Dellafiore wrote:
 
  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?
 
  --
  Daniele Dellafiore
  http://blog.ildella.net
  http://twitter.com/ildella
 
 

 --
 View this message in context:
 http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25747314.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Daniele Dellafiore
http

Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-10-03 Thread Daniele Dellafiore
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 b...@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 b...@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();
 PropertyModelBoolean 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-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@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-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




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


[tinymce] problem adding/removing TinyMceBehavior dinamically

2009-09-30 Thread Daniele Dellafiore
Hi. I have a problem with this example code:

  tinyMceBehavior = new TinyMceBehavior();
  PropertyModelBoolean 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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-09-30 Thread bgooren

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();
   PropertyModelBoolean 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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-09-30 Thread nino martinez wael
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 b...@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();
PropertyModelBoolean 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-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-09-30 Thread bgooren

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 b...@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();
PropertyModelBoolean 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-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@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-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-09-30 Thread Daniele Dellafiore
that is what I do.

enable disable for me means add/remove to/from a component, while the
javascript is loaded as the page is loaded.

but, after removing the behavior, the save generate that error.
or maybe you mean something different with enable/disable.

On Wed, Sep 30, 2009 at 4:50 PM, bgooren b...@iswd.nl wrote:

 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();
       PropertyModelBoolean 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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@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-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





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

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org