1.0.0 • Published 6 years ago
@yi-note/text-highlighter v1.0.0
TextHighlighter-esm
This is a fork of mir3z/texhighlighter.
What's new
- Migrate to ES module system.
- Use
Rollupas module bundler. - Export in both
es moduleandiifeformat for browser use. - Publish in npm.
Installation
npm i @yi-note/text-highlighter --save-devGetting started
Use ES module
import TextHighlighter from '@yi-note/text-highlighter'Use IIFE
Add minified script file to head section of your web page, the file can be find in node_modules/@yi-note/text-highlighter/dist/bundle.min.js. Feel free to upload it into CDN or move to the src folder.
Include minified lib file in HTML
<script type="text/javascript" src="bundle.min.js"></script>How to use
var hltr = new TextHighlighter(document.body);For more details see API reference or Wiki pages on GitHub.
Development
Install dependencies
npm installLocal dev
npm run devRun static pages (index, demos, doc) locally
npm run staticFor more informatin, please refer to scripts section in package.json.
Features
- Highlighting of selected text.
- Highlighting all occurrences of given text (find & highlight).
- Removing highlights.
- Selecting highlight color.
- Serialization & deserialization.
- Works well in iframes.
- Keeps DOM clean.
- No dependencies. No jQuery or other libraries needed.
Compatibility
Should work in all decent browsers and IE >= 9.
Demos
Documentation
You may check API reference or Wiki pages on GitHub.
1.0.0
6 years ago