@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
17 lines (16 loc) • 804 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.transformSliceToDecisionList = void 0;
var _model = require("@atlaskit/editor-prosemirror/model");
// If slice is decisionItem, wrap it inside a decisionList. This prevents an
// additional newline from being pasted along with the selected decision item.
var transformSliceToDecisionList = exports.transformSliceToDecisionList = function transformSliceToDecisionList(slice, schema) {
var node = slice.content.firstChild;
if (slice.content.childCount === 1 && node && node.type.name === 'decisionItem') {
var decisionListWrapperNode = schema.nodes.decisionList.create({}, node);
return new _model.Slice(_model.Fragment.from(decisionListWrapperNode), slice.openStart, slice.openEnd);
}
return slice;
};