import { Node } from 'prosemirror-model';
import { ATTRIBUTE_LIST_STYLE_TYPE } from './ListItemNodeSpec.js';
import { LIST_ITEM } from './NodeNames.js';
import { ATTRIBUTE_INDENT, MIN_INDENT_LEVEL } from './ParagraphNodeSpec.js';
var AUTO_LIST_STYLE_TYPES = ['disc', 'square', 'circle'];
var BulletListNodeSpec = {
  attrs: {
    id: {
      "default": null
    },
    indent: {
      "default": 0
    },
    listStyleType: {
      "default": null
    }
  },
  group: 'block',
  content: LIST_ITEM + '+',
  parseDOM: [{
    tag: 'ul',
    getAttrs: function getAttrs(dom) {
      var listStyleType = dom.getAttribute(ATTRIBUTE_LIST_STYLE_TYPE) || null;
      var indent = dom.hasAttribute(ATTRIBUTE_INDENT) ? parseInt(dom.getAttribute(ATTRIBUTE_INDENT), 10) : MIN_INDENT_LEVEL;
      return {
        indent: indent,
        listStyleType: listStyleType
      };
    }
  }],
  toDOM: function toDOM(node) {
    var _node$attrs = node.attrs,
      indent = _node$attrs.indent,
      listStyleType = _node$attrs.listStyleType;
    var attrs = {};
    // [FS] IRAD-947 2020-05-26
    // Bullet list type changing fix
    attrs[ATTRIBUTE_INDENT] = indent;
    if (listStyleType) {
      attrs[ATTRIBUTE_LIST_STYLE_TYPE] = listStyleType;
    }
    var htmlListStyleType = listStyleType;
    if (!htmlListStyleType || htmlListStyleType === 'disc') {
      htmlListStyleType = AUTO_LIST_STYLE_TYPES[indent % AUTO_LIST_STYLE_TYPES.length];
    }
    attrs.type = htmlListStyleType;
    return ['ul', attrs, 0];
  }
};
export default BulletListNodeSpec;
import { bpfrpt_proptype_NodeSpec } from "./Types.js";