@progress/kendo-react-editor 7.2.4-develop.3 → 7.3.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.
Files changed (150) hide show
  1. package/Editor.js +8 -0
  2. package/Editor.mjs +327 -0
  3. package/config/defaultStyles.js +229 -0
  4. package/config/defaultStyles.mjs +235 -0
  5. package/config/shortcuts.js +8 -0
  6. package/config/shortcuts.mjs +34 -0
  7. package/config/toolsSettings.js +8 -0
  8. package/config/toolsSettings.mjs +549 -0
  9. package/dialogs/FindReplace.js +8 -0
  10. package/dialogs/FindReplace.mjs +214 -0
  11. package/dialogs/index.js +8 -0
  12. package/dialogs/index.mjs +30 -0
  13. package/dialogs/insertImage.js +8 -0
  14. package/dialogs/insertImage.mjs +117 -0
  15. package/dialogs/insertLink.js +8 -0
  16. package/dialogs/insertLink.mjs +96 -0
  17. package/dialogs/viewHtml.js +8 -0
  18. package/dialogs/viewHtml.mjs +70 -0
  19. package/dist/cdn/js/kendo-react-editor.js +8 -226
  20. package/index.d.mts +2943 -5
  21. package/index.d.ts +2941 -178
  22. package/index.js +8 -226
  23. package/index.mjs +165 -4118
  24. package/messages/index.js +8 -0
  25. package/messages/index.mjs +345 -0
  26. package/package-metadata.js +8 -0
  27. package/package-metadata.mjs +19 -0
  28. package/package.json +11 -11
  29. package/tools/align.js +8 -0
  30. package/tools/align.mjs +38 -0
  31. package/tools/applyColor.js +8 -0
  32. package/tools/applyColor.mjs +34 -0
  33. package/tools/cleanFormatting.js +8 -0
  34. package/tools/cleanFormatting.mjs +41 -0
  35. package/tools/findReplace.js +8 -0
  36. package/tools/findReplace.mjs +53 -0
  37. package/tools/fontStyle.js +8 -0
  38. package/tools/fontStyle.mjs +61 -0
  39. package/tools/formatBlock.js +8 -0
  40. package/tools/formatBlock.mjs +60 -0
  41. package/tools/history.js +8 -0
  42. package/tools/history.mjs +17 -0
  43. package/tools/indent.js +8 -0
  44. package/tools/indent.mjs +43 -0
  45. package/tools/index.js +8 -0
  46. package/tools/index.mjs +278 -0
  47. package/tools/inlineFormat.js +8 -0
  48. package/tools/inlineFormat.mjs +43 -0
  49. package/tools/insertImage.js +8 -0
  50. package/tools/insertImage.mjs +58 -0
  51. package/tools/insertLink.js +8 -0
  52. package/tools/insertLink.mjs +61 -0
  53. package/tools/insertTable/popup.js +8 -0
  54. package/tools/insertTable/popup.mjs +94 -0
  55. package/tools/insertTable/popupGrid.js +8 -0
  56. package/tools/insertTable/popupGrid.mjs +58 -0
  57. package/tools/insertTable/tool.js +8 -0
  58. package/tools/insertTable/tool.mjs +73 -0
  59. package/tools/lists-styled.js +8 -0
  60. package/tools/lists-styled.mjs +61 -0
  61. package/tools/lists.js +8 -0
  62. package/tools/lists.mjs +47 -0
  63. package/tools/outdent.js +8 -0
  64. package/tools/outdent.mjs +43 -0
  65. package/tools/pdf.js +8 -0
  66. package/tools/pdf.mjs +36 -0
  67. package/tools/print.js +8 -0
  68. package/tools/print.mjs +38 -0
  69. package/tools/proseMirrorTool.js +8 -0
  70. package/tools/proseMirrorTool.mjs +37 -0
  71. package/tools/selectAll.js +8 -0
  72. package/tools/selectAll.mjs +36 -0
  73. package/tools/table-wizard/cellPropsUtils.js +8 -0
  74. package/tools/table-wizard/cellPropsUtils.mjs +124 -0
  75. package/tools/table-wizard/tableCellProperties.js +8 -0
  76. package/tools/table-wizard/tableCellProperties.mjs +238 -0
  77. package/tools/table-wizard/tableProperties.js +8 -0
  78. package/tools/table-wizard/tableProperties.mjs +292 -0
  79. package/tools/table-wizard/tablePropsUtils.js +8 -0
  80. package/tools/table-wizard/tablePropsUtils.mjs +288 -0
  81. package/tools/table-wizard/utils.js +8 -0
  82. package/tools/table-wizard/utils.mjs +91 -0
  83. package/tools/tableEdit.js +8 -0
  84. package/tools/tableEdit.mjs +36 -0
  85. package/tools/unlink.js +8 -0
  86. package/tools/unlink.mjs +41 -0
  87. package/tools/utils.js +8 -0
  88. package/tools/utils.mjs +51 -0
  89. package/tools/viewHtml.js +8 -0
  90. package/tools/viewHtml.mjs +57 -0
  91. package/utils/browser-detection.js +8 -0
  92. package/utils/browser-detection.mjs +12 -0
  93. package/utils/controlled-value.js +8 -0
  94. package/utils/controlled-value.mjs +19 -0
  95. package/utils/index.js +8 -0
  96. package/utils/index.mjs +162 -0
  97. package/utils/props-key.js +8 -0
  98. package/utils/props-key.mjs +13 -0
  99. package/Editor.d.ts +0 -122
  100. package/EditorProps.d.ts +0 -200
  101. package/config/defaultStyles.d.ts +0 -16
  102. package/config/pasteSettings.d.ts +0 -10
  103. package/config/schema.d.ts +0 -5
  104. package/config/shortcuts.d.ts +0 -28
  105. package/config/toolsSettings.d.ts +0 -493
  106. package/dialogs/EditorDialogProps.d.ts +0 -30
  107. package/dialogs/FindReplace.d.ts +0 -75
  108. package/dialogs/index.d.ts +0 -53
  109. package/dialogs/insertImage.d.ts +0 -32
  110. package/dialogs/insertLink.d.ts +0 -30
  111. package/dialogs/viewHtml.d.ts +0 -29
  112. package/messages/index.d.ts +0 -338
  113. package/package-metadata.d.ts +0 -9
  114. package/tools/ToolProps.d.ts +0 -41
  115. package/tools/align.d.ts +0 -11
  116. package/tools/applyColor.d.ts +0 -16
  117. package/tools/cleanFormatting.d.ts +0 -20
  118. package/tools/findReplace.d.ts +0 -33
  119. package/tools/fontStyle.d.ts +0 -32
  120. package/tools/formatBlock.d.ts +0 -22
  121. package/tools/history.d.ts +0 -30
  122. package/tools/indent.d.ts +0 -21
  123. package/tools/index.d.ts +0 -718
  124. package/tools/inlineFormat.d.ts +0 -51
  125. package/tools/insertImage.d.ts +0 -17
  126. package/tools/insertLink.d.ts +0 -28
  127. package/tools/insertTable/index.d.ts +0 -7
  128. package/tools/insertTable/popup.d.ts +0 -97
  129. package/tools/insertTable/popupGrid.d.ts +0 -35
  130. package/tools/insertTable/tool.d.ts +0 -28
  131. package/tools/lists-styled.d.ts +0 -8
  132. package/tools/lists.d.ts +0 -31
  133. package/tools/outdent.d.ts +0 -21
  134. package/tools/pdf.d.ts +0 -29
  135. package/tools/print.d.ts +0 -20
  136. package/tools/proseMirrorTool.d.ts +0 -16
  137. package/tools/selectAll.d.ts +0 -20
  138. package/tools/table-wizard/cellPropsUtils.d.ts +0 -40
  139. package/tools/table-wizard/tableCellProperties.d.ts +0 -24
  140. package/tools/table-wizard/tableProperties.d.ts +0 -15
  141. package/tools/table-wizard/tablePropsUtils.d.ts +0 -56
  142. package/tools/table-wizard/utils.d.ts +0 -43
  143. package/tools/tableEdit.d.ts +0 -102
  144. package/tools/unlink.d.ts +0 -21
  145. package/tools/utils.d.ts +0 -54
  146. package/tools/viewHtml.d.ts +0 -28
  147. package/utils/browser-detection.d.ts +0 -8
  148. package/utils/controlled-value.d.ts +0 -9
  149. package/utils/index.d.ts +0 -367
  150. package/utils/props-key.d.ts +0 -9
