UNPKG

@progress/kendo-vue-editor

Version:
100 lines (99 loc) 2.62 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 { DropDownList as c } from "@progress/kendo-vue-dropdowns"; import { applyInlineStyle as y, getInlineStyles as v } from "@progress/kendo-editor-common"; import { userSelectNone as g } from "./utils.mjs"; import { provideLocalizationService as h } from "@progress/kendo-vue-intl"; import { messages as I } from "../messages/main.mjs"; import { defineComponent as z, h as w } from "vue"; const L = /* @__PURE__ */ z({ name: "KendoFontName", props: { view: Object, settings: { type: Object, default: function() { return { messages: {} }; } }, ...c.props }, inject: { kendoLocalizationService: { default: null } }, render() { const { view: o, render: n, dataItems: t, settings: a, defaultItem: i, ...s } = this.$props, { style: d } = a, r = o ? v(o.state, { name: d, value: /^.+$/ }) : [], l = new Set(r).size === 1 ? r[0] : null, m = t || a.items; let e = i || a.defaultItem; const p = h(this); e && e.localizationKey && (e = { ...e }, e.text = e.localizationKey ? p.toLanguageString(e.localizationKey, I[e.localizationKey]) : e.text); const u = { ...s, ...a.props, value: l && m.find((f) => f.value === l), dataItems: m, defaultItem: e, itemRender: this.customItemRender, textField: "text", dataItemKey: "value", leftRightKeysNavigation: !1, title: e.text, onChange: this.onFontNameChange, style: g }; return w(c, u); }, methods: { customItemRender(o, n, t) { return t.dataItem.style ? o("li", { class: t.itemClass, onClick: t.onClick }, [o("span", { style: t.dataItem.style }, [...n.children])]) : n; }, onFontNameChange(o) { const { view: n, settings: t } = this.$props, { style: a } = t, i = o.target.value; if (n) { y({ style: a, value: i.value }, t.commandName)(n.state, n.dispatch); const { event: s } = o; s && s.type === "click" && n.focus(); } } } }); export { L as FontName };