@lingxiteam/lcdp-ueditor-react 1.0.0-alpha.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 (272) hide show
  1. package/es/LcdpUeditor.d.ts +74 -0
  2. package/es/LcdpUeditor.js +335 -0
  3. package/es/const.d.ts +12 -0
  4. package/es/const.js +19 -0
  5. package/es/defaultConfig.json +77 -0
  6. package/es/index.d.ts +4 -0
  7. package/es/index.js +3 -0
  8. package/es/tools/UeditorResourceLoader.d.ts +21 -0
  9. package/es/tools/UeditorResourceLoader.js +114 -0
  10. package/es/tools/loadScript.d.ts +5 -0
  11. package/es/tools/loadScript.js +54 -0
  12. package/es/type.d.ts +142 -0
  13. package/es/type.js +1 -0
  14. package/package.json +32 -0
  15. package/ueditor-resource/dialogs/anchor/anchor.html +62 -0
  16. package/ueditor-resource/dialogs/attachment/attachment.css +716 -0
  17. package/ueditor-resource/dialogs/attachment/attachment.html +61 -0
  18. package/ueditor-resource/dialogs/attachment/attachment.js +803 -0
  19. package/ueditor-resource/dialogs/attachment/images/alignicon.gif +0 -0
  20. package/ueditor-resource/dialogs/attachment/images/alignicon.png +0 -0
  21. package/ueditor-resource/dialogs/attachment/images/bg.png +0 -0
  22. package/ueditor-resource/dialogs/attachment/images/file-icons.gif +0 -0
  23. package/ueditor-resource/dialogs/attachment/images/file-icons.png +0 -0
  24. package/ueditor-resource/dialogs/attachment/images/icons.gif +0 -0
  25. package/ueditor-resource/dialogs/attachment/images/icons.png +0 -0
  26. package/ueditor-resource/dialogs/attachment/images/image.png +0 -0
  27. package/ueditor-resource/dialogs/attachment/images/progress.png +0 -0
  28. package/ueditor-resource/dialogs/attachment/images/success.gif +0 -0
  29. package/ueditor-resource/dialogs/attachment/images/success.png +0 -0
  30. package/ueditor-resource/dialogs/audio/audio.css +879 -0
  31. package/ueditor-resource/dialogs/audio/audio.html +94 -0
  32. package/ueditor-resource/dialogs/audio/audio.js +815 -0
  33. package/ueditor-resource/dialogs/audio/icon/center-active.png +0 -0
  34. package/ueditor-resource/dialogs/audio/icon/center.png +0 -0
  35. package/ueditor-resource/dialogs/audio/icon/img.png +0 -0
  36. package/ueditor-resource/dialogs/audio/icon/left-active.png +0 -0
  37. package/ueditor-resource/dialogs/audio/icon/left.png +0 -0
  38. package/ueditor-resource/dialogs/audio/icon/none-active.png +0 -0
  39. package/ueditor-resource/dialogs/audio/icon/none.png +0 -0
  40. package/ueditor-resource/dialogs/audio/icon/right-active.png +0 -0
  41. package/ueditor-resource/dialogs/audio/icon/right.png +0 -0
  42. package/ueditor-resource/dialogs/audio/images/bg.png +0 -0
  43. package/ueditor-resource/dialogs/audio/images/center_focus.jpg +0 -0
  44. package/ueditor-resource/dialogs/audio/images/file-icons.gif +0 -0
  45. package/ueditor-resource/dialogs/audio/images/file-icons.png +0 -0
  46. package/ueditor-resource/dialogs/audio/images/icons.gif +0 -0
  47. package/ueditor-resource/dialogs/audio/images/icons.png +0 -0
  48. package/ueditor-resource/dialogs/audio/images/image.png +0 -0
  49. package/ueditor-resource/dialogs/audio/images/left_focus.jpg +0 -0
  50. package/ueditor-resource/dialogs/audio/images/none_focus.jpg +0 -0
  51. package/ueditor-resource/dialogs/audio/images/progress.png +0 -0
  52. package/ueditor-resource/dialogs/audio/images/right_focus.jpg +0 -0
  53. package/ueditor-resource/dialogs/audio/images/success.gif +0 -0
  54. package/ueditor-resource/dialogs/audio/images/success.png +0 -0
  55. package/ueditor-resource/dialogs/background/background.css +193 -0
  56. package/ueditor-resource/dialogs/background/background.html +59 -0
  57. package/ueditor-resource/dialogs/background/background.js +370 -0
  58. package/ueditor-resource/dialogs/background/images/bg.png +0 -0
  59. package/ueditor-resource/dialogs/background/images/success.png +0 -0
  60. package/ueditor-resource/dialogs/contentimport/contentimport.html +176 -0
  61. package/ueditor-resource/dialogs/contentimport/contentimport.js +91 -0
  62. package/ueditor-resource/dialogs/emotion/emotion.css +129 -0
  63. package/ueditor-resource/dialogs/emotion/emotion.html +70 -0
  64. package/ueditor-resource/dialogs/emotion/emotion.js +186 -0
  65. package/ueditor-resource/dialogs/emotion/images/0.gif +0 -0
  66. package/ueditor-resource/dialogs/emotion/images/bface.gif +0 -0
  67. package/ueditor-resource/dialogs/emotion/images/cface.gif +0 -0
  68. package/ueditor-resource/dialogs/emotion/images/fface.gif +0 -0
  69. package/ueditor-resource/dialogs/emotion/images/jxface2.gif +0 -0
  70. package/ueditor-resource/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
  71. package/ueditor-resource/dialogs/emotion/images/tface.gif +0 -0
  72. package/ueditor-resource/dialogs/emotion/images/wface.gif +0 -0
  73. package/ueditor-resource/dialogs/emotion/images/yface.gif +0 -0
  74. package/ueditor-resource/dialogs/formula/formula.html +98 -0
  75. package/ueditor-resource/dialogs/formula/formula.js +147 -0
  76. package/ueditor-resource/dialogs/help/help.css +37 -0
  77. package/ueditor-resource/dialogs/help/help.html +82 -0
  78. package/ueditor-resource/dialogs/help/help.js +57 -0
  79. package/ueditor-resource/dialogs/image/icon/center-active.png +0 -0
  80. package/ueditor-resource/dialogs/image/icon/center.png +0 -0
  81. package/ueditor-resource/dialogs/image/icon/img.png +0 -0
  82. package/ueditor-resource/dialogs/image/icon/left-active.png +0 -0
  83. package/ueditor-resource/dialogs/image/icon/left.png +0 -0
  84. package/ueditor-resource/dialogs/image/icon/none-active.png +0 -0
  85. package/ueditor-resource/dialogs/image/icon/none.png +0 -0
  86. package/ueditor-resource/dialogs/image/icon/right-active.png +0 -0
  87. package/ueditor-resource/dialogs/image/icon/right.png +0 -0
  88. package/ueditor-resource/dialogs/image/image.css +768 -0
  89. package/ueditor-resource/dialogs/image/image.html +145 -0
  90. package/ueditor-resource/dialogs/image/image.js +1060 -0
  91. package/ueditor-resource/dialogs/image/images/alignicon.jpg +0 -0
  92. package/ueditor-resource/dialogs/image/images/bg.png +0 -0
  93. package/ueditor-resource/dialogs/image/images/icons.gif +0 -0
  94. package/ueditor-resource/dialogs/image/images/icons.png +0 -0
  95. package/ueditor-resource/dialogs/image/images/image.png +0 -0
  96. package/ueditor-resource/dialogs/image/images/progress.png +0 -0
  97. package/ueditor-resource/dialogs/image/images/success.gif +0 -0
  98. package/ueditor-resource/dialogs/image/images/success.png +0 -0
  99. package/ueditor-resource/dialogs/insertframe/insertframe.html +135 -0
  100. package/ueditor-resource/dialogs/internal.js +81 -0
  101. package/ueditor-resource/dialogs/link/link.html +148 -0
  102. package/ueditor-resource/dialogs/preview/preview.html +45 -0
  103. package/ueditor-resource/dialogs/scrawl/images/addimg.png +0 -0
  104. package/ueditor-resource/dialogs/scrawl/images/brush.png +0 -0
  105. package/ueditor-resource/dialogs/scrawl/images/delimg.png +0 -0
  106. package/ueditor-resource/dialogs/scrawl/images/delimgH.png +0 -0
  107. package/ueditor-resource/dialogs/scrawl/images/empty.png +0 -0
  108. package/ueditor-resource/dialogs/scrawl/images/emptyH.png +0 -0
  109. package/ueditor-resource/dialogs/scrawl/images/eraser.png +0 -0
  110. package/ueditor-resource/dialogs/scrawl/images/redo.png +0 -0
  111. package/ueditor-resource/dialogs/scrawl/images/redoH.png +0 -0
  112. package/ueditor-resource/dialogs/scrawl/images/scale.png +0 -0
  113. package/ueditor-resource/dialogs/scrawl/images/scaleH.png +0 -0
  114. package/ueditor-resource/dialogs/scrawl/images/size.png +0 -0
  115. package/ueditor-resource/dialogs/scrawl/images/undo.png +0 -0
  116. package/ueditor-resource/dialogs/scrawl/images/undoH.png +0 -0
  117. package/ueditor-resource/dialogs/scrawl/scrawl.css +324 -0
  118. package/ueditor-resource/dialogs/scrawl/scrawl.html +95 -0
  119. package/ueditor-resource/dialogs/scrawl/scrawl.js +682 -0
  120. package/ueditor-resource/dialogs/searchreplace/searchreplace.html +144 -0
  121. package/ueditor-resource/dialogs/searchreplace/searchreplace.js +174 -0
  122. package/ueditor-resource/dialogs/spechars/spechars.html +42 -0
  123. package/ueditor-resource/dialogs/spechars/spechars.js +86 -0
  124. package/ueditor-resource/dialogs/table/dragicon.png +0 -0
  125. package/ueditor-resource/dialogs/table/edittable.css +85 -0
  126. package/ueditor-resource/dialogs/table/edittable.html +69 -0
  127. package/ueditor-resource/dialogs/table/edittable.js +241 -0
  128. package/ueditor-resource/dialogs/table/edittd.html +62 -0
  129. package/ueditor-resource/dialogs/table/edittip.html +33 -0
  130. package/ueditor-resource/dialogs/template/config.js +42 -0
  131. package/ueditor-resource/dialogs/template/images/bg.gif +0 -0
  132. package/ueditor-resource/dialogs/template/images/pre0.png +0 -0
  133. package/ueditor-resource/dialogs/template/images/pre1.png +0 -0
  134. package/ueditor-resource/dialogs/template/images/pre2.png +0 -0
  135. package/ueditor-resource/dialogs/template/images/pre3.png +0 -0
  136. package/ueditor-resource/dialogs/template/images/pre4.png +0 -0
  137. package/ueditor-resource/dialogs/template/template.css +99 -0
  138. package/ueditor-resource/dialogs/template/template.html +26 -0
  139. package/ueditor-resource/dialogs/template/template.js +53 -0
  140. package/ueditor-resource/dialogs/video/icon/center-active.png +0 -0
  141. package/ueditor-resource/dialogs/video/icon/center.png +0 -0
  142. package/ueditor-resource/dialogs/video/icon/img.png +0 -0
  143. package/ueditor-resource/dialogs/video/icon/left-active.png +0 -0
  144. package/ueditor-resource/dialogs/video/icon/left.png +0 -0
  145. package/ueditor-resource/dialogs/video/icon/none-active.png +0 -0
  146. package/ueditor-resource/dialogs/video/icon/none.png +0 -0
  147. package/ueditor-resource/dialogs/video/icon/right-active.png +0 -0
  148. package/ueditor-resource/dialogs/video/icon/right.png +0 -0
  149. package/ueditor-resource/dialogs/video/images/bg.png +0 -0
  150. package/ueditor-resource/dialogs/video/images/center_focus.jpg +0 -0
  151. package/ueditor-resource/dialogs/video/images/file-icons.gif +0 -0
  152. package/ueditor-resource/dialogs/video/images/file-icons.png +0 -0
  153. package/ueditor-resource/dialogs/video/images/icons.gif +0 -0
  154. package/ueditor-resource/dialogs/video/images/icons.png +0 -0
  155. package/ueditor-resource/dialogs/video/images/image.png +0 -0
  156. package/ueditor-resource/dialogs/video/images/left_focus.jpg +0 -0
  157. package/ueditor-resource/dialogs/video/images/none_focus.jpg +0 -0
  158. package/ueditor-resource/dialogs/video/images/progress.png +0 -0
  159. package/ueditor-resource/dialogs/video/images/right_focus.jpg +0 -0
  160. package/ueditor-resource/dialogs/video/images/success.gif +0 -0
  161. package/ueditor-resource/dialogs/video/images/success.png +0 -0
  162. package/ueditor-resource/dialogs/video/video.css +909 -0
  163. package/ueditor-resource/dialogs/video/video.html +115 -0
  164. package/ueditor-resource/dialogs/video/video.js +867 -0
  165. package/ueditor-resource/dialogs/wordimage/wordimage.html +221 -0
  166. package/ueditor-resource/dialogs/wordimage/wordimage.js +93 -0
  167. package/ueditor-resource/index.html +146 -0
  168. package/ueditor-resource/lang/en/en.js +686 -0
  169. package/ueditor-resource/lang/en/images/addimage.png +0 -0
  170. package/ueditor-resource/lang/en/images/alldeletebtnhoverskin.png +0 -0
  171. package/ueditor-resource/lang/en/images/alldeletebtnupskin.png +0 -0
  172. package/ueditor-resource/lang/en/images/background.png +0 -0
  173. package/ueditor-resource/lang/en/images/button.png +0 -0
  174. package/ueditor-resource/lang/en/images/copy.png +0 -0
  175. package/ueditor-resource/lang/en/images/deletedisable.png +0 -0
  176. package/ueditor-resource/lang/en/images/deleteenable.png +0 -0
  177. package/ueditor-resource/lang/en/images/listbackground.png +0 -0
  178. package/ueditor-resource/lang/en/images/localimage.png +0 -0
  179. package/ueditor-resource/lang/en/images/music.png +0 -0
  180. package/ueditor-resource/lang/en/images/rotateleftdisable.png +0 -0
  181. package/ueditor-resource/lang/en/images/rotateleftenable.png +0 -0
  182. package/ueditor-resource/lang/en/images/rotaterightdisable.png +0 -0
  183. package/ueditor-resource/lang/en/images/rotaterightenable.png +0 -0
  184. package/ueditor-resource/lang/en/images/upload.png +0 -0
  185. package/ueditor-resource/lang/zh-cn/images/copy.png +0 -0
  186. package/ueditor-resource/lang/zh-cn/images/localimage.png +0 -0
  187. package/ueditor-resource/lang/zh-cn/images/music.png +0 -0
  188. package/ueditor-resource/lang/zh-cn/images/upload.png +0 -0
  189. package/ueditor-resource/lang/zh-cn/zh-cn.js +748 -0
  190. package/ueditor-resource/plugins/demo/demo.js +3 -0
  191. package/ueditor-resource/themes/default/css/ueditor.css +2148 -0
  192. package/ueditor-resource/themes/default/dialog.css +17 -0
  193. package/ueditor-resource/themes/default/dialogbase.css +132 -0
  194. package/ueditor-resource/themes/default/exts/ai.svg +12 -0
  195. package/ueditor-resource/themes/default/exts/apk.svg +12 -0
  196. package/ueditor-resource/themes/default/exts/chm.svg +12 -0
  197. package/ueditor-resource/themes/default/exts/css.svg +12 -0
  198. package/ueditor-resource/themes/default/exts/doc.svg +22 -0
  199. package/ueditor-resource/themes/default/exts/docx.svg +22 -0
  200. package/ueditor-resource/themes/default/exts/dwg.svg +16 -0
  201. package/ueditor-resource/themes/default/exts/folder.svg +3 -0
  202. package/ueditor-resource/themes/default/exts/gif.svg +14 -0
  203. package/ueditor-resource/themes/default/exts/html.svg +12 -0
  204. package/ueditor-resource/themes/default/exts/jpeg.svg +14 -0
  205. package/ueditor-resource/themes/default/exts/jpg.svg +14 -0
  206. package/ueditor-resource/themes/default/exts/log.svg +12 -0
  207. package/ueditor-resource/themes/default/exts/mp3.svg +14 -0
  208. package/ueditor-resource/themes/default/exts/mp4.svg +12 -0
  209. package/ueditor-resource/themes/default/exts/pdf.svg +14 -0
  210. package/ueditor-resource/themes/default/exts/png.svg +14 -0
  211. package/ueditor-resource/themes/default/exts/ppt.svg +24 -0
  212. package/ueditor-resource/themes/default/exts/pptx.svg +24 -0
  213. package/ueditor-resource/themes/default/exts/psd.svg +12 -0
  214. package/ueditor-resource/themes/default/exts/rar.svg +12 -0
  215. package/ueditor-resource/themes/default/exts/svg.svg +12 -0
  216. package/ueditor-resource/themes/default/exts/torrent.svg +14 -0
  217. package/ueditor-resource/themes/default/exts/txt.svg +14 -0
  218. package/ueditor-resource/themes/default/exts/unknown.svg +12 -0
  219. package/ueditor-resource/themes/default/exts/xls.svg +25 -0
  220. package/ueditor-resource/themes/default/exts/xlsx.svg +25 -0
  221. package/ueditor-resource/themes/default/exts/zip.svg +12 -0
  222. package/ueditor-resource/themes/default/images/anchor.gif +0 -0
  223. package/ueditor-resource/themes/default/images/arrow.png +0 -0
  224. package/ueditor-resource/themes/default/images/arrow_down.png +0 -0
  225. package/ueditor-resource/themes/default/images/arrow_up.png +0 -0
  226. package/ueditor-resource/themes/default/images/button-bg.gif +0 -0
  227. package/ueditor-resource/themes/default/images/cancelbutton.gif +0 -0
  228. package/ueditor-resource/themes/default/images/charts.png +0 -0
  229. package/ueditor-resource/themes/default/images/cursor_h.gif +0 -0
  230. package/ueditor-resource/themes/default/images/cursor_h.png +0 -0
  231. package/ueditor-resource/themes/default/images/cursor_v.gif +0 -0
  232. package/ueditor-resource/themes/default/images/cursor_v.png +0 -0
  233. package/ueditor-resource/themes/default/images/dialog-title-bg.png +0 -0
  234. package/ueditor-resource/themes/default/images/filescan.png +0 -0
  235. package/ueditor-resource/themes/default/images/highlighted.gif +0 -0
  236. package/ueditor-resource/themes/default/images/icons-all.gif +0 -0
  237. package/ueditor-resource/themes/default/images/icons.gif +0 -0
  238. package/ueditor-resource/themes/default/images/icons.png +0 -0
  239. package/ueditor-resource/themes/default/images/img-cracked.png +0 -0
  240. package/ueditor-resource/themes/default/images/loaderror.png +0 -0
  241. package/ueditor-resource/themes/default/images/loading.gif +0 -0
  242. package/ueditor-resource/themes/default/images/lock.gif +0 -0
  243. package/ueditor-resource/themes/default/images/neweditor-tab-bg.png +0 -0
  244. package/ueditor-resource/themes/default/images/pagebreak.gif +0 -0
  245. package/ueditor-resource/themes/default/images/scale.png +0 -0
  246. package/ueditor-resource/themes/default/images/sortable.png +0 -0
  247. package/ueditor-resource/themes/default/images/spacer.gif +0 -0
  248. package/ueditor-resource/themes/default/images/sparator_v.png +0 -0
  249. package/ueditor-resource/themes/default/images/table-cell-align.png +0 -0
  250. package/ueditor-resource/themes/default/images/tangram-colorpicker.png +0 -0
  251. package/ueditor-resource/themes/default/images/toolbar_bg.png +0 -0
  252. package/ueditor-resource/themes/default/images/unhighlighted.gif +0 -0
  253. package/ueditor-resource/themes/default/images/upload.png +0 -0
  254. package/ueditor-resource/themes/default/images/videologo.gif +0 -0
  255. package/ueditor-resource/themes/default/images/word.gif +0 -0
  256. package/ueditor-resource/themes/default/images/wordpaste.png +0 -0
  257. package/ueditor-resource/themes/iframe.css +63 -0
  258. package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +3655 -0
  259. package/ueditor-resource/third-party/SyntaxHighlighter/shCoreDefault.css +1 -0
  260. package/ueditor-resource/third-party/clipboard/clipboard.js +753 -0
  261. package/ueditor-resource/third-party/clipboard/clipboard.swf +0 -0
  262. package/ueditor-resource/third-party/codemirror/codemirror.css +106 -0
  263. package/ueditor-resource/third-party/codemirror/codemirror.js +3581 -0
  264. package/ueditor-resource/third-party/jquery-3.5.1.js +2 -0
  265. package/ueditor-resource/third-party/jquery-3.5.1_1.js +4314 -0
  266. package/ueditor-resource/third-party/webuploader/webuploader.css +88 -0
  267. package/ueditor-resource/third-party/webuploader/webuploader.js +4 -0
  268. package/ueditor-resource/third-party/zeroclipboard/ZeroClipboard.js +1256 -0
  269. package/ueditor-resource/third-party/zeroclipboard/ZeroClipboard.swf +0 -0
  270. package/ueditor-resource/ueditor.all.js +32643 -0
  271. package/ueditor-resource/ueditor.config.js +656 -0
  272. package/ueditor-resource/ueditor.parse.js +639 -0
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import type { ILcdpUeditorProps } from './type';
3
+ declare class LcdpUeditor extends React.Component<ILcdpUeditorProps, {}> {
4
+ /**
5
+ * 静态资源地址
6
+ */
7
+ ueditorPath: string;
8
+ /**
9
+ * 文件上传inputRef
10
+ */
11
+ private inputRef;
12
+ /**
13
+ * 编辑器容器ref
14
+ */
15
+ private containerRef;
16
+ /**
17
+ * 编辑器容器id
18
+ */
19
+ private containerId;
20
+ /**
21
+ * 编辑器实例
22
+ */
23
+ private ueditorInst;
24
+ /**
25
+ * 是否上报
26
+ */
27
+ private isReportFlag;
28
+ /**
29
+ * 值变化节流函数
30
+ */
31
+ private debounceContentChange;
32
+ /**
33
+ * 当前值
34
+ */
35
+ private currentContent;
36
+ /**
37
+ * 上传文件函数
38
+ */
39
+ private uploadFunction;
40
+ /**
41
+ * 初始加载失败
42
+ */
43
+ state: Readonly<{
44
+ initError: boolean;
45
+ }>;
46
+ /**
47
+ * 编辑器配置项
48
+ */
49
+ editorConfig: any;
50
+ constructor(props: ILcdpUeditorProps);
51
+ componentWillReceiveProps(nextProps: ILcdpUeditorProps): void;
52
+ private onContentChange;
53
+ private getExtString;
54
+ /**
55
+ * 文件选择
56
+ * @param cb 回调给编辑器
57
+ * @param type 类型
58
+ */
59
+ private fileSelect;
60
+ /**
61
+ * 对外暴露编辑器实例
62
+ */
63
+ private mountRef;
64
+ /**
65
+ * 初始化样式
66
+ */
67
+ private initStyle;
68
+ /**
69
+ * 初始化编辑器实例
70
+ */
71
+ initUeditor(): Promise<void>;
72
+ render(): React.ReactNode;
73
+ }
74
+ export default LcdpUeditor;
@@ -0,0 +1,335 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
14
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
15
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
17
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ import React from 'react';
21
+ import { DEFAULT_UEDITOR_CONFIG, DEFAULT_UEDITOR_PATH } from "./const";
22
+ import DefaultConfig from "./defaultConfig.json";
23
+ import UeditorResourceLoader from "./tools/UeditorResourceLoader";
24
+ import { debounce } from 'lodash';
25
+ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
26
+ _inherits(LcdpUeditor, _React$Component);
27
+ var _super = _createSuper(LcdpUeditor);
28
+ function LcdpUeditor(props) {
29
+ var _this;
30
+ _classCallCheck(this, LcdpUeditor);
31
+ _this = _super.call(this, props);
32
+ /**
33
+ * 静态资源地址
34
+ */
35
+ _defineProperty(_assertThisInitialized(_this), "ueditorPath", DEFAULT_UEDITOR_PATH);
36
+ /**
37
+ * 文件上传inputRef
38
+ */
39
+ _defineProperty(_assertThisInitialized(_this), "inputRef", /*#__PURE__*/React.createRef());
40
+ /**
41
+ * 编辑器容器ref
42
+ */
43
+ _defineProperty(_assertThisInitialized(_this), "containerRef", /*#__PURE__*/React.createRef());
44
+ /**
45
+ * 编辑器容器id
46
+ */
47
+ _defineProperty(_assertThisInitialized(_this), "containerId", void 0);
48
+ /**
49
+ * 编辑器实例
50
+ */
51
+ _defineProperty(_assertThisInitialized(_this), "ueditorInst", null);
52
+ /**
53
+ * 是否上报
54
+ */
55
+ _defineProperty(_assertThisInitialized(_this), "isReportFlag", true);
56
+ /**
57
+ * 值变化节流函数
58
+ */
59
+ _defineProperty(_assertThisInitialized(_this), "debounceContentChange", void 0);
60
+ /**
61
+ * 当前值
62
+ */
63
+ _defineProperty(_assertThisInitialized(_this), "currentContent", '');
64
+ /**
65
+ * 上传文件函数
66
+ */
67
+ _defineProperty(_assertThisInitialized(_this), "uploadFunction", void 0);
68
+ /**
69
+ * 初始加载失败
70
+ */
71
+ _defineProperty(_assertThisInitialized(_this), "state", {
72
+ initError: false
73
+ });
74
+ /**
75
+ * 编辑器配置项
76
+ */
77
+ _defineProperty(_assertThisInitialized(_this), "editorConfig", {});
78
+ var config = props.config;
79
+ _this.containerId = "ueditor_".concat(Date.now(), "_").concat(String(Math.random()).slice(2, 6));
80
+ if (_this.props.ueditorPath) {
81
+ _this.ueditorPath = _this.props.ueditorPath;
82
+ }
83
+ _this.currentContent = _this.props.value;
84
+ _this.uploadFunction = function (file, type) {
85
+ var _this$props$config;
86
+ // TODO 内置上传 图片base64
87
+ if (type === 'image' && ((_this$props$config = _this.props.config) === null || _this$props$config === void 0 ? void 0 : _this$props$config.imageType) === 'base64') {
88
+ var reader = new FileReader();
89
+ reader.readAsDataURL(file);
90
+ return new Promise(function (resolve, reject) {
91
+ reader.onload = function (_ref) {
92
+ var target = _ref.target;
93
+ return resolve({
94
+ state: 'SUCCESS',
95
+ url: target === null || target === void 0 ? void 0 : target.result,
96
+ title: file.name,
97
+ original: file.name
98
+ });
99
+ };
100
+ });
101
+ }
102
+ if (_this.props.uploadFunction) {
103
+ return _this.props.uploadFunction(file);
104
+ }
105
+ return null;
106
+ };
107
+ _this.editorConfig = _objectSpread(_objectSpread({}, DefaultConfig), {}, {
108
+ initialFrameHeight: (config === null || config === void 0 ? void 0 : config.height) || 300,
109
+ autoHeightEnabled: false,
110
+ selectCallback: function selectCallback(cb, type) {
111
+ _this.fileSelect(cb, type);
112
+ },
113
+ uploadFunction: _this.uploadFunction
114
+ });
115
+ _this.initUeditor();
116
+ _this.debounceContentChange = debounce(_this.onContentChange.bind(_assertThisInitialized(_this)), 300);
117
+ return _this;
118
+ }
119
+ _createClass(LcdpUeditor, [{
120
+ key: "componentWillReceiveProps",
121
+ value: function componentWillReceiveProps(nextProps) {
122
+ if ('value' in nextProps && this.currentContent !== nextProps.value) {
123
+ this.isReportFlag = false;
124
+ if (this.ueditorInst) {
125
+ this.ueditorInst.setContent(nextProps.value);
126
+ }
127
+ }
128
+ // 禁用操作需要调用指定的api进行操作
129
+ if (nextProps.disabled !== this.props.disabled && this.ueditorInst) {
130
+ if (nextProps.disabled) {
131
+ this.ueditorInst.setDisabled();
132
+ } else {
133
+ this.ueditorInst.setEnabled();
134
+ }
135
+ }
136
+ }
137
+ }, {
138
+ key: "onContentChange",
139
+ value: function onContentChange() {
140
+ if (!this.isReportFlag) {
141
+ this.isReportFlag = true;
142
+ } else if (this.props.onChange) {
143
+ this.currentContent = this.ueditorInst.getContent();
144
+ this.props.onChange(this.currentContent);
145
+ }
146
+ }
147
+ }, {
148
+ key: "getExtString",
149
+ value: function getExtString(str) {
150
+ if (Array.isArray(str)) {
151
+ return str.join(',');
152
+ }
153
+ return str || '';
154
+ }
155
+
156
+ /**
157
+ * 文件选择
158
+ * @param cb 回调给编辑器
159
+ * @param type 类型
160
+ */
161
+ }, {
162
+ key: "fileSelect",
163
+ value: (function () {
164
+ var _fileSelect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(cb, type) {
165
+ var _this2 = this;
166
+ var accept;
167
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
168
+ while (1) switch (_context2.prev = _context2.next) {
169
+ case 0:
170
+ if (!this.inputRef.current) {
171
+ _context2.next = 15;
172
+ break;
173
+ }
174
+ accept = '';
175
+ _context2.t0 = type;
176
+ _context2.next = _context2.t0 === 'image' ? 5 : _context2.t0 === 'audio' ? 7 : _context2.t0 === 'video' ? 9 : 11;
177
+ break;
178
+ case 5:
179
+ accept = this.getExtString(this.editorConfig.imageAllowFiles);
180
+ return _context2.abrupt("break", 12);
181
+ case 7:
182
+ accept = this.getExtString(this.editorConfig.audioAllowFiles);
183
+ return _context2.abrupt("break", 12);
184
+ case 9:
185
+ accept = this.getExtString(this.editorConfig.videoAllowFiles);
186
+ return _context2.abrupt("break", 12);
187
+ case 11:
188
+ return _context2.abrupt("break", 12);
189
+ case 12:
190
+ this.inputRef.current.accept = accept || '';
191
+ this.inputRef.current.click();
192
+ this.inputRef.current.onchange = /*#__PURE__*/function () {
193
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
194
+ var file, fileList, res;
195
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
196
+ while (1) switch (_context.prev = _context.next) {
197
+ case 0:
198
+ fileList = e.target.files;
199
+ if ((fileList === null || fileList === void 0 ? void 0 : fileList.length) > 0) {
200
+ file = fileList[0];
201
+ }
202
+ if (!file) {
203
+ _context.next = 7;
204
+ break;
205
+ }
206
+ _context.next = 5;
207
+ return _this2.uploadFunction(file, type);
208
+ case 5:
209
+ res = _context.sent;
210
+ if (res.state === 'SUCCESS' && res.url) {
211
+ cb(res);
212
+ }
213
+ case 7:
214
+ // @ts-ignore
215
+ _this2.inputRef.current.value = '';
216
+ case 8:
217
+ case "end":
218
+ return _context.stop();
219
+ }
220
+ }, _callee);
221
+ }));
222
+ return function (_x3) {
223
+ return _ref2.apply(this, arguments);
224
+ };
225
+ }();
226
+ case 15:
227
+ case "end":
228
+ return _context2.stop();
229
+ }
230
+ }, _callee2, this);
231
+ }));
232
+ function fileSelect(_x, _x2) {
233
+ return _fileSelect.apply(this, arguments);
234
+ }
235
+ return fileSelect;
236
+ }()
237
+ /**
238
+ * 对外暴露编辑器实例
239
+ */
240
+ )
241
+ }, {
242
+ key: "mountRef",
243
+ value: function mountRef() {
244
+ if (this.props.onMount) {
245
+ this.props.onMount(this.ueditorInst);
246
+ }
247
+ }
248
+
249
+ /**
250
+ * 初始化样式
251
+ */
252
+ }, {
253
+ key: "initStyle",
254
+ value: function initStyle() {
255
+ var _ref3 = this.props.style || {},
256
+ toolbarColor = _ref3.toolbarColor,
257
+ backgroundColor = _ref3.backgroundColor;
258
+ if (this.containerRef.current) {
259
+ if (backgroundColor) {
260
+ var _editor$style;
261
+ var editor = this.containerRef.current.querySelector('.edui-editor');
262
+ (_editor$style = editor.style) === null || _editor$style === void 0 || _editor$style.setProperty('background-color', backgroundColor);
263
+ }
264
+ if (toolbarColor) {
265
+ var _toolBox$style;
266
+ var toolBox = this.containerRef.current.querySelector('.edui-editor-toolbarboxouter');
267
+ (_toolBox$style = toolBox.style) === null || _toolBox$style === void 0 || _toolBox$style.setProperty('background-color', toolbarColor);
268
+ }
269
+ }
270
+ }
271
+
272
+ /**
273
+ * 初始化编辑器实例
274
+ */
275
+ }, {
276
+ key: "initUeditor",
277
+ value: (function () {
278
+ var _initUeditor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
279
+ var _this3 = this;
280
+ var jsList;
281
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
282
+ while (1) switch (_context3.prev = _context3.next) {
283
+ case 0:
284
+ UeditorResourceLoader.onReady(function () {
285
+ _this3.ueditorInst = window.UE.getEditor(_this3.containerId, _this3.editorConfig);
286
+ _this3.ueditorInst.ready(function () {
287
+ _this3.ueditorInst.addListener('contentChange', function () {
288
+ _this3.debounceContentChange();
289
+ });
290
+ _this3.initStyle();
291
+ });
292
+ _this3.mountRef();
293
+ });
294
+ jsList = ["".concat(this.ueditorPath, "/").concat(DEFAULT_UEDITOR_CONFIG.UEDITOR_CONFIG), "".concat(this.ueditorPath, "/").concat(DEFAULT_UEDITOR_CONFIG.UEDITOR_ALL), "".concat(this.ueditorPath, "/").concat(DEFAULT_UEDITOR_CONFIG.GET_UEDITOR_LANG())];
295
+ UeditorResourceLoader.onLoadError(function () {
296
+ _this3.setState({
297
+ initError: true
298
+ });
299
+ });
300
+ UeditorResourceLoader.startLoad(jsList);
301
+ case 4:
302
+ case "end":
303
+ return _context3.stop();
304
+ }
305
+ }, _callee3, this);
306
+ }));
307
+ function initUeditor() {
308
+ return _initUeditor.apply(this, arguments);
309
+ }
310
+ return initUeditor;
311
+ }())
312
+ }, {
313
+ key: "render",
314
+ value: function render() {
315
+ var initError = this.state.initError;
316
+ if (initError) {
317
+ throw new Error('Load Ueditor Resource Fail');
318
+ }
319
+ return /*#__PURE__*/React.createElement("div", {
320
+ ref: this.containerRef,
321
+ style: this.props.style,
322
+ className: this.props.className
323
+ }, /*#__PURE__*/React.createElement("script", {
324
+ id: this.containerId,
325
+ type: "text/plain"
326
+ }), /*#__PURE__*/React.createElement("input", {
327
+ hidden: true,
328
+ ref: this.inputRef,
329
+ type: "file"
330
+ }));
331
+ }
332
+ }]);
333
+ return LcdpUeditor;
334
+ }(React.Component);
335
+ export default LcdpUeditor;
package/es/const.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 默认的ueditor资源路径
3
+ */
4
+ export declare const DEFAULT_UEDITOR_PATH = "./ueditor-resource";
5
+ /**
6
+ * ueditor 资源文件名
7
+ */
8
+ export declare const DEFAULT_UEDITOR_CONFIG: {
9
+ UEDITOR_CONFIG: string;
10
+ UEDITOR_ALL: string;
11
+ GET_UEDITOR_LANG: (lang?: string) => string;
12
+ };
package/es/const.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * 默认的ueditor资源路径
3
+ */
4
+ export var DEFAULT_UEDITOR_PATH = './ueditor-resource';
5
+
6
+ /**
7
+ * ueditor 资源文件名
8
+ */
9
+ export var DEFAULT_UEDITOR_CONFIG = {
10
+ // 配置文件
11
+ UEDITOR_CONFIG: 'ueditor.config.js',
12
+ // 主文件
13
+ UEDITOR_ALL: 'ueditor.all.js',
14
+ // 语言文件
15
+ GET_UEDITOR_LANG: function GET_UEDITOR_LANG() {
16
+ var lang = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'zh-cn';
17
+ return "lang/".concat(lang, "/").concat(lang, ".js");
18
+ }
19
+ };
@@ -0,0 +1,77 @@
1
+ {
2
+ "imageActionName": "image",
3
+ "imageFieldName": "file",
4
+ "imageMaxSize": 10485760,
5
+ "imageAllowFiles": [
6
+ ".jpg",
7
+ ".png",
8
+ ".jpeg"
9
+ ],
10
+ "imageCompressEnable": true,
11
+ "imageCompressBorder": 5000,
12
+ "imageInsertAlign": "none",
13
+ "imageUrlPrefix": "",
14
+ "scrawlActionName": "crawl",
15
+ "scrawlFieldName": "file",
16
+ "scrawlMaxSize": 10485760,
17
+ "scrawlUrlPrefix": "",
18
+ "scrawlInsertAlign": "none",
19
+ "snapscreenActionName": "snap",
20
+ "snapscreenUrlPrefix": "",
21
+ "snapscreenInsertAlign": "none",
22
+ "catcherLocalDomain": [
23
+ "127.0.0.1",
24
+ "localhost"
25
+ ],
26
+ "catcherActionName": "catch",
27
+ "catcherFieldName": "source",
28
+ "catcherUrlPrefix": "",
29
+ "catcherMaxSize": 10485760,
30
+ "catcherAllowFiles": [
31
+ ".jpg",
32
+ ".png",
33
+ ".jpeg"
34
+ ],
35
+ "videoActionName": "video",
36
+ "videoFieldName": "file",
37
+ "videoUrlPrefix": "",
38
+ "videoMaxSize": 104857600,
39
+ "videoAllowFiles": [
40
+ ".mp4",
41
+ ".webm",
42
+ ".mkv"
43
+ ],
44
+ "audioActionName": "audio",
45
+ "audioFieldName": "file",
46
+ "audioUrlPrefix": "",
47
+ "audioMaxSize": 104857600,
48
+ "audioAllowFiles": [
49
+ ".mp3"
50
+ ],
51
+ "fileActionName": "file",
52
+ "fileFieldName": "file",
53
+ "fileUrlPrefix": "",
54
+ "fileMaxSize": 104857600,
55
+ "fileAllowFiles": [
56
+ ".zip",
57
+ ".pdf",
58
+ ".doc"
59
+ ],
60
+ "imageManagerActionName": "listImage",
61
+ "imageManagerListSize": 20,
62
+ "imageManagerUrlPrefix": "",
63
+ "imageManagerInsertAlign": "none",
64
+ "imageManagerAllowFiles": [
65
+ ".jpg",
66
+ ".png",
67
+ ".jpeg"
68
+ ],
69
+ "fileManagerActionName": "listFile",
70
+ "fileManagerUrlPrefix": "",
71
+ "fileManagerListSize": 20,
72
+ "fileManagerAllowFiles": [
73
+ ".zip",
74
+ ".pdf",
75
+ ".doc"
76
+ ]
77
+ }
package/es/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import LcdpUeditor from './LcdpUeditor';
2
+ import type { ILcdpUeditorProps } from './type';
3
+ export { LcdpUeditor, ILcdpUeditorProps, };
4
+ export default LcdpUeditor;
package/es/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import LcdpUeditor from "./LcdpUeditor";
2
+ export { LcdpUeditor };
3
+ export default LcdpUeditor;
@@ -0,0 +1,21 @@
1
+ declare class UeditorResourceLoader {
2
+ private static instance;
3
+ private callbackList;
4
+ private errorCallbackList;
5
+ private isReady;
6
+ private loading;
7
+ private initError;
8
+ static startLoad(jsList: string[]): Promise<void>;
9
+ static getInstance(): UeditorResourceLoader;
10
+ /**
11
+ * 加载完成执行
12
+ * @param callback 回调函数
13
+ */
14
+ static onReady(callback: Function): void;
15
+ /**
16
+ * 资源加载失败执行
17
+ * @param callback
18
+ */
19
+ static onLoadError(callback: Function): void;
20
+ }
21
+ export default UeditorResourceLoader;