import { jsx as _jsx } from "react/jsx-runtime";
import { ToolButton } from "../components/tool-button";
import { useToolbarLocation } from "../stores/toolbar-store";
import { CodeBlock } from "../../extensions/code-block";
export function Italic(props) {
    const { editor } = props;
    return (_jsx(ToolButton, Object.assign({}, props, { toggled: editor.isActive("italic"), onClick: () => editor.chain().focus().toggleItalic().run() })));
}
export function Strikethrough(props) {
    const { editor } = props;
    return (_jsx(ToolButton, Object.assign({}, props, { toggled: editor.isActive("strike"), onClick: () => editor.chain().focus().toggleStrike().run() })));
}
export function Underline(props) {
    const { editor } = props;
    return (_jsx(ToolButton, Object.assign({}, props, { toggled: editor.isActive("underline"), onClick: () => editor.chain().focus().toggleUnderline().run() })));
}
export function Code(props) {
    const { editor } = props;
    return (_jsx(ToolButton, Object.assign({}, props, { toggled: editor.isActive("code"), disabled: editor.isActive(CodeBlock.name), onClick: () => editor.chain().focus().toggleCode().run() })));
}
export function Bold(props) {
    const { editor } = props;
    return (_jsx(ToolButton, Object.assign({}, props, { toggled: editor.isActive("bold"), onClick: () => editor.chain().focus().toggleBold().run() })));
}
export function Subscript(props) {
    const { editor } = props;
    return (_jsx(ToolButton, Object.assign({}, props, { toggled: editor.isActive("subscript"), disabled: editor.isActive(CodeBlock.name), onClick: () => editor.chain().focus().toggleSubscript().run() })));
}
export function Superscript(props) {
    const { editor } = props;
    return (_jsx(ToolButton, Object.assign({}, props, { toggled: editor.isActive("superscript"), disabled: editor.isActive(CodeBlock.name), onClick: () => editor.chain().focus().toggleSuperscript().run() })));
}
export function ClearFormatting(props) {
    const { editor } = props;
    return (_jsx(ToolButton, Object.assign({}, props, { toggled: false, onClick: () => editor === null || editor === void 0 ? void 0 : editor.chain().focus().clearNodes().unsetAllMarks().unsetMark("link").run() })));
}
export function CodeRemove(props) {
    const { editor } = props;
    const isBottom = useToolbarLocation() === "bottom";
    if (!editor.isActive("code") || !isBottom)
        return null;
    return (_jsx(ToolButton, Object.assign({}, props, { toggled: false, onClick: () => editor.chain().focus().unsetMark("code").run() })));
}
export function Math(props) {
    const { editor } = props;
    return (_jsx(ToolButton, Object.assign({}, props, { toggled: false, onClick: () => editor.chain().focus().insertMathInline().run(), disabled: editor.isActive(CodeBlock.name) })));
}
