@progress/kendo-vue-editor
Version:
81 lines (80 loc) • 2.07 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 { Button as r } from "@progress/kendo-vue-buttons";
import { toggleInlineFormat as u, hasMark as d } from "@progress/kendo-editor-common";
import { provideLocalizationService as g } from "@progress/kendo-vue-intl";
import { messages as v } from "../messages/main.mjs";
import { defineComponent as f, h as k } from "vue";
const D = /* @__PURE__ */ f({
name: "KendoInlineFormat",
props: {
view: Object,
settings: {
type: Object,
default: function() {
return {
messages: {}
};
}
},
...r.props
},
inject: {
kendoLocalizationService: {
default: null
}
},
render() {
const {
view: t,
render: s,
settings: e,
...n
} = this.$props, o = t && t.state, {
mark: a,
altMarks: l,
altStyle: c
} = e, m = {
mark: a,
altMarks: l,
altStyle: c
}, p = g(this), i = e.messages.title, h = {
...n,
selected: !!o && d(o, m),
togglable: !0,
title: p.toLanguageString(i, v[i]),
...e.props
};
return k(r, {
onClick: this.handleClick,
onMousedown: this.preventDefault,
onPointerdown: this.preventDefault,
...h
});
},
methods: {
handleClick() {
const t = this.view && this.view.state, {
mark: s,
altMarks: e,
altStyle: n
} = this.settings, o = {
mark: s,
altMarks: e,
altStyle: n
};
return this.view && u(o, t && t.tr.setMeta("commandName", this.settings.commandName))(this.view.state, this.view.dispatch);
},
preventDefault(t) {
t.preventDefault();
}
}
});
export {
D as InlineFormat
};