@progress/kendo-react-editor 16.2.0-develop.9 → 16.2.0

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.
package/Editor.mjs CHANGED
@@ -8,30 +8,31 @@
8
8
  import * as t from "react";
9
9
  import c from "prop-types";
10
10
  import { ButtonGroup as ke, Toolbar as Ee, toolbarButtons as Re, ToolbarSeparator as we } from "@progress/kendo-react-buttons";
11
- import { validatePackage as Ce, getLicenseMessage as Se, useWebMcpRegister as Le, classNames as Ae, WatermarkOverlay as Be } from "@progress/kendo-react-common";
12
- import { Plugin as W, PluginKey as j, spacesFix as Ne, caretColor as Pe, history as De, dropCursor as Ie, gapCursor as Te, tableEditing as We, cspFix as xe, Schema as He, marks as Me, nodes as _e, EditorState as Fe, keymap as z, baseKeymap as Oe, EditorView as Ve, getMark as je } from "@progress/kendo-editor-common";
13
- import { defaultStyle as ze, tablesStyles as qe, rtlStyles as Ke } from "./config/defaultStyles.mjs";
14
- import { EditorToolsSettings as $e } from "./config/toolsSettings.mjs";
15
- import { EditorDialogs as Ge } from "./dialogs/index.mjs";
11
+ import { validatePackage as Ce, getLicenseMessage as Se, useWebMcpRegister as Le, classNames as Ne, WatermarkOverlay as Ae } from "@progress/kendo-react-common";
12
+ import { Plugin as W, PluginKey as V, spacesFix as Be, caretColor as Pe, history as De, dropCursor as Ie, gapCursor as Te, tableEditing as We, cspFix as xe, Schema as He, nodes as Me, EditorState as _e, keymap as j, baseKeymap as Fe, EditorView as Oe, getMark as ze } from "@progress/kendo-editor-common";
13
+ import { sanitizeLinkNode as Ve, marks as je } from "./config/schema.mjs";
14
+ import { defaultStyle as qe, tablesStyles as Ke, rtlStyles as $e } from "./config/defaultStyles.mjs";
15
+ import { EditorToolsSettings as Ge } from "./config/toolsSettings.mjs";
16
+ import { EditorDialogs as Ue } from "./dialogs/index.mjs";
16
17
  import { EditorUtils as x } from "./utils/index.mjs";
17
18
  import { editorPropsKey as q } from "./utils/props-key.mjs";
18
- import { updateEditorValue as Ue } from "./utils/controlled-value.mjs";
19
+ import { updateEditorValue as Je } from "./utils/controlled-value.mjs";
19
20
  import { packageMetadata as K } from "./package-metadata.mjs";
