我正在尝试将At.js集成到Trix 编辑器中,以便我可以@提及用户。
$('trix-editor').atwho({
at: "@",
data:['Peter', 'Tom', 'Anne']
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/basecamp/trix/master/dist/trix.js"></script>
<script src="https://cdn.rawgit.com/ichord/At.js/master/dist/js/jquery.atwho.js"></script>
<script src="https://cdn.rawgit.com/ichord/Caret.js/master/dist/jquery.caret.js"></script>
<link href="https://cdn.rawgit.com/basecamp/trix/master/dist/trix.css" rel="stylesheet"/>
<link href="https://cdn.rawgit.com/ichord/At.js/master/dist/css/jquery.atwho.css" rel="stylesheet"/>
Trix Editor:
<form action='#'>
<input id="x" type="hidden" name="content" value="Type @">
<trix-editor input="x"></trix-editor>
</form>
正如您在上面的示例中看到的那样,出现了弹出窗口,但是当您选择一个项目时,您会收到以下错误:jquery.atwho.js:686 The given range isn't in document.
“给定范围不在文档中”是什么意思我应该从哪里开始寻找调试它?