split element blocks at the cursor. useful for inserting elements in between content.
Install with component(1):
$ component install component/split-at-cursor
var editor = document.getElementById('editor');
var parent = editor.parentNode;
btn.onclick = function() {
var el = split(editor);
var hr = document.createElement('hr');
parent.appendChild(hr);
parent.appendChild(el);
}
Split the DOM tree of el
at the cursor. Returns a clone of el
containing the right half of the DOM tree.
npm install
make test
MIT