未捕获的TypeError:无法读取未定义的TinyMCE编辑器的属性'rowIndex'

时间:2018-12-25 12:47:26

标签: jquery tinymce codeigniter-3 tinymce-plugins

我在我的一个项目中实现了tinymce编辑器。我有使用不同语言的网站,并且在管理面板中创建了一个功能来添加每种语言的内容,即每个textarea都初始化为tinymce编辑器。 textarea字段是使用语言的foreach循环创建的。现在的问题是,当我使用“工具”菜单下的“源代码”将HTML添加到编辑器时,出现错误:

Uncaught TypeError: Cannot read property 'rowIndex' of undefined
at d (plugin.min.js:1)
at A (plugin.min.js:1)
at plugin.min.js:1
at Array.<anonymous> (tinymce.min.js:3)
at n (tinymce.min.js:3)
at Object.r [as map] (tinymce.min.js:3)
at C (plugin.min.js:1)
at D (plugin.min.js:1)
at t (plugin.min.js:1)
at A.<anonymous> (plugin.min.js:2)

我正在使用Codeigniter框架,这是我的PHP HTML代码:

<?php if(count($languages) > 0) { //list of languages added for the site
foreach($languages as $language)
{
    if(isset($page_detail))
    {
        $translations = unserialize($page_detail->languages); //translation of page in each language.
    }
    ?>
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title"><?php echo $language->vchlangname;?> Language</h3>
        </div>
        <div class="panel-body languages" lang_id="<?php echo $language->intlangid;?>">
            <div class="row">
                <div class="col-lg-6">
                    <div class="form-group">
                        <label>Page Title:</label><span class="mandatory">*</span>
                        <input name="vchTitle<?php echo $language->intlangid;?>" id="vchTitle<?php echo $language->intlangid;?>" type="text" class="form-control" placeholder="Enter page title" value="<?php echo isset($translations[$language->vchlangcode]['vchtitle']) ? strval($translations[$language->vchlangcode]['vchtitle']) : "";?>" >
                    </div>
                </div>
                <div class="col-lg-12">
                    <div class="form-group">
                        <label>Description:</label><span class="mandatory">*</span>
                        <textarea name="vchDescription<?php echo $language->intlangid;?>" id="vchDescription<?php echo $language->intlangid;?>" placeholder="Enter description" class="form-control" rows="3"><?php echo isset($translations[$language->vchlangcode]['txtdescription']) ? strval($translations[$language->vchlangcode]['txtdescription']) : "";?></textarea>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <?php
}
}?>

这是我的脚本代码和ajax提交代码:

 <script type="text/javascript">
tinymce.init({
    selector: 'textarea',
    height: 500,
    theme: 'modern',
    relative_urls: false,
    remove_script_host: false,
    verify_html : false,
    plugins: [
      'advlist autolink lists link image charmap print preview hr anchor pagebreak',
      'searchreplace wordcount visualblocks visualchars code fullscreen',
      'insertdatetime media nonbreaking save table contextmenu directionality',
      'emoticons template paste textcolor colorpicker textpattern imagetools'
    ],
    toolbar1: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
    toolbar2: 'print preview media | forecolor backcolor emoticons',
    image_advtab: true
   });

jQuery("#frmPages").validate({
    submitHandler: function(form)
    {
        var language_desc = {}; // array to store decription of languages.
        var ajaxURL = "<?php echo base_url();?>/admin/pages/page_data";
        var description = encodeURIComponent(tinymce.get('vchDescription').getContent());
        <?php 
        if(count($languages) > 0)
        {
            foreach($languages as $language)
            {
                ?>
                language_desc[<?php echo $language->intlangid;?>] = encodeURIComponent(tinymce.get('vchDescription<?php echo $language->intlangid;?>').getContent());
                <?php
            }
        }
        ?>
        var id = "<?php echo isset($page_detail) ? $page_detail->intpageid : '';?>";
        jQuery.post(ajaxURL,jQuery(form).serialize()+"&id="+id+"&description="+description+"&lang_description="+JSON.stringify(language_desc)+"&ajax=true&action=managePages",function(data)
        {
            alert("Saving your changes. Please wait for the page redirect.");
            alert(data);

        });
    }
});
</script>

我希望我已经完全解释了这种情况并提供了所需的代码。请告诉我我错了。

谢谢。

0 个答案:

没有答案