@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
19 lines • 594 B
JavaScript
import { createWrapSelectionTransaction } from './create-wrap-selection-transaction';
/**
* Function will add wrapping node.
* 1. If currently selected blocks can be wrapped in the wrapper type it will wrap them.
* 2. If current block can not be wrapped inside wrapping block it will create a new block below selection,
* and set selection on it.
*/
export function wrapSelectionIn(type) {
return function (state, dispatch) {
var tr = createWrapSelectionTransaction({
state: state,
type: type
});
if (dispatch) {
dispatch(tr);
}
return true;
};
}