jQuery-textcomplete与CKEditor / TinyMCE集成

时间:2016-09-13 10:54:01

标签: javascript jquery autocomplete ckeditor tinymce

我尝试将jquery-textcomplete与ckeditor和tinyMCE集成。

我收到了这个错误。

TypeError: CKEDITOR.instances.issue_notes is undefined

你能给我一点帮助,将jQuery-textcomplete与CKEditor / TinyMCE集成。您可以在此处查看代码示例https://jsfiddle.net/btjapqkp/

HTML

<script src="https://code.jquery.com/jquery-3.1.0.js" type="text/javascript"> 
</script>
<script src="https://cdn.ckeditor.com/4.5.10/standard/ckeditor.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.5.10/adapters/jquery.js">
</script>

的JavaScript

$(document).ready(function(){
  tinymce.init({ selector:'#three' });
  $('#two').ckeditor();
  $('.editable').textcomplete([{
    match: /(^|\b)(\w{2,})$/,
    search: function (term, callback) {
      var words = ['google', 'facebook', 'github', 'microsoft', 'yahoo'];
      callback($.map(words, function (word) {
        return word.indexOf(term) === 0 ? word : null;
      }));
    },
    replace: function (word) {
      return word + ' ';
    }
  }]);
});

1 个答案:

答案 0 :(得分:0)

这是因为jquery-textcomplete中的一个错误。查看下面的URL以解决该问题。该解决方案将在不久的将来合并到jquery-texcomplete。那么你不需要遵循以下解决方案。

https://github.com/yuku-t/jquery-textcomplete/issues/285