const o = [
  { label: "1.0", value: "1.0" },
  { label: "1.15", value: "1.15" },
  { label: "1.5", value: "1.5" },
  { label: "2.0", value: "2.0" },
  { label: "2.5", value: "2.5" },
  { label: "3.0", value: "3.0" }
], s = (t) => {
  let e = t;
  const n = ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "LI", "BLOCKQUOTE", "PRE"];
  for (; e; ) {
    if (e.nodeType === Node.ELEMENT_NODE) {
      const l = e;
      if (n.includes(l.tagName))
        return l;
    }
    e = e.parentNode;
  }
  return null;
}, i = (t) => {
  if (!t) return !1;
  try {
    const e = window.getSelection();
    if (!e || e.rangeCount === 0) return !1;
    const n = e.getRangeAt(0), l = s(n.commonAncestorContainer);
    return l ? (l.style.lineHeight = t, !0) : !1;
  } catch (e) {
    return console.error("Failed to set line height:", e), !1;
  }
}, r = (t, e) => {
  var n;
  typeof window != "undefined" && ((n = window.registerEditorCommand) == null || n.call(window, t, e));
}, a = () => {
  r("setLineHeight", i);
};
typeof window != "undefined" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", a) : a());
const c = () => ({
  name: "lineHeight",
  marks: {
    lineHeight: {
      attrs: {
        height: { default: null }
      },
      parseDOM: [
        {
          tag: 'span[style*="line-height"]',
          getAttrs: (t) => {
            const n = t.style.lineHeight;
            return n ? { height: n } : !1;
          }
        }
      ],
      toDOM: (t) => ["span", { style: `line-height: ${t.attrs.height}` }, 0]
    }
  },
  toolbar: [
    {
      label: "Line Height",
      command: "setLineHeight",
      type: "inline-menu",
      options: o,
      icon: '<svg width="24" height="24" focusable="false"><path d="M21 5a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zM7 3.6l3.7 3.7a1 1 0 0 1-1.3 1.5h-.1L8 7.3v9.2l1.3-1.3a1 1 0 0 1 1.3 0h.1c.4.4.4 1 0 1.3v.1L7 20.4l-3.7-3.7a1 1 0 0 1 1.3-1.5h.1L6 16.7V7.4L4.7 8.7a1 1 0 0 1-1.3 0h-.1a1 1 0 0 1 0-1.3v-.1L7 3.6z"></path></svg>'
    }
  ],
  commands: {
    setLineHeight: i
  }
});
export {
  c as LineHeightPlugin,
  i as setLineHeight
};
//# sourceMappingURL=LineHeightPlugin.native-CWQT2FIa.mjs.map
