@progress/kendo-vue-editor
Version:
64 lines (63 loc) • 2.23 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 m } from "@progress/kendo-vue-buttons";
import { isIndented as h, hasNode as d, canIndentAsListItem as p, sinkListItem as g, indentBlocks as L } from "@progress/kendo-editor-common";
import { provideLocalizationService as b } from "@progress/kendo-vue-intl";
import { messages as k } from "../messages/main.mjs";
import { defineComponent as y, h as C } from "vue";
const N = /* @__PURE__ */ y({
name: "KendoIndent",
props: {
view: Object,
settings: {
type: Object,
default: function() {
return {
messages: {}
};
}
},
...m.props
},
inject: {
kendoLocalizationService: {
default: null
}
},
render() {
const {
view: t,
render: o,
settings: s,
...n
} = this.$props, e = t && t.state, i = e && e.schema.nodes, c = i && i[s.listsTypes.listItem], a = s.actions, v = !!e && (h(e, a, n.dir) || a.some((l) => i[l.node] && d(e, i[l.node]))) && !d(e, c), u = !!e && p(e, c), f = v || u, I = b(this), r = s.messages.title, w = {
...n,
disabled: !f,
title: I.toLanguageString(r, k[r]),
...s.props
};
return C(m, {
onClick: this.handleClick,
onMousedown: this.preventDefault,
onPointerdown: this.preventDefault,
...w
});
},
methods: {
handleClick() {
const t = this.view && this.view.state, o = t && t.schema.nodes, s = o && o[this.settings.listsTypes.listItem], n = this.settings.actions, e = !!t && (h(t, n, this.dir) || n.some((c) => o[c.node] && d(t, o[c.node]))) && !d(t, s), i = !!t && p(t, s);
this.view && i ? g(s)(this.view.state, this.view.dispatch) : this.view && e && L(n, this.settings.commandName, this.dir)(this.view.state, this.view.dispatch);
},
preventDefault(t) {
t.preventDefault();
}
}
});
export {
N as Indent
};