【问题标题】:Annotations using annotator.js is not working properly使用 annotator.js 的注释无法正常工作
【发布时间】:2017-09-02 17:56:26
【问题描述】:

我正在使用 annotator.js 并将范围存储在 mysql 中。对于突出显示文本,我在我的代码文件中使用此代码。

<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 is undefined”上得到了这个 知道我做错了什么,请帮我解决这个问题。

【问题讨论】:

    标签: javascript jquery mysql node.js annotations


    【解决方案1】:

    我使用这个请求解决了我的问题,

    annotation.annotator('addPlugin', 'Store', { 前缀:prefixUrl, 注释数据:{ 'uri': '/注解' },

    谢谢

    【讨论】:

      猜你喜欢
      • 2023-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-31
      • 2012-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多