@progress/kendo-react-editor 8.3.0-develop.9 → 8.4.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.
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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react"),i=require("prop-types"),b=require("@progress/kendo-react-buttons"),k=require("@progress/kendo-react-common"),n=require("@progress/kendo-editor-common"),S=require("./config/defaultStyles.js"),L=require("./config/toolsSettings.js"),W=require("./dialogs/index.js"),_=require("./utils/index.js"),D=require("./utils/props-key.js"),z=require("./utils/controlled-value.js"),q=require("./utils/browser-detection.js"),N=require("./package-metadata.js"),O=require("./messages/index.js"),B=require("@progress/kendo-react-intl");function j(m){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const e in m)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(m,e);Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:()=>m[e]})}}return o.default=m,Object.freeze(o)}const c=j(M),{link:x,bold:H,italic:F,underline:K}=L.EditorToolsSettings,P=class P extends c.Component{constructor(o){super(o),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]&&c.createElement(e,{view:this.view,settings:t,dir:this.props.dir,onClose:()=>this.setState({[s]:!1})}),this.renderTool=(e,t,s=!1)=>{const d=c.createElement(e,{view:this.view,dir:this.props.dir,key:t,className:s?"k-toolbar-button":void 0});return d.type===b.ToolbarSeparator?c.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,p={target:this,value:s,html:"",transaction:e,schema:d};Object.defineProperty(p,"html",{get:()=>(this.htmlOnChange=_.EditorUtils.getHtml({doc:s,schema:d}),this.htmlOnChange)}),this.props.onChange.call(void 0,p)}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),k.validatePackage(N.packageMetadata),this.showLicenseWatermark=k.shouldShowValidationUI(N.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.iframe||!q.firefox)&&this.initialize()}componentDidUpdate(o){const{value:e}=this.props,t=this.view;e===void 0||!t||(z.updateEditorValue(t,e,o.value,this.trOnChange,this.htmlOnChange),this.trOnChange=null,this.htmlOnChange=null)}componentWillUnmount(){this.view&&this.view.destroy(),this._view=void 0;const o=this.iframe&&this.iframe.contentWindow;if(o){this._contentElement&&this._contentElement.parentNode&&this._contentElement.parentNode.removeChild(this._contentElement);const e=o.document.head;for(;e&&e.firstChild;)e.removeChild(e.firstChild)}}render(){const{tools:o=[],defaultEditMode:e="iframe",preserveWhitespace:t="full",style:s,className:d}=this.props,p=B.provideLocalizationService(this);if(this.view){const a=D.editorPropsKey.getState(this.view.state);a.preserveWhitespace=t}let u=this.props.contentStyle;u===void 0&&(s||{}).height===void 0&&(u={height:"300px"});const f=o.map((a,v)=>Array.isArray(a)?c.createElement(b.ButtonGroup,{key:v,className:"k-toolbar-button-group k-button-group-solid"},a.map((E,C)=>this.renderTool(E,C))):this.renderTool(a,v,!0));return c.createElement("div",{ref:a=>this._element=a,className:k.classNames("k-editor",d,{"k-editor-resizable":this.props.resizable}),dir:this.props.dir,style:s},f.length>0&&c.createElement(b.Toolbar,{className:"k-editor-toolbar",keyboardNavigation:this.props.keyboardNavigation},f),e==="iframe"?c.createElement("div",{className:"k-editor-content"},c.createElement("iframe",{onLoad:q.firefox?()=>{this.initialize()}:void 0,ref:a=>this.iframe=a,frameBorder:"0",title:p.toLanguageString(O.keys.iframeTitle,O.messages[O.keys.iframeTitle]),style:u,className:"k-iframe"})):c.createElement("div",{style:u,className:"k-editor-content"},c.createElement("div",{ref:a=>this._contentElement=a,suppressContentEditableWarning:!0,role:"textbox","aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-label":this.props.ariaLabel})),this.renderDialog(W.EditorDialogs.InsertLinkDialog,x,"linkDialog"),this.showLicenseWatermark&&c.createElement(k.WatermarkOverlay,null))}initialize(){const o=this.iframe&&this.iframe.contentWindow;if(o){const r=o.document;[S.defaultStyle,S.tablesStyles,this.props.dir==="rtl"?S.rtlStyles:void 0].forEach(l=>{if(l){const g=r.createElement("style");g.appendChild(r.createTextNode(l)),r.head.appendChild(g)}});const h=r.createElement("meta");h.setAttribute("charset","utf-8"),r.head.appendChild(h),this._contentElement=r.createElement("div"),r.body.appendChild(this._contentElement),this._contentElement.classList.add("k-content")}const e=this._contentElement;if(!e)return;const{preserveWhitespace:t="full"}=this.props;let 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,h)=>h}}),n.spacesFix(),n.caretColor(),n.history(),n.dropCursor(),n.gapCursor(),n.tableEditing(),n.cspFix()],d={..._.EditorUtils.getShortcuts({types:{listItem:"list_item",hardBreak:"hard_break"},toolsSettings:{bold:H,italic:F,underline:K}}),"Mod-k":()=>{const{linkDialog:r}=this.state,h=this.view;if(h){const l=h.state,g=l.selection.empty,y=n.getMark(l,l.schema.marks[x.mark]);!r&&!(g&&!y)&&this.setState({linkDialog:!0})}return!r},"Alt-F10":()=>{var h;const r=(h=this.element)==null?void 0:h.querySelector(".k-toolbar");if(r){const l=r.querySelector(b.toolbarButtons.join(","));if(l)return l.focus(),!0}return!1}};const{defaultContent:p="",value:u,onMount:f}=this.props,a=u&&typeof u!="string"?u:_.EditorUtils.createDocument(new n.Schema({nodes:n.nodes,marks:n.marks}),u||p,{preserveWhitespace:t}),v={state:n.EditorState.create({plugins:[...s,n.keymap(d),n.keymap(n.baseKeymap)],doc:a}),transformPastedHTML:this.onPasteHtml,dispatchTransaction:this.dispatchTransaction,handleDOMEvents:{focus:this.onFocus,blur:this.onBlur,paste:this.onPaste},handleDrop:(r,h,l,g)=>{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:v,dom:e},C=this._view=f&&f.call(void 0,E)||new n.EditorView({mount:e},v);this.setState({view:C})}};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};let w=P;B.registerForLocalization(w);exports.Editor=w;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react"),i=require("prop-types"),b=require("@progress/kendo-react-buttons"),k=require("@progress/kendo-react-common"),n=require("@progress/kendo-editor-common"),S=require("./config/defaultStyles.js"),M=require("./config/toolsSettings.js"),F=require("./dialogs/index.js"),_=require("./utils/index.js"),D=require("./utils/props-key.js"),L=require("./utils/controlled-value.js"),q=require("./utils/browser-detection.js"),N=require("./package-metadata.js"),O=require("./messages/index.js"),x=require("@progress/kendo-react-intl");function W(m){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const e in m)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(m,e);Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:()=>m[e]})}}return o.default=m,Object.freeze(o)}const c=W(B),{link:I,bold:z,italic:j,underline:H}=M.EditorToolsSettings,P=class P extends c.Component{constructor(o){super(o),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]&&c.createElement(e,{view:this.view,settings:t,dir:this.props.dir,onClose:()=>this.setState({[s]:!1})}),this.renderTool=(e,t,s=!1)=>{const d=c.createElement(e,{view:this.view,dir:this.props.dir,key:t,className:s?"k-toolbar-button":void 0});return d.type===b.ToolbarSeparator?c.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,p={target:this,value:s,html:"",transaction:e,schema:d};Object.defineProperty(p,"html",{get:()=>(this.htmlOnChange=_.EditorUtils.getHtml({doc:s,schema:d}),this.htmlOnChange)}),this.props.onChange.call(void 0,p)}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},k.validatePackage(N.packageMetadata),this.showLicenseWatermark=k.shouldShowValidationUI(N.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.iframe||!q.firefox)&&this.initialize()}componentDidUpdate(o){const{value:e}=this.props,t=this.view;e===void 0||!t||(L.updateEditorValue(t,e,o.value,this.trOnChange,this.htmlOnChange),this.trOnChange=null,this.htmlOnChange=null)}componentWillUnmount(){var e;this.view&&this.view.destroy(),this._view=void 0;const o=(e=this.iframe)==null?void 0:e.contentWindow;if(o){this._contentElement&&this._contentElement.parentNode&&this._contentElement.parentNode.removeChild(this._contentElement);const t=o.document.head;for(;t&&t.firstChild;)t.removeChild(t.firstChild)}}render(){const{tools:o=[],defaultEditMode:e="iframe",preserveWhitespace:t="full",style:s,className:d}=this.props,p=x.provideLocalizationService(this);if(this.view){const a=D.editorPropsKey.getState(this.view.state);a.preserveWhitespace=t}let u=this.props.contentStyle;u===void 0&&(s||{}).height===void 0&&(u={height:"300px"});const f=o.map((a,v)=>Array.isArray(a)?c.createElement(b.ButtonGroup,{key:v,className:"k-toolbar-button-group k-button-group-solid"},a.map((E,C)=>this.renderTool(E,C))):this.renderTool(a,v,!0));return c.createElement("div",{ref:a=>this._element=a,className:k.classNames("k-editor",d,{"k-editor-resizable":this.props.resizable}),dir:this.props.dir,style:s},f.length>0&&c.createElement(b.Toolbar,{className:"k-editor-toolbar",keyboardNavigation:this.props.keyboardNavigation},f),e==="iframe"?c.createElement("div",{className:"k-editor-content"},c.createElement("iframe",{onLoad:q.firefox?()=>{this.initialize()}:void 0,ref:a=>this.iframe=a,frameBorder:"0",title:p.toLanguageString(O.keys.iframeTitle,O.messages[O.keys.iframeTitle]),style:u,className:"k-iframe"})):c.createElement("div",{style:u,className:"k-editor-content"},c.createElement("div",{ref:a=>this._contentElement=a,suppressContentEditableWarning:!0,role:"textbox","aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-label":this.props.ariaLabel})),this.renderDialog(F.EditorDialogs.InsertLinkDialog,I,"linkDialog"),this.showLicenseWatermark&&c.createElement(k.WatermarkOverlay,null))}initialize(){const o=this.iframe&&this.iframe.contentWindow;if(o){const r=o.document,h=r.createElement("meta");h.setAttribute("charset","utf-8"),r.head.appendChild(h),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):[S.defaultStyle,S.tablesStyles,this.props.dir==="rtl"?S.rtlStyles:void 0].forEach(l=>{if(l){const g=r.createElement("style");g.appendChild(r.createTextNode(l)),r.head.appendChild(g)}})}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,h)=>h}}),n.spacesFix(),n.caretColor(),n.history(),n.dropCursor(),n.gapCursor(),n.tableEditing(),n.cspFix()],d={..._.EditorUtils.getShortcuts({types:{listItem:"list_item",hardBreak:"hard_break"},toolsSettings:{bold:z,italic:j,underline:H}}),"Mod-k":()=>{const{linkDialog:r}=this.state,h=this.view;if(h){const l=h.state,g=l.selection.empty,y=n.getMark(l,l.schema.marks[I.mark]);!r&&!(g&&!y)&&this.setState({linkDialog:!0})}return!r},"Alt-F10":()=>{var h;const r=(h=this.element)==null?void 0:h.querySelector(".k-toolbar");if(r){const l=r.querySelector(b.toolbarButtons.join(","));if(l)return l.focus(),!0}return!1}},{defaultContent:p="",value:u,onMount:f}=this.props,a=u&&typeof u!="string"?u:_.EditorUtils.createDocument(new n.Schema({nodes:n.nodes,marks:n.marks}),u||p,{preserveWhitespace:t}),v={state:n.EditorState.create({plugins:[...s,n.keymap(d),n.keymap(n.baseKeymap)],doc:a}),transformPastedHTML:this.onPasteHtml,dispatchTransaction:this.dispatchTransaction,handleDOMEvents:{focus:this.onFocus,blur:this.onBlur,paste:this.onPaste},handleDrop:(r,h,l,g)=>{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:v,dom:e},C=this._view=f&&f.call(void 0,E)||new n.EditorView({mount:e},v);this.setState({view:C})}};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 w=P;x.registerForLocalization(w);exports.Editor=w;
package/Editor.mjs CHANGED
@@ -8,9 +8,9 @@
8
8
  "use client";
