import { Node } from 'prosemirror-model';
import toCSSColor from './ui/toCSSColor.js';
var TextColorMarkSpec = {
  attrs: {
    color: {
      "default": null
    },
    //  Allow missing color
    overridden: {
      "default": false
    }
  },
  inline: true,
  group: 'inline',
  parseDOM: [{
    tag: 'span[style*=color]',
    getAttrs: function getAttrs(dom) {
      var color = dom.style.color;
      var overridden = dom.getAttribute('overridden') === 'true'; // Extract overridden flag
      return {
        color: toCSSColor(color),
        overridden: overridden
      };
    }
  }],
  toDOM: function toDOM(node) {
    var _node$attrs = node.attrs,
      color = _node$attrs.color,
      overridden = _node$attrs.overridden;
    var attrs = {};
    if (color) {
      attrs.style = "color: ".concat(color, ";");
      attrs['overridden'] = overridden === null || overridden === void 0 ? void 0 : overridden.toString();
    }
    return ['span', attrs, 0];
  }
};
export default TextColorMarkSpec;
import { bpfrpt_proptype_MarkSpec } from "./Types.js";