20
- import { keys as b, messages as N } from "./messages/index.mjs";
21
- import { useLocalization as Je } from "@progress/kendo-react-intl";
22
- const { link: $, bold: Qe, italic: Xe, underline: Ye } = $e, G = t.forwardRef((d, U) => {
21
+ import { keys as b, messages as B } from "./messages/index.mjs";
22
+ import { useLocalization as Qe } from "@progress/kendo-react-intl";
23
+ const { link: $, bold: Xe, italic: Ye, underline: Ze } = Ge, G = t.forwardRef((d, U) => {
23
24
  const { tools: J = [], defaultEditMode: Q = "iframe", preserveWhitespace: X = "full", style: k, className: Y } = d, [Z, E] = t.useState({
24
25
  view: void 0,
25
26
  linkDialog: !1
26
- }), P = t.useRef(null), f = t.useRef(null), H = t.useRef(null), i = t.useRef(void 0), v = t.useRef(null), R = t.useRef(null), w = t.useRef(void 0), a = t.useRef(d);
27
- a.current = d;
27
+ }), P = t.useRef(null), f = t.useRef(null), H = t.useRef(null), i = t.useRef(void 0), v = t.useRef(null), R = t.useRef(null), w = t.useRef(void 0), o = t.useRef(d);
28
+ o.current = d;
28
29
  const ee = t.useCallback((e) => {
29
30
  P.current = e;
30
31
  }, []), te = t.useCallback((e) => {
31
32
  H.current = e;
32
33
  }, []), re = t.useCallback((e) => {
33
34
  f.current = e;
34
- }, []), [ne] = t.useState(() => !Ce(K, { component: "Editor" })), [ae] = t.useState(() => Se(K)), C = Je(), S = t.useRef(null);
35
+ }, []), [ne] = t.useState(() => !Ce(K, { component: "Editor" })), [oe] = t.useState(() => Se(K)), C = Qe(), S = t.useRef(null);
35
36
  t.useImperativeHandle(
36
37
  S,
37
38
  () => ({
@@ -45,34 +46,34 @@ const { link: $, bold: Qe, italic: Xe, underline: Ye } = $e, G = t.forwardRef((d
45
46
  return i.current;
46
47
  },
47
48
  get value() {
48
- return v.current !== null ? v.current.doc : a.current.value !== void 0 ? a.current.value : i.current ? i.current.state.doc : a.current.defaultContent || "";
49
+ return v.current !== null ? v.current.doc : o.current.value !== void 0 ? o.current.value : i.current ? i.current.state.doc : o.current.defaultContent || "";
49
50
  },
50
51
  get props() {
51
- return a.current;
52
+ return o.current;
52
53
  },
53
54
  focus: () => {
54
55
  i.current && i.current.focus();
55
56
  }
56
57
  })
57
58
  ), t.useImperativeHandle(U, () => S.current), Le("editor", S, d, d.webMcp);
58
- const p = () => S.current, oe = t.useRef((e, r) => {
59
+ const p = () => S.current, ae = t.useRef((e, r) => {
59
60
  var s, g;
60
61
  const n = { target: p(), transaction: e, state: r };
61
- return ((g = (s = a.current).onExecute) == null ? void 0 : g.call(s, n)) !== !1;
62
+ return ((g = (s = o.current).onExecute) == null ? void 0 : g.call(s, n)) !== !1;
62
63
  }).current, ce = t.useRef((e) => {
63
- if (a.current.onPasteHtml && w.current) {
64
+ if (o.current.onPasteHtml && w.current) {
64
65
  const r = {
65
66
  target: p(),
66
67
  pastedHtml: e,
67
68
  nativeEvent: w.current
68
- }, n = a.current.onPasteHtml(r);
69
+ }, n = o.current.onPasteHtml(r);
69
70
  if (w.current = void 0, typeof n == "string")
70
71
  return n;
71
72
  }
72
73
  return e;
73
74
  }).current, se = t.useRef((e) => {
74
75
  const r = e.docChanged;
75
- if (a.current.onChange && r) {
76
+ if (o.current.onChange && r) {
76
77
  v.current = e;
77
78
  const s = e.doc, g = e.doc.type.schema, y = {
78
79
  target: p(),
@@ -83,58 +84,58 @@ const { link: $, bold: Qe, italic: Xe, underline: Ye } = $e, G = t.forwardRef((d
83
84
  };
84
85
  Object.defineProperty(y, "html", {
85
86
  get: () => (R.current = x.getHtml({ doc: s, schema: g }), R.current)
86
- }), a.current.onChange(y);
87
+ }), o.current.onChange(y);
87
88
  }
88
89
  const n = i.current;
89
- n && (a.current.value === void 0 || !r) && n.updateState(n.state.apply(e));
90
+ n && (o.current.value === void 0 || !r) && n.updateState(n.state.apply(e));
90
91
  }).current, ie = t.useRef((e, r) => {
91
- if (a.current.onFocus) {
92
+ if (o.current.onFocus) {
92
93
  const n = {
93
94
  target: p(),
94
95
  nativeEvent: r
95
96
  };
96
- a.current.onFocus(n);
97
+ o.current.onFocus(n);
97
98
  }
98
99
  return !1;
99
100
  }).current, ue = t.useRef((e, r) => {
100
- if (a.current.onBlur) {
101
+ if (o.current.onBlur) {
101
102
  const n = {
102
103
  target: p(),
103
104
  nativeEvent: r
104
105
  };
105
- a.current.onBlur(n);
106
+ o.current.onBlur(n);
106
107
  }
107
108
  return !1;
108
- }).current, le = t.useRef((e, r) => (a.current.onPasteHtml && (w.current = r), !1)).current, de = t.useRef((e) => {
109
- if (a.current.onIFrameInit) {
109
+ }).current, le = t.useRef((e, r) => (o.current.onPasteHtml && (w.current = r), !1)).current, de = t.useRef((e) => {
110
+ if (o.current.onIFrameInit) {
110
111
  const r = {
111
112
  target: p(),
112
113
  iframe: e
113
114
  };
114
- a.current.onIFrameInit(r);
115
+ o.current.onIFrameInit(r);
115
116
  }
116
117
  return !1;
117
118
  }).current, fe = t.useRef((e, r) => {
118
119
  E((n) => ({ ...n, view: e }));
119
120
  }).current;
120
121
  t.useEffect(() => {
121
- var V;
122
+ var z;
122
123
  const e = H.current, r = e == null ? void 0 : e.contentWindow;
123
124
  if (r) {
124
- const o = r.document;
125
- if (!o.head.querySelector("meta[charset]")) {
126
- const l = o.createElement("meta");
127
- l.setAttribute("charset", "utf-8"), o.head.appendChild(l);
125
+ const a = r.document;
126
+ if (!a.head.querySelector("meta[charset]")) {
127
+ const l = a.createElement("meta");
128
+ l.setAttribute("charset", "utf-8"), a.head.appendChild(l);
128
129
  }
129
- const u = o.body.querySelector(".k-content");
130
- u ? (u.textContent = "", f.current = u) : (f.current = o.createElement("div"), o.body.appendChild(f.current), f.current.classList.add("k-content")), f.current.setAttribute("role", "textbox"), f.current.setAttribute(
130
+ const u = a.body.querySelector(".k-content");
131
+ u ? (u.textContent = "", f.current = u) : (f.current = a.createElement("div"), a.body.appendChild(f.current), f.current.classList.add("k-content")), f.current.setAttribute("role", "textbox"), f.current.setAttribute(
131
132
  "aria-label",
132
- a.current.ariaLabel || C.toLanguageString(b.contentAreaLabel, N[b.contentAreaLabel])
133
- ), a.current.ariaLabelledBy && f.current.setAttribute("aria-labelledby", a.current.ariaLabelledBy), a.current.ariaDescribedBy && f.current.setAttribute("aria-describedby", a.current.ariaDescribedBy), e && a.current.onIFrameInit ? de(e) : o.head.querySelector("style") || [ze, qe, a.current.dir === "rtl" ? Ke : void 0].forEach(
133
+ o.current.ariaLabel || C.toLanguageString(b.contentAreaLabel, B[b.contentAreaLabel])
134
+ ), o.current.ariaLabelledBy && f.current.setAttribute("aria-labelledby", o.current.ariaLabelledBy), o.current.ariaDescribedBy && f.current.setAttribute("aria-describedby", o.current.ariaDescribedBy), e && o.current.onIFrameInit ? de(e) : a.head.querySelector("style") || [qe, Ke, o.current.dir === "rtl" ? $e : void 0].forEach(
134
135
  (l) => {
135
136
  if (l) {
136
- const m = o.createElement("style");
137
- m.appendChild(o.createTextNode(l)), o.head.appendChild(m);
137
+ const m = a.createElement("style");
138
+ m.appendChild(a.createTextNode(l)), a.head.appendChild(m);
138
139
  }
139
140
  }
140
141
  );
@@ -142,24 +143,24 @@ const { link: $, bold: Qe, italic: Xe, underline: Ye } = $e, G = t.forwardRef((d
142
143
  const n = f.current;
143
144
  if (!n)
144
145
  return;
145
- const s = (V = a.current.preserveWhitespace) != null ? V : "full", g = [
146
+ const s = (z = o.current.preserveWhitespace) != null ? z : "full", g = [
146
147
  // https://prosemirror.net/docs/ref/#state.PluginSpec
147
148
  new W({
148
149
  view: (() => ({ update: fe })),
149
- key: new j("toolbar-tools-update-plugin")
150
+ key: new V("toolbar-tools-update-plugin")
150
151
  }),
151
152
  new W({
152
- filterTransaction: oe,
153
- key: new j("onExecute-event-plugin")
153
+ filterTransaction: ae,
154
+ key: new V("onExecute-event-plugin")
154
155
  }),
155
156
  new W({
156
157
  key: q,
157
158
  state: {
158
159
  init: () => ({ preserveWhitespace: s }),
159
- apply: (o, u) => u
160
+ apply: (a, u) => u
160
161
  }
161
162
  }),
162
- Ne(),
163
+ Be(),
163
164
  Pe(),
164
165
  De(),
165
166
  Ie(),
@@ -169,31 +170,31 @@ const { link: $, bold: Qe, italic: Xe, underline: Ye } = $e, G = t.forwardRef((d
169
170
  ], y = {
170
171
  ...x.getShortcuts({
171
172
  types: { listItem: "list_item", hardBreak: "hard_break" },
172
- toolsSettings: { bold: Qe, italic: Xe, underline: Ye }
173
+ toolsSettings: { bold: Xe, italic: Ye, underline: Ze }
173
174
  }),
174
175
  "Mod-k": () => {
175
- const o = i.current;
176
- if (o) {
177
- const u = o.state, l = u.selection.empty, m = je(u, u.schema.marks[$.mark]);
176
+ const a = i.current;
177
+ if (a) {
178
+ const u = a.state, l = u.selection.empty, m = ze(u, u.schema.marks[$.mark]);
178
179
  l && !m || E((h) => h.linkDialog ? h : { ...h, linkDialog: !0 });
179
180
  }
180
181
  return !0;
181
182
  },
182
183
  "Alt-F10": () => {
183
184
  var u;
184
- const o = (u = P.current) == null ? void 0 : u.querySelector(".k-toolbar");
185
- if (o) {
186
- const l = o.querySelector(Re.join(","));
185
+ const a = (u = P.current) == null ? void 0 : u.querySelector(".k-toolbar");
186
+ if (a) {
187
+ const l = a.querySelector(Re.join(","));
187
188
  if (l)
188
189
  return l.focus(), !0;
189
190
  }
190
191
  return !1;
191
192
  }
192
- }, { defaultContent: ve = "", value: A, onMount: T } = a.current, ye = A && typeof A != "string" ? A : x.createDocument(new He({ nodes: _e, marks: Me }), A || ve, {
193
+ }, { defaultContent: ve = "", value: N, onMount: T } = o.current, ye = N && typeof N != "string" ? Ve(N) : x.createDocument(new He({ nodes: Me, marks: je }), N || ve, {
193
194
  preserveWhitespace: s
194
195
  }), F = {
195
- state: Fe.create({
196
- plugins: [...g, z(y), z(Oe)],
196
+ state: _e.create({
197
+ plugins: [...g, j(y), j(Fe)],
197
198
  doc: ye
198
199
  }),
199
200
  transformPastedHTML: ce,
@@ -203,20 +204,20 @@ const { link: $, bold: Qe, italic: Xe, underline: Ye } = $e, G = t.forwardRef((d
203
204
  blur: ue,
204
205
  paste: le
205
206
  },
206
- handleDrop: (o, u, l, m) => {
207
- let B = !1;
207
+ handleDrop: (a, u, l, m) => {
208
+ let A = !1;
208
209
  return l.content.nodesBetween(0, l.content.size, (h) => {
209
- B = B || h.type.name === "table_caption_external";
210
- }), B;
210
+ A = A || h.type.name === "table_caption_external";
211
+ }), A;
211
212
  }
212
- }, he = { plugins: g, shortcuts: y, target: p(), viewProps: F, dom: n }, O = (T == null ? void 0 : T(he)) || new Ve({ mount: n }, F);
213
- return i.current = O, E((o) => ({ ...o, view: O })), () => {
213
+ }, he = { plugins: g, shortcuts: y, target: p(), viewProps: F, dom: n }, O = (T == null ? void 0 : T(he)) || new Oe({ mount: n }, F);
214
+ return i.current = O, E((a) => ({ ...a, view: O })), () => {
214
215
  var u, l;
215
216
  i.current && i.current.destroy(), i.current = void 0;
216
- const o = e == null ? void 0 : e.contentWindow;
217
- if (o != null && o.document) {
217
+ const a = e == null ? void 0 : e.contentWindow;
218
+ if (a != null && a.document) {
218
219
  (l = (u = f.current) == null ? void 0 : u.parentNode) == null || l.removeChild(f.current);
219
- const m = o.document.head;
220
+ const m = a.document.head;
220
221
  for (; m != null && m.firstChild; )
221
222
  m.removeChild(m.firstChild);
222
223
  }
@@ -224,12 +225,12 @@ const { link: $, bold: Qe, italic: Xe, underline: Ye } = $e, G = t.forwardRef((d
224
225
  }, []);
225
226
  const D = t.useRef(d.value);
226
227
  if (t.useEffect(() => {
227
- const { value: e } = a.current, r = i.current;
228
+ const { value: e } = o.current, r = i.current;
228
229
  if (e === void 0 || !r) {
229
230
  D.current = e;
230
231
  return;
231
232
  }
232
- Ue(r, e, D.current, v.current, R.current), v.current = null, R.current = null, D.current = e;
233
+ Je(r, e, D.current, v.current, R.current), v.current = null, R.current = null, D.current = e;
233
234
  }), i.current) {
234
235
  const e = q.getState(i.current.state);
235
236
  e.preserveWhitespace = X;
@@ -259,16 +260,16 @@ const { link: $, bold: Qe, italic: Xe, underline: Ye } = $e, G = t.forwardRef((d
259
260
  (e, r) => Array.isArray(e) ? /* @__PURE__ */ t.createElement(ke, { key: me(e, r), className: "k-toolbar-button-group" }, e.map((n, s) => M(n, I(n, r, s)))) : M(e, I(e, r, 0), !0)
260
261
  ), be = C.toLanguageString(
261
262
  b.toolbarAriaLabel,
262
- N[b.toolbarAriaLabel]
263
+ B[b.toolbarAriaLabel]
263
264
  ), pe = C.toLanguageString(
264
265
  b.contentAreaLabel,
265
- N[b.contentAreaLabel]
266
+ B[b.contentAreaLabel]
266
267
  );
267
268
  return /* @__PURE__ */ t.createElement(
268
269
  "div",
269
270
  {
270
271
  ref: ee,
271
- className: Ae("k-editor", Y, { "k-editor-resizable": d.resizable }),
272
+ className: Ne("k-editor", Y, { "k-editor-resizable": d.resizable }),
272
273
  dir: d.dir,
273
274
  style: k
274
275
  },
@@ -286,7 +287,7 @@ const { link: $, bold: Qe, italic: Xe, underline: Ye } = $e, G = t.forwardRef((d
286
287
  {
287
288
  ref: te,
288
289
  frameBorder: "0",
289
- title: C.toLanguageString(b.iframeTitle, N[b.iframeTitle]),
290
+ title: C.toLanguageString(b.iframeTitle, B[b.iframeTitle]),
290
291
  style: L,
291
292
  className: "k-iframe"
292
293
  }
@@ -303,8 +304,8 @@ const { link: $, bold: Qe, italic: Xe, underline: Ye } = $e, G = t.forwardRef((d
303
304
  suppressContentEditableWarning: !0
304
305
  }
305
306
  ),
306
- ge(Ge.InsertLinkDialog, $, "linkDialog"),
307
- ne && /* @__PURE__ */ t.createElement(Be, { message: ae })
307
+ ge(Ue.InsertLinkDialog, $, "linkDialog"),
308
+ ne && /* @__PURE__ */ t.createElement(Ae, { message: oe })
308
309
  );
309
310
  });
310
311
  G.propTypes = {
@@ -5,4 +5,14 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- export { marks, nodes } from '@progress/kendo-editor-common';
8
+ import { MarkSpec, Node, Schema, parseContent as parseContentCommon } from '@progress/kendo-editor-common';
9
+ export { nodes } from '@progress/kendo-editor-common';
10
+ declare const marks: {
11
+ link: MarkSpec;
12
+ };
13
+ /** @hidden */
14
+ export declare const sanitizeLinkSchema: (schema: Schema) => Schema;
15
+ export declare const parseContent: typeof parseContentCommon;
16
+ /** @hidden */
17
+ export declare const sanitizeLinkNode: (node: Node) => Node;
18
+ export { marks };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@progress/kendo-editor-common"),k=require("@progress/kendo-react-common"),u=t=>{const r=(t.parseDOM||[]).map(i=>({...i,getAttrs:c=>{const s=typeof i.getAttrs=="function"?i.getAttrs(c):{};return s&&typeof s=="object"&&"href"in s&&(s.href=k.sanitizeUrl(s.href)||null),s}})),n=t.toDOM;return{...t,parseDOM:r,toDOM:typeof n=="function"?(i,c)=>{var s;return n({...i,attrs:{...i.attrs,href:k.sanitizeUrl((s=i.attrs)==null?void 0:s.href)||null}},c)}:n}},l={...a.marks,link:u(a.marks.link)},o=new WeakMap,p=new WeakMap,m=t=>{const r=o.get(t);if(r)return r;const n=t.spec.marks.get("link");if(!n)return o.set(t,t),t;const e=new a.Schema({...t.spec,marks:t.spec.marks.update("link",u(n))});return o.set(t,e),o.set(e,e),e},f=t=>{const r=t.marks.map(e=>e.type.name==="link"?e.type.create({...e.attrs,href:k.sanitizeUrl(e.attrs.href)||null}):e);if(t.isText)return t.mark(r);const n=[];return t.forEach(e=>n.push(f(e))),t.copy(a.Fragment.fromArray(n)).mark(r)},h=(t,r,n)=>f(a.parseContent(t,r,n)),d=t=>{const r=p.get(t);if(r)return r;const n=m(t.type.schema),e=f(n===t.type.schema?t:n.nodeFromJSON(t.toJSON()));return p.set(t,e),p.set(e,e),e};Object.defineProperty(exports,"nodes",{enumerable:!0,get:()=>a.nodes});exports.marks=l;exports.parseContent=h;exports.sanitizeLinkNode=d;exports.sanitizeLinkSchema=m;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { marks as k, parseContent as h, Fragment as u, Schema as l } from "@progress/kendo-editor-common";
9
+ import { nodes as d } from "@progress/kendo-editor-common";
10
+ import { sanitizeUrl as p } from "@progress/kendo-react-common";
11
+ const m = (t) => {
12
+ const r = (t.parseDOM || []).map((a) => ({
13
+ ...a,
14
+ getAttrs: (i) => {
15
+ const n = typeof a.getAttrs == "function" ? a.getAttrs(i) : {};
16
+ return n && typeof n == "object" && "href" in n && (n.href = p(n.href) || null), n;
17
+ }
18
+ })), s = t.toDOM;
19
+ return { ...t, parseDOM: r, toDOM: typeof s == "function" ? (a, i) => {
20
+ var n;
21
+ return s(
22
+ {
23
+ ...a,
24
+ attrs: { ...a.attrs, href: p((n = a.attrs) == null ? void 0 : n.href) || null }
25
+ },
26
+ i
27
+ );
28
+ } : s };
29
+ }, g = { ...k, link: m(k.link) }, o = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), M = (t) => {
30
+ const r = o.get(t);
31
+ if (r)
32
+ return r;
33
+ const s = t.spec.marks.get("link");
34
+ if (!s)
35
+ return o.set(t, t), t;
36
+ const e = new l({
37
+ ...t.spec,
38
+ marks: t.spec.marks.update("link", m(s))
39
+ });
40
+ return o.set(t, e), o.set(e, e), e;
41
+ }, f = (t) => {
42
+ const r = t.marks.map(
43
+ (e) => e.type.name === "link" ? e.type.create({ ...e.attrs, href: p(e.attrs.href) || null }) : e
44
+ );
45
+ if (t.isText)
46
+ return t.mark(r);
47
+ const s = [];
48
+ return t.forEach((e) => s.push(f(e))), t.copy(u.fromArray(s)).mark(r);
49
+ }, O = (t, r, s) => f(h(t, r, s)), S = (t) => {
50
+ const r = c.get(t);
51
+ if (r)
52
+ return r;
53
+ const s = M(t.type.schema), e = f(s === t.type.schema ? t : s.nodeFromJSON(t.toJSON()));
54
+ return c.set(t, e), c.set(e, e), e;
55
+ };
56
+ export {
57
+ g as marks,
58
+ d as nodes,
59
+ O as parseContent,
60
+ S as sanitizeLinkNode,
61
+ M as sanitizeLinkSchema
62
+ };
@@ -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 S=require("react"),y=require("@progress/kendo-react-dialogs"),C=require("@progress/kendo-react-buttons"),m=require("@progress/kendo-react-inputs"),c=require("@progress/kendo-react-form"),w=require("@progress/kendo-editor-common"),L=require("@progress/kendo-react-intl"),o=require("../messages/index.js");function x(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>s[n]})}}return t.default=s,Object.freeze(t)}const e=x(S);let F=class extends e.Component{constructor(){super(...arguments),this.href=null,this.title=null,this.target=null,this.onClose=()=>{this.props.view.focus(),this.props.onClose()},this.onInsert=()=>{const t=this.props.view,n=this.props.settings.mark,r={href:this.href?this.href.value:void 0,title:this.title?this.title.value:void 0,target:this.target&&this.target.element&&this.target.element.checked?"_blank":void 0};w.applyLink({mark:n,attrs:r},this.props.settings.commandName)(t.state,t.dispatch),this.onClose()}}render(){const{view:t,settings:n,dir:r,render:u}=this.props,l=L.provideLocalizationService(this),{insertHyperlinkDialogTitle:d,insertHyperlinkAddress:g,insertHyperlinkTitle:k,insertHyperlinkNewWindow:h,insertHyperlinkCancel:p,insertHyperlinkInsert:f}=n.messages,a=t?w.getMark(t.state,t.state.schema.marks[n.mark]):!1,v=e.createElement(c.Form,{render:()=>e.createElement(c.FormElement,{horizontal:!0},e.createElement(c.FieldWrapper,null,e.createElement("label",{htmlFor:"k-editor-link-url",className:"k-form-label"},l.toLanguageString(g,o.messages[g])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.Input,{type:"text",id:"k-editor-link-url",ref:i=>{this.href=i&&i.element},defaultValue:a&&a.attrs.href||void 0,autoFocus:!0}))),e.createElement(c.FieldWrapper,null,e.createElement("label",{htmlFor:"k-editor-link-text",className:"k-form-label"},l.toLanguageString(k,o.messages[k])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.Input,{type:"text",id:"k-editor-link-text",ref:i=>{this.title=i&&i.element},defaultValue:a&&a.attrs.title||void 0}))),n.linkTarget!==!1&&e.createElement(c.FieldWrapper,null,e.createElement("label",{htmlFor:"k-editor-link-target",className:"k-checkbox-label"},e.createElement(m.Checkbox,{id:"k-editor-link-target",ref:i=>{this.target=i},defaultChecked:a&&!!a.attrs.target||void 0}),l.toLanguageString(h,o.messages[h]))))}),E=[e.createElement(C.Button,{onClick:this.onClose,dir:r,key:"cancel"},l.toLanguageString(p,o.messages[p])),e.createElement(C.Button,{onClick:this.onInsert,themeColor:"primary",dir:r,key:"insert"},l.toLanguageString(f,o.messages[f]))],b=e.createElement(y.Window,{initialWidth:450,initialHeight:250,className:"k-editor-window",title:l.toLanguageString(d,o.messages[d]),onClose:this.onClose,style:r==="rtl"?{textAlign:"right"}:void 0,modal:!0,minimizeButton:()=>null,maximizeButton:()=>null,resizable:!1},v,e.createElement(y.WindowActionsBar,null,...E));return u?u(b,{content:v,actionButtons:E}):b}};L.registerForLocalization(F);exports.InsertLinkDialog=F;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),y=require("@progress/kendo-react-dialogs"),C=require("@progress/kendo-react-buttons"),u=require("@progress/kendo-react-inputs"),c=require("@progress/kendo-react-form"),x=require("@progress/kendo-react-common"),w=require("@progress/kendo-editor-common"),L=require("@progress/kendo-react-intl"),o=require("../messages/index.js");function I(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>s[n]})}}return t.default=s,Object.freeze(t)}const e=I(S);let F=class extends e.Component{constructor(){super(...arguments),this.href=null,this.title=null,this.target=null,this.onClose=()=>{this.props.view.focus(),this.props.onClose()},this.onInsert=()=>{const t=this.props.view,n=this.props.settings.mark,m={href:(this.href?x.sanitizeUrl(this.href.value):void 0)||void 0,title:this.title?this.title.value:void 0,target:this.target&&this.target.element&&this.target.element.checked?"_blank":void 0};w.applyLink({mark:n,attrs:m},this.props.settings.commandName)(t.state,t.dispatch),this.onClose()}}render(){const{view:t,settings:n,dir:r,render:m}=this.props,l=L.provideLocalizationService(this),{insertHyperlinkDialogTitle:d,insertHyperlinkAddress:g,insertHyperlinkTitle:k,insertHyperlinkNewWindow:h,insertHyperlinkCancel:p,insertHyperlinkInsert:f}=n.messages,a=t?w.getMark(t.state,t.state.schema.marks[n.mark]):!1,v=e.createElement(c.Form,{render:()=>e.createElement(c.FormElement,{horizontal:!0},e.createElement(c.FieldWrapper,null,e.createElement("label",{htmlFor:"k-editor-link-url",className:"k-form-label"},l.toLanguageString(g,o.messages[g])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(u.Input,{type:"text",id:"k-editor-link-url",ref:i=>{this.href=i&&i.element},defaultValue:a&&a.attrs.href||void 0,autoFocus:!0}))),e.createElement(c.FieldWrapper,null,e.createElement("label",{htmlFor:"k-editor-link-text",className:"k-form-label"},l.toLanguageString(k,o.messages[k])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(u.Input,{type:"text",id:"k-editor-link-text",ref:i=>{this.title=i&&i.element},defaultValue:a&&a.attrs.title||void 0}))),n.linkTarget!==!1&&e.createElement(c.FieldWrapper,null,e.createElement("label",{htmlFor:"k-editor-link-target",className:"k-checkbox-label"},e.createElement(u.Checkbox,{id:"k-editor-link-target",ref:i=>{this.target=i},defaultChecked:a&&!!a.attrs.target||void 0}),l.toLanguageString(h,o.messages[h]))))}),E=[e.createElement(C.Button,{onClick:this.onClose,dir:r,key:"cancel"},l.toLanguageString(p,o.messages[p])),e.createElement(C.Button,{onClick:this.onInsert,themeColor:"primary",dir:r,key:"insert"},l.toLanguageString(f,o.messages[f]))],b=e.createElement(y.Window,{initialWidth:450,initialHeight:250,className:"k-editor-window",title:l.toLanguageString(d,o.messages[d]),onClose:this.onClose,style:r==="rtl"?{textAlign:"right"}:void 0,modal:!0,minimizeButton:()=>null,maximizeButton:()=>null,resizable:!1},v,e.createElement(y.WindowActionsBar,null,...E));return m?m(b,{content:v,actionButtons:E}):b}};L.registerForLocalization(F);exports.InsertLinkDialog=F;
@@ -7,42 +7,43 @@
7
7
  */
8
8
  import * as e from "react";
9
9
  import { Window as C, WindowActionsBar as w } from "@progress/kendo-react-dialogs";
10
- import { Button as v } from "@progress/kendo-react-buttons";
10
+ import { Button as E } from "@progress/kendo-react-buttons";
11
11
  import { Input as y, Checkbox as L } from "@progress/kendo-react-inputs";
12
- import { Form as b, FormElement as x, FieldWrapper as s } from "@progress/kendo-react-form";
12
+ import { Form as b, FormElement as x, FieldWrapper as m } from "@progress/kendo-react-form";
13
+ import { sanitizeUrl as z } from "@progress/kendo-react-common";
13
14
  import { applyLink as F, getMark as N } from "@progress/kendo-editor-common";
14
- import { provideLocalizationService as z, registerForLocalization as H } from "@progress/kendo-react-intl";
15
- import { messages as n } from "../messages/index.mjs";
16
- let I = class extends e.Component {
15
+ import { provideLocalizationService as H, registerForLocalization as I } from "@progress/kendo-react-intl";
16
+ import { messages as l } from "../messages/index.mjs";
17
+ let S = class extends e.Component {
17
18
  constructor() {
18
19
  super(...arguments), this.href = null, this.title = null, this.target = null, this.onClose = () => {
19
20
  this.props.view.focus(), this.props.onClose();
20
21
  }, this.onInsert = () => {
21
- const r = this.props.view, a = this.props.settings.mark, o = {
22
- href: this.href ? this.href.value : void 0,
22
+ const r = this.props.view, o = this.props.settings.mark, s = {
23
+ href: (this.href ? z(this.href.value) : void 0) || void 0,
23
24
  title: this.title ? this.title.value : void 0,
24
25
  target: this.target && this.target.element && this.target.element.checked ? "_blank" : void 0
25
26
  };
26
- F({ mark: a, attrs: o }, this.props.settings.commandName)(r.state, r.dispatch), this.onClose();
27
+ F({ mark: o, attrs: s }, this.props.settings.commandName)(r.state, r.dispatch), this.onClose();
27
28
  };
28
29
  }
29
30
  /**
30
31
  * @hidden
31
32
  */
32
33
  render() {
33
- const { view: r, settings: a, dir: o, render: m } = this.props, i = z(this), {
34
+ const { view: r, settings: o, dir: a, render: s } = this.props, i = H(this), {
34
35
  insertHyperlinkDialogTitle: c,
35
36
  insertHyperlinkAddress: h,
36
- insertHyperlinkTitle: k,
37
- insertHyperlinkNewWindow: d,
37
+ insertHyperlinkTitle: d,
38
+ insertHyperlinkNewWindow: k,
38
39
  insertHyperlinkCancel: g,
39
40
  insertHyperlinkInsert: p
40
- } = a.messages, l = r ? N(r.state, r.state.schema.marks[a.mark]) : !1, u = /* @__PURE__ */ e.createElement(
41
+ } = o.messages, n = r ? N(r.state, r.state.schema.marks[o.mark]) : !1, u = /* @__PURE__ */ e.createElement(
41
42
  b,
42
43
  {
43
- render: () => /* @__PURE__ */ e.createElement(x, { horizontal: !0 }, /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement("label", { htmlFor: "k-editor-link-url", className: "k-form-label" }, i.toLanguageString(
44
+ render: () => /* @__PURE__ */ e.createElement(x, { horizontal: !0 }, /* @__PURE__ */ e.createElement(m, null, /* @__PURE__ */ e.createElement("label", { htmlFor: "k-editor-link-url", className: "k-form-label" }, i.toLanguageString(
44
45
  h,
45
- n[h]
46
+ l[h]
46
47
  )), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
47
48
  y,
48
49
  {
@@ -51,12 +52,12 @@ let I = class extends e.Component {
51
52
  ref: (t) => {
52
53
  this.href = t && t.element;
53
54
  },
54
- defaultValue: l && l.attrs.href || void 0,
55
+ defaultValue: n && n.attrs.href || void 0,
55
56
  autoFocus: !0
56
57
  }
57
- ))), /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement("label", { htmlFor: "k-editor-link-text", className: "k-form-label" }, i.toLanguageString(
58
- k,
59
- n[k]
58
+ ))), /* @__PURE__ */ e.createElement(m, null, /* @__PURE__ */ e.createElement("label", { htmlFor: "k-editor-link-text", className: "k-form-label" }, i.toLanguageString(
59
+ d,
60
+ l[d]
60
61
  )), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
61
62
  y,
62
63
  {
@@ -65,26 +66,26 @@ let I = class extends e.Component {
65
66
  ref: (t) => {
66
67
  this.title = t && t.element;
67
68
  },
68
- defaultValue: l && l.attrs.title || void 0
69
+ defaultValue: n && n.attrs.title || void 0
69
70
  }
70
- ))), a.linkTarget !== !1 && /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement("label", { htmlFor: "k-editor-link-target", className: "k-checkbox-label" }, /* @__PURE__ */ e.createElement(
71
+ ))), o.linkTarget !== !1 && /* @__PURE__ */ e.createElement(m, null, /* @__PURE__ */ e.createElement("label", { htmlFor: "k-editor-link-target", className: "k-checkbox-label" }, /* @__PURE__ */ e.createElement(
71
72
  L,
72
73
  {
73
74
  id: "k-editor-link-target",
74
75
  ref: (t) => {
75
76
  this.target = t;
76
77
  },
77
- defaultChecked: l && !!l.attrs.target || void 0
78
+ defaultChecked: n && !!n.attrs.target || void 0
78
79
  }
79
80
  ), i.toLanguageString(
80
- d,
81
- n[d]
81
+ k,
82
+ l[k]
82
83
  ))))
83
84
  }
84
85
  ), f = [
85
- /* @__PURE__ */ e.createElement(v, { onClick: this.onClose, dir: o, key: "cancel" }, i.toLanguageString(g, n[g])),
86
- /* @__PURE__ */ e.createElement(v, { onClick: this.onInsert, themeColor: "primary", dir: o, key: "insert" }, i.toLanguageString(p, n[p]))
87
- ], E = /* @__PURE__ */ e.createElement(
86
+ /* @__PURE__ */ e.createElement(E, { onClick: this.onClose, dir: a, key: "cancel" }, i.toLanguageString(g, l[g])),
87
+ /* @__PURE__ */ e.createElement(E, { onClick: this.onInsert, themeColor: "primary", dir: a, key: "insert" }, i.toLanguageString(p, l[p]))
88
+ ], v = /* @__PURE__ */ e.createElement(
88
89
  C,
89
90
  {
90
91
  initialWidth: 450,
@@ -92,10 +93,10 @@ let I = class extends e.Component {
92
93
  className: "k-editor-window",
93
94
  title: i.toLanguageString(
94
95
  c,
95
- n[c]
96
+ l[c]
96
97
  ),
97
98
  onClose: this.onClose,
98
- style: o === "rtl" ? { textAlign: "right" } : void 0,
99
+ style: a === "rtl" ? { textAlign: "right" } : void 0,
99
100
  modal: !0,
100
101
  minimizeButton: () => null,
101
102
  maximizeButton: () => null,
@@ -104,10 +105,10 @@ let I = class extends e.Component {
104
105
  u,
105
106
  /* @__PURE__ */ e.createElement(w, null, ...f)
106
107
  );
107
- return m ? m(E, { content: u, actionButtons: f }) : E;
108
+ return s ? s(v, { content: u, actionButtons: f }) : v;
108
109
  }
109
110
  };
110
- H(I);
111
+ I(S);
111
112
  export {
112
- I as InsertLinkDialog
113
+ S as InsertLinkDialog
113
114
  };