9
9
  import * as a from "react";
10
10
  import i from "prop-types";
11
- import { ToolbarSeparator as B, ButtonGroup as L, Toolbar as W, toolbarButtons as x } from "@progress/kendo-react-buttons";
12
- import { validatePackage as M, shouldShowValidationUI as z, classNames as H, WatermarkOverlay as F } from "@progress/kendo-react-common";
13
- import { Plugin as w, PluginKey as _, spacesFix as j, caretColor as V, history as A, dropCursor as U, gapCursor as I, tableEditing as K, cspFix as q, getMark as G, Schema as R, nodes as J, marks as Q, EditorState as X, keymap as S, baseKeymap as Y, EditorView as Z } from "@progress/kendo-editor-common";
11
+ import { ToolbarSeparator as I, ButtonGroup as B, Toolbar as F, toolbarButtons as L } from "@progress/kendo-react-buttons";
12
+ import { validatePackage as W, shouldShowValidationUI as x, classNames as M, WatermarkOverlay as z } from "@progress/kendo-react-common";
13
+ import { Plugin as w, PluginKey as _, spacesFix as H, caretColor as j, history as V, dropCursor as A, gapCursor as U, tableEditing as K, cspFix as q, getMark as G, Schema as R, nodes as J, marks as Q, EditorState as X, keymap as S, baseKeymap as Y, EditorView as Z } from "@progress/kendo-editor-common";
14
14
  import { defaultStyle as $, tablesStyles as tt, rtlStyles as et } from "./config/defaultStyles.mjs";
