UNPKG

@progress/kendo-react-editor

Version:

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

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