import { Decoration_Type } from "./../../ricos-schema/next-schema/index.js";
const fontSizeConverter = {
  fromPm: {
    type: Decoration_Type.FONT_SIZE,
    convert: (mark) => {
      const { attrs } = mark;
      if (!attrs || !attrs.value) {
        return [];
      }
      return [
        {
          type: Decoration_Type.FONT_SIZE,
          fontSizeData: {
            value: attrs.value,
            // if attrs.unit is 'PX' we should not save it since it defaults to that anyway,
            // but old versions of viewer will be angry if it's not there, so we keep it for now
            unit: attrs.unit ?? "PX"
          }
        }
      ];
    }
  },
  toPm: {
    type: Decoration_Type.FONT_SIZE,
    convert: (decoration) => {
      const { fontSizeData } = decoration;
      if (!fontSizeData || !fontSizeData.value) {
        return void 0;
      }
      return {
        type: Decoration_Type.FONT_SIZE,
        attrs: {
          value: fontSizeData.value,
          unit: fontSizeData.unit ?? "PX"
        }
      };
    }
  }
};
export {
  fontSizeConverter
};
//# sourceMappingURL=font-size-converter.js.map
