@progress/kendo-vue-editor
Version:
77 lines (76 loc) • 2.04 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 { defineComponent as d, h as m, createVNode as i } from "vue";
import { Button as s } from "@progress/kendo-vue-buttons";
import { getMark as u } from "@progress/kendo-editor-common";
import { InsertLinkDialog as f } from "../dialogs/insertLink.mjs";
import { provideLocalizationService as k } from "@progress/kendo-vue-intl";
import { messages as h } from "../messages/main.mjs";
const z = /* @__PURE__ */ d({
name: "KendoLinkTool",
props: {
view: Object,
settings: {
type: Object,
default: function() {
return {
messages: {}
};
}
},
...s.props
},
inject: {
kendoLocalizationService: {
default: null
}
},
data() {
return {
openedDialog: !1
};
},
render() {
const {
view: e,
settings: o,
...r
} = this.$props, t = e && e.state, l = t ? t.selection.empty : !0, a = t && u(t, t.schema.marks[o.mark]), p = k(this), {
insertHyperlink: n
} = o.messages, g = {
...r,
key: "link",
disabled: l && !a,
title: p.toLanguageString(n, h[n]),
...o.props
}, c = [m(s, {
onClick: this.toggleDialog,
onMousedown: this.preventDefault,
onPointerdown: this.preventDefault,
...g
}), this.openedDialog && e && i(f, {
key: "insertLinkDialog",
settings: o,
dir: this.dir,
view: e,
onClose: this.toggleDialog
}, null) || null];
return i("span", null, [c]);
},
methods: {
toggleDialog() {
this.openedDialog = !this.openedDialog;
},
preventDefault(e) {
e.preventDefault();
}
}
});
export {
z as LinkTool
};