import { definePmNodeConverter } from "./../../pm-converters/types.js";
import { removeNullValues } from "./../../pm-converters/utils.js";
import { Node_Type } from "./../../ricos-schema/next-schema/index.js";
const headingConverter = definePmNodeConverter({
  toPm: {
    types: [Node_Type.HEADING],
    convert: (node, visit) => {
      const { id, style, headingData } = node;
      return {
        type: Node_Type.HEADING,
        attrs: {
          ...headingData,
          ...style ? { style } : {},
          id
        },
        content: visit?.(node)
      };
    }
  },
  fromPm: {
    types: [Node_Type.HEADING],
    convert: (node, visit) => {
      const { id, style, ...data } = node.attrs || {};
      return {
        type: Node_Type.HEADING,
        id,
        nodes: visit?.(node),
        ...style ? { style } : {},
        headingData: {
          ...removeNullValues(data)
        }
      };
    }
  }
});
export {
  headingConverter
};
//# sourceMappingURL=heading-converter.js.map
