1

Topic: Bug mceInsertContent in tinymce 3.4.1 jquery

Hello, after updating of tinyMCE 3.4.1 jquery , my plugin contains a bug with inserting link
The plugin performs research and proposes to insert a link, but it performs the search and insert all the links.
Is it because of the function mceInsertContent?
My code in my plugin

init : function() {
        var t = this;
        t._search();
    },
    _search : function(){
        var t = this;
        $("#forms-search-product").submit(function(){
            $(this).ajaxSubmit({
                url: '/admin/catalog.php?get_search_product=true',
                type:"post",
                dataType:"json",
                resetForm: true,
                beforeSubmit:function(){
                    $('#table_search_product tbody').empty();
                    $('#table_search_product tbody').html('<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td><img src="/framework/img/small_loading.gif" /></td><td>&nbsp;</td><td>&nbsp;</td></tr>');
                },
                success:function(request) {
                    t._result(request);
                }
            });
            return false; 
        });
    },
    _result :function(j){
        var t = this;
        $('#table_search_product tbody').empty();
        if(j === undefined){
            console.log(j);
        }
        if(j !== null){
            $.each(j, function(i,item) {
                if(item.codelang != null){
                    flaglang = item.codelang;
                }else{
                    flaglang = '-';
                }
                if(item.codelang != null){
                    flaglang = item.codelang;
                }else{
                    flaglang = '-';
                }
                if(item.subcategory != null){
                    scategory = item.subcategory;
                }else{
                    scategory = '-';
                }
                var insertLink = t._insert(item.uriproduct,item.titlecatalog);
                return $('<tr>'
                +'<td>'+item.idproduct+'</td>'
                +'<td>'+flaglang+'</td>'
                +'<td>'+item.titlecatalog+'</td>'
                +'<td>'+item.category+'</td>'
                +'<td>'+scategory+'</td>'
                +'<td><a href="#" onclick="tinyMCEPopup.close();" onmousedown="'+insertLink+'">Insert</a></td>'
                +'</tr>').appendTo('#table_search_product tbody');
            });
        }else{
            return $('<tr>'
                    +'<td>-</td>'
                    +'<td>-</td>'
                    +'<td>-</td>'
                    +'<td>-</td>'
                    +'<td>-</td>'
                    +'<td>-</td>'
                    +'</tr>').appendTo('#table_search_product tbody');
        }
    },
    _insert : function(href,name) {
        var t = this;
        tinyMCE.execCommand('mceInsertContent',false,'<a title="'+name+'" href="'+href+'">'+name+'</a>');
    }

Is this plugin autolink is at stake?
Can you disable it or how to adapt my plugin does not insert it automatically links

Last edited by gtraxx (2011-03-25 11:41:42)

Main developer of Magix CMS AND magix cjQuery

2

Re: Bug mceInsertContent in tinymce 3.4.1 jquery

I found my problem is simply insert tag to be configured differently.
Exemple :

+'<td><a href="#" onclick="tinyMCEPopup.close();" onmousedown="insert_cms_link(\''+item.uricms+'\',\''+titlepage+'\');" class="link-cms-page">Insert</a></td>'

Best regards

Main developer of Magix CMS AND magix cjQuery