15
15
  import { EditorToolsSettings as it } from "./config/toolsSettings.mjs";
16
16
  import { EditorDialogs as st } from "./dialogs/index.mjs";
@@ -46,7 +46,7 @@ const { link: N, bold: lt, italic: ht, underline: ct } = it, k = class k extends
46
46
  className: s ? "k-toolbar-button" : void 0
47
47
  }
48
48
  );
49
- return c.type === B ? /* @__PURE__ */ a.createElement(t, { key: e }) : c;
49
+ return c.type === I ? /* @__PURE__ */ a.createElement(t, { key: e }) : c;
50
50
  }, this.updateTools = (t, e) => {
51
51
  this.setState({ view: t });
52
52
  }, this.filterTransaction = (t, e) => {
@@ -97,7 +97,16 @@ const { link: N, bold: lt, italic: ht, underline: ct } = it, k = class k extends
97
97
  this.props.onBlur.call(void 0, s);
98
98
  }
99
99
  return !1;
100
- }, this.onPaste = (t, e) => (this.props.onPasteHtml && (this.pasteEvent = e), !1), M(P), this.showLicenseWatermark = z(P);
100
+ }, this.onPaste = (t, e) => (this.props.onPasteHtml && (this.pasteEvent = e), !1), this.onIFrameInit = (t) => {
101
+ if (this.props.onIFrameInit) {
102
+ const e = {
103
+ target: this,
104
+ iframe: t
105
+ };
106
+ this.props.onIFrameInit.call(void 0, e);
107
+ }
108
+ return !1;
109
+ }, W(P), this.showLicenseWatermark = x(P);
101
110
  }
