import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
import { mapChildren } from '../utils/slice';
export const transformSliceNestedExpandToExpand = (slice, schema) => {
  const {
    expand,
    nestedExpand
  } = schema.nodes;
  const children = [];
  mapChildren(slice.content, node => {
    if (node.type === nestedExpand) {
      children.push(expand.createChecked(node.attrs, node.content, node.marks));
    } else {
      children.push(node);
    }
  });
  return new Slice(Fragment.fromArray(children), slice.openStart, slice.openEnd);
};