package/Editor.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),s=require("prop-types"),b=require("@progress/kendo-react-buttons"),w=require("@progress/kendo-react-common"),n=require("@progress/kendo-editor-common"),E=require("./config/defaultStyles.js"),L=require("./config/toolsSettings.js"),W=require("./dialogs/index.js"),C=require("./utils/index.js"),P=require("./utils/props-key.js"),z=require("./utils/controlled-value.js"),T=require("./utils/browser-detection.js"),D=require("./package-metadata.js"),S=require("./messages/index.js"),B=require("@progress/kendo-react-intl");function j(f){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const e in f)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(f,e);Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:()=>f[e]})}}return o.default=f,Object.freeze(o)}const c=j(x),{link:q,bold:H,italic:F,underline:K}=L.EditorToolsSettings,_=class _ 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,i)=>this.state[i]&&c.createElement(e,{view:this.view,settings:t,dir:this.props.dir,onClose:()=>this.setState({[i]:!1})}),this.renderTool=(e,t)=>{const i=c.createElement(e,{view:this.view,dir:this.props.dir,key:t});return i.type===b.ToolbarSeparator?c.createElement(e,{key:t}):i},this.updateTools=(e,t)=>{this.setState({view:e})},this.filterTransaction=(e,t)=>{const i={target:this,transaction:e,state:t};return(this.props.onExecute&&this.props.onExecute.call(void 0,i))!==!1},this.onPasteHtml=e=>{if(this.props.onPasteHtml&&this.pasteEvent){const t={target:this,pastedHtml:e,nativeEvent:this.pasteEvent},i=this.props.onPasteHtml.call(void 0,t);if(this.pasteEvent=void 0,typeof i=="string")return i}return e},this.dispatchTransaction=e=>{const t=e.docChanged;if(this.props.onChange&&t){this.trOnChange=e;const i=e.doc,u=e.doc.type.schema,p={target:this,value:i,html:"",transaction:e,schema:u};Object.defineProperty(p,"html",{get:()=>(this.htmlOnChange=C.EditorUtils.getHtml({doc:i,schema:u}),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 i={target:this,nativeEvent:t};this.props.onFocus.call(void 0,i)}return!1},this.onBlur=(e,t)=>{if(this.props.onBlur){const i={target:this,nativeEvent:t};this.props.onBlur.call(void 0,i)}return!1},this.onPaste=(e,t)=>(this.props.onPasteHtml&&(this.pasteEvent=t),!1),w.validatePackage(D.packageMetadata),this.showLicenseWatermark=w.shouldShowValidationUI(D.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||!T.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:i,className:u}=this.props,p=B.provideLocalizationService(this);if(this.view){const a=P.editorPropsKey.getState(this.view.state);a.preserveWhitespace=t}let d=this.props.contentStyle;d===void 0&&(i||{}).height===void 0&&(d={height:"300px"});const v=o.map((a,m)=>Array.isArray(a)?c.createElement(b.ButtonGroup,{key:m},a.map(this.renderTool,m)):this.renderTool(a,m));return c.createElement("div",{ref:a=>this._element=a,className:w.classNames("k-editor",u,{"k-editor-resizable":this.props.resizable}),dir:this.props.dir,style:i},v.length>0&&c.createElement(b.Toolbar,{className:"k-editor-toolbar",keyboardNavigation:this.props.keyboardNavigation},v),e==="iframe"?c.createElement("div",{className:"k-editor-content"},c.createElement("iframe",{onLoad:T.firefox?()=>{this.initialize()}:void 0,ref:a=>this.iframe=a,frameBorder:"0",title:p.toLanguageString(S.keys.iframeTitle,S.messages[S.keys.iframeTitle]),style:d,className:"k-iframe"})):c.createElement("div",{style:d,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,q,"linkDialog"),this.showLicenseWatermark&&c.createElement(w.WatermarkOverlay,null))}initialize(){const o=this.iframe&&this.iframe.contentWindow;if(o){const r=o.document;[E.defaultStyle,E.tablesStyles,this.props.dir==="rtl"?E.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 i=[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:P.editorPropsKey,state:{init:()=>({preserveWhitespace:t}),apply:(r,h)=>h}}),n.spacesFix(),n.caretColor(),n.history(),n.dropCursor(),n.gapCursor(),n.tableEditing(),n.cspFix()],u={...C.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[q.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:d,onMount:v}=this.props,a=d&&typeof d!="string"?d:C.EditorUtils.createDocument(new n.Schema({nodes:n.nodes,marks:n.marks}),d||p,{preserveWhitespace:t}),m={state:n.EditorState.create({plugins:[...i,n.keymap(u),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,O=>{y=y||O.type.name==="table_caption_external"}),y}},M={plugins:i,shortcuts:u,target:this,viewProps:m,dom:e},N=this._view=v&&v.call(void 0,M)||new n.EditorView({mount:e},m);this.setState({view:N})}};_.propTypes={defaultContent:s.string,value:s.oneOfType([s.object,s.string]),defaultEditMode:s.oneOf(["iframe","div"]),contentStyle:s.object,dir:s.string,className:s.string,ariaDescribedBy:s.string,ariaLabelledBy:s.string,ariaLabel:s.string,style:s.object,tools:s.arrayOf(s.any),keyboardNavigation:s.bool,resizable:s.bool,preserveWhitespace:s.oneOf([!0,!1,"full"]),onMount:s.func,onFocus:s.func,onBlur:s.func,onChange:s.func,onPasteHtml:s.func,onExecute:s.func};let k=_;B.registerForLocalization(k);exports.Editor=k;
package/Editor.mjs ADDED
@@ -0,0 +1,327 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 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 client";
9
+ import * as a from "react";
10
+ import s from "prop-types";
11
+ import { ToolbarSeparator as L, ButtonGroup as N, 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 g, PluginKey as k, 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 C, baseKeymap as Y, EditorView as Z } from "@progress/kendo-editor-common";
14
+ import { defaultStyle as $, tablesStyles as tt, rtlStyles as et } from "./config/defaultStyles.mjs";
15
+ import { EditorToolsSettings as it } from "./config/toolsSettings.mjs";
16
+ import { EditorDialogs as st } from "./dialogs/index.mjs";
17
+ import { EditorUtils as y } from "./utils/index.mjs";
18
+ import { editorPropsKey as _ } from "./utils/props-key.mjs";
19
+ import { updateEditorValue as ot } from "./utils/controlled-value.mjs";
20
+ import { firefox as S } from "./utils/browser-detection.mjs";
21
+ import { packageMetadata as T } from "./package-metadata.mjs";
22
+ import { keys as O, messages as nt } from "./messages/index.mjs";
23
+ import { provideLocalizationService as rt, registerForLocalization as at } from "@progress/kendo-react-intl";
24
+ const { link: P, bold: lt, italic: ht, underline: ct } = it, E = class E extends a.Component {
25
+ constructor(l) {
26
+ super(l), this.state = {
27
+ view: void 0,
28
+ linkDialog: !1
29
+ }, this._element = null, this._contentElement = null, this.iframe = null, this.trOnChange = null, this.htmlOnChange = null, this.showLicenseWatermark = !1, this.focus = () => {
30
+ this.view && this.view.focus();
31
+ }, this.renderDialog = (t, e, i) => this.state[i] && /* @__PURE__ */ a.createElement(
32
+ t,
33
+ {
34
+ view: this.view,
35
+ settings: e,
36
+ dir: this.props.dir,
37
+ onClose: () => this.setState({ [i]: !1 })
38
+ }
39
+ ), this.renderTool = (t, e) => {
40
+ const i = /* @__PURE__ */ a.createElement(
41
+ t,
42
+ {
43
+ view: this.view,
44
+ dir: this.props.dir,
45
+ key: e
46
+ }
47
+ );
48
+ return i.type === L ? /* @__PURE__ */ a.createElement(t, { key: e }) : i;
49
+ }, this.updateTools = (t, e) => {
50
+ this.setState({ view: t });
51
+ }, this.filterTransaction = (t, e) => {
52
+ const i = { target: this, transaction: t, state: e };
53
+ return (this.props.onExecute && this.props.onExecute.call(void 0, i)) !== !1;
54
+ }, this.onPasteHtml = (t) => {
55
+ if (this.props.onPasteHtml && this.pasteEvent) {
56
+ const e = {
57
+ target: this,
58
+ pastedHtml: t,
59
+ nativeEvent: this.pasteEvent
60
+ }, i = this.props.onPasteHtml.call(void 0, e);
61
+ if (this.pasteEvent = void 0, typeof i == "string")
62
+ return i;
63
+ }
64
+ return t;
65
+ }, this.dispatchTransaction = (t) => {
66
+ const e = t.docChanged;
67
+ if (this.props.onChange && e) {
68
+ this.trOnChange = t;
69
+ const i = t.doc, p = t.doc.type.schema, d = {
70
+ target: this,
71
+ value: i,
72
+ html: "",
73
+ transaction: t,
74
+ schema: p
75
+ };
76
+ Object.defineProperty(d, "html", {
77
+ get: () => (this.htmlOnChange = y.getHtml({ doc: i, schema: p }), this.htmlOnChange)
78
+ }), this.props.onChange.call(void 0, d);
79
+ }
80
+ this.view && (this.props.value === void 0 || !e) && this.view.updateState(this.view.state.apply(t));
81
+ }, this.onFocus = (t, e) => {
82
+ if (this.props.onFocus) {
83
+ const i = {
84
+ target: this,
85
+ nativeEvent: e
86
+ };
87
+ this.props.onFocus.call(void 0, i);
88
+ }
89
+ return !1;
90
+ }, this.onBlur = (t, e) => {
91
+ if (this.props.onBlur) {
92
+ const i = {
93
+ target: this,
94
+ nativeEvent: e
95
+ };
96
+ this.props.onBlur.call(void 0, i);
97
+ }
98
+ return !1;
99
+ }, this.onPaste = (t, e) => (this.props.onPasteHtml && (this.pasteEvent = e), !1), M(T), this.showLicenseWatermark = z(T);
100
+ }
101
+ /**
102
+ * The value of the Editor.
103
+ */
104
+ get value() {
105
+ return this.trOnChange !== null ? this.trOnChange.doc : this.props.value !== void 0 ? this.props.value : this.view ? this.view.state.doc : this.props.defaultContent || "";
106
+ }
107
+ /**
108
+ * Returns the DOM element of the Editor.
109
+ */
110
+ get element() {
111
+ return this._element;
112
+ }
113
+ /**
114
+ * Returns the content-editable DOM element of the Editor.
115
+ */
116
+ get contentElement() {
117
+ return this._contentElement;
118
+ }
119
+ /**
120
+ * Returns the `view` object of the Editor.
121
+ */
122
+ get view() {
123
+ return this._view;
124
+ }
125
+ /**
126
+ * @hidden
127
+ */
128
+ componentDidMount() {
129
+ (!this.iframe || !S) && this.initialize();
130
+ }
131
+ /**
132
+ * @hidden
133
+ */
134
+ componentDidUpdate(l) {
135
+ const { value: t } = this.props, e = this.view;
136
+ t === void 0 || !e || (ot(e, t, l.value, this.trOnChange, this.htmlOnChange), this.trOnChange = null, this.htmlOnChange = null);
137
+ }
138
+ /**
139
+ * @hidden
140
+ */
141
+ componentWillUnmount() {
142
+ this.view && this.view.destroy(), this._view = void 0;
143
+ const l = this.iframe && this.iframe.contentWindow;
144
+ if (l) {
145
+ this._contentElement && this._contentElement.parentNode && this._contentElement.parentNode.removeChild(this._contentElement);
146
+ const t = l.document.head;
147
+ for (; t && t.firstChild; )
148
+ t.removeChild(t.firstChild);
149
+ }
150
+ }
151
+ /**
152
+ * @hidden
153
+ */
154
+ render() {
155
+ const {
156
+ tools: l = [],
157
+ defaultEditMode: t = "iframe",
158
+ preserveWhitespace: e = "full",
159
+ style: i,
160
+ className: p
161
+ } = this.props, d = rt(this);
162
+ if (this.view) {
163
+ const n = _.getState(this.view.state);
164
+ n.preserveWhitespace = e;
165
+ }
166
+ let c = this.props.contentStyle;
167
+ c === void 0 && (i || {}).height === void 0 && (c = { height: "300px" });
168
+ const u = l.map((n, m) => Array.isArray(n) ? /* @__PURE__ */ a.createElement(N, { key: m }, n.map(this.renderTool, m)) : this.renderTool(n, m));
169
+ return /* @__PURE__ */ a.createElement(
170
+ "div",
171
+ {
172
+ ref: (n) => this._element = n,
173
+ className: H("k-editor", p, { "k-editor-resizable": this.props.resizable }),
174
+ dir: this.props.dir,
175
+ style: i
176
+ },
177
+ u.length > 0 && /* @__PURE__ */ a.createElement(W, { className: "k-editor-toolbar", keyboardNavigation: this.props.keyboardNavigation }, u),
178
+ t === "iframe" ? /* @__PURE__ */ a.createElement("div", { className: "k-editor-content" }, /* @__PURE__ */ a.createElement(
179
+ "iframe",
180
+ {
181
+ onLoad: S ? () => {
182
+ this.initialize();
183
+ } : void 0,
184
+ ref: (n) => this.iframe = n,
185
+ frameBorder: "0",
186
+ title: d.toLanguageString(O.iframeTitle, nt[O.iframeTitle]),
187
+ style: c,
188
+ className: "k-iframe"
189
+ }
190
+ )) : /* @__PURE__ */ a.createElement(
191
+ "div",
192
+ {
193
+ style: c,
194
+ className: "k-editor-content"
195
+ },
196
+ /* @__PURE__ */ a.createElement(
197
+ "div",
198
+ {
199
+ ref: (n) => this._contentElement = n,
200
+ suppressContentEditableWarning: !0,
201
+ role: "textbox",
202
+ "aria-labelledby": this.props.ariaLabelledBy,
203
+ "aria-describedby": this.props.ariaDescribedBy,
204
+ "aria-label": this.props.ariaLabel
205
+ }
206
+ )
207
+ ),
208
+ this.renderDialog(st.InsertLinkDialog, P, "linkDialog"),
209
+ this.showLicenseWatermark && /* @__PURE__ */ a.createElement(F, null)
210
+ );
211
+ }
212
+ initialize() {
213
+ const l = this.iframe && this.iframe.contentWindow;
214
+ if (l) {
215
+ const o = l.document;
216
+ [$, tt, this.props.dir === "rtl" ? et : void 0].forEach((r) => {
217
+ if (r) {
218
+ const f = o.createElement("style");
219
+ f.appendChild(o.createTextNode(r)), o.head.appendChild(f);
220
+ }
221
+ });
222
+ const h = o.createElement("meta");
223
+ 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");
224
+ }
225
+ const t = this._contentElement;
226
+ if (!t)
227
+ return;
228
+ const { preserveWhitespace: e = "full" } = this.props;
229
+ let i = [
230
+ // https://prosemirror.net/docs/ref/#state.PluginSpec
231
+ new g({
232
+ view: () => ({ update: this.updateTools }),
233
+ key: new k("toolbar-tools-update-plugin")
234
+ }),
235
+ new g({
236
+ filterTransaction: this.filterTransaction,
237
+ key: new k("onExecute-event-plugin")
238
+ }),
239
+ new g({
240
+ key: _,
241
+ state: {
242
+ init: () => ({ preserveWhitespace: e }),
243
+ apply: (o, h) => h
244
+ }
245
+ }),
246
+ j(),
247
+ V(),
248
+ A(),
249
+ U(),
250
+ I(),
251
+ K(),
252
+ q()
253
+ ], p = {
254
+ ...y.getShortcuts({
255
+ types: { listItem: "list_item", hardBreak: "hard_break" },
256
+ toolsSettings: { bold: lt, italic: ht, underline: ct }
257
+ }),
258
+ "Mod-k": () => {
259
+ const { linkDialog: o } = this.state, h = this.view;
260
+ if (h) {
261
+ const r = h.state, f = r.selection.empty, v = G(r, r.schema.marks[P.mark]);
262
+ !o && !(f && !v) && this.setState({ linkDialog: !0 });
263
+ }
264
+ return !o;
265
+ },
266
+ "Alt-F10": () => {
267
+ var h;
268
+ const o = (h = this.element) == null ? void 0 : h.querySelector(".k-toolbar");
269
+ if (o) {
270
+ const r = o.querySelector(x.join(","));
271
+ if (r)
272
+ return r.focus(), !0;
273
+ }
274
+ return !1;
275
+ }
276
+ };
277
+ const { defaultContent: d = "", value: c, onMount: u } = this.props, n = c && typeof c != "string" ? c : y.createDocument(new R({ nodes: J, marks: Q }), c || d, { preserveWhitespace: e }), m = {
278
+ state: X.create({
279
+ plugins: [...i, C(p), C(Y)],
280
+ doc: n
281
+ }),
282
+ transformPastedHTML: this.onPasteHtml,
283
+ dispatchTransaction: this.dispatchTransaction,
284
+ handleDOMEvents: {
285
+ focus: this.onFocus,
286
+ blur: this.onBlur,
287
+ paste: this.onPaste
288
+ },
289
+ handleDrop: (o, h, r, f) => {
290
+ let v = !1;
291
+ return r.content.nodesBetween(0, r.content.size, (b) => {
292
+ v = v || b.type.name === "table_caption_external";
293
+ }), v;
294
+ }
295
+ }, D = { plugins: i, shortcuts: p, target: this, viewProps: m, dom: t }, B = this._view = u && u.call(void 0, D) || new Z({ mount: t }, m);
296
+ this.setState({
297
+ view: B
298
+ });
299
+ }
300
+ };
301
+ E.propTypes = {
302
+ defaultContent: s.string,
303
+ value: s.oneOfType([s.object, s.string]),
304
+ defaultEditMode: s.oneOf(["iframe", "div"]),
305
+ contentStyle: s.object,
306
+ dir: s.string,
307
+ className: s.string,
308
+ ariaDescribedBy: s.string,
309
+ ariaLabelledBy: s.string,
310
+ ariaLabel: s.string,
311
+ style: s.object,
312
+ tools: s.arrayOf(s.any),
313
+ keyboardNavigation: s.bool,
314
+ resizable: s.bool,
315
+ preserveWhitespace: s.oneOf([!0, !1, "full"]),
316
+ onMount: s.func,
317
+ onFocus: s.func,
318
+ onBlur: s.func,
319
+ onChange: s.func,
320
+ onPasteHtml: s.func,
321
+ onExecute: s.func
322
+ };
323
+ let w = E;
324
+ at(w);
325
+ export {
326
+ w as Editor
327
+ };
@@ -0,0 +1,229 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=`
9
+ html, body {
10
+ margin: 0;
11
+ height: 100%;
12
+ padding: 0;
13
+ }
14
+
15
+ html {
16
+ min-height: 100%;
17
+ }
18
+
19
+ body {
20
+ box-sizing: border-box;
21
+ position: relative;
22
+ word-wrap: break-word;
23
+ padding: 8px;
24
+ }
25
+
26
+ body > .k-content {
27
+ outline: 0;
28
+ height: 100%;
29
+ white-space: pre-wrap;
30
+ }
31
+
32
+ .k-content > p {
33
+ margin: 0 0 1em;
34
+ }
35
+
36
+ .k-content table {
37
+ white-space: pre-wrap;
38
+ }
39
+
40
+ .k-content .k-text-selected, .k-content::selection {
41
+ color: HighlightText;
42
+ background-color: Highlight;
43
+ }
44
+
45
+ .k-content .k-text-highlighted {
46
+ background-color: #bbdefb;
47
+ }
48
+
49
+ .k-content .ProseMirror-selectednode {
50
+ outline: 2px solid #8cf;
51
+ }
52
+
53
+ .ProseMirror-hideselection *::selection { background: transparent; }
54
+ .ProseMirror-hideselection *::-moz-selection { background: transparent; }
55
+ .ProseMirror-hideselection { caret-color: transparent; }
56
+
57
+ .ProseMirror-gapcursor {
58
+ display: none;
59
+ pointer-events: none;
60
+ position: absolute;
61
+ }
62
+
63
+ .ProseMirror-gapcursor:after {
64
+ content: "";
65
+ display: block;
66
+ position: absolute;
67
+ top: -2px;
68
+ width: 20px;
69
+ border-top: 1px solid black;
70
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
71
+ }
72
+
73
+ @keyframes ProseMirror-cursor-blink {
74
+ to {
75
+ visibility: hidden;
76
+ }
77
+ }
78
+
79
+ .ProseMirror-focused .ProseMirror-gapcursor {
80
+ display: block;
81
+ }
82
+
83
+ .k-editor-resize-handles-wrapper {
84
+ position: absolute;
85
+ visibility: hidden;
86
+ }
87
+
88
+ .k-editor-resize-handle {
89
+ position: absolute;
90
+ visibility: visible;
91
+ background-color: #fff;
92
+ border: 1px solid #000;
93
+ z-index: 100;
94
+ width: 5px;
95
+ height: 5px;
96
+ }
97
+
98
+ .k-editor-resize-handle.northwest {
99
+ top: 0;
100
+ left: 0;
101
+ transform: translate(-50%, -50%);
102
+ cursor: nw-resize;
103
+ }
104
+
105
+ .k-editor-resize-handle.north {
106
+ top: 0;
107
+ left: 50%;
108
+ transform: translate(-50%, -50%);
109
+ cursor: n-resize;
110
+ }
111
+
112
+ .k-editor-resize-handle.northeast {
113
+ top: 0;
114
+ right: 0;
115
+ transform: translate(50%, -50%);
116
+ cursor: ne-resize;
117
+ }
118
+
119
+ .k-editor-resize-handle.southwest {
120
+ left: 0;
121
+ bottom: 0;
122
+ transform: translate(-50%, 50%);
123
+ cursor: sw-resize;
124
+ }
125
+
126
+ .k-editor-resize-handle.south {
127
+ bottom: 0;
128
+ left: 50%;
129
+ transform: translate(-50%, 50%);
130
+ cursor: s-resize;
131
+ }
132
+
133
+ .k-editor-resize-handle.southeast {
134
+ right: 0;
135
+ bottom: 0;
136
+ transform: translate(50%, 50%);
137
+ cursor: se-resize;
138
+ }
139
+
140
+ .k-editor-resize-handle.west {
141
+ top: 50%;
142
+ left: 0;
143
+ transform: translate(-50%, -50%);
144
+ cursor: w-resize;
145
+ }
146
+
147
+ .k-editor-resize-handle.east {
148
+ top: 50%;
149
+ right: 0;
150
+ transform: translate(50%, -50%);
151
+ cursor: e-resize;
152
+ }
153
+
154
+ .k-editor-resize-wrap-element {
155
+ display: inline-block;
156
+ position: relative;
157
+ }
158
+
159
+ .ProseMirror .row-resize-handle {
160
+ position: absolute;
161
+ right: 0; left: 0; bottom: 0;
162
+ transform: translate(0, 50%);
163
+ height: 4px;
164
+ z-index: 20;
165
+ background-color: #adf;
166
+ pointer-events: none;
167
+ }
168
+
169
+ .ProseMirror .column-resize-handle {
170
+ position: absolute;
171
+ right: -2px; top: 0; bottom: 0;
172
+ width: 4px;
173
+ z-index: 20;
174
+ background-color: #adf;
175
+ pointer-events: none;
176
+ }
177
+
178
+ .ProseMirror.resize-cursor {
179
+ cursor: ew-resize;
180
+ cursor: col-resize;
181
+ }
182
+
183
+ .ProseMirror.resize-cursor-vertical {
184
+ cursor: sn-resize;
185
+ cursor: row-resize;
186
+ }
187
+
188
+ .k-editor-resize-wrap-element table td p,
189
+ .k-editor-resize-wrap-element table th p {
190
+ margin: 0 auto;
191
+ }
192
+ `,r=`
193
+ .ProseMirror .tableWrapper {
194
+ overflow-x: auto;
195
+ margin: 1em 0;
196
+ }
197
+
198
+ .ProseMirror table {
199
+ margin: 0;
200
+ border-collapse: collapse;
201
+ table-layout: fixed;
202
+ width: 100%;
203
+ overflow: hidden;
204
+ }
205
+
206
+ .ProseMirror td, .ProseMirror th {
207
+ min-width: 1em;
208
+ border: 1px solid #ddd;
209
+ padding: 3px 5px;
210
+ vertical-align: top;
211
+ box-sizing: border-box;
212
+ position: relative;
213
+ }
214
+
215
+ .ProseMirror th {
216
+ font-weight: bold;
217
+ text-align: left;
218
+ }
219
+
220
+ /* Give selected cells a blue overlay */
221
+ .ProseMirror .selectedCell:after {
222
+ z-index: 2;
223
+ position: absolute;
224
+ content: "";
225
+ left: 0; right: 0; top: 0; bottom: 0;
226
+ background: rgba(200, 200, 255, 0.4);
227
+ pointer-events: none;
228
+ }
229
+ `,o="body { direction: rtl }";exports.defaultStyle=e;exports.rtlStyles=o;exports.tablesStyles=r;