[drupal-devel] HTMLArea is dead, long live rich text editing

Richard Bennett richard.b at gritechnologies.com
Tue Mar 8 22:38:31 UTC 2005


On Tuesday 08 March 2005 21:12, Boris Mann wrote:
> * get in touch if you want to further develop rich text editing in
> Drupal, likely to be based on FCKEditor

Hi,
I tried those, and found htmlarea not to work cross browser, and fckeditor
crashed FF on linux for me, and made pages slow and un-responsive.

I setup a very basic TinyMCE module, and found this one worked better. It's
cross-browser/platform (at least firefox and IE) and pretty lightweight.

I wanted to add a few features before releasing the module properly, but here
are the basics. It is currently set to show a simple toolbar on the content
and comment textareas. (Not on those used for other settings.)

Save the following as tinymce.module in a folder tinymce in the modules
directory, and save the current tinymce code in another folder called
tinymce, so it sits here:
modules/tinymce/tinymce.module
modules/tinymce/tinymce/jscripts/tiny_mce/tiny_mce.js

<?php
//By richard.b at gritechnologies.com

function tinymce_help($section) {
  switch($section) {
    case "admin/modules#description":
      $output = t("Allows Drupal to use TinyMCE cross-browser WYSIWYG
editor.");
      break;
  }
  return $output;
}
function tinymce_init() {
    $output = '<script language="javascript" type="text/javascript"
src="modules/tinymce/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>';
    drupal_set_html_head($output);
}
function tinymce_textarea($op, $name) {
  if ($op == 'pre' && ($name == 'body' || $name == 'comment')) {
    $output = '<script language="javascript" type="text/javascript">
	tinyMCE.init({
		mode : "exact",
		elements : "edit-'.$name.'"
	});
    </script>' ;
    return $output;
  }
}

?>

HTH
Richard.

-------------------------------------------------------



More information about the drupal-devel mailing list