wrap the current selection with an element
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
History.md
Makefile
Readme.md
component.json
index.js

Readme.md

wrap-selection

Wrap the current selection with an element. It behaves a bit weirdly when the selection intersects other elements... notably paragraphs. If someone has a good fix for this, I'll buy you a beer.

Installation

Install with component(1):

$ component install bmcmahen/wrap-selection

Example

var wrap = require('wrap-selection');
var el = document.createElement('span');
el.className = 'bacon';
wrap(el);

License

MIT