save-selection
v2.0.2
Published
Save & restore selections in a document, using `<mark>` elements
Downloads
2
Readme
save-selection
Save & restore selections in a document, using <mark>
elements
Installation
Download node at nodejs.org and install it, if you haven't already.
npm install save-selection --save
Usage
import {save, restore} from 'save-selection';
// will save selections in <mark> elements
// with classes "selection-start" & "selection-end"
save(document.querySelector('#main'));
// will restore selections,
// setting start to a <mark> element with class selection-start
// and end with class selection-end
restore(document.querySelector('#main'));
Tests
npm install
npm test
Dependencies
- get-selection-range-from-elm: window.getSelection().rangeAt(0) but only if it exists & is within an element
Dev Dependencies
- babel-cli: Babel command line.
- babel-core: Babel compiler core.
- babel-preset-es2015: Babel preset for all es2015 plugins.
- babelify: Babel browserify transform
- browserify: browser-side require() the node way
- electron-prebuilt: Install electron prebuilt binaries for the command-line use using npm
- package-json-to-readme: Generate a README.md from package.json contents
- semistandard: All the goodness of
feross/standard
with semicolons sprinkled on top. - snazzy: Format JavaScript Standard Style as Stylish (i.e. snazzy) output
- tape: tap-producing test harness for node and browsers
- testron: CI your client side tests with Electron
License
MIT
Generated by package-json-to-readme