Hi Jorn,

I agree with your comments and I've implemented the changes you
suggested.

$.fck.create(options) - finds and initializes FCk editor instances

$.fck.intercept - intercepts known methods and stores them within the
plugin (at the moment there's only one method so it's only one
variable, not an array)

$.fck.update - updates form data

And finally...
$.FCK (not the capital case)
is a separate method used as a 'shortcut' to the 2 main functions of
the plugin: a) find and load FCK editors, b) update form data for
submission.
// start editors (textarea.fck - will make this configurable)
var editors = $.FCK({ /* options */ })
// update form data
$.FCK(1);

What do you think of the above? Is it a problem that it's outside the
plugin namespace? Ideally I'd like it to be $.fck, but then $.fck
couldn't be an object with child properties/methods. Am I making
sense?

On Jun 28, 9:53 pm, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:
> Diego A. wrote:
> > Any feedback will be appreciated.
>
> I find an integration plugin that simply registers itself with other
> plugins to support any kind of rich text editor for those plugins quite
> interesting. That and mabe simplifying the setup of those editors, like
> you seem to do with $.FCK().
>
> Integration with the validate plugin is not as plain simple as with the
> ajaxSubmit method. I think you'd need to intercept
> jQuery.validator.fn.form, but that needs some testing.
>
> On the matter of intercepting I prefer the following pattern in favor of
> your approach (renaming to $.fn.ajaxSubmit_):
>
> (function() {
>   var intercepted = $.fn.ajaxSubmit;
>   $.fn.ajaxSubmit = function() {
>     // do something
>     return intercepted.apply( this, arguments );
>   });
>
> })();
>
> Saving a reference inside a closure allows you to intercept the method
> multiple times. You are already using apply(this, arguments), but
> without returning what the original returned.
>
> --
> Jörn Zaefferer
>
> http://bassistance.de

Reply via email to