我在myqsl中使用annotator.js和存储范围。对于突出显示文本,我在我的代码文件中使用此代码。
<script src="/js/pdfjs/annotator.js"></script>
<script>
$(function(){
var annotation = $('#content').annotator();
annotation.annotator('addPlugin', 'Store', {
prefix: '',
urls: {
create: '/highlighter',
update: '/update/:id',
destroy: '/delete/:id',
search: '/highlightersearch'
}
});
var comments = {
"total": 1,
"rows": [
{
"text": "n thi",
"consumer": "d4c108122b51434aab1d27ad4ebd2b02",
"permissions": {
"update": [],
"read": [],
"admin": [],
"delete": []
},
"updated": "2017-04-07T10:31:55.378772+00:00",
"quote": "ffff",
"uri": "http://localhost:8124/user/pdf/14396734926770",
"id": "AVtH-G9LqWiVDsXRg1jq",
"ranges": [
{
"endOffset": 6,
"startOffset": 1,
"end": "/div[1]/div[1]/div[2]/div[4]",
"start": "/div[1]/div[1]/div[2]/div[4]"
}
],
"created": "2017-04-07T10:31:55.378759+00:00"
}]};
var arr = $.map(comments, function(el) { return el });
annotation.annotator("loadAnnotations", arr);
});
</script>
错误: 我在控制台日志中得到这个“ TypeError:_ref1未定义” 不知道我做错了什么,请帮我快点。
答案 0 :(得分:0)
我使用此请求解决了我的问题,
annotation.annotator(&#39; addPlugin&#39;,&#39; Store&#39;,{ prefix:prefixUrl, annotationData:{ &#39; uri&#39;:&#39; / annotations&#39; },
由于