UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

25 lines (24 loc) 747 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.wrapSelectionIn = wrapSelectionIn; var _createWrapSelectionTransaction = require("./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. */ function wrapSelectionIn(type) { return function (state, dispatch) { var tr = (0, _createWrapSelectionTransaction.createWrapSelectionTransaction)({ state: state, type: type }); if (dispatch) { dispatch(tr); } return true; }; }