UNPKG

@progress/kendo-react-editor

Version:

React Editor enables users to create rich text content through a WYSIWYG interface. KendoReact Editor package

64 lines (63 loc) 2.32 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as a from "react"; import { Button as D } from "@progress/kendo-react-buttons"; import { getMark as u } from "@progress/kendo-editor-common"; import { onDownPreventDefault as f } from "./utils.mjs"; import { EditorDialogs as h } from "../dialogs/index.mjs"; import { registerForLocalization as v, provideLocalizationService as L } from "@progress/kendo-react-intl"; import { messages as N } from "../messages/index.mjs"; import { classNames as y } from "@progress/kendo-react-common"; var c; ((p) => { p.createLinkTool = (o) => { const s = class extends a.Component { constructor() { super(...arguments), this.state = { openedDialog: !1 }, this.toggleDialog = () => { this.setState({ openedDialog: !this.state.openedDialog }); }; } render() { const { view: e, render: l, ...r } = this.props, t = e && e.state, d = t ? t.selection.empty : !0, g = t && u(t, t.schema.marks[o.mark]), k = L(this), { insertHyperlink: n } = o.messages, i = d && !g, m = [ /* @__PURE__ */ a.createElement( D, { onClick: i ? void 0 : this.toggleDialog, "aria-disabled": i ? !0 : void 0, key: "link", ...f, title: k.toLanguageString(n, N[n]), ...o.props, ...r, className: y(r.className, o.props.className, { "k-disabled": i }) } ), this.state.openedDialog && e && /* @__PURE__ */ a.createElement( h.InsertLinkDialog, { key: "insertLinkDialog", settings: o, dir: r.dir, view: e, onClose: this.toggleDialog } ) || null ]; return l ? l.call(void 0, m, { view: e }) : m; } }; return v(s), s; }; })(c || (c = {})); export { c as LinkToolNS };