reactjs-tiptap-editor
Version:
A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React
36 lines (35 loc) • 1.82 kB
JavaScript
import { jsxs as c, jsx as e } from "react/jsx-runtime";
import n from "react";
import { Slot as r } from "@radix-ui/react-slot";
import { i as d, T as m, a as f, B as s, b as u, g } from "./index-RcSPeQHn.js";
import "./theme.js";
const C = n.forwardRef(
({ asChild: x = !1, tooltip: i, ...t }, l) => {
var a;
const h = d[t.icon];
return /* @__PURE__ */ c(m, { children: [
/* @__PURE__ */ e(f, { asChild: !0, children: /* @__PURE__ */ e(
x ? r : s,
{
className: "richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0",
"data-state": t != null && t.dataState ? "on" : "off",
disabled: t == null ? void 0 : t.disabled,
ref: l,
variant: "ghost",
...t,
children: /* @__PURE__ */ c("div", { className: "richtext-flex richtext-h-full richtext-items-center richtext-font-normal", children: [
(t == null ? void 0 : t.title) && /* @__PURE__ */ e("div", { className: "richtext-grow richtext-truncate richtext-text-left richtext-text-sm", children: t == null ? void 0 : t.title }),
h && /* @__PURE__ */ e(h, { className: "richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500" })
] })
}
) }),
i && /* @__PURE__ */ e(u, { children: /* @__PURE__ */ c("div", { className: "richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center", children: [
i && /* @__PURE__ */ e("div", { children: i }),
/* @__PURE__ */ e("div", { className: "richtext-flex", children: !!((a = t == null ? void 0 : t.shortcutKeys) != null && a.length) && /* @__PURE__ */ e("span", { children: g(t == null ? void 0 : t.shortcutKeys) }) })
] }) })
] });
}
);
export {
C as A
};