npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

text-remark

v0.0.15

Published

JS Document annotation Base Library 文本注释标注基础库

Readme

text-remark

JS Document annotation Base Library 文本注释标注基础库 See in github

How to use 如何使用

// init textRemark
const textRemark = new TextRemark({
  container: '#mark',
  text: 'Text annotation test',
  /*
  Remarks is the marked data information, which has four fields: start position(baseoffset), end position(extentoffset), type and JSON data.Where type will be added to CSS marked with DOM tag <span data-type="danger" data-index="0" class="text-remark-tag text-remark-danger">this metting</span>,Data can be obtained in the remark selected event of textremark
  */
 /*
  remarks为标注的数据信息,有四个字段,开始位置baseOffset、结束位置extentOffset、类型、json数据
  其中type会添加到标注dom标签的css上 <span data-type="danger" data-index="0" class="text-remark-tag text-remark-danger">此次会议</span>
  data在 textRemark的remark-selected事件中,可以拿到
 */

  remarks: [
    {
      baseOffset: 4,
      extentOffset: 8,
      type: 'danger',
      data: { text: 'this is a remark' }
    },
    {
      baseOffset: 694,
      extentOffset: 699,
      type: 'normal',
      data: { text: 'this is another remark' }
    }
  ]
})

Start demo

demo based vue. Download code,Enter the example directory
demo 基于 vue 完成。下载代码,进入 example 后

npm i
npm start

text-remark

方法

| 方法 | 描述 | 其它 | | ----------------- | --------------------------------------- | ---------------------------------------------------------------- | | addRemark | 添加标注 addRemark(type, data = {}) | Data is saved in json,data 会保存到 json 中 | | removeRemark | 移出标注 removeRemark(index) | index 为索引号 | | updateRemark | 更新标注 updateRemark(index, data={}) | index 为索引号,data is a object data | | getJson | 获取组件 json 数据 {text:'',remarks:[]} | get json | | clearActive | 清除选中状态 clearActive() | 组件重写默认的选中状态,光标 blur 的时候无法清除,利用该方法清除 | | setSelectedRemark | 设置选中状态 setSelectedRemark(index) | 设置第几个 mark 为选中 | | updateShowText | 更新显示的文本 updateShowText() | 强制更新标注显示 |

事件

| 事件 | 描述 | 其它 | | --------------- | ------------------------------------------------------------- | ---------------------------------- | | remark-selected | textRemark.on('remark-selected', function(e){console.log(e)}) | 选中标记的 remark 时,会触发该方法 |