Place this inside the plugin closure:

jQuery.fn.rte.disableDesignMode = function(iframe, submit) {
 disableDesignMode(iframe, submit);
}

Then call it using

jQuery.fn.rte.disableDesignMode(x,y);

Better still, ask the author to add this as a public function.

On Jan 29, 3:48 pm, kgosser <kgos...@gmail.com> wrote:
> Hello all,
>
> This is a beginner question, and may well be more of a JavaScript
> answer than a jQuery answer. None the less, here is my example:
>
> I'm using the ultra lightweight Rich Text Editor plugin (http://
> batiste.dosimple.ch/blog/posts/2007-09-11-1/rich-text-editor-
> jquery.html)
>
> It is called via it's jquery.rte.js file. In that JS file, he has his
> main function set up:
>
> jQuery.fn.rte = function(css_url, media_url) {
>    // stuff
>
> }
>
> Inside of that, he has his "disableDesignMode" function that I need to
> some how tap into via other controls than just the "disable" button he
> gives in the toolbar. Here's the function:
>
>     function disableDesignMode(iframe, submit) {
>         var content =
> iframe.contentWindow.document.getElementsByTagName("body")
> [0].innerHTML;
>         if(submit==true)
>             var textarea = $('<input type="hidden" />');
>         else
>             var textarea = $('<textarea cols="40" rows="10"></
> textarea>');
>         textarea.val(content);
>         t = textarea.get(0);
>         if(iframe.className)
>             t.className = iframe.className;
>         if(iframe.id)
>             t.id = iframe.id;
>         if(iframe.title)
>             t.name = iframe.title;
>         $(iframe).before(textarea);
>         if(submit!=true)
>             $(iframe).remove();
>         return textarea;
>     }
>
> So, with that said... my question is how do I go about accessing that
> "disableDesignMode" function, when it's private to his plugin
> function? Do I extend it somehow? If so, how?
>
> Thanks in advance. This is a big learning point for me with JS and
> jQuery, so any help is greatly appreciated.

Reply via email to