slate-edit-list
Version:
A Slate plugin to handle keyboard events in lists.
15 lines (11 loc) • 404 B
JavaScript
module.exports = function(plugin, state) {
const selectedBlock = state.document.getDescendant('_selection_key');
const withCursor = state.transform()
.collapseToStartOf(selectedBlock)
.moveForward(2) // It|em 1
.apply();
const transform = withCursor.transform();
return plugin.transforms
.splitListItem(transform)
.apply();
};