@progress/kendo-vue-editor 10.0.1-develop.6 → 10.1.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,7 @@ declare const InsertImageDialog: import('vue').DefineComponent<import('vue').Ext
26
26
  titleValue: any;
27
27
  widthValue: any;
28
28
  heightValue: any;
29
+ srcInvalid: boolean;
29
30
  }, {}, {
30
31
  handleSrcInput(e: any): void;
31
32
  handleAltInput(e: any): void;
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),b=require("@progress/kendo-vue-dialogs"),S=require("@progress/kendo-vue-buttons"),I=require("@progress/kendo-editor-common"),y=require("@progress/kendo-vue-intl"),d=require("../messages/main.js"),s=require("@progress/kendo-vue-common"),u=require("@progress/kendo-vue-form"),m=require("@progress/kendo-vue-inputs");function k(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const T=e.defineComponent({name:"KendoInsertImageDialog",emits:{close:null},props:{view:Object,settings:Object,dir:String},inject:{kendoLocalizationService:{default:null}},data(){const{view:t,settings:o}=this.$props,a=t&&t.state;let i={};return a&&a.selection instanceof I.NodeSelection&&a.selection.node.type===a.schema.nodes[o.node]&&(i=a.selection.node.attrs),{srcValue:i.src,altValue:i.alt,titleValue:i.title,widthValue:i.width,heightValue:i.height}},mounted(){this.src=s.getRef(this,"src"),this.altText=s.getRef(this,"altText"),this.title=s.getRef(this,"title"),this.width=s.getRef(this,"width"),this.height=s.getRef(this,"height"),this.src&&this.src.focus()},render(){let t,o;const{view:a,settings:i,dir:l}=this.$props,{insertImageDialogTitle:c,insertImageAddress:f,insertImageTitle:p,insertImageAltText:n,insertImageWidth:h,insertImageHeight:N,insertImageCancel:w,insertImageInsert:v}=i.messages,r=y.provideLocalizationService(this),g=a&&a.state;g&&g.selection instanceof I.NodeSelection&&g.selection.node.type===g.schema.nodes[i.node]&&g.selection.node.attrs;const C=e.createVNode(u.Form,null,{default:()=>[e.createVNode(u.FormElement,{horizontal:!0},{default:()=>[e.createVNode(u.FieldWrapper,null,{default:()=>[e.createVNode("label",{for:"k-editor-image-url",class:"k-form-label"},[r.toLanguageString(f,d.messages[f])]),e.createVNode("div",{class:"k-form-field-wrap"},[e.createVNode(m.Input,{id:"k-editor-image-url",value:this.srcValue,onInput:this.handleSrcInput,ref:s.setRef(this,"src")},null)])]}),e.createVNode(u.FieldWrapper,null,{default:()=>[e.createVNode("label",{for:"k-editor-image-url",class:"k-form-label"},[r.toLanguageString(n,d.messages[n])]),e.createVNode("div",{class:"k-form-field-wrap"},[e.createVNode(m.Input,{id:"k-editor-image-alt",value:this.altValue,onInput:this.handleAltInput,ref:s.setRef(this,"altText")},null)])]}),e.createVNode(u.FieldWrapper,null,{default:()=>[e.createVNode("label",{for:"k-editor-image-title",class:"k-form-label"},[r.toLanguageString(p,d.messages[p])]),e.createVNode("div",{class:"k-form-field-wrap"},[e.createVNode(m.Input,{id:"k-editor-image-title",value:this.titleValue,onInput:this.handleTitleInput,ref:s.setRef(this,"title")},null)])]}),e.createVNode(u.FieldWrapper,null,{default:()=>[e.createVNode("label",{for:"k-editor-image-width",class:"k-form-label"},[r.toLanguageString(h,d.messages[h])]),e.createVNode("div",{class:"k-form-field-wrap"},[e.createVNode(m.Input,{id:"k-editor-image-width",value:this.widthValue,onInput:this.handleWidthInput,ref:s.setRef(this,"width")},null)])]}),e.createVNode(u.FieldWrapper,null,{default:()=>[e.createVNode("label",{for:"k-editor-image-height",class:"k-form-label"},[r.toLanguageString(N,d.messages[N])]),e.createVNode("div",{class:"k-form-field-wrap"},[e.createVNode(m.Input,{id:"k-editor-image-height",value:this.heightValue,onInput:this.handleHeightInput,ref:s.setRef(this,"height")},null)])]})]})]}),V=[e.createVNode(S.Button,{type:"button",onClick:this.onClose,dir:l,key:"cancel"},k(t=r.toLanguageString(w,d.messages[w]))?t:{default:()=>[t]}),e.createVNode(S.Button,{type:"button",disabled:!this.srcValue,onClick:this.onInsert,themeColor:"primary",dir:l,key:"insert"},k(o=r.toLanguageString(v,d.messages[v]))?o:{default:()=>[o]})];return e.createVNode(b.Window,{initialWidth:500,initialHeight:360,windowClass:"k-editor-window",title:r.toLanguageString(c,d.messages[c]),onClose:this.onClose,key:"dialog",dir:l,style:l==="rtl"?{textAlign:"right"}:void 0,modal:!0,minimizeButton:()=>null,maximizeButton:()=>null,resizable:!1},{default:()=>[C,e.createVNode(b.DialogActionsBar,null,k(V)?V:{default:()=>[V]})]})},methods:{handleSrcInput(t){this.srcValue=t.value},handleAltInput(t){this.altValue=t.value},handleTitleInput(t){this.titleValue=t.value},handleWidthInput(t){this.widthValue=t.value},handleHeightInput(t){this.heightValue=t.value},onClose(){this.$props.view.focus(),this.$emit("close")},onInsert(){const{view:t,settings:o}=this.$props,i=t.state.schema.nodes[o.node],l={src:this.src?this.srcValue:null,title:this.title?this.titleValue:null,alt:this.altText?this.altValue:null,width:this.width?this.widthValue:null,height:this.height?this.heightValue:null},c=Object.keys(l).filter(n=>l[n]!==null&&l[n]!=="").reduce((n,h)=>Object.assign(n,{[h]:l[h]}),{}),f=i.createAndFill(c);I.insertNode(f,!0)(t.state,n=>t.dispatch(n.setMeta("commandName",o.commandName).setMeta("args",c))),this.onClose()}}});exports.InsertImageDialog=T;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),b=require("@progress/kendo-vue-dialogs"),S=require("@progress/kendo-vue-buttons"),I=require("@progress/kendo-editor-common"),y=require("@progress/kendo-vue-intl"),d=require("../messages/main.js"),s=require("@progress/kendo-vue-common"),u=require("@progress/kendo-vue-form"),m=require("@progress/kendo-vue-inputs");function k(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const T=e.defineComponent({name:"KendoInsertImageDialog",emits:{close:null},props:{view:Object,settings:Object,dir:String},inject:{kendoLocalizationService:{default:null}},data(){const{view:t,settings:o}=this.$props,a=t&&t.state;let i={};return a&&a.selection instanceof I.NodeSelection&&a.selection.node.type===a.schema.nodes[o.node]&&(i=a.selection.node.attrs),{srcValue:i.src,altValue:i.alt,titleValue:i.title,widthValue:i.width,heightValue:i.height,srcInvalid:!1}},mounted(){this.src=s.getRef(this,"src"),this.altText=s.getRef(this,"altText"),this.title=s.getRef(this,"title"),this.width=s.getRef(this,"width"),this.height=s.getRef(this,"height"),this.src&&this.src.focus()},render(){let t,o;const{view:a,settings:i,dir:l}=this.$props,{insertImageDialogTitle:c,insertImageAddress:f,insertImageTitle:p,insertImageAltText:n,insertImageWidth:h,insertImageHeight:N,insertImageCancel:v,insertImageInsert:w}=i.messages,r=y.provideLocalizationService(this),g=a&&a.state;g&&g.selection instanceof I.NodeSelection&&g.selection.node.type===g.schema.nodes[i.node]&&g.selection.node.attrs;const C=e.createVNode(u.Form,null,{default:()=>[e.createVNode(u.FormElement,{horizontal:!0},{default:()=>[e.createVNode(u.FieldWrapper,null,{default:()=>[e.createVNode("label",{for:"k-editor-image-url",class:"k-form-label"},[r.toLanguageString(f,d.messages[f])]),e.createVNode("div",{class:"k-form-field-wrap"},[e.createVNode(m.Input,{id:"k-editor-image-url",value:this.srcValue,onInput:this.handleSrcInput,ref:s.setRef(this,"src"),valid:!this.srcInvalid},null)])]}),e.createVNode(u.FieldWrapper,null,{default:()=>[e.createVNode("label",{for:"k-editor-image-url",class:"k-form-label"},[r.toLanguageString(n,d.messages[n])]),e.createVNode("div",{class:"k-form-field-wrap"},[e.createVNode(m.Input,{id:"k-editor-image-alt",value:this.altValue,onInput:this.handleAltInput,ref:s.setRef(this,"altText")},null)])]}),e.createVNode(u.FieldWrapper,null,{default:()=>[e.createVNode("label",{for:"k-editor-image-title",class:"k-form-label"},[r.toLanguageString(p,d.messages[p])]),e.createVNode("div",{class:"k-form-field-wrap"},[e.createVNode(m.Input,{id:"k-editor-image-title",value:this.titleValue,onInput:this.handleTitleInput,ref:s.setRef(this,"title")},null)])]}),e.createVNode(u.FieldWrapper,null,{default:()=>[e.createVNode("label",{for:"k-editor-image-width",class:"k-form-label"},[r.toLanguageString(h,d.messages[h])]),e.createVNode("div",{class:"k-form-field-wrap"},[e.createVNode(m.Input,{id:"k-editor-image-width",value:this.widthValue,onInput:this.handleWidthInput,ref:s.setRef(this,"width")},null)])]}),e.createVNode(u.FieldWrapper,null,{default:()=>[e.createVNode("label",{for:"k-editor-image-height",class:"k-form-label"},[r.toLanguageString(N,d.messages[N])]),e.createVNode("div",{class:"k-form-field-wrap"},[e.createVNode(m.Input,{id:"k-editor-image-height",value:this.heightValue,onInput:this.handleHeightInput,ref:s.setRef(this,"height")},null)])]})]})]}),V=[e.createVNode(S.Button,{type:"button",onClick:this.onClose,dir:l,key:"cancel"},k(t=r.toLanguageString(v,d.messages[v]))?t:{default:()=>[t]}),e.createVNode(S.Button,{type:"button",disabled:!this.srcValue,onClick:this.onInsert,themeColor:"primary",dir:l,key:"insert"},k(o=r.toLanguageString(w,d.messages[w]))?o:{default:()=>[o]})];return e.createVNode(b.Window,{initialWidth:500,initialHeight:360,windowClass:"k-editor-window",title:r.toLanguageString(c,d.messages[c]),onClose:this.onClose,key:"dialog",dir:l,style:l==="rtl"?{textAlign:"right"}:void 0,modal:!0,minimizeButton:()=>null,maximizeButton:()=>null,resizable:!1},{default:()=>[C,e.createVNode(b.DialogActionsBar,null,k(V)?V:{default:()=>[V]})]})},methods:{handleSrcInput(t){this.srcValue=t.value,this.srcInvalid=!1},handleAltInput(t){this.altValue=t.value},handleTitleInput(t){this.titleValue=t.value},handleWidthInput(t){this.widthValue=t.value},handleHeightInput(t){this.heightValue=t.value},onClose(){this.$props.view.focus(),this.$emit("close")},onInsert(){const{view:t,settings:o}=this.$props,i=t.state.schema.nodes[o.node];if(this.src&&!s.isSafeUrl(this.srcValue)){this.srcInvalid=!0;return}const l={src:this.src?this.srcValue:null,title:this.title?this.titleValue:null,alt:this.altText?this.altValue:null,width:this.width?this.widthValue:null,height:this.height?this.heightValue:null},c=Object.keys(l).filter(n=>l[n]!==null&&l[n]!=="").reduce((n,h)=>Object.assign(n,{[h]:l[h]}),{}),f=i.createAndFill(c);I.insertNode(f,!0)(t.state,n=>t.dispatch(n.setMeta("commandName",o.commandName).setMeta("args",c))),this.onClose()}}});exports.InsertImageDialog=T;
@@ -11,13 +11,13 @@ import { Button as S } from "@progress/kendo-vue-buttons";
11
11
  import { insertNode as z, NodeSelection as C } from "@progress/kendo-editor-common";
12
12
  import { provideLocalizationService as A } from "@progress/kendo-vue-intl";
13
13
  import { messages as r } from "../messages/main.mjs";
14
- import { setRef as c, getRef as g } from "@progress/kendo-vue-common";
15
- import { Form as N, FormElement as O, FieldWrapper as m } from "@progress/kendo-vue-form";
14
+ import { isSafeUrl as N, setRef as c, getRef as g } from "@progress/kendo-vue-common";
15
+ import { Form as O, FormElement as W, FieldWrapper as m } from "@progress/kendo-vue-form";
16
16
  import { Input as f } from "@progress/kendo-vue-inputs";
17
- function k(e) {
17
+ function w(e) {
18
18
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !T(e);
19
19
  }
20
- const K = /* @__PURE__ */ L({
20
+ const U = /* @__PURE__ */ L({
21
21
  name: "KendoInsertImageDialog",
22
22
  emits: {
23
23
  close: null
@@ -43,7 +43,8 @@ const K = /* @__PURE__ */ L({
43
43
  altValue: i.alt,
44
44
  titleValue: i.title,
45
45
  widthValue: i.width,
46
- heightValue: i.height
46
+ heightValue: i.height,
47
+ srcInvalid: !1
47
48
  };
48
49
  },
49
50
  mounted() {
@@ -61,13 +62,13 @@ const K = /* @__PURE__ */ L({
61
62
  insertImageTitle: I,
62
63
  insertImageAltText: a,
63
64
  insertImageWidth: h,
64
- insertImageHeight: v,
65
+ insertImageHeight: k,
65
66
  insertImageCancel: V,
66
67
  insertImageInsert: b
67
68
  } = i.messages, o = A(this), u = l && l.state;
68
69
  u && u.selection instanceof C && u.selection.node.type === u.schema.nodes[i.node] && u.selection.node.attrs;
69
- const y = t(N, null, {
70
- default: () => [t(O, {
70
+ const y = t(O, null, {
71
+ default: () => [t(W, {
71
72
  horizontal: !0
72
73
  }, {
73
74
  default: () => [t(m, null, {
@@ -80,7 +81,8 @@ const K = /* @__PURE__ */ L({
80
81
  id: "k-editor-image-url",
81
82
  value: this.srcValue,
82
83
  onInput: this.handleSrcInput,
83
- ref: c(this, "src")
84
+ ref: c(this, "src"),
85
+ valid: !this.srcInvalid
84
86
  }, null)])]
85
87
  }), t(m, null, {
86
88
  default: () => [t("label", {
@@ -122,7 +124,7 @@ const K = /* @__PURE__ */ L({
122
124
  default: () => [t("label", {
123
125
  for: "k-editor-image-height",
124
126
  class: "k-form-label"
125
- }, [o.toLanguageString(v, r[v])]), t("div", {
127
+ }, [o.toLanguageString(k, r[k])]), t("div", {
126
128
  class: "k-form-field-wrap"
127
129
  }, [t(f, {
128
130
  id: "k-editor-image-height",
@@ -132,12 +134,12 @@ const K = /* @__PURE__ */ L({
132
134
  }, null)])]
133
135
  })]
134
136
  })]
135
- }), w = [t(S, {
137
+ }), v = [t(S, {
136
138
  type: "button",
137
139
  onClick: this.onClose,
138
140
  dir: s,
139
141
  key: "cancel"
140
- }, k(e = o.toLanguageString(V, r[V])) ? e : {
142
+ }, w(e = o.toLanguageString(V, r[V])) ? e : {
141
143
  default: () => [e]
142
144
  }), t(S, {
143
145
  type: "button",
@@ -146,7 +148,7 @@ const K = /* @__PURE__ */ L({
146
148
  themeColor: "primary",
147
149
  dir: s,
148
150
  key: "insert"
149
- }, k(n = o.toLanguageString(b, r[b])) ? n : {
151
+ }, w(n = o.toLanguageString(b, r[b])) ? n : {
150
152
  default: () => [n]
151
153
  })];
152
154
  return t(j, {
@@ -165,14 +167,14 @@ const K = /* @__PURE__ */ L({
165
167
  maximizeButton: () => null,
166
168
  resizable: !1
167
169
  }, {
168
- default: () => [y, t(x, null, k(w) ? w : {
169
- default: () => [w]
170
+ default: () => [y, t(x, null, w(v) ? v : {
171
+ default: () => [v]
170
172
  })]
171
173
  });
172
174
  },
173
175
  methods: {
174
176
  handleSrcInput(e) {
175
- this.srcValue = e.value;
177
+ this.srcValue = e.value, this.srcInvalid = !1;
176
178
  },
177
179
  handleAltInput(e) {
178
180
  this.altValue = e.value;
@@ -193,7 +195,12 @@ const K = /* @__PURE__ */ L({
193
195
  const {
194
196
  view: e,
195
197
  settings: n
196
- } = this.$props, i = e.state.schema.nodes[n.node], s = {
198
+ } = this.$props, i = e.state.schema.nodes[n.node];
199
+ if (this.src && !N(this.srcValue)) {
200
+ this.srcInvalid = !0;
201
+ return;
202
+ }
203
+ const s = {
197
204
  src: this.src ? this.srcValue : null,
198
205
  title: this.title ? this.titleValue : null,
199
206
  alt: this.altText ? this.altValue : null,
@@ -207,5 +214,5 @@ const K = /* @__PURE__ */ L({
207
214
  }
208
215
  });
209
216
  export {
210
- K as InsertImageDialog
217
+ U as InsertImageDialog
211
218
  };
@@ -24,6 +24,7 @@ declare const InsertLinkDialog: import('vue').DefineComponent<import('vue').Extr
24
24
  hrefValue: any;
25
25
  titleValue: any;
26
26
  targetValue: true;
27
+ hrefInvalid: boolean;
27
28
  }, {}, {
28
29
  hrefChange(e: any): void;
29
30
  titleChange(e: any): void;
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),p=require("@progress/kendo-vue-dialogs"),m=require("@progress/kendo-vue-buttons"),V=require("@progress/kendo-editor-common"),v=require("@progress/kendo-vue-intl"),s=require("../messages/main.js"),o=require("@progress/kendo-vue-common"),a=require("@progress/kendo-vue-form"),d=require("@progress/kendo-vue-inputs");function C(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const y=t.defineComponent({name:"KendoInsertLinkDialog",emits:{close:null},props:{view:Object,settings:Object,dir:String},data(){const{view:e,settings:n}=this.$props,i=e?V.getMark(e.state,e.state.schema.marks[n.mark]):!1;return{hrefValue:i&&i.attrs.href||void 0,titleValue:i&&i.attrs.title||void 0,targetValue:i&&!!i.attrs.target||void 0}},inject:{kendoLocalizationService:{default:null}},mounted(){this.href=o.getRef(this,"href"),this.title=o.getRef(this,"title"),this.target=o.getRef(this,"target"),this.href&&this.href.focus()},render(){let e,n;const{settings:i,dir:l}=this.$props,r=v.provideLocalizationService(this),{insertHyperlinkDialogTitle:u,insertHyperlinkAddress:c,insertHyperlinkTitle:h,insertHyperlinkNewWindow:g,insertHyperlinkCancel:f,insertHyperlinkInsert:k}=i.messages,N=r.toLanguageString(g,s.messages[g]),b=t.createVNode(a.Form,null,{default:()=>[t.createVNode(a.FormElement,{horizontal:!0},{default:()=>[t.createVNode(a.FieldWrapper,null,{default:()=>[t.createVNode("label",{for:"k-editor-link-url",class:"k-form-label"},[r.toLanguageString(c,s.messages[c])]),t.createVNode("div",{class:"k-form-field-wrap"},[t.createVNode(d.Input,{id:"k-editor-link-url",ref:o.setRef(this,"href"),onInput:this.hrefChange,value:this.hrefValue},null)])]}),t.createVNode(a.FieldWrapper,null,{default:()=>[t.createVNode("label",{for:"k-editor-link-text",class:"k-form-label"},[r.toLanguageString(h,s.messages[h])]),t.createVNode("div",{class:"k-form-field-wrap"},[t.createVNode(d.Input,{id:"k-editor-link-text",ref:o.setRef(this,"title"),onInput:this.titleChange,value:this.titleValue},null)])]}),i.linkTarget!==!1&&t.createVNode(a.FieldWrapper,null,{default:()=>[t.createVNode("div",{class:"k-form-label"},null),t.createVNode("div",{class:"k-form-field-wrap"},[t.createVNode(d.Checkbox,{id:"k-editor-link-target",ref:o.setRef(this,"target"),label:N,onChange:this.targetChange,checked:this.targetValue},null)])]})]})]});return t.createVNode(p.Window,{initialWidth:450,initialHeight:250,windowClass:"k-editor-window",title:r.toLanguageString(u,s.messages[u]),onClose:this.onClose,dir:l,modal:!0,minimizeButton:()=>null,maximizeButton:()=>null,resizable:!1},{default:()=>[b,t.createVNode(p.DialogActionsBar,null,{default:()=>[t.createVNode(m.Button,{type:"button",onClick:this.onClose,dir:l,key:"cancel"},C(e=r.toLanguageString(f,s.messages[f]))?e:{default:()=>[e]}),t.createVNode(m.Button,{type:"button",onClick:this.onInsert,themeColor:"primary",dir:l,key:"insert"},C(n=r.toLanguageString(k,s.messages[k]))?n:{default:()=>[n]})]})]})},methods:{hrefChange(e){this.hrefValue=e.value},titleChange(e){this.titleValue=e.value},targetChange(e){this.targetValue=e.value},onClose(){this.$props.view.focus(),this.$emit("close")},onInsert(){const e=this.$props.view,n=this.$props.settings.mark,i={href:this.href?this.hrefValue:void 0,title:this.title?this.titleValue:void 0,target:this.target&&this.targetValue?"_blank":void 0};V.applyLink({mark:n,attrs:i},this.$props.settings.commandName)(e.state,e.dispatch),this.onClose()}}});exports.InsertLinkDialog=y;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),p=require("@progress/kendo-vue-dialogs"),m=require("@progress/kendo-vue-buttons"),V=require("@progress/kendo-editor-common"),b=require("@progress/kendo-vue-intl"),a=require("../messages/main.js"),n=require("@progress/kendo-vue-common"),l=require("@progress/kendo-vue-form"),d=require("@progress/kendo-vue-inputs");function v(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const y=t.defineComponent({name:"KendoInsertLinkDialog",emits:{close:null},props:{view:Object,settings:Object,dir:String},data(){const{view:e,settings:r}=this.$props,i=e?V.getMark(e.state,e.state.schema.marks[r.mark]):!1;return{hrefValue:i&&i.attrs.href||void 0,titleValue:i&&i.attrs.title||void 0,targetValue:i&&!!i.attrs.target||void 0,hrefInvalid:!1}},inject:{kendoLocalizationService:{default:null}},mounted(){this.href=n.getRef(this,"href"),this.title=n.getRef(this,"title"),this.target=n.getRef(this,"target"),this.href&&this.href.focus()},render(){let e,r;const{settings:i,dir:o}=this.$props,s=b.provideLocalizationService(this),{insertHyperlinkDialogTitle:u,insertHyperlinkAddress:c,insertHyperlinkTitle:h,insertHyperlinkNewWindow:f,insertHyperlinkCancel:g,insertHyperlinkInsert:k}=i.messages,C=s.toLanguageString(f,a.messages[f]),N=t.createVNode(l.Form,null,{default:()=>[t.createVNode(l.FormElement,{horizontal:!0},{default:()=>[t.createVNode(l.FieldWrapper,null,{default:()=>[t.createVNode("label",{for:"k-editor-link-url",class:"k-form-label"},[s.toLanguageString(c,a.messages[c])]),t.createVNode("div",{class:"k-form-field-wrap"},[t.createVNode(d.Input,{id:"k-editor-link-url",ref:n.setRef(this,"href"),onInput:this.hrefChange,value:this.hrefValue,valid:!this.hrefInvalid},null)])]}),t.createVNode(l.FieldWrapper,null,{default:()=>[t.createVNode("label",{for:"k-editor-link-text",class:"k-form-label"},[s.toLanguageString(h,a.messages[h])]),t.createVNode("div",{class:"k-form-field-wrap"},[t.createVNode(d.Input,{id:"k-editor-link-text",ref:n.setRef(this,"title"),onInput:this.titleChange,value:this.titleValue},null)])]}),i.linkTarget!==!1&&t.createVNode(l.FieldWrapper,null,{default:()=>[t.createVNode("div",{class:"k-form-label"},null),t.createVNode("div",{class:"k-form-field-wrap"},[t.createVNode(d.Checkbox,{id:"k-editor-link-target",ref:n.setRef(this,"target"),label:C,onChange:this.targetChange,checked:this.targetValue},null)])]})]})]});return t.createVNode(p.Window,{initialWidth:450,initialHeight:250,windowClass:"k-editor-window",title:s.toLanguageString(u,a.messages[u]),onClose:this.onClose,dir:o,modal:!0,minimizeButton:()=>null,maximizeButton:()=>null,resizable:!1},{default:()=>[N,t.createVNode(p.DialogActionsBar,null,{default:()=>[t.createVNode(m.Button,{type:"button",onClick:this.onClose,dir:o,key:"cancel"},v(e=s.toLanguageString(g,a.messages[g]))?e:{default:()=>[e]}),t.createVNode(m.Button,{type:"button",onClick:this.onInsert,themeColor:"primary",dir:o,key:"insert"},v(r=s.toLanguageString(k,a.messages[k]))?r:{default:()=>[r]})]})]})},methods:{hrefChange(e){this.hrefValue=e.value,this.hrefInvalid=!1},titleChange(e){this.titleValue=e.value},targetChange(e){this.targetValue=e.value},onClose(){this.$props.view.focus(),this.$emit("close")},onInsert(){const e=this.$props.view,r=this.$props.settings.mark;if(this.href&&!n.isSafeUrl(this.hrefValue)){this.hrefInvalid=!0;return}const i={href:this.href?this.hrefValue:void 0,title:this.title?this.titleValue:void 0,target:this.target&&this.targetValue?"_blank":void 0};V.applyLink({mark:r,attrs:i},this.$props.settings.commandName)(e.state,e.dispatch),this.onClose()}}});exports.InsertLinkDialog=y;
@@ -5,19 +5,19 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { defineComponent as w, createVNode as e, isVNode as y } from "vue";
9
- import { Window as V, DialogActionsBar as L } from "@progress/kendo-vue-dialogs";
8
+ import { defineComponent as w, createVNode as e, isVNode as V } from "vue";
9
+ import { Window as y, DialogActionsBar as I } from "@progress/kendo-vue-dialogs";
10
10
  import { Button as p } from "@progress/kendo-vue-buttons";
11
- import { applyLink as S, getMark as I } from "@progress/kendo-editor-common";
11
+ import { applyLink as L, getMark as S } from "@progress/kendo-editor-common";
12
12
  import { provideLocalizationService as z } from "@progress/kendo-vue-intl";
13
- import { messages as r } from "../messages/main.mjs";
14
- import { setRef as s, getRef as a } from "@progress/kendo-vue-common";
15
- import { Form as H, FormElement as $, FieldWrapper as u } from "@progress/kendo-vue-form";
16
- import { Input as k, Checkbox as j } from "@progress/kendo-vue-inputs";
17
- function C(t) {
18
- return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !y(t);
13
+ import { messages as n } from "../messages/main.mjs";
14
+ import { isSafeUrl as H, setRef as s, getRef as o } from "@progress/kendo-vue-common";
15
+ import { Form as $, FormElement as j, FieldWrapper as h } from "@progress/kendo-vue-form";
16
+ import { Input as k, Checkbox as x } from "@progress/kendo-vue-inputs";
17
+ function v(t) {
18
+ return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !V(t);
19
19
  }
20
- const M = /* @__PURE__ */ w({
20
+ const R = /* @__PURE__ */ w({
21
21
  name: "KendoInsertLinkDialog",
22
22
  emits: {
23
23
  close: null
@@ -31,11 +31,12 @@ const M = /* @__PURE__ */ w({
31
31
  const {
32
32
  view: t,
33
33
  settings: l
34
- } = this.$props, i = t ? I(t.state, t.state.schema.marks[l.mark]) : !1;
34
+ } = this.$props, i = t ? S(t.state, t.state.schema.marks[l.mark]) : !1;
35
35
  return {
36
36
  hrefValue: i && i.attrs.href || void 0,
37
37
  titleValue: i && i.attrs.title || void 0,
38
- targetValue: i && !!i.attrs.target || void 0
38
+ targetValue: i && !!i.attrs.target || void 0,
39
+ hrefInvalid: !1
39
40
  };
40
41
  },
41
42
  inject: {
@@ -44,41 +45,42 @@ const M = /* @__PURE__ */ w({
44
45
  }
45
46
  },
46
47
  mounted() {
47
- this.href = a(this, "href"), this.title = a(this, "title"), this.target = a(this, "target"), this.href && this.href.focus();
48
+ this.href = o(this, "href"), this.title = o(this, "title"), this.target = o(this, "target"), this.href && this.href.focus();
48
49
  },
49
50
  render() {
50
51
  let t, l;
51
52
  const {
52
53
  settings: i,
53
- dir: o
54
- } = this.$props, n = z(this), {
55
- insertHyperlinkDialogTitle: h,
56
- insertHyperlinkAddress: d,
57
- insertHyperlinkTitle: f,
54
+ dir: a
55
+ } = this.$props, r = z(this), {
56
+ insertHyperlinkDialogTitle: f,
57
+ insertHyperlinkAddress: u,
58
+ insertHyperlinkTitle: d,
58
59
  insertHyperlinkNewWindow: g,
59
60
  insertHyperlinkCancel: c,
60
61
  insertHyperlinkInsert: m
61
- } = i.messages, b = n.toLanguageString(g, r[g]), v = e(H, null, {
62
- default: () => [e($, {
62
+ } = i.messages, C = r.toLanguageString(g, n[g]), b = e($, null, {
63
+ default: () => [e(j, {
63
64
  horizontal: !0
64
65
  }, {
65
- default: () => [e(u, null, {
66
+ default: () => [e(h, null, {
66
67
  default: () => [e("label", {
67
68
  for: "k-editor-link-url",
68
69
  class: "k-form-label"
69
- }, [n.toLanguageString(d, r[d])]), e("div", {
70
+ }, [r.toLanguageString(u, n[u])]), e("div", {
70
71
  class: "k-form-field-wrap"
71
72
  }, [e(k, {
72
73
  id: "k-editor-link-url",
73
74
  ref: s(this, "href"),
74
75
  onInput: this.hrefChange,
75
- value: this.hrefValue
76
+ value: this.hrefValue,
77
+ valid: !this.hrefInvalid
76
78
  }, null)])]
77
- }), e(u, null, {
79
+ }), e(h, null, {
78
80
  default: () => [e("label", {
79
81
  for: "k-editor-link-text",
80
82
  class: "k-form-label"
81
- }, [n.toLanguageString(f, r[f])]), e("div", {
83
+ }, [r.toLanguageString(d, n[d])]), e("div", {
82
84
  class: "k-form-field-wrap"
83
85
  }, [e(k, {
84
86
  id: "k-editor-link-text",
@@ -86,48 +88,48 @@ const M = /* @__PURE__ */ w({
86
88
  onInput: this.titleChange,
87
89
  value: this.titleValue
88
90
  }, null)])]
89
- }), i.linkTarget !== !1 && e(u, null, {
91
+ }), i.linkTarget !== !1 && e(h, null, {
90
92
  default: () => [e("div", {
91
93
  class: "k-form-label"
92
94
  }, null), e("div", {
93
95
  class: "k-form-field-wrap"
94
- }, [e(j, {
96
+ }, [e(x, {
95
97
  id: "k-editor-link-target",
96
98
  ref: s(this, "target"),
97
- label: b,
99
+ label: C,
98
100
  onChange: this.targetChange,
99
101
  checked: this.targetValue
100
102
  }, null)])]
101
103
  })]
102
104
  })]
103
105
  });
104
- return e(V, {
106
+ return e(y, {
105
107
  initialWidth: 450,
106
108
  initialHeight: 250,
107
109
  windowClass: "k-editor-window",
108
- title: n.toLanguageString(h, r[h]),
110
+ title: r.toLanguageString(f, n[f]),
109
111
  onClose: this.onClose,
110
- dir: o,
112
+ dir: a,
111
113
  modal: !0,
112
114
  minimizeButton: () => null,
113
115
  maximizeButton: () => null,
114
116
  resizable: !1
115
117
  }, {
116
- default: () => [v, e(L, null, {
118
+ default: () => [b, e(I, null, {
117
119
  default: () => [e(p, {
118
120
  type: "button",
119
121
  onClick: this.onClose,
120
- dir: o,
122
+ dir: a,
121
123
  key: "cancel"
122
- }, C(t = n.toLanguageString(c, r[c])) ? t : {
124
+ }, v(t = r.toLanguageString(c, n[c])) ? t : {
123
125
  default: () => [t]
124
126
  }), e(p, {
125
127
  type: "button",
126
128
  onClick: this.onInsert,
127
129
  themeColor: "primary",
128
- dir: o,
130
+ dir: a,
129
131
  key: "insert"
130
- }, C(l = n.toLanguageString(m, r[m])) ? l : {
132
+ }, v(l = r.toLanguageString(m, n[m])) ? l : {
131
133
  default: () => [l]
132
134
  })]
133
135
  })]
@@ -135,7 +137,7 @@ const M = /* @__PURE__ */ w({
135
137
  },
136
138
  methods: {
137
139
  hrefChange(t) {
138
- this.hrefValue = t.value;
140
+ this.hrefValue = t.value, this.hrefInvalid = !1;
139
141
  },
140
142
  titleChange(t) {
141
143
  this.titleValue = t.value;
@@ -147,12 +149,17 @@ const M = /* @__PURE__ */ w({
147
149
  this.$props.view.focus(), this.$emit("close");
148
150
  },
149
151
  onInsert() {
150
- const t = this.$props.view, l = this.$props.settings.mark, i = {
152
+ const t = this.$props.view, l = this.$props.settings.mark;
153
+ if (this.href && !H(this.hrefValue)) {
154
+ this.hrefInvalid = !0;
155
+ return;
156
+ }
157
+ const i = {
151
158
  href: this.href ? this.hrefValue : void 0,
152
159
  title: this.title ? this.titleValue : void 0,
153
160
  target: this.target && this.targetValue ? "_blank" : void 0
154
161
  };
155
- S({
162
+ L({
156
163
  mark: l,
157
164
  attrs: i
158
165
  }, this.$props.settings.commandName)(t.state, t.dispatch), this.onClose();
@@ -160,5 +167,5 @@ const M = /* @__PURE__ */ w({
160
167
  }
161
168
  });
162
169
  export {
163
- M as InsertLinkDialog
170
+ R as InsertLinkDialog
164
171
  };