AJAX InPlaceRichEditor 1.3

written by seb on February 18th, 2008 @ 12:43 AM

As of today the first release candidate of the AJAX InPlaceRichEditor version 1.3 have seen the public scene.

Update: Version 1.3.2: With TinyMCE 3.4.2, Prototype 1.7 and Scriptaculous 1.9.0. Add support for Internet Explorer 9

This new release is now using the fantastic TinyMCE 3.0 from MoxieCode

It include some new features and improvements, some wished ones finally achieved ;-) so let's discover them.

Multiple TinyMCE initializations

Now you need to give an extra parameter to AJAX.InPlaceRichEditor constructor, containing the TinyMCE options you wish to use.
The best way to do so is to keep all the initialization in the tiny_mce_init file as it may preload all needed modules and make InPlaceRichEdition more responsive, let's see what it mean.

In tiny_mce_init,js

var tinymce_options = {
  mode : "textareas",
  theme : "simple"
};

var tinymce_advanced_options = {
  mode : "textareas",
  theme : "advanced"
};

tinyMCE.init(tinymce_advanced_options);
tinyMCE.init(tinymce_options);

NOTICE: It's important to take care of the initialization order as the last one will be used by default for the normal editors.

Your AJAX.InPlaceRichEditor calls

<h1 id="tobeedited">To be edited w/ simple theme</h1>
<script>
// <![CDATA[
  new Ajax.InPlaceRichEditor($('tobeedited'), 'YOU_UPDATE_URL', {}, tinymce_options);
// ]]>
</script>

<h1 id="tobeeditedadvanced">To be edited w/ advanced theme</h1>
<script>
// <![CDATA[
  new Ajax.InPlaceRichEditor($('tobeeditedadvanced'), 'YOU_UPDATE_URL', {}, tinymce_advanced_options);
// ]]>
</script>

Features fixes and changes

  • The fieldPostCreation option is now properly working on InPlaceRichEditor side and is set to focus by default, however there's still some bugs with it in some browsers.
  • As in InPlaceRichEditor 1.2, the deprecation layer from scriptaculous' InPlaceEditoris ot present anymore, I believe that it's now the time to use the actual stuff in your scripts and extensions ;-)
  • The RichEditor will be disabled while loading external text if you are using the advanced theme, the simple one doesn't seem to allow it

Highly recomanded patch

In scriptaculous' InPlaceEditor 1.8.1 the failure handling is broken which doesn't help providing clean error explanations to users.
I brought few week ago a tiny patch to fix this InPlaceEditor onFailure issue that I highly recommend to all users.

Extra feature as InPlaceEditor patch

I needed for Tiare the ability to have the empty texts in edit mode for easier comprehension, for this reason I've published a patch to editOnBlank an InPlaceEditor or InPlaceRichEditor.

Rails 2.0 users' happiness

In Rails 2.0 a new security feature introduce an authenticity_token to every form and InPlaceRichEditor can work fine with this as well.
Even if it's still not an easy-as-pie feature, it's pretty easy to build a work around for it.

Railers, grab this InPlaceRichEditor 1.3_rc0 with rails 2.0.2 demo to find more about it.

Security notice

DO NEVER FORGET to clean code sent by InPlaceRichEditor, javascript cleaning is wonderful but purely useless when we speak about security.
Railers may consider using white_list but you can also use what ever way you like to keep yourself secure.

Tested

InPlaceRichEditor has been tested on FF 2, IE 6, IE 7, Safari 3 and Opera, all on Mac (except IE) and Windows

Some bugs relative to fieldPostCreation are still present on some browser

Thanks

Thank you to all contributors, from feedbacks to patches, it's always a pleasure to listen about your experience using InPlaceRichEditor.
A big thanks as well to the prototype and scriptaculous core team and contributors.
Of course big thanks to MoxieCode too for them great tool and support

Have fun

Comments

  • Rafael Mueller on 29 Feb 12:08

    The InPlaceRichEditor 1.3_rc0 with rails 2.0.2 demo isnt working for me (just changed sqlite to mysql). This example is working on your box? Theres any documentation on how to use the InPlaceRichEitor? Keep up the good work!

Comments are closed