alienzhou/web-highlighter
✨ A no-runtime dependency lib for text highlighting & persistence on any website ✨🖍️
17 Releases
Latest: 4y ago
v0.7.4Latest
📋 Changes
- [Array.prototype.includes](https://caniuse.com/array-includes)
- [String: startsWith](https://caniuse.com/mdn-javascript_builtins_string_startswith)
- [RegExp: unicode](https://caniuse.com/mdn-javascript_builtins_regexp_unicode)
v0.7.3
📋 Changes
- highlight wrapper inside another wrapper not get updated when deleting #80
- make the className the latest one when wrapping a partial or an overlap node #82
- better typings for event emitter #81
- tsconfig path alias and npm scripts #84
v0.7.2
📋 Changes
- including type declarations in the `package.json`
- making public `.options` a private field
v0.7.1
📋 Changes
- Generating .d.ts files for projects using typescript.
- Select the range's container element correctly when it is not Text/Comment/CDATASection. #56
v0.7.0
📋 Changes
- Make get id methods more flexible.
- It will get correct id(s) inside a wrapper. No need to be a wrapper element.
- It is limited in the root scope.
- Retain the wrapper's classname when wrapping a partial node.
v0.6.0
📋 Changes
- Add `.getExtraIdByDom` instance method which helps get extra ids from a wrapper. [more>>](https://github.com/alienzhou/web-highlighter/tree/v0.6.0#highlightergetextraidbydomnode)
- Add a new hook: `Serialize.Restore`. You can use it to customize your own restoring method. When you tap this hook, the HighlightSource instance will use the function you pass to calculate the start and end nodes' info. [more>>](https://github.com/alienzhou/web-highlighter/blob/master/docs/ADVANCE.md#serializerestore)
- Support remove function in hooks. Now `hook.tap()` will return a function for removing it. Besides, you can also call `hook.remove()` to remove a tapped function.
- When pre&next nodes are empty texts, the text node's wrapper should not be split.
- Avoid add duplicate functions to a hook.
- Add unit tests for hook, event emitter and new features.
- Use unknown type instead of any.
v0.5.2
📋 Changes
- Support verbose configuration. It decides whether warning&error message will be output.
- Add a static method `.isHighlightWrapNode()`. You can use it to test whether a node(DOM) is a highlight wrapper.
- Prevent emit REMOVE event when no node is affected by calling `.remove()` and `.removeAll()`
- Fix the bug in `.getAll`, now it will return correct data
- Prevent injecting duplicate stylesheets when one has been injected
- Add a suit of unit tests to ensure the code quality.
- Refactor the way of error reporting.
- Remove `.dataset` polyfill.
v0.5.1
📋 Changes
- fix the bug: When the root node has no children (except text nodes), the highlights can't be recreate by sources. #38
v0.6.0-beta.0
📋 Changes
- add a new hook: `Serialize.Restore`
v0.5.0
📋 Changes
- add an option: support changing the default wrapper's tag name
0.4.0-beta.0
📋 Changes
- support highlighting on mobile devices: (#26 )
- automatically detect whether mobile devices
- use touch events when on mobile devices
- source code: provide some internal methods for dom operation
- example app: bugfix & update
v0.3.5
📋 Changes
- Bugfix: The `highlighter.removeAll()` method doesn't work
v0.3.3
📋 Changes
- hook: Remove.UpdateNode --> Remove.UpdateNodes
- docs: english version
- use new README for the example
v0.3.2
📋 Changes
- refactor: split some painter's functions
- update: update docs and the example
v0.3.1
📋 Changes
- Structure refactor
- Handling compatibility issues
- Remove unnecessary modules
v0.0.3
📋 Changes
- support setting config dynamically
- rename `.render()` to `.fromSource()`
- rename `.highlight()` to `.fromRange()`
- remove `.init` method and `highlight:init` event
v0.0.2
📋 Changes
- set highlight style (class) by id
- get highlight position info (offsetTop, offsetLeft)
- highlighting web text by passing range manually
