@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.
15 lines (14 loc) • 602 B
JavaScript
"use client";
import { jsx as _jsx } from "react/jsx-runtime";
import { useEditorStore } from "../store/useEditorState";
import { LuLink2Off } from "react-icons/lu";
export function LinkUnset() {
const { editor } = useEditorStore();
const currentLink = editor?.getAttributes("link").href || "";
function onClick() {
if (currentLink) {
editor?.chain().focus().unsetLink().run();
}
}
return (_jsx("button", { title: "Remove Link", className: "toolbar-button", onClick: onClick, disabled: currentLink === "", children: _jsx(LuLink2Off, { size: 16 }) }));
}