UNPKG

@progress/kendo-react-editor

Version:

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

34 lines (33 loc) 1.24 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 s from "react"; import { ColorPicker as g } from "@progress/kendo-react-inputs"; import { applyInlineStyle as u } from "@progress/kendo-editor-common"; import { useLocalization as y } from "@progress/kendo-react-intl"; import { messages as m } from "../messages/index.mjs"; const k = (p) => { const { view: e, style: l, colorPickerProps: t, commandName: i } = p, o = t.title, a = t.ariaLabel, { view: r = "palette" } = t, c = y(), n = s.useCallback( (f) => { e && (u({ style: l, value: f.value }, i)(e.state, e.dispatch), r === "palette" && e.focus()); }, [e, l, r, i] ); return /* @__PURE__ */ s.createElement( g, { onChange: n, onActiveColorClick: n, ...t, title: o && c.toLanguageString(o, m[o]), ariaLabel: a && c.toLanguageString(a, m[a]) } ); }; export { k as ApplyColorTool };