"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.insertBreakList = void 0;
var _core = require("../../../core");
var _queries = require("../queries");
var _transforms = require("../transforms");
const insertBreakList = editor => {
  if (!editor.selection) return;

  // moved | inserted
  let moved = false;
  const res = (0, _queries.getListItemEntry)(editor, {});
  // If selection is in a li, and li content is empty
  if (res) {
    if ((0, _core.isBlockAboveEmpty)(editor)) {
      moved = (0, _transforms.movedListItemUp)(editor, res);
      if (moved) return true;
    }
  }
  if (!moved) {
    const inserted = (0, _transforms.insertListItem)(editor);
    if (inserted) return true;
  }
  return;
};
exports.insertBreakList = insertBreakList;