@progress/kendo-react-editor 14.5.0-develop.13 → 14.5.0-develop.15

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.js CHANGED
@@ -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 B=require("react"),i=require("prop-types"),w=require("@progress/kendo-react-buttons"),E=require("@progress/kendo-react-common"),n=require("@progress/kendo-editor-common"),_=require("./config/defaultStyles.js"),I=require("./config/toolsSettings.js"),x=require("./dialogs/index.js"),S=require("./utils/index.js"),D=require("./utils/props-key.js"),F=require("./utils/controlled-value.js"),M=require("./package-metadata.js"),O=require("./messages/index.js"),q=require("@progress/kendo-react-intl");function L(v){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(v){for(const e in v)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(v,e);Object.defineProperty(a,e,t.get?t:{enumerable:!0,get:()=>v[e]})}}return a.default=v,Object.freeze(a)}const h=L(B),{link:N,bold:W,italic:j,underline:z}=I.EditorToolsSettings,P=class P extends h.Component{constructor(a){super(a),this.state={view:void 0,linkDialog:!1},this._element=null,this._contentElement=null,this.iframe=null,this.trOnChange=null,this.htmlOnChange=null,this.showLicenseWatermark=!1,this.focus=()=>{this.view&&this.view.focus()},this.renderDialog=(e,t,s)=>this.state[s]&&h.createElement(e,{view:this.view,settings:t,dir:this.props.dir,onClose:()=>this.setState({[s]:!1})}),this.renderTool=(e,t,s=!1)=>{const d=h.createElement(e,{view:this.view,dir:this.props.dir,key:t,className:s?"k-toolbar-button":void 0});return d.type===w.ToolbarSeparator?h.createElement(e,{key:t}):d},this.updateTools=(e,t)=>{this.setState({view:e})},this.filterTransaction=(e,t)=>{const s={target:this,transaction:e,state:t};return(this.props.onExecute&&this.props.onExecute.call(void 0,s))!==!1},this.onPasteHtml=e=>{if(this.props.onPasteHtml&&this.pasteEvent){const t={target:this,pastedHtml:e,nativeEvent:this.pasteEvent},s=this.props.onPasteHtml.call(void 0,t);if(this.pasteEvent=void 0,typeof s=="string")return s}return e},this.dispatchTransaction=e=>{const t=e.docChanged;if(this.props.onChange&&t){this.trOnChange=e;const s=e.doc,d=e.doc.type.schema,m={target:this,value:s,html:"",transaction:e,schema:d};Object.defineProperty(m,"html",{get:()=>(this.htmlOnChange=S.EditorUtils.getHtml({doc:s,schema:d}),this.htmlOnChange)}),this.props.onChange.call(void 0,m)}this.view&&(this.props.value===void 0||!t)&&this.view.updateState(this.view.state.apply(e))},this.onFocus=(e,t)=>{if(this.props.onFocus){const s={target:this,nativeEvent:t};this.props.onFocus.call(void 0,s)}return!1},this.onBlur=(e,t)=>{if(this.props.onBlur){const s={target:this,nativeEvent:t};this.props.onBlur.call(void 0,s)}return!1},this.onPaste=(e,t)=>(this.props.onPasteHtml&&(this.pasteEvent=t),!1),this.onIFrameInit=e=>{if(this.props.onIFrameInit){const t={target:this,iframe:e};this.props.onIFrameInit.call(void 0,t)}return!1},this.showLicenseWatermark=!E.validatePackage(M.packageMetadata,{component:"Editor"}),this.licenseMessage=E.getLicenseMessage(M.packageMetadata)}get value(){return this.trOnChange!==null?this.trOnChange.doc:this.props.value!==void 0?this.props.value:this.view?this.view.state.doc:this.props.defaultContent||""}get element(){return this._element}get contentElement(){return this._contentElement}get view(){return this._view}componentDidMount(){this.initialize()}componentDidUpdate(a){const{value:e}=this.props,t=this.view;e===void 0||!t||(F.updateEditorValue(t,e,a.value,this.trOnChange,this.htmlOnChange),this.trOnChange=null,this.htmlOnChange=null)}componentWillUnmount(){var e;this.view&&this.view.destroy(),this._view=void 0;const a=(e=this.iframe)==null?void 0:e.contentWindow;if(a){this._contentElement&&this._contentElement.parentNode&&this._contentElement.parentNode.removeChild(this._contentElement);const t=a.document.head;for(;t&&t.firstChild;)t.removeChild(t.firstChild)}}render(){const{tools:a=[],defaultEditMode:e="iframe",preserveWhitespace:t="full",style:s,className:d}=this.props,m=q.provideLocalizationService(this);if(this.view){const o=D.editorPropsKey.getState(this.view.state);o.preserveWhitespace=t}let p=this.props.contentStyle;p===void 0&&(s||{}).height===void 0&&(p={height:"300px"});const f=(o,u)=>o.displayName||o.name||`tool-${u}`,C=(o,u)=>o.map((r,l)=>f(r,l)).join("-")||`group-${u}`,g=a.map((o,u)=>Array.isArray(o)?h.createElement(w.ButtonGroup,{key:C(o,u),className:"k-toolbar-button-group"},o.map((r,l)=>this.renderTool(r,f(r,l)))):this.renderTool(o,f(o,u),!0));return h.createElement("div",{ref:o=>{this._element=o},className:E.classNames("k-editor",d,{"k-editor-resizable":this.props.resizable}),dir:this.props.dir,style:s},g.length>0&&h.createElement(w.Toolbar,{className:"k-editor-toolbar",keyboardNavigation:this.props.keyboardNavigation},g),e==="iframe"?h.createElement("div",{className:"k-editor-content"},h.createElement("iframe",{ref:o=>{this.iframe=o},frameBorder:"0",title:m.toLanguageString(O.keys.iframeTitle,O.messages[O.keys.iframeTitle]),style:p,className:"k-iframe"})):h.createElement("div",{style:p,className:"k-editor-content"},h.createElement("div",{ref:o=>{this._contentElement=o},suppressContentEditableWarning:!0,role:"textbox","aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-label":this.props.ariaLabel})),this.renderDialog(x.EditorDialogs.InsertLinkDialog,N,"linkDialog"),this.showLicenseWatermark&&h.createElement(E.WatermarkOverlay,{message:this.licenseMessage}))}initialize(){const a=this.iframe&&this.iframe.contentWindow;if(a){const r=a.document,l=r.createElement("meta");l.setAttribute("charset","utf-8"),r.head.appendChild(l),this._contentElement=r.createElement("div"),r.body.appendChild(this._contentElement),this._contentElement.classList.add("k-content"),this.iframe&&this.props.onIFrameInit?this.onIFrameInit(this.iframe):[_.defaultStyle,_.tablesStyles,this.props.dir==="rtl"?_.rtlStyles:void 0].forEach(c=>{if(c){const y=r.createElement("style");y.appendChild(r.createTextNode(c)),r.head.appendChild(y)}})}const e=this._contentElement;if(!e)return;const{preserveWhitespace:t="full"}=this.props,s=[new n.Plugin({view:(()=>({update:this.updateTools})),key:new n.PluginKey("toolbar-tools-update-plugin")}),new n.Plugin({filterTransaction:this.filterTransaction,key:new n.PluginKey("onExecute-event-plugin")}),new n.Plugin({key:D.editorPropsKey,state:{init:()=>({preserveWhitespace:t}),apply:(r,l)=>l}}),n.spacesFix(),n.caretColor(),n.history(),n.dropCursor(),n.gapCursor(),n.tableEditing(),n.cspFix()],d={...S.EditorUtils.getShortcuts({types:{listItem:"list_item",hardBreak:"hard_break"},toolsSettings:{bold:W,italic:j,underline:z}}),"Mod-k":()=>{const{linkDialog:r}=this.state,l=this.view;if(l){const c=l.state,y=c.selection.empty,b=n.getMark(c,c.schema.marks[N.mark]);!r&&!(y&&!b)&&this.setState({linkDialog:!0})}return!r},"Alt-F10":()=>{var l;const r=(l=this.element)==null?void 0:l.querySelector(".k-toolbar");if(r){const c=r.querySelector(w.toolbarButtons.join(","));if(c)return c.focus(),!0}return!1}},{defaultContent:m="",value:p,onMount:f}=this.props,C=p&&typeof p!="string"?p:S.EditorUtils.createDocument(new n.Schema({nodes:n.nodes,marks:n.marks}),p||m,{preserveWhitespace:t}),g={state:n.EditorState.create({plugins:[...s,n.keymap(d),n.keymap(n.baseKeymap)],doc:C}),transformPastedHTML:this.onPasteHtml,dispatchTransaction:this.dispatchTransaction,handleDOMEvents:{focus:this.onFocus,blur:this.onBlur,paste:this.onPaste},handleDrop:(r,l,c,y)=>{let b=!1;return c.content.nodesBetween(0,c.content.size,T=>{b=b||T.type.name==="table_caption_external"}),b}},o={plugins:s,shortcuts:d,target:this,viewProps:g,dom:e},u=this._view=f&&f.call(void 0,o)||new n.EditorView({mount:e},g);this.setState({view:u})}};P.propTypes={defaultContent:i.string,value:i.oneOfType([i.object,i.string]),defaultEditMode:i.oneOf(["iframe","div"]),contentStyle:i.object,dir:i.string,className:i.string,ariaDescribedBy:i.string,ariaLabelledBy:i.string,ariaLabel:i.string,style:i.object,tools:i.arrayOf(i.any),keyboardNavigation:i.bool,resizable:i.bool,preserveWhitespace:i.oneOf([!0,!1,"full"]),onMount:i.func,onFocus:i.func,onBlur:i.func,onChange:i.func,onPasteHtml:i.func,onExecute:i.func,onIFrameInit:i.func};let k=P;q.registerForLocalization(k);exports.Editor=k;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),i=require("prop-types"),w=require("@progress/kendo-react-buttons"),C=require("@progress/kendo-react-common"),o=require("@progress/kendo-editor-common"),S=require("./config/defaultStyles.js"),q=require("./config/toolsSettings.js"),x=require("./dialogs/index.js"),L=require("./utils/index.js"),D=require("./utils/props-key.js"),A=require("./utils/controlled-value.js"),B=require("./package-metadata.js"),h=require("./messages/index.js"),O=require("@progress/kendo-react-intl");function I(g){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(g){for(const e in g)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(g,e);Object.defineProperty(c,e,t.get?t:{enumerable:!0,get:()=>g[e]})}}return c.default=g,Object.freeze(c)}const p=I(N),{link:M,bold:F,italic:W,underline:j}=q.EditorToolsSettings,P=class P extends p.Component{constructor(c){super(c),this.state={view:void 0,linkDialog:!1},this._element=null,this._contentElement=null,this.iframe=null,this.trOnChange=null,this.htmlOnChange=null,this.showLicenseWatermark=!1,this.focus=()=>{this.view&&this.view.focus()},this.renderDialog=(e,t,s)=>this.state[s]&&p.createElement(e,{view:this.view,settings:t,dir:this.props.dir,onClose:()=>this.setState({[s]:!1})}),this.renderTool=(e,t,s=!1)=>{const d=p.createElement(e,{view:this.view,dir:this.props.dir,key:t,className:s?"k-toolbar-button":void 0});return d.type===w.ToolbarSeparator?p.createElement(e,{key:t}):d},this.updateTools=(e,t)=>{this.setState({view:e})},this.filterTransaction=(e,t)=>{const s={target:this,transaction:e,state:t};return(this.props.onExecute&&this.props.onExecute.call(void 0,s))!==!1},this.onPasteHtml=e=>{if(this.props.onPasteHtml&&this.pasteEvent){const t={target:this,pastedHtml:e,nativeEvent:this.pasteEvent},s=this.props.onPasteHtml.call(void 0,t);if(this.pasteEvent=void 0,typeof s=="string")return s}return e},this.dispatchTransaction=e=>{const t=e.docChanged;if(this.props.onChange&&t){this.trOnChange=e;const s=e.doc,d=e.doc.type.schema,u={target:this,value:s,html:"",transaction:e,schema:d};Object.defineProperty(u,"html",{get:()=>(this.htmlOnChange=L.EditorUtils.getHtml({doc:s,schema:d}),this.htmlOnChange)}),this.props.onChange.call(void 0,u)}this.view&&(this.props.value===void 0||!t)&&this.view.updateState(this.view.state.apply(e))},this.onFocus=(e,t)=>{if(this.props.onFocus){const s={target:this,nativeEvent:t};this.props.onFocus.call(void 0,s)}return!1},this.onBlur=(e,t)=>{if(this.props.onBlur){const s={target:this,nativeEvent:t};this.props.onBlur.call(void 0,s)}return!1},this.onPaste=(e,t)=>(this.props.onPasteHtml&&(this.pasteEvent=t),!1),this.onIFrameInit=e=>{if(this.props.onIFrameInit){const t={target:this,iframe:e};this.props.onIFrameInit.call(void 0,t)}return!1},this.showLicenseWatermark=!C.validatePackage(B.packageMetadata,{component:"Editor"}),this.licenseMessage=C.getLicenseMessage(B.packageMetadata)}get value(){return this.trOnChange!==null?this.trOnChange.doc:this.props.value!==void 0?this.props.value:this.view?this.view.state.doc:this.props.defaultContent||""}get element(){return this._element}get contentElement(){return this._contentElement}get view(){return this._view}componentDidMount(){this.initialize()}componentDidUpdate(c){const{value:e}=this.props,t=this.view;e===void 0||!t||(A.updateEditorValue(t,e,c.value,this.trOnChange,this.htmlOnChange),this.trOnChange=null,this.htmlOnChange=null)}componentWillUnmount(){var e;this.view&&this.view.destroy(),this._view=void 0;const c=(e=this.iframe)==null?void 0:e.contentWindow;if(c){this._contentElement&&this._contentElement.parentNode&&this._contentElement.parentNode.removeChild(this._contentElement);const t=c.document.head;for(;t&&t.firstChild;)t.removeChild(t.firstChild)}}render(){const{tools:c=[],defaultEditMode:e="iframe",preserveWhitespace:t="full",style:s,className:d}=this.props,u=O.provideLocalizationService(this),f=this.props.ariaLabel||u.toLanguageString(h.keys.contentAreaLabel,h.messages[h.keys.contentAreaLabel]);if(this.view){const r=D.editorPropsKey.getState(this.view.state);r.preserveWhitespace=t}let m=this.props.contentStyle;m===void 0&&(s||{}).height===void 0&&(m={height:"300px"});const v=(r,n)=>r.displayName||r.name||`tool-${n}`,k=(r,n)=>r.map((a,l)=>v(a,l)).join("-")||`group-${n}`,E=c.map((r,n)=>Array.isArray(r)?p.createElement(w.ButtonGroup,{key:k(r,n),className:"k-toolbar-button-group"},r.map((a,l)=>this.renderTool(a,v(a,l)))):this.renderTool(r,v(r,n),!0));return p.createElement("div",{ref:r=>{this._element=r},className:C.classNames("k-editor",d,{"k-editor-resizable":this.props.resizable}),dir:this.props.dir,style:s},E.length>0&&p.createElement(w.Toolbar,{className:"k-editor-toolbar",ariaLabel:u.toLanguageString(h.keys.toolbarAriaLabel,h.messages[h.keys.toolbarAriaLabel]),keyboardNavigation:this.props.keyboardNavigation},E),e==="iframe"?p.createElement("iframe",{ref:r=>{this.iframe=r},frameBorder:"0",title:u.toLanguageString(h.keys.iframeTitle,h.messages[h.keys.iframeTitle]),style:m,className:"k-iframe"}):p.createElement("div",{ref:r=>{this._contentElement=r},style:m,className:"k-editor-content",role:"textbox","aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-label":f,suppressContentEditableWarning:!0}),this.renderDialog(x.EditorDialogs.InsertLinkDialog,M,"linkDialog"),this.showLicenseWatermark&&p.createElement(C.WatermarkOverlay,{message:this.licenseMessage}))}initialize(){const c=this.iframe&&this.iframe.contentWindow;if(c){const n=c.document,a=n.createElement("meta");a.setAttribute("charset","utf-8"),n.head.appendChild(a),this._contentElement=n.createElement("div"),n.body.appendChild(this._contentElement),this._contentElement.classList.add("k-content"),this._contentElement.setAttribute("role","textbox"),this.props.ariaLabelledBy&&this._contentElement.setAttribute("aria-labelledby",this.props.ariaLabelledBy),this.props.ariaDescribedBy&&this._contentElement.setAttribute("aria-describedby",this.props.ariaDescribedBy),this._contentElement.setAttribute("aria-label",this.props.ariaLabel||O.provideLocalizationService(this).toLanguageString(h.keys.contentAreaLabel,h.messages[h.keys.contentAreaLabel])),this.iframe&&this.props.onIFrameInit?this.onIFrameInit(this.iframe):[S.defaultStyle,S.tablesStyles,this.props.dir==="rtl"?S.rtlStyles:void 0].forEach(l=>{if(l){const b=n.createElement("style");b.appendChild(n.createTextNode(l)),n.head.appendChild(b)}})}const e=this._contentElement;if(!e)return;const{preserveWhitespace:t="full"}=this.props,s=[new o.Plugin({view:(()=>({update:this.updateTools})),key:new o.PluginKey("toolbar-tools-update-plugin")}),new o.Plugin({filterTransaction:this.filterTransaction,key:new o.PluginKey("onExecute-event-plugin")}),new o.Plugin({key:D.editorPropsKey,state:{init:()=>({preserveWhitespace:t}),apply:(n,a)=>a}}),o.spacesFix(),o.caretColor(),o.history(),o.dropCursor(),o.gapCursor(),o.tableEditing(),o.cspFix()],d={...L.EditorUtils.getShortcuts({types:{listItem:"list_item",hardBreak:"hard_break"},toolsSettings:{bold:F,italic:W,underline:j}}),"Mod-k":()=>{const{linkDialog:n}=this.state,a=this.view;if(a){const l=a.state,b=l.selection.empty,y=o.getMark(l,l.schema.marks[M.mark]);!n&&!(b&&!y)&&this.setState({linkDialog:!0})}return!n},"Alt-F10":()=>{var a;const n=(a=this.element)==null?void 0:a.querySelector(".k-toolbar");if(n){const l=n.querySelector(w.toolbarButtons.join(","));if(l)return l.focus(),!0}return!1}},{defaultContent:u="",value:f,onMount:m}=this.props,v=f&&typeof f!="string"?f:L.EditorUtils.createDocument(new o.Schema({nodes:o.nodes,marks:o.marks}),f||u,{preserveWhitespace:t}),k={state:o.EditorState.create({plugins:[...s,o.keymap(d),o.keymap(o.baseKeymap)],doc:v}),transformPastedHTML:this.onPasteHtml,dispatchTransaction:this.dispatchTransaction,handleDOMEvents:{focus:this.onFocus,blur:this.onBlur,paste:this.onPaste},handleDrop:(n,a,l,b)=>{let y=!1;return l.content.nodesBetween(0,l.content.size,T=>{y=y||T.type.name==="table_caption_external"}),y}},E={plugins:s,shortcuts:d,target:this,viewProps:k,dom:e},r=this._view=m&&m.call(void 0,E)||new o.EditorView({mount:e},k);this.setState({view:r})}};P.propTypes={defaultContent:i.string,value:i.oneOfType([i.object,i.string]),defaultEditMode:i.oneOf(["iframe","div"]),contentStyle:i.object,dir:i.string,className:i.string,ariaDescribedBy:i.string,ariaLabelledBy:i.string,ariaLabel:i.string,style:i.object,tools:i.arrayOf(i.any),keyboardNavigation:i.bool,resizable:i.bool,preserveWhitespace:i.oneOf([!0,!1,"full"]),onMount:i.func,onFocus:i.func,onBlur:i.func,onChange:i.func,onPasteHtml:i.func,onExecute:i.func,onIFrameInit:i.func};let _=P;O.registerForLocalization(_);exports.Editor=_;
package/Editor.mjs CHANGED
@@ -5,28 +5,28 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as l from "react";
8
+ import * as c from "react";
9
9
  import i from "prop-types";
