]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #3853 caching a bookmark for insert carot when embedding content into TinyMCE...
authorCash Costello <cash.costello@gmail.com>
Sun, 6 Nov 2011 22:54:05 +0000 (17:54 -0500)
committerCash Costello <cash.costello@gmail.com>
Sun, 6 Nov 2011 22:54:05 +0000 (17:54 -0500)
mod/tinymce/views/default/js/tinymce.php
mod/tinymce/views/default/tinymce/embed_custom_insert_js.php

index c6973d87837d70a827205f7d5f3e2613e3139811..20236d657306d87e032720871a4168d3e8c8fc17 100644 (file)
@@ -18,7 +18,7 @@ elgg.tinymce.toggleEditor = function(event) {
                tinyMCE.execCommand('mceRemoveControl', false, id);
                $(this).html(elgg.echo('tinymce:add'));
        }
-};
+}
 
 /**
  * TinyMCE initialization script
@@ -59,7 +59,7 @@ elgg.tinymce.init = function() {
                                var text = elgg.echo('tinymce:word_count') + strip.split(' ').length + ' ';
                                tinymce.DOM.setHTML(tinymce.DOM.get(tinyMCE.activeEditor.id + '_path_row'), text);
                        });
-       
+
                        ed.onKeyUp.add(function(ed, e) {
                                var strip = (tinyMCE.activeEditor.getContent()).replace(/(&lt;([^&gt;]+)&gt;)/ig,"");
                                var text = elgg.echo('tinymce:word_count') + strip.split(' ').length + ' ';
@@ -69,6 +69,21 @@ elgg.tinymce.init = function() {
                content_css: elgg.config.wwwroot + 'mod/tinymce/css/elgg_tinymce.css'
        });
 
-};
+       // work around for IE/TinyMCE bug where TinyMCE loses insert carot
+       if ($.browser.msie) {
+               $(".embed-control").live('hover', function() {
+                       var classes = $(this).attr('class');
+                       var embedClass = classes.split(/[, ]+/).pop();
+                       var textAreaId = embedClass.substr(embedClass.indexOf('embed-control-') + "embed-control-".length);
+
+                       if (window.tinyMCE) {
+                               var editor = window.tinyMCE.get(textAreaId);
+                               if (elgg.tinymce.bookmark == null) {
+                                       elgg.tinymce.bookmark = editor.selection.getBookmark(2);
+                               }
+                       }
+               });
+       }
+}
 
 elgg.register_hook_handler('init', 'system', elgg.tinymce.init);
\ No newline at end of file
index d5513cef185ee752155e39ca10c723a6e293d2c0..a861a4035efc3d7a4796d7bea2573f0fb9aa435b 100644 (file)
@@ -1,8 +1,14 @@
        if (window.tinyMCE) {
                var editor = window.tinyMCE.get(textAreaId);
-               
+
                if (editor) {
+
+                       // work around for IE/TinyMCE bug where TinyMCE loses insert carot
+                       if ($.browser.msie) {
+                               editor.focus();
+                               editor.selection.moveToBookmark(elgg.tinymce.bookmark);
+                       }
+
                        editor.execCommand("mceInsertContent", true, content);
                }
        }
-       
\ No newline at end of file