]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Was in the wrong path for the previous commit. Now embed correctly support losely...
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 30 Jun 2010 18:31:13 +0000 (18:31 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 30 Jun 2010 18:31:13 +0000 (18:31 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6597 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/embed/README.txt
mod/embed/views/default/embed/addcontentjs.php
mod/embed/views/default/embed/js.php
mod/tinymce/start.php

index f81d5b14afefdb1b983ebf7a8ed25f73488584e1..9cc21d9491a104b444ca6b34d10d648279ea995f 100644 (file)
@@ -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
index f5533c22eb678124809ff86048c9d018203ac668..c32d90871b894d7451874e95201e4df2a2327d4e 100644 (file)
@@ -1,2 +1,5 @@
-       var entity;
-       $('textarea[name=' + textAreaName + ']').val($('textarea[name=' + textAreaName + ']').val() + ' ' + content);
\ No newline at end of file
+<?php 
+/**
+ * Blank for compatibility.
+ */
+?>
\ No newline at end of file
index c98fe63dad6c34546ad35460390541afd2d753cf..c8fe3bc5330aea5af8a344e1055ab56763f22e2f 100644 (file)
@@ -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);
+       
        <?php
                // This view includes the guts of the function to do the inserting.
                // Anything that overrides input/longtext with its own editor
                // needs to supply its own function here that inserts
                // content into textAreaName.
                // See TinyMCE as an example.
+               
+               // for compatibility
+               // the old on that was overriden.
                echo elgg_view('embed/addcontentjs');
+               
+               // the one you should extend.
+               echo elgg_view('embed/custom_insert_js');
        ?>
+       
+       
        $.facebox.close();
 }
 
index 47bb627a6aa715d18783eb1a25620eeaff88f491..6a79524d72f0432d36249b912b5025ef7aa8a9c6 100644 (file)
@@ -13,7 +13,7 @@ function tinymce_init() {
        global $CONFIG;
 
        elgg_extend_view('css', 'tinymce/css');
-       //set_view_location('embed/addcontentjs', $CONFIG->pluginspath . 'tinymce/views/');
+       elgg_extend_view('embed/custom_insert_js', 'tinymce/embed_custom_insert_js');
 }
 
 register_elgg_event_handler('init', 'system', 'tinymce_init', 9999);