在 Laravel 的动态文本字段中添加 CKEDITOR:错误代码:editor-element-conflict

时间:2021-03-16 16:18:12

标签: angularjs ajax laravel ckeditor

我想在laravel的动态字段中添加ckeditor。 ckeditor 脚本文件是

<script>
  $(function() {
  $('.ckeditor').each(function(){  
CKEDITOR.replace($(this).attr('id'), {
extraPlugins: 'mathjax',
mathJaxLib: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_CHTML',
height: 100
});
});  
  });  
</script>

查看页面就像

     <div class="row" data-ng-repeat="i in range(total_answers) track by $index" ng-if="total_answers > 0">
     
    <fieldset class="form-group col-md-4" >
        <label >Option @{{ $index+1 }}</label> <span class="text-red">*</span>
        <input type="textarea" name="options[]" id="option_@{{ $index }}" class="form-control ckeditor" placeholder="Option @{{ $index+1 }}" ng-model="answers[$index].option_value">
    </fieldset>

    <fieldset class="form-group col-md-4" >
        <label >Option @{{ $index+1 }} (2nd Language) </label> 
        <input type="text" name="optionsl2[]" id="optionl2_@{{ $index }}" class="form-control ckeditor" placeholder="Option 2nd lang @{{ $index+1 }}" ng-model="answers[$index].optionl2_value">
        
    </fieldset>
</div>

请帮帮我,我不知道问题出在哪里

1 个答案:

答案 0 :(得分:0)

您的元素都没有“ckeditor”类,这正是您的脚本正在寻找的。将该类添加到 textarea 中,只要您没有任何其他问题,它就应该适合您。

相关问题