import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
export var insertContentDeleteRange = function insertContentDeleteRange(tr, getSelectionResolvedPos, insertions, deletions) {
  insertions.forEach(function (contentInsert) {
    var _contentInsert = _slicedToArray(contentInsert, 2),
      content = _contentInsert[0],
      pos = _contentInsert[1];
    tr.insert(tr.mapping.map(pos), content);
  });
  deletions.forEach(function (deleteRange) {
    var _deleteRange = _slicedToArray(deleteRange, 2),
      firstPos = _deleteRange[0],
      lastPos = _deleteRange[1];
    tr.delete(tr.mapping.map(firstPos), tr.mapping.map(lastPos));
  });
  tr.setSelection(new TextSelection(getSelectionResolvedPos(tr)));
};