102
111
  /**
103
112
  * The value of the Editor.
@@ -140,42 +149,39 @@ const { link: N, bold: lt, italic: ht, underline: ct } = it, k = class k extends
140
149
  * @hidden
141
150
  */
142
151
  componentWillUnmount() {
152
+ var t;
143
153
  this.view && this.view.destroy(), this._view = void 0;
144
- const l = this.iframe && this.iframe.contentWindow;
154
+ const l = (t = this.iframe) == null ? void 0 : t.contentWindow;
145
155
  if (l) {
146
156
  this._contentElement && this._contentElement.parentNode && this._contentElement.parentNode.removeChild(this._contentElement);
147
- const t = l.document.head;
148
- for (; t && t.firstChild; )
149
- t.removeChild(t.firstChild);
157
+ const e = l.document.head;
158
+ for (; e && e.firstChild; )
159
+ e.removeChild(e.firstChild);
150
160
  }
151
161
  }
152
162
  /**
153
163
  * @hidden
154
164
  */
155
165
  render() {
156
- const {
157
- tools: l = [],
158
- defaultEditMode: t = "iframe",
159
- preserveWhitespace: e = "full",
160
- style: s,
161
- className: c
162
- } = this.props, d = rt(this);
166
+ const { tools: l = [], defaultEditMode: t = "iframe", preserveWhitespace: e = "full", style: s, className: c } = this.props, d = rt(this);
163
167
  if (this.view) {
164
168
  const n = T.getState(this.view.state);
165
169
  n.preserveWhitespace = e;
166
170
  }
167
171
  let p = this.props.contentStyle;
168
172
  p === void 0 && (s || {}).height === void 0 && (p = { height: "300px" });
169
- const m = l.map((n, u) => Array.isArray(n) ? /* @__PURE__ */ a.createElement(L, { key: u, className: "k-toolbar-button-group k-button-group-solid" }, n.map((g, y) => this.renderTool(g, y))) : this.renderTool(n, u, !0));
173
+ const m = l.map(
174
+ (n, u) => Array.isArray(n) ? /* @__PURE__ */ a.createElement(B, { key: u, className: "k-toolbar-button-group k-button-group-solid" }, n.map((g, y) => this.renderTool(g, y))) : this.renderTool(n, u, !0)
175
+ );
170
176
  return /* @__PURE__ */ a.createElement(
171
177
  "div",
172
178
  {
173
179
  ref: (n) => this._element = n,
174
- className: H("k-editor", c, { "k-editor-resizable": this.props.resizable }),
180
+ className: M("k-editor", c, { "k-editor-resizable": this.props.resizable }),
175
181
  dir: this.props.dir,
176
182
  style: s
177
183
  },
178
- m.length > 0 && /* @__PURE__ */ a.createElement(W, { className: "k-editor-toolbar", keyboardNavigation: this.props.keyboardNavigation }, m),
184
+ m.length > 0 && /* @__PURE__ */ a.createElement(F, { className: "k-editor-toolbar", keyboardNavigation: this.props.keyboardNavigation }, m),
179
185
  t === "iframe" ? /* @__PURE__ */ a.createElement("div", { className: "k-editor-content" }, /* @__PURE__ */ a.createElement(
180
186
  "iframe",
181
187
  {
@@ -188,46 +194,36 @@ const { link: N, bold: lt, italic: ht, underline: ct } = it, k = class k extends
188
194
  style: p,
189
195
  className: "k-iframe"
190
196
  }
191
- )) : /* @__PURE__ */ a.createElement(
197
+ )) : /* @__PURE__ */ a.createElement("div", { style: p, className: "k-editor-content" }, /* @__PURE__ */ a.createElement(
192
198
  "div",
193
199
  {
194
- style: p,
195
- className: "k-editor-content"
196
- },
197
- /* @__PURE__ */ a.createElement(
198
- "div",
199
- {
200
- ref: (n) => this._contentElement = n,
201
- suppressContentEditableWarning: !0,
202
- role: "textbox",
203
- "aria-labelledby": this.props.ariaLabelledBy,
204
- "aria-describedby": this.props.ariaDescribedBy,
205
- "aria-label": this.props.ariaLabel
206
- }
207
- )
208
- ),
200
+ ref: (n) => this._contentElement = n,
201
+ suppressContentEditableWarning: !0,
202
+ role: "textbox",
203
+ "aria-labelledby": this.props.ariaLabelledBy,
204
+ "aria-describedby": this.props.ariaDescribedBy,
205
+ "aria-label": this.props.ariaLabel
206
+ }
207
+ )),
209
208
  this.renderDialog(st.InsertLinkDialog, N, "linkDialog"),
