Jump to content


[Snippet] RTE (Rich Text Editor)


  • You cannot reply to this topic
8 replies to this topic

#1 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 19 July 2007 - 09:29 PM

File Name: RTE (Rich Text Editor)
File Submitter: Ralph
File Submitted: 19 Jul 2007
File Category: Blogs & News

This snippet can be used to integrate the RTE WYSIWYG editor into custom snippets. The RTE snippet is required by the RTE Blogger snippet.

// Snippet Name: RTE
// Purpose: Snippet to create a Rich Text Editor
// Created By: Ralph A. Dahlgren
// Created: 2006-08-02 - Initial release with the Etomite RTE integration
// Modified: 2007-04-17 - modified $path value and additional usage information
// Use: Place a snippet call where the textarea should be in the form
// [!RTE?rte=<field_name>&value=<data>!]
// OR: Called using runSnippet() from within another snippet
// $wysiwyg = $etomite->runSnippet("RTE",$params=array('rte'=>'text', 'value'=>$entryText));
// Usage requires inclusion of the onsubmit form attribute as noted below
// <form name="RTEDemo" action="" method="post" onsubmit="return submitForm();">

Click here to download this file

#2 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 24 July 2008 - 08:43 PM

Thanks for this Ralph!

Should I be able to use it on several fields on one form if I use the RunSnippet call?

#3 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 24 July 2008 - 10:33 PM

I have been hoping to make modifications to allow multiple RTE's in a form... I actually have a need for this functionality for a current project but haven't had time to look at the code due to other commitments...

#4 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 25 July 2008 - 11:18 AM

Thanks Ralph ... since you haven't said 'it can't be done' I'll look into it.

#5 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 25 July 2008 - 03:29 PM

It can be done.

Separate out the bit the writes the main Javascript that references the editor code into a RTE_support snippet, and put the instance specific code that writes the Javascript for the specific textarea editors into an RTE_instance snippet.
Use the RTE_support snippet once on the page, before any use of the RTE_instance snippet. (this is logical, it may not actually be required)

I'm puzzled that putting the rteSafe function into the RTE_support snippet works if you use the [[RTE_instance....]] syntax, but not if you use the RunSnippet(...) approach. As a result of this I ended up with the rteSafe function in the instance snippet, but wrapped in
 if (!function_defined('rteSafe')) {
...
}

As a result, its probably simpler to use a chunk for RTE_support , as it ends up holding just code to copy Javascript to the output stream (I think).

do you want me to PM the bits to you, Ralph?

Edited by mikef, 25 July 2008 - 04:05 PM.


#6 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 25 July 2008 - 04:41 PM

Yeah, you're at about where I was at with multi-textarea integration... I was at the point of conditional rteSafe inclusion a couple weeks ago as I recall... Feel free to PM or email what you've come up with mike and I'll see if it works my one project... Once we have a good working version we can release it to the community...

#7 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 19 January 2009 - 11:38 AM

ignore ... the <STYLE ...> problem with RTE mentioned elsewhere (I can't find it now) is much broader, at least with the PHP/browser configuration I'm now using.

Edited by mikef, 19 January 2009 - 12:47 PM.


#8 Dean

    Loves Etomite Forums!

  • Admin
  • 4,758 posts
  • Gender:Male

Posted 19 January 2009 - 12:47 PM

If I remember rightly, I think this bug was mentioned somewhere else also?

#9 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 19 January 2009 - 01:17 PM

yes, finally found it - discussed in the etoComment documentation





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users