You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jasper de Vries <je...@gmail.com> on 2008/12/04 12:23:16 UTC

Re: [Trinidad] about using Tinymce with Trinidad

This might help to render an editor when needed:

http://matthiaswessendorf.wordpress.com/2008/02/16/using-dojo-and-apache-trinidad/

You can put the following code in your Java event handler method:

ExtendedRenderKitService service =
  Service.getRenderKitService(
    FacesContext.getCurrentInstance()
  , ExtendedRenderKitService.class
  )
;  
service.addScript(
  FacesContext.getCurrentInstance()
, "alert('Render editor function here');"
);

See also: 

http://myfaces.apache.org/trinidad/trinidad-api/apidocs/org/apache/myfaces/trinidad/render/ExtendedRenderKitService.html


Renzo Tomaselli wrote:
> 
> Well - in case anybody is interested - things can be setup by catching 
> any ongoing Trinidad PPR request by using addStateChangeListener and 
> then killing all existing Timymce editors.
> The tricky point is that any returning page part might not involve 
> existing editors at all (for example, expanding a tr:tree node) - thus 
> surviving editors must be recreated at PPR completion (same listener).
> This strategy seems working well for all cases when PPR returns with 
> same/more/less editor areas than page had before.
> The only drawback is about some heavy flickering due to turning off/on 
> editors of surviving areas. I tried to kill lost editors during PPR 
> response processing, but this raises Tinymce exceptions - likely because 
> Dom changed. I will try to post some how-to on the Tinymce list.
> 
> -- Renzo
> 

-- 
View this message in context: http://www.nabble.com/-Trinidad--about-using-Tinymce-with-Trinidad-tp16202920p20831598.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Trinidad] about using Tinymce with Trinidad

Posted by Jasper de Vries <je...@gmail.com>.
Rendering TinyMCE editors is easy. Removing editors is a pain! Removing
editors using the tinyMCE.remove function doesn't seem to work that well. To
remove all editors I wrote this Javascript function:

trUnrenderTinyMCE = function(){
  // First try to do a nice remove
  while ( tinyMCE.remove( tinyMCE.activeEditor ) ) { /* Remove all active
editors */ };
  
  // Then do a brutal remove
  var spans = document.getElementsByTagName("span");
  for (var i = spans.length - 1; i >= 0; i--){
    if (spans[i].className.indexOf("mceEditor") >= 0) {
      spans[i].parentNode.removeChild(spans[i]);
    }
  }
}


Jasper de Vries wrote:
> 
> This might help to render an editor when needed:
> 
> http://matthiaswessendorf.wordpress.com/2008/02/16/using-dojo-and-apache-trinidad/
> 
> You can put the following code in your Java event handler method:
> 
> ExtendedRenderKitService service =
>   Service.getRenderKitService(
>     FacesContext.getCurrentInstance()
>   , ExtendedRenderKitService.class
>   )
> ;  
> service.addScript(
>   FacesContext.getCurrentInstance()
> , "alert('Render editor function here');"
> );
> 
> See also: 
> 
> http://myfaces.apache.org/trinidad/trinidad-api/apidocs/org/apache/myfaces/trinidad/render/ExtendedRenderKitService.html
> 

-- 
View this message in context: http://www.nabble.com/-Trinidad--about-using-Tinymce-with-Trinidad-tp16202920p20834516.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.