@progress/kendo-react-editor
Version:
React Editor enables users to create rich text content through a WYSIWYG interface. KendoReact Editor package
60 lines (59 loc) • 2.26 kB
JavaScript
/**
* @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 d from "react";
import { DropDownList as y } from "@progress/kendo-react-dropdowns";
import { formatBlockElements as z, getBlockFormats as w } from "@progress/kendo-editor-common";
import { itemRender as x, userSelectNone as k } from "./utils.mjs";
import { registerForLocalization as D, provideLocalizationService as F } from "@progress/kendo-react-intl";
import { messages as K } from "../messages/index.mjs";
var f;
((u) => {
u.createFormatBlockDropDownList = (i) => {
const s = class extends d.Component {
constructor() {
super(...arguments), this.onChange = (e) => {
const a = e.target.value, { view: o } = this.props;
if (o && z(a.value, i.commandName)(o.state, o.dispatch)) {
const { syntheticEvent: r } = e;
r && r.type === "click" && o.focus();
}
};
}
render() {
const { view: e, render: a, data: o, defaultItem: r, ...v } = this.props, l = o || i.items;
let t = r || i.defaultItem;
const c = e && e.state, m = c ? w(c) : [], g = F(this);
t && t.localizationKey && (t = { ...t }, t.text = t.localizationKey ? g.toLanguageString(
t.localizationKey,
K[t.localizationKey]
) : t.text);
const n = new Set(m).size === 1 ? m[0] : null, p = /* @__PURE__ */ d.createElement(
y,
{
value: n && l.find((h) => h.value === n),
onChange: this.onChange,
itemRender: x,
data: l,
defaultItem: t,
textField: "text",
dataItemKey: "value",
style: k,
leftRightKeysNavigation: !1,
title: t.text,
...v
}
);
return a ? a.call(void 0, p, { view: e }) : p;
}
};
return D(s), s;
};
})(f || (f = {}));
export {
f as FormatBlockToolNS
};