UNPKG

slate-edit-list

Version:

A Slate plugin to handle keyboard events in lists.

15 lines (11 loc) 373 B
module.exports = function(plugin, state) { const p = state.document.findDescendant(node => node.type == 'paragraph'); const withCursor = state.transform() .collapseToStartOf(p) .moveToOffsets(5, 5) .apply(); const transform = withCursor.transform(); return plugin.transforms .splitListItem(transform) .apply(); };