210
- this.showLicenseWatermark && /* @__PURE__ */ a.createElement(F, null)
209
+ this.showLicenseWatermark && /* @__PURE__ */ a.createElement(z, null)
211
210
  );
212
211
  }
213
212
  initialize() {
214
213
  const l = this.iframe && this.iframe.contentWindow;
215
214
  if (l) {
216
- const o = l.document;
217
- [$, tt, this.props.dir === "rtl" ? et : void 0].forEach((r) => {
215
+ const o = l.document, h = o.createElement("meta");
216
+ h.setAttribute("charset", "utf-8"), o.head.appendChild(h), this._contentElement = o.createElement("div"), o.body.appendChild(this._contentElement), this._contentElement.classList.add("k-content"), this.iframe && this.props.onIFrameInit ? this.onIFrameInit(this.iframe) : [$, tt, this.props.dir === "rtl" ? et : void 0].forEach((r) => {
218
217
  if (r) {
219
218
  const f = o.createElement("style");
220
219
  f.appendChild(o.createTextNode(r)), o.head.appendChild(f);
221
220
  }
222
221
  });
223
- const h = o.createElement("meta");
224
- h.setAttribute("charset", "utf-8"), o.head.appendChild(h), this._contentElement = o.createElement("div"), o.body.appendChild(this._contentElement), this._contentElement.classList.add("k-content");
225
222
  }
226
223
  const t = this._contentElement;
227
224
  if (!t)
228
225
  return;
229
- const { preserveWhitespace: e = "full" } = this.props;
230
- let s = [
226
+ const { preserveWhitespace: e = "full" } = this.props, s = [
231
227
  // https://prosemirror.net/docs/ref/#state.PluginSpec
232
228
  new w({
233
229
  view: () => ({ update: this.updateTools }),
@@ -244,11 +240,11 @@ const { link: N, bold: lt, italic: ht, underline: ct } = it, k = class k extends
244
240
  apply: (o, h) => h
245
241
  }
246
242
  }),
243
+ H(),
247
244
  j(),
248
245
  V(),
249
246
  A(),
250
247
  U(),
251
- I(),
252
248
  K(),
253
249
  q()
254
250
  ], c = {
@@ -268,14 +264,15 @@ const { link: N, bold: lt, italic: ht, underline: ct } = it, k = class k extends
268
264
  var h;
269
265
  const o = (h = this.element) == null ? void 0 : h.querySelector(".k-toolbar");
270
266
  if (o) {
271
- const r = o.querySelector(x.join(","));
267
+ const r = o.querySelector(L.join(","));
272
268
  if (r)
273
269
  return r.focus(), !0;
274
270
  }
275
271
  return !1;
276
272
  }
277
- };
278
- const { defaultContent: d = "", value: p, onMount: m } = this.props, n = p && typeof p != "string" ? p : b.createDocument(new R({ nodes: J, marks: Q }), p || d, { preserveWhitespace: e }), u = {
273
+ }, { defaultContent: d = "", value: p, onMount: m } = this.props, n = p && typeof p != "string" ? p : b.createDocument(new R({ nodes: J, marks: Q }), p || d, {
274
+ preserveWhitespace: e
275
+ }), u = {
279
276
  state: X.create({
280
277
  plugins: [...s, S(c), S(Y)],
281
278
  doc: n
@@ -319,7 +316,8 @@ k.propTypes = {
319
316
  onBlur: i.func,
320
317
  onChange: i.func,
321
318
  onPasteHtml: i.func,
322
- onExecute: i.func
319
+ onExecute: i.func,
320
+ onIFrameInit: i.func
323
321
  };
324
322
  let E = k;
325
323
  at(E);
@@ -11,55 +11,44 @@ html, body {
11
11
  height: 100%;
12
12
  padding: 0;
13
13
  }
14
-
15
14
  html {
16
15
  min-height: 100%;
17
16
  }
18
-
19
17
  body {
20
18
  box-sizing: border-box;
21
19
  position: relative;
22
20
  word-wrap: break-word;
23
21
  padding: 8px;
24
22
  }
25
-
26
23
  body > .k-content {
27
24
  outline: 0;
28
25
  height: 100%;
29
26
  white-space: pre-wrap;
30
27
  }
31
-
32
28
  .k-content > p {
33
29
  margin: 0 0 1em;
34
30
  }
35
-
36
31
  .k-content table {
37
32
  white-space: pre-wrap;
38
33
  }
39
-
40
34
  .k-content .k-text-selected, .k-content::selection {
41
35
  color: HighlightText;
42
36
  background-color: Highlight;
43
37
  }
44
-
45
38
  .k-content .k-text-highlighted {
46
39
  background-color: #bbdefb;
47
40
  }
48
-
49
41
  .k-content .ProseMirror-selectednode {
50
42
  outline: 2px solid #8cf;
51
43
  }
52
-
53
44
  .ProseMirror-hideselection *::selection { background: transparent; }
54
45
  .ProseMirror-hideselection *::-moz-selection { background: transparent; }
55
46
  .ProseMirror-hideselection { caret-color: transparent; }
56
-
57
47
  .ProseMirror-gapcursor {
58
48
  display: none;
59
49
  pointer-events: none;
60
50
  position: absolute;
61
51
  }
62
-
63
52
  .ProseMirror-gapcursor:after {
64
53
  content: "";
65
54
  display: block;
@@ -69,22 +58,18 @@ body > .k-content {
69
58
  border-top: 1px solid black;
70
59
  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
71
60
  }
72
-
73
61
  @keyframes ProseMirror-cursor-blink {
74
62
  to {
75
63
  visibility: hidden;
76
64
  }
77
65
  }
78
-
79
66
  .ProseMirror-focused .ProseMirror-gapcursor {
80
67
  display: block;
81
68
  }
82
-
83
69
  .k-editor-resize-handles-wrapper {
84
70
  position: absolute;
85
71
  visibility: hidden;
86
72
  }
87
-
88
73
  .k-editor-resize-handle {
89
74
  position: absolute;
90
75
  visibility: visible;
@@ -94,68 +79,58 @@ body > .k-content {
94
79
  width: 5px;
95
80
  height: 5px;
96
81
  }
97
-
98
82
  .k-editor-resize-handle.northwest {
99
83
  top: 0;
100
84
  left: 0;
101
85
  transform: translate(-50%, -50%);
102
86
  cursor: nw-resize;
103
87
  }
104
-
105
88
  .k-editor-resize-handle.north {
106
89
  top: 0;
107
90
  left: 50%;
108
91
  transform: translate(-50%, -50%);
109
92
  cursor: n-resize;
110
93
  }
111
-
112
94
  .k-editor-resize-handle.northeast {
113
95
  top: 0;
114
96
  right: 0;
115
97
  transform: translate(50%, -50%);
116
98
  cursor: ne-resize;
117
99
  }
118
-
119
100
  .k-editor-resize-handle.southwest {
120
101
  left: 0;
121
102
  bottom: 0;
122
103
  transform: translate(-50%, 50%);
123
104
  cursor: sw-resize;
124
105
  }
125
-
126
106
  .k-editor-resize-handle.south {
127
107
  bottom: 0;
128
108
  left: 50%;
129
109
  transform: translate(-50%, 50%);
130
110
  cursor: s-resize;
131
111
  }
132
-
133
112
  .k-editor-resize-handle.southeast {
134
113
  right: 0;
135
114
  bottom: 0;
136
115
  transform: translate(50%, 50%);
137
116
  cursor: se-resize;
138
117
  }
139
-
140
118
  .k-editor-resize-handle.west {
141
119
  top: 50%;
142
120
  left: 0;
143
121
  transform: translate(-50%, -50%);
144
122
  cursor: w-resize;
145
123
  }
146
-
147
124
  .k-editor-resize-handle.east {
148
125
  top: 50%;
149
126
  right: 0;
150
127
  transform: translate(50%, -50%);
151
128
  cursor: e-resize;
152
129
  }
153
-
154
130
  .k-editor-resize-wrap-element {
155
131
  display: inline-block;
156
132
  position: relative;
157
133
  }
158
-
159
134
  .ProseMirror .row-resize-handle {
160
135
  position: absolute;
161
136
  right: 0; left: 0; bottom: 0;
@@ -165,7 +140,6 @@ body > .k-content {
165
140
  background-color: #adf;
166
141
  pointer-events: none;
167
142
  }
168
-
169
143
  .ProseMirror .column-resize-handle {
170
144
  position: absolute;
171
145
  right: -2px; top: 0; bottom: 0;
@@ -174,17 +148,14 @@ body > .k-content {
174
148
  background-color: #adf;
175
149
  pointer-events: none;
176
150
  }
177
-
178
151
  .ProseMirror.resize-cursor {
179
152
  cursor: ew-resize;
180
153
  cursor: col-resize;
181
154
  }
182
-
183
155
  .ProseMirror.resize-cursor-vertical {
184
156
  cursor: sn-resize;
185
157
  cursor: row-resize;
186
158
  }
187
-
188
159
  .k-editor-resize-wrap-element table td p,
189
160
  .k-editor-resize-wrap-element table th p {
190
161
  margin: 0 auto;
@@ -194,7 +165,6 @@ body > .k-content {
194
165
  overflow-x: auto;
195
166
  margin: 1em 0;
196
167
  }
197
-
198
168
  .ProseMirror table {
199
169
  margin: 0;
200
170
  border-collapse: collapse;
@@ -202,7 +172,6 @@ body > .k-content {
202
172
  width: 100%;
203
173
  overflow: hidden;
204
174
  }
205
-
206
175
  .ProseMirror td, .ProseMirror th {
207
176
  min-width: 1em;
208
177
  border: 1px solid #ddd;
@@ -211,12 +180,10 @@ body > .k-content {
211
180
  box-sizing: border-box;
212
181
  position: relative;
213
182
  }
214
-
215
183
  .ProseMirror th {
216
184
  font-weight: bold;
217
185
  text-align: left;
218
186
  }
219
-
220
187
  /* Give selected cells a blue overlay */
221
188
  .ProseMirror .selectedCell:after {
222
189
  z-index: 2;
@@ -12,55 +12,44 @@ html, body {
12
12
  height: 100%;
13
13
  padding: 0;
14
14
  }
15
-
16
15
  html {
17
16
  min-height: 100%;
18
17
  }
19
-
20
18
  body {
21
19
  box-sizing: border-box;
22
20
  position: relative;
23
21
  word-wrap: break-word;
24
22
  padding: 8px;
25
23
  }
26
-
27
24
  body > .k-content {
28
25
  outline: 0;
29
26
  height: 100%;
30
27
  white-space: pre-wrap;
31
28
  }
32
-
33
29
  .k-content > p {
34
30
  margin: 0 0 1em;
35
31
  }
36
-
37
32
  .k-content table {
38
33
  white-space: pre-wrap;
39
34
  }
40
-
41
35
  .k-content .k-text-selected, .k-content::selection {
42
36
  color: HighlightText;
43
37
  background-color: Highlight;
44
38
  }
45
-
46
39
  .k-content .k-text-highlighted {
47
40
  background-color: #bbdefb;
48
41
  }
49
-
50
42
  .k-content .ProseMirror-selectednode {
51
43
  outline: 2px solid #8cf;
52
44
  }
53
-
54
45
  .ProseMirror-hideselection *::selection { background: transparent; }
55
46
  .ProseMirror-hideselection *::-moz-selection { background: transparent; }
56
47
  .ProseMirror-hideselection { caret-color: transparent; }
57
-
58
48
  .ProseMirror-gapcursor {
59
49
  display: none;
60
50
  pointer-events: none;
61
51
  position: absolute;
62
52
  }
63
-
64
53
  .ProseMirror-gapcursor:after {
65
54
  content: "";
66
55
  display: block;
@@ -70,22 +59,18 @@ body > .k-content {
70
59
  border-top: 1px solid black;
71
60
  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
72
61
  }
73
-
74
62
  @keyframes ProseMirror-cursor-blink {
75
63
  to {
76
64
  visibility: hidden;
77
65
  }
78
66
  }
79
-
80
67
  .ProseMirror-focused .ProseMirror-gapcursor {
81
68
  display: block;
82
69
  }
83
-
84
70
  .k-editor-resize-handles-wrapper {
85
71
  position: absolute;
86
72
  visibility: hidden;
87
73
  }
88
-
89
74
  .k-editor-resize-handle {
90
75
  position: absolute;
91
76
  visibility: visible;
@@ -95,68 +80,58 @@ body > .k-content {
95
80
  width: 5px;
96
81
  height: 5px;
97
82
  }
98
-
99
83
  .k-editor-resize-handle.northwest {
100
84
  top: 0;
101
85
  left: 0;
102
86
  transform: translate(-50%, -50%);
103
87
  cursor: nw-resize;
104
88
  }
105
-
106
89
  .k-editor-resize-handle.north {
107
90
  top: 0;
108
91
  left: 50%;
109
92
  transform: translate(-50%, -50%);
110
93
  cursor: n-resize;
111
94
  }
112
-
113
95
  .k-editor-resize-handle.northeast {
114
96
  top: 0;
115
97
  right: 0;
116
98
  transform: translate(50%, -50%);
117
99
  cursor: ne-resize;
118
100
  }
119
-
120
101
  .k-editor-resize-handle.southwest {
121
102
  left: 0;
122
103
  bottom: 0;
123
104
  transform: translate(-50%, 50%);
124
105
  cursor: sw-resize;
125
106
  }
126
-
127
107
  .k-editor-resize-handle.south {
128
108
  bottom: 0;
129
109
  left: 50%;
130
110
  transform: translate(-50%, 50%);
131
111
  cursor: s-resize;
132
112
  }
133
-
134
113
  .k-editor-resize-handle.southeast {
135
114
  right: 0;
136
115
  bottom: 0;
137
116
  transform: translate(50%, 50%);
138
117
  cursor: se-resize;
139
118
  }
140
-
141
119
  .k-editor-resize-handle.west {
142
120
  top: 50%;
143
121
  left: 0;
144
122
  transform: translate(-50%, -50%);
145
123
  cursor: w-resize;
146
124
  }
147
-
148
125
  .k-editor-resize-handle.east {
149
126
  top: 50%;
150
127
  right: 0;
151
128
  transform: translate(50%, -50%);
152
129
  cursor: e-resize;
153
130
  }
154
-
155
131
  .k-editor-resize-wrap-element {
156
132
  display: inline-block;
157
133
  position: relative;
158
134
  }
159
-
160
135
  .ProseMirror .row-resize-handle {
161
136
  position: absolute;
162
137
  right: 0; left: 0; bottom: 0;
@@ -166,7 +141,6 @@ body > .k-content {
166
141
  background-color: #adf;
167
142
  pointer-events: none;
168
143
  }
169
-
170
144
  .ProseMirror .column-resize-handle {
171
145
  position: absolute;
172
146
  right: -2px; top: 0; bottom: 0;
@@ -175,17 +149,14 @@ body > .k-content {
175
149
  background-color: #adf;
176
150
  pointer-events: none;
177
151
  }
178
-
179
152
  .ProseMirror.resize-cursor {
180
153
  cursor: ew-resize;
181
154
  cursor: col-resize;
182
155
  }
183
-
184
156
  .ProseMirror.resize-cursor-vertical {
185
157
  cursor: sn-resize;
186
158
  cursor: row-resize;
187
159
  }
188
-
189
160
  .k-editor-resize-wrap-element table td p,
190
161
  .k-editor-resize-wrap-element table th p {
191
162
  margin: 0 auto;
@@ -195,7 +166,6 @@ body > .k-content {
195
166
  overflow-x: auto;
196
167
  margin: 1em 0;
197
168
  }
198
-
199
169
  .ProseMirror table {
200
170
  margin: 0;
201
171
  border-collapse: collapse;
@@ -203,7 +173,6 @@ body > .k-content {
203
173
  width: 100%;
204
174
  overflow: hidden;
205
175
  }
206
-
207
176
  .ProseMirror td, .ProseMirror th {
208
177
  min-width: 1em;
209
178
  border: 1px solid #ddd;
@@ -212,12 +181,10 @@ body > .k-content {
212
181
  box-sizing: border-box;
213
182
  position: relative;
214
183
  }
215
-
216
184
  .ProseMirror th {
217
185
  font-weight: bold;
218
186
  text-align: left;
219
187
  }
220
-
221
188
  /* Give selected cells a blue overlay */
222
189
  .ProseMirror .selectedCell:after {
223
190
  z-index: 2;
@@ -26,7 +26,10 @@ let A = class extends e.Component {
26
26
  width: this.width ? this.width.value : null,
27
27
  height: this.height ? this.height.value : null
28
28
  }, c = Object.keys(n).filter((l) => n[l] !== null && n[l] !== "").reduce((l, r) => Object.assign(l, { [r]: n[r] }), {}), d = p.createAndFill(c);
29
- d && y(d, !0)(s.state, (r) => s.dispatch(r.setMeta("commandName", m.commandName).setMeta("args", c))), this.onClose();
29
+ d && y(d, !0)(
30
+ s.state,
31
+ (r) => s.dispatch(r.setMeta("commandName", m.commandName).setMeta("args", c))
32
+ ), this.onClose();
30
33
  };
31
34
  }
32
35
  /**
@@ -48,7 +51,10 @@ let A = class extends e.Component {
48
51
  const I = /* @__PURE__ */ e.createElement(
49
52
  T,
50
53
  {
51
- render: () => /* @__PURE__ */ e.createElement(z, { horizontal: !0 }, /* @__PURE__ */ e.createElement(u, null, /* @__PURE__ */ e.createElement("label", { htmlFor: "k-editor-image-url", className: "k-form-label" }, i.toLanguageString(c, a[c])), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
54
+ render: () => /* @__PURE__ */ e.createElement(z, { horizontal: !0 }, /* @__PURE__ */ e.createElement(u, null, /* @__PURE__ */ e.createElement("label", { htmlFor: "k-editor-image-url", className: "k-form-label" }, i.toLanguageString(
55
+ c,
56
+ a[c]
57
+ )), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
52
58
  h,
53
59
  {
54
60
  type: "text",
@@ -57,7 +63,10 @@ let A = class extends e.Component {
57
63
  ref: (t) => this.src = t,
58
64
  autoFocus: !0
59
65
  }
60
- ))), /* @__PURE__ */ e.createElement(u, null, /* @__PURE__ */ e.createElement("label", { htmlFor: "k-editor-image-url", className: "k-form-label" }, i.toLanguageString(l, a[l])), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
66
+ ))), /* @__PURE__ */ e.createElement(u, null, /* @__PURE__ */ e.createElement("label", { htmlFor: "k-editor-image-url", className: "k-form-label" }, i.toLanguageString(
67
+ l,
68
+ a[l]
69
+ )), /* @__PURE__ */ e.createElement("div", { className: "k-form-field-wrap" }, /* @__PURE__ */ e.createElement(
61
70
  h,
62
71
  {
63
72
  type: "text",
@@ -90,7 +99,10 @@ let A = class extends e.Component {
90
99
  }
91
100
  ))))
92
101
  }
93
- ), v = [/* @__PURE__ */ e.createElement(b, { onClick: this.onClose, dir: f, key: "cancel" }, i.toLanguageString(k, a[k])), /* @__PURE__ */ e.createElement(b, { onClick: this.onInsert, themeColor: "primary", dir: f, key: "insert" }, i.toLanguageString(w, a[w]))], N = /* @__PURE__ */ e.createElement(
102
+ ), v = [
103
+ /* @__PURE__ */ e.createElement(b, { onClick: this.onClose, dir: f, key: "cancel" }, i.toLanguageString(k, a[k])),
104
+ /* @__PURE__ */ e.createElement(b, { onClick: this.onInsert, themeColor: "primary", dir: f, key: "insert" }, i.toLanguageString(w, a[w]))
105
+ ], N = /* @__PURE__ */ e.createElement(
94
106
  x,
95
107
  {
96
108
  initialWidth: 500,