10
- import { ToolbarSeparator as D, ButtonGroup as B, Toolbar as F, toolbarButtons as I } from "@progress/kendo-react-buttons";
11
- import { validatePackage as L, getLicenseMessage as M, classNames as W, WatermarkOverlay as x } from "@progress/kendo-react-common";
12
- import { Plugin as w, PluginKey as _, spacesFix as H, caretColor as z, history as j, dropCursor as K, gapCursor as A, tableEditing as V, cspFix as U, Schema as q, marks as G, nodes as $, EditorState as R, keymap as S, baseKeymap as J, EditorView as Q, getMark as X } from "@progress/kendo-editor-common";
13
- import { defaultStyle as Y, tablesStyles as Z, rtlStyles as tt } from "./config/defaultStyles.mjs";
14
- import { EditorToolsSettings as et } from "./config/toolsSettings.mjs";
15
- import { EditorDialogs as it } from "./dialogs/index.mjs";
16
- import { EditorUtils as b } from "./utils/index.mjs";
17
- import { editorPropsKey as T } from "./utils/props-key.mjs";
18
- import { updateEditorValue as st } from "./utils/controlled-value.mjs";
19
- import { packageMetadata as O } from "./package-metadata.mjs";
20
- import { keys as N, messages as ot } from "./messages/index.mjs";
21
- import { provideLocalizationService as nt, registerForLocalization as rt } from "@progress/kendo-react-intl";
22
- const { link: P, bold: at, italic: lt, underline: ht } = et, k = class k extends l.Component {
23
- constructor(h) {
24
- super(h), this.state = {
10
+ import { ToolbarSeparator as A, ButtonGroup as N, Toolbar as x, toolbarButtons as F } from "@progress/kendo-react-buttons";
11
+ import { validatePackage as I, getLicenseMessage as M, classNames as W, WatermarkOverlay as H } from "@progress/kendo-react-common";
12
+ import { Plugin as E, PluginKey as S, spacesFix as z, caretColor as j, history as K, dropCursor as V, gapCursor as U, tableEditing as q, cspFix as G, Schema as $, marks as R, nodes as J, EditorState as Q, keymap as T, baseKeymap as X, EditorView as Y, getMark as Z } from "@progress/kendo-editor-common";
13
+ import { defaultStyle as tt, tablesStyles as et, rtlStyles as it } from "./config/defaultStyles.mjs";
14
+ import { EditorToolsSettings as st } from "./config/toolsSettings.mjs";
15
+ import { EditorDialogs as nt } from "./dialogs/index.mjs";
16
+ import { EditorUtils as k } from "./utils/index.mjs";
17
+ import { editorPropsKey as B } from "./utils/props-key.mjs";
18
+ import { updateEditorValue as ot } from "./utils/controlled-value.mjs";
19
+ import { packageMetadata as D } from "./package-metadata.mjs";
20
+ import { keys as d, messages as w } from "./messages/index.mjs";
21
+ import { provideLocalizationService as O, registerForLocalization as rt } from "@progress/kendo-react-intl";
22
+ const { link: P, bold: at, italic: lt, underline: ht } = st, _ = class _ extends c.Component {
23
+ constructor(l) {
24
+ super(l), this.state = {
25
25
  view: void 0,
26
26
  linkDialog: !1
27
27
  }, this._element = null, this._contentElement = null, this.iframe = null, this.trOnChange = null, this.htmlOnChange = null, this.showLicenseWatermark = !1, this.focus = () => {
28
28
  this.view && this.view.focus();
29
- }, this.renderDialog = (t, e, s) => this.state[s] && /* @__PURE__ */ l.createElement(
29
+ }, this.renderDialog = (t, e, s) => this.state[s] && /* @__PURE__ */ c.createElement(
30
30
  t,
31
31
  {
32
32
  view: this.view,
@@ -35,7 +35,7 @@ const { link: P, bold: at, italic: lt, underline: ht } = et, k = class k extends
35
35
  onClose: () => this.setState({ [s]: !1 })
36
36
  }
37
37
  ), this.renderTool = (t, e, s = !1) => {
38
- const c = /* @__PURE__ */ l.createElement(
38
+ const h = /* @__PURE__ */ c.createElement(
39
39
  t,
40
40
  {
41
41
  view: this.view,
@@ -44,7 +44,7 @@ const { link: P, bold: at, italic: lt, underline: ht } = et, k = class k extends
44
44
  className: s ? "k-toolbar-button" : void 0
45
45
  }
46
46
  );
47
- return c.type === D ? /* @__PURE__ */ l.createElement(t, { key: e }) : c;
47
+ return h.type === A ? /* @__PURE__ */ c.createElement(t, { key: e }) : h;
48
48
  }, this.updateTools = (t, e) => {
49
49
  this.setState({ view: t });
50
50
  }, this.filterTransaction = (t, e) => {
@@ -65,16 +65,16 @@ const { link: P, bold: at, italic: lt, underline: ht } = et, k = class k extends
65
65
  const e = t.docChanged;
66
66
  if (this.props.onChange && e) {
67
67
  this.trOnChange = t;
68
- const s = t.doc, c = t.doc.type.schema, m = {
68
+ const s = t.doc, h = t.doc.type.schema, p = {
69
69
  target: this,
70
70
  value: s,
71
71
  html: "",
72
72
  transaction: t,
73
- schema: c
73
+ schema: h
74
74
  };
75
- Object.defineProperty(m, "html", {
76
- get: () => (this.htmlOnChange = b.getHtml({ doc: s, schema: c }), this.htmlOnChange)
77
- }), this.props.onChange.call(void 0, m);
75
+ Object.defineProperty(p, "html", {
76
+ get: () => (this.htmlOnChange = k.getHtml({ doc: s, schema: h }), this.htmlOnChange)
77
+ }), this.props.onChange.call(void 0, p);
78
78
  }
79
79
  this.view && (this.props.value === void 0 || !e) && this.view.updateState(this.view.state.apply(t));
80
80
  }, this.onFocus = (t, e) => {
@@ -104,7 +104,7 @@ const { link: P, bold: at, italic: lt, underline: ht } = et, k = class k extends
104
104
  this.props.onIFrameInit.call(void 0, e);
105
105
  }
106
106
  return !1;
107
- }, this.showLicenseWatermark = !L(O, { component: "Editor" }), this.licenseMessage = M(O);
107
+ }, this.showLicenseWatermark = !I(D, { component: "Editor" }), this.licenseMessage = M(D);
108
108
  }
109
109
  /**
110
110
  * The value of the Editor.
@@ -139,9 +139,9 @@ const { link: P, bold: at, italic: lt, underline: ht } = et, k = class k extends
139
139
  /**
140
140
  * @hidden
141
141
  */
142
- componentDidUpdate(h) {
142
+ componentDidUpdate(l) {
143
143
  const { value: t } = this.props, e = this.view;
144
- t === void 0 || !e || (st(e, t, h.value, this.trOnChange, this.htmlOnChange), this.trOnChange = null, this.htmlOnChange = null);
144
+ t === void 0 || !e || (ot(e, t, l.value, this.trOnChange, this.htmlOnChange), this.trOnChange = null, this.htmlOnChange = null);
145
145
  }
146
146
  /**
147
147
  * @hidden
@@ -149,10 +149,10 @@ const { link: P, bold: at, italic: lt, underline: ht } = et, k = class k extends
149
149
  componentWillUnmount() {
150
150
  var t;
151
151
  this.view && this.view.destroy(), this._view = void 0;
152
- const h = (t = this.iframe) == null ? void 0 : t.contentWindow;
153
- if (h) {
152
+ const l = (t = this.iframe) == null ? void 0 : t.contentWindow;
153
+ if (l) {
154
154
  this._contentElement && this._contentElement.parentNode && this._contentElement.parentNode.removeChild(this._contentElement);
155
- const e = h.document.head;
155
+ const e = l.document.head;
156
156
  for (; e && e.firstChild; )
157
157
  e.removeChild(e.firstChild);
158
158
  }
@@ -161,60 +161,76 @@ const { link: P, bold: at, italic: lt, underline: ht } = et, k = class k extends
161
161
  * @hidden
162
162
  */
163
163
  render() {
164
- const { tools: h = [], defaultEditMode: t = "iframe", preserveWhitespace: e = "full", style: s, className: c } = this.props, m = nt(this);
164
+ const { tools: l = [], defaultEditMode: t = "iframe", preserveWhitespace: e = "full", style: s, className: h } = this.props, p = O(this), u = this.props.ariaLabel || p.toLanguageString(d.contentAreaLabel, w[d.contentAreaLabel]);
165
165
  if (this.view) {
166
- const o = T.getState(this.view.state);
166
+ const o = B.getState(this.view.state);
167
167
  o.preserveWhitespace = e;
168
168
  }
169
- let p = this.props.contentStyle;
170
- p === void 0 && (s || {}).height === void 0 && (p = { height: "300px" });
171
- const u = (o, d) => o.displayName || o.name || `tool-${d}`, y = (o, d) => o.map((n, r) => u(n, r)).join("-") || `group-${d}`, f = h.map(
172
- (o, d) => Array.isArray(o) ? /* @__PURE__ */ l.createElement(B, { key: y(o, d), className: "k-toolbar-button-group" }, o.map((n, r) => this.renderTool(n, u(n, r)))) : this.renderTool(o, u(o, d), !0)
169
+ let m = this.props.contentStyle;
170
+ m === void 0 && (s || {}).height === void 0 && (m = { height: "300px" });
171
+ const f = (o, n) => o.displayName || o.name || `tool-${n}`, b = (o, n) => o.map((r, a) => f(r, a)).join("-") || `group-${n}`, y = l.map(
172
+ (o, n) => Array.isArray(o) ? /* @__PURE__ */ c.createElement(N, { key: b(o, n), className: "k-toolbar-button-group" }, o.map((r, a) => this.renderTool(r, f(r, a)))) : this.renderTool(o, f(o, n), !0)
173
173
  );
174
- return /* @__PURE__ */ l.createElement(
174
+ return /* @__PURE__ */ c.createElement(
175
175
  "div",
176
176
  {
177
177
  ref: (o) => {
178
178
  this._element = o;
179
179
  },
180
- className: W("k-editor", c, { "k-editor-resizable": this.props.resizable }),
180
+ className: W("k-editor", h, { "k-editor-resizable": this.props.resizable }),
181
181
  dir: this.props.dir,
182
182
  style: s
183
183
  },
184
- f.length > 0 && /* @__PURE__ */ l.createElement(F, { className: "k-editor-toolbar", keyboardNavigation: this.props.keyboardNavigation }, f),
185
- t === "iframe" ? /* @__PURE__ */ l.createElement("div", { className: "k-editor-content" }, /* @__PURE__ */ l.createElement(
184
+ y.length > 0 && /* @__PURE__ */ c.createElement(
185
+ x,
186
+ {
187
+ className: "k-editor-toolbar",
188
+ ariaLabel: p.toLanguageString(d.toolbarAriaLabel, w[d.toolbarAriaLabel]),
189
+ keyboardNavigation: this.props.keyboardNavigation
190
+ },
191
+ y
192
+ ),
193
+ t === "iframe" ? /* @__PURE__ */ c.createElement(
186
194
  "iframe",
187
195
  {
188
196
  ref: (o) => {
189
197
  this.iframe = o;
190
198
  },
191
199
  frameBorder: "0",
192
- title: m.toLanguageString(N.iframeTitle, ot[N.iframeTitle]),
193
- style: p,
200
+ title: p.toLanguageString(d.iframeTitle, w[d.iframeTitle]),
201
+ style: m,
194
202
  className: "k-iframe"
195
203
  }
196
- )) : /* @__PURE__ */ l.createElement("div", { style: p, className: "k-editor-content" }, /* @__PURE__ */ l.createElement(
204
+ ) : /* @__PURE__ */ c.createElement(
197
205
  "div",
198
206
  {
199
207
  ref: (o) => {
200
208
  this._contentElement = o;
201
209
  },
202
- suppressContentEditableWarning: !0,
210
+ style: m,
211
+ className: "k-editor-content",
203
212
  role: "textbox",
204
213
  "aria-labelledby": this.props.ariaLabelledBy,
205
214
  "aria-describedby": this.props.ariaDescribedBy,
206
- "aria-label": this.props.ariaLabel
215
+ "aria-label": u,
216
+ suppressContentEditableWarning: !0
207
217
  }
208
- )),
209
- this.renderDialog(it.InsertLinkDialog, P, "linkDialog"),
210
- this.showLicenseWatermark && /* @__PURE__ */ l.createElement(x, { message: this.licenseMessage })
218
+ ),
219
+ this.renderDialog(nt.InsertLinkDialog, P, "linkDialog"),
220
+ this.showLicenseWatermark && /* @__PURE__ */ c.createElement(H, { message: this.licenseMessage })
211
221
  );
212
222
  }
213
223
  initialize() {
214
- const h = this.iframe && this.iframe.contentWindow;
215
- if (h) {
216
- const n = h.document, r = n.createElement("meta");
217
- r.setAttribute("charset", "utf-8"), n.head.appendChild(r), this._contentElement = n.createElement("div"), n.body.appendChild(this._contentElement), this._contentElement.classList.add("k-content"), this.iframe && this.props.onIFrameInit ? this.onIFrameInit(this.iframe) : [Y, Z, this.props.dir === "rtl" ? tt : void 0].forEach((a) => {
224
+ const l = this.iframe && this.iframe.contentWindow;
225
+ if (l) {
226
+ const n = l.document, r = n.createElement("meta");
227
+ r.setAttribute("charset", "utf-8"), n.head.appendChild(r), this._contentElement = n.createElement("div"), n.body.appendChild(this._contentElement), this._contentElement.classList.add("k-content"), this._contentElement.setAttribute("role", "textbox"), this.props.ariaLabelledBy && this._contentElement.setAttribute("aria-labelledby", this.props.ariaLabelledBy), this.props.ariaDescribedBy && this._contentElement.setAttribute("aria-describedby", this.props.ariaDescribedBy), this._contentElement.setAttribute(
228
+ "aria-label",
229
+ this.props.ariaLabel || O(this).toLanguageString(
230
+ d.contentAreaLabel,
231
+ w[d.contentAreaLabel]
232
+ )
233
+ ), this.iframe && this.props.onIFrameInit ? this.onIFrameInit(this.iframe) : [tt, et, this.props.dir === "rtl" ? it : void 0].forEach((a) => {
218
234
  if (a) {
219
235
  const v = n.createElement("style");
220
236
  v.appendChild(n.createTextNode(a)), n.head.appendChild(v);
@@ -226,37 +242,37 @@ const { link: P, bold: at, italic: lt, underline: ht } = et, k = class k extends
226
242
  return;
227
243
  const { preserveWhitespace: e = "full" } = this.props, s = [
228
244
  // https://prosemirror.net/docs/ref/#state.PluginSpec
229
- new w({
245
+ new E({
230
246
  view: (() => ({ update: this.updateTools })),
231
- key: new _("toolbar-tools-update-plugin")
247
+ key: new S("toolbar-tools-update-plugin")
232
248
  }),
233
- new w({
249
+ new E({
234
250
  filterTransaction: this.filterTransaction,
235
- key: new _("onExecute-event-plugin")
251
+ key: new S("onExecute-event-plugin")
236
252
  }),
237
- new w({
238
- key: T,
253
+ new E({
254
+ key: B,
239
255
  state: {
240
256
  init: () => ({ preserveWhitespace: e }),
241
257
  apply: (n, r) => r
242
258
  }
243
259
  }),
244
- H(),
245
260
  z(),
246
261
  j(),
247
262
  K(),
248
- A(),
249
263
  V(),
250
- U()
251
- ], c = {
252
- ...b.getShortcuts({
264
+ U(),
265
+ q(),
266
+ G()
267
+ ], h = {
268
+ ...k.getShortcuts({
253
269
  types: { listItem: "list_item", hardBreak: "hard_break" },
254
270
  toolsSettings: { bold: at, italic: lt, underline: ht }
255
271
  }),
256
272
  "Mod-k": () => {
257
273
  const { linkDialog: n } = this.state, r = this.view;
258
274
  if (r) {
259
- const a = r.state, v = a.selection.empty, g = X(a, a.schema.marks[P.mark]);
275
+ const a = r.state, v = a.selection.empty, g = Z(a, a.schema.marks[P.mark]);
260
276
  !n && !(v && !g) && this.setState({ linkDialog: !0 });
261
277
  }
262
278
  return !n;
@@ -265,18 +281,18 @@ const { link: P, bold: at, italic: lt, underline: ht } = et, k = class k extends
265
281
  var r;
266
282
  const n = (r = this.element) == null ? void 0 : r.querySelector(".k-toolbar");
267
283
  if (n) {
268
- const a = n.querySelector(I.join(","));
284
+ const a = n.querySelector(F.join(","));
269
285
  if (a)
270
286
  return a.focus(), !0;
271
287
  }
272
288
  return !1;
273
289
  }
274
- }, { defaultContent: m = "", value: p, onMount: u } = this.props, y = p && typeof p != "string" ? p : b.createDocument(new q({ nodes: $, marks: G }), p || m, {
290
+ }, { defaultContent: p = "", value: u, onMount: m } = this.props, f = u && typeof u != "string" ? u : k.createDocument(new $({ nodes: J, marks: R }), u || p, {
275
291
  preserveWhitespace: e
276
- }), f = {
277
- state: R.create({
278
- plugins: [...s, S(c), S(J)],
279
- doc: y
292
+ }), b = {
293
+ state: Q.create({
294
+ plugins: [...s, T(h), T(X)],
295
+ doc: f
280
296
  }),
281
297
  transformPastedHTML: this.onPasteHtml,
282
298
  dispatchTransaction: this.dispatchTransaction,
@@ -287,17 +303,17 @@ const { link: P, bold: at, italic: lt, underline: ht } = et, k = class k extends
287
303
  },
288
304
  handleDrop: (n, r, a, v) => {
289
305
  let g = !1;
290
- return a.content.nodesBetween(0, a.content.size, (C) => {
291
- g = g || C.type.name === "table_caption_external";
306
+ return a.content.nodesBetween(0, a.content.size, (L) => {
307
+ g = g || L.type.name === "table_caption_external";
292
308
  }), g;
293
309
  }
294
- }, o = { plugins: s, shortcuts: c, target: this, viewProps: f, dom: t }, d = this._view = u && u.call(void 0, o) || new Q({ mount: t }, f);
310
+ }, y = { plugins: s, shortcuts: h, target: this, viewProps: b, dom: t }, o = this._view = m && m.call(void 0, y) || new Y({ mount: t }, b);
295
311
  this.setState({
296
- view: d
312
+ view: o
297
313
  });
298
314
  }
299
315
  };
300
- k.propTypes = {
316
+ _.propTypes = {
301
317
  defaultContent: i.string,
302
318
  value: i.oneOfType([i.object, i.string]),
303
319
  defaultEditMode: i.oneOf(["iframe", "div"]),
@@ -320,8 +336,8 @@ k.propTypes = {
320
336
  onExecute: i.func,
321
337
  onIFrameInit: i.func
322
338
  };
323
- let E = k;
324
- rt(E);
339
+ let C = _;
340
+ rt(C);
325
341
  export {
326
- E as Editor
342
+ C as Editor
327
343
  };
@@ -0,0 +1,17 @@
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 { Editor as EditorClassComponent } from './Editor.js';
9
+ import { EditorProps } from './EditorProps';
10
+ /**
11
+ * Editor wrapper that integrates the Web MCP hook.
12
+ *
13
+ * @hidden
14
+ */
15
+ import * as React from 'react';
16
+ /** @hidden */
17
+ export declare const EditorWrapper: React.ForwardRefExoticComponent<EditorProps & React.RefAttributes<EditorClassComponent>>;
@@ -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 i=require("react"),d=require("./Editor.js"),n=require("@progress/kendo-react-common");function u(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const c=u(i),a=c.forwardRef((e,r)=>{const[t,o]=n.useMergedRef(r);return n.useWebMcpRegister("editor",t,e,e.webMcp),c.createElement(d.Editor,{...e,ref:o})});a.displayName="KendoReactEditor";exports.EditorWrapper=a;
@@ -0,0 +1,18 @@
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 * as r from "react";
9
+ import { Editor as d } from "./Editor.mjs";
10
+ import { useMergedRef as f, useWebMcpRegister as m } from "@progress/kendo-react-common";
11
+ const a = r.forwardRef((e, t) => {
12
+ const [o, i] = f(t);
13
+ return m("editor", o, e, e.webMcp), /* @__PURE__ */ r.createElement(d, { ...e, ref: i });
14
+ });
15
+ a.displayName = "KendoReactEditor";
16
+ export {
17
+ a as EditorWrapper
18
+ };
package/EditorProps.d.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  import { EditorState, Plugin, Transaction, EditorView, Schema, Node } from '@progress/kendo-editor-common';
9
9
  import { EditorUtils } from './utils/index.js';
10
10
  import { Editor } from './Editor.js';
11
+ import { WebMcpProps } from '@progress/kendo-react-common';
11
12
  interface EditorEvent {
12
13
  /**
13
14
  * An event target.
@@ -411,5 +412,21 @@ export interface EditorProps {
411
412
  * ```
412
413
  */
413
414
  preserveWhitespace?: boolean | 'full';
415
+ /**
416
+ * Enables browser-native AI agent tools via Web MCP (Chrome 146+).
417
+ *
418
+ * Pass `true` for defaults or an object for fine-grained control.
419
+ * AI agents are multilingual — `dataName` accepts any language.
420
+ *
421
+ * @example
422
+ * ```tsx
423
+ * // Boolean: generic "editor" label
424
+ * <Editor webMcp tools={[[EditorTools.Bold, EditorTools.Italic]]} />
425
+ *
426
+ * // Config object: explicit name
427
+ * <Editor webMcp={{ dataName: 'article' }} tools={[[EditorTools.Bold, EditorTools.Italic]]} />
428
+ * ```
429
+ */
430
+ webMcp?: boolean | WebMcpProps;
414
431
  }
415
432
  export {};