@explita/editor
Version:
`@explita/editor` is a versatile, modern rich-text editor built on TipTap for seamless integration into React applications. It provides extensive customization options and advanced features to cater to diverse content creation needs.
13 lines (12 loc) • 1.07 kB
JavaScript
"use client";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger, } from "./ui/dropdown-menu";
import { useEditorStore } from "../store/useEditorState";
import { LuFoldVertical } from "react-icons/lu";
import { lineHeights } from "../lib/constants";
import { cn } from "../lib/utils";
export function LineHeight() {
const { editor } = useEditorStore();
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { title: "Line Height", className: "toolbar-button", children: _jsx(LuFoldVertical, { size: 16 }) }) }), _jsx(DropdownMenuContent, { className: "editor-dropdown-content", children: lineHeights.map(({ label, value }) => (_jsx("button", { onClick: () => editor?.chain().focus().setLineHeight(value).run(), className: cn("editor-dropdown-menu-button", editor?.getAttributes("paragraph").lineHeight === value &&
"editor-item-active"), children: _jsx("span", { children: label }) }, value))) })] }));
}