reactjs-tiptap-editor
Version:
A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React
51 lines (50 loc) • 1.34 kB
JavaScript
import { N as l } from "./clsx-DaPvp9ji.js";
import { jsx as r, Fragment as p } from "react/jsx-runtime";
import { u as d, e as m, A as f } from "./index-RcSPeQHn.js";
function x() {
const o = d(v.name), {
icon: t = void 0,
tooltip: n = void 0,
shortcutKeys: s = void 0,
tooltipOptions: c = {},
action: i = void 0,
isActive: a = void 0
} = (o == null ? void 0 : o.componentProps) ?? {}, { disabled: e } = m(a), u = () => {
e || i && i();
};
return o ? /* @__PURE__ */ r(
f,
{
action: u,
disabled: e,
icon: t,
shortcutKeys: s,
tooltip: n,
tooltipOptions: c
}
) : /* @__PURE__ */ r(p, {});
}
const v = /* @__PURE__ */ l.create({
name: "clear",
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-expect-error
addOptions() {
var o;
return {
...(o = this.parent) == null ? void 0 : o.call(this),
button: ({ editor: t, t: n }) => ({
// component: ActionButton,
componentProps: {
action: () => t.chain().focus().clearNodes().unsetAllMarks().run(),
isActive: () => t.can().chain().focus().clearNodes().unsetAllMarks().run(),
icon: "Eraser",
tooltip: n("editor.clear.tooltip")
}
})
};
}
});
export {
v as Clear,
x as RichTextClear
};