将羽毛笔编辑器与php codeigniter集成

时间:2019-12-30 10:13:27

标签: javascript php codeigniter quill

我正在php codigniter框架中工作,并且试图将quilljs编辑器集成到该系统中,我尝试了所有以下脚本代码:

  <script>
  $('.quill-editor').each(function(i, el) {
    var el = $(this), id = 'quilleditor-' + i, val = el.val(), editor_height = 200;
    var div = $('<div/>').attr('id', id).css('height', editor_height + 'px').html(val);
    el.addClass('d-none');
    el.parent().append(div);

    var quill = new Quill('#' + id, {
        modules: { toolbar: true },
        theme: 'snow'
    });
    quill.on('text-change', function() {
        el.html(quill.getContents());
    });
});
  </script>

我在textarea的类中调用了此脚本,但是它对文本区域没有作用

<textarea id="discussion_desc" name="discussion_desc" rows="5" class="form-control quill-editor" oninput="enableSubmitButton()"><?php if($edit_discussion[0]['discussion_desc']){ echo $edit_discussion[0]['discussion_desc']; } ?></textarea>

0 个答案:

没有答案