"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.transformSingleLineCodeBlockToCodeMark = void 0;
var _model = require("@atlaskit/editor-prosemirror/model");
var transformSingleLineCodeBlockToCodeMark = exports.transformSingleLineCodeBlockToCodeMark = function transformSingleLineCodeBlockToCodeMark(slice, schema) {
  if (slice.content.childCount === 1 && (slice.openStart || slice.openEnd)) {
    var maybeCodeBlock = slice.content.firstChild;
    if (maybeCodeBlock && maybeCodeBlock.type === schema.nodes.codeBlock) {
      if (maybeCodeBlock.textContent && maybeCodeBlock.textContent.indexOf('\n') === -1) {
        return new _model.Slice(_model.Fragment.from(schema.text(maybeCodeBlock.textContent, [schema.marks.code.create()])), 0, 0);
      }
    }
  }
  return slice;
};