From 554a8175469fbe7594ec6587335e77e95b2b14e7 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 30 Jun 2010 18:31:13 +0000 Subject: Was in the wrong path for the previous commit. Now embed correctly support losely coupled insert JS views. git-svn-id: http://code.elgg.org/elgg/trunk@6597 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/embed/README.txt | 16 +++++++++++++++- mod/embed/views/default/embed/addcontentjs.php | 7 +++++-- mod/embed/views/default/embed/js.php | 13 +++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) (limited to 'mod/embed') diff --git a/mod/embed/README.txt b/mod/embed/README.txt index f81d5b14a..9cc21d949 100644 --- a/mod/embed/README.txt +++ b/mod/embed/README.txt @@ -6,4 +6,18 @@ http://www.gnu.org/licenses/old-licenses/gpl-2.0.html The embed plugin requires Elgg 1.5 (or prior to the Elgg 1.5 release, Elgg revision 2634 or above) and the file plugin. -To insert into the active editor, use elggEmbedInsert(html). \ No newline at end of file +To insert into the active editor, use elggEmbedInsert(html, textAreaName). + +The default behavior searches for all textareas with name textAreaName and +inserts the content into them. + +If you need to use special embed code to insert content into a custom textarea +(like tinyMce, FCK, etc), extend (nb: EXTEND, not override) the embed/custom_insert_js +view with your custom JS. The vars available to you are: + str content The content to insert. + str textAreaName The name of the textarea to receive the content. + +It is important to correctly extend this view for compatibility across +multiple plugins and textarea states. Your custom JS should run without +error no matter plugin order or rich text editor status. See TinyMCE as +an example of how to losely extend this function. \ No newline at end of file diff --git a/mod/embed/views/default/embed/addcontentjs.php b/mod/embed/views/default/embed/addcontentjs.php index f5533c22e..c32d90871 100644 --- a/mod/embed/views/default/embed/addcontentjs.php +++ b/mod/embed/views/default/embed/addcontentjs.php @@ -1,2 +1,5 @@ - var entity; - $('textarea[name=' + textAreaName + ']').val($('textarea[name=' + textAreaName + ']').val() + ' ' + content); \ No newline at end of file + \ No newline at end of file diff --git a/mod/embed/views/default/embed/js.php b/mod/embed/views/default/embed/js.php index c98fe63da..c8fe3bc53 100644 --- a/mod/embed/views/default/embed/js.php +++ b/mod/embed/views/default/embed/js.php @@ -6,14 +6,27 @@ ?> function elggEmbedInsertContent(content, textAreaName) { content = ' ' + content + ' '; + + // default input. + // if this doesn't match anything it won't add anything. + $('textarea[name=' + textAreaName + ']').val($('textarea[name=' + textAreaName + ']').val() + ' ' + content); + + + $.facebox.close(); } -- cgit v1.2.3