@lingxiteam/lcdp-ueditor-react 1.0.0-alpha.9 → 1.0.2

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 (120) hide show
  1. package/es/LcdpUeditor.d.ts +1 -0
  2. package/es/LcdpUeditor.d.ts.map +1 -0
  3. package/es/LcdpUeditor.js +72 -61
  4. package/es/const.d.ts.map +1 -0
  5. package/es/const.js +4 -4
  6. package/es/defaultConfig.json +76 -76
  7. package/es/index.d.ts.map +1 -0
  8. package/es/tools/UeditorResourceLoader.d.ts.map +1 -0
  9. package/es/tools/UeditorResourceLoader.js +11 -16
  10. package/es/tools/filterHtmlNode.d.ts +5 -0
  11. package/es/tools/filterHtmlNode.d.ts.map +1 -0
  12. package/es/tools/filterHtmlNode.js +41 -0
  13. package/es/tools/loadScript.d.ts.map +1 -0
  14. package/es/tools/loadScript.js +5 -7
  15. package/es/type.d.ts +6 -0
  16. package/es/type.d.ts.map +1 -0
  17. package/lib/LcdpUeditor.d.ts +1 -0
  18. package/lib/LcdpUeditor.js +24 -8
  19. package/lib/defaultConfig.json +76 -76
  20. package/lib/tools/filterHtmlNode.d.ts +5 -0
  21. package/lib/tools/filterHtmlNode.js +61 -0
  22. package/lib/type.d.ts +6 -0
  23. package/package.json +35 -34
  24. package/ueditor-resource/dialogs/anchor/anchor.html +62 -62
  25. package/ueditor-resource/dialogs/attachment/attachment.css +716 -716
  26. package/ueditor-resource/dialogs/attachment/attachment.html +61 -61
  27. package/ueditor-resource/dialogs/attachment/attachment.js +803 -803
  28. package/ueditor-resource/dialogs/audio/audio.css +879 -879
  29. package/ueditor-resource/dialogs/audio/audio.html +93 -93
  30. package/ueditor-resource/dialogs/audio/audio.js +815 -815
  31. package/ueditor-resource/dialogs/background/background.css +193 -193
  32. package/ueditor-resource/dialogs/background/background.html +59 -59
  33. package/ueditor-resource/dialogs/background/background.js +370 -370
  34. package/ueditor-resource/dialogs/contentimport/contentimport.html +176 -176
  35. package/ueditor-resource/dialogs/contentimport/contentimport.js +91 -91
  36. package/ueditor-resource/dialogs/emotion/emotion.css +129 -129
  37. package/ueditor-resource/dialogs/emotion/emotion.html +70 -70
  38. package/ueditor-resource/dialogs/emotion/emotion.js +186 -186
  39. package/ueditor-resource/dialogs/formula/formula.html +98 -98
  40. package/ueditor-resource/dialogs/formula/formula.js +147 -147
  41. package/ueditor-resource/dialogs/help/help.css +37 -37
  42. package/ueditor-resource/dialogs/help/help.html +82 -82
  43. package/ueditor-resource/dialogs/help/help.js +57 -57
  44. package/ueditor-resource/dialogs/image/image.css +768 -768
  45. package/ueditor-resource/dialogs/image/image.html +144 -144
  46. package/ueditor-resource/dialogs/image/image.js +1060 -1060
  47. package/ueditor-resource/dialogs/insertframe/insertframe.html +135 -135
  48. package/ueditor-resource/dialogs/internal.js +81 -81
  49. package/ueditor-resource/dialogs/link/link.html +148 -148
  50. package/ueditor-resource/dialogs/preview/preview.html +45 -45
  51. package/ueditor-resource/dialogs/scrawl/scrawl.css +324 -324
  52. package/ueditor-resource/dialogs/scrawl/scrawl.html +95 -95
  53. package/ueditor-resource/dialogs/scrawl/scrawl.js +682 -682
  54. package/ueditor-resource/dialogs/searchreplace/searchreplace.html +144 -144
  55. package/ueditor-resource/dialogs/searchreplace/searchreplace.js +174 -174
  56. package/ueditor-resource/dialogs/spechars/spechars.html +42 -42
  57. package/ueditor-resource/dialogs/spechars/spechars.js +86 -86
  58. package/ueditor-resource/dialogs/table/edittable.css +85 -85
  59. package/ueditor-resource/dialogs/table/edittable.html +69 -69
  60. package/ueditor-resource/dialogs/table/edittable.js +241 -241
  61. package/ueditor-resource/dialogs/table/edittd.html +62 -62
  62. package/ueditor-resource/dialogs/table/edittip.html +33 -33
  63. package/ueditor-resource/dialogs/template/config.js +42 -42
  64. package/ueditor-resource/dialogs/template/template.css +99 -99
  65. package/ueditor-resource/dialogs/template/template.html +26 -26
  66. package/ueditor-resource/dialogs/template/template.js +53 -53
  67. package/ueditor-resource/dialogs/video/video.css +909 -909
  68. package/ueditor-resource/dialogs/video/video.html +114 -114
  69. package/ueditor-resource/dialogs/video/video.js +867 -867
  70. package/ueditor-resource/dialogs/wordimage/wordimage.html +221 -221
  71. package/ueditor-resource/dialogs/wordimage/wordimage.js +93 -93
  72. package/ueditor-resource/lang/en/en.js +686 -686
  73. package/ueditor-resource/lang/zh-cn/zh-cn.js +748 -748
  74. package/ueditor-resource/lang/zh-tw/zh-tw.js +748 -748
  75. package/ueditor-resource/plugins/demo/demo.js +3 -3
  76. package/ueditor-resource/themes/default/css/ueditor.css +2149 -2148
  77. package/ueditor-resource/themes/default/dialog.css +17 -17
  78. package/ueditor-resource/themes/default/dialogbase.css +132 -132
  79. package/ueditor-resource/themes/default/exts/ai.svg +12 -12
  80. package/ueditor-resource/themes/default/exts/apk.svg +12 -12
  81. package/ueditor-resource/themes/default/exts/chm.svg +12 -12
  82. package/ueditor-resource/themes/default/exts/css.svg +12 -12
  83. package/ueditor-resource/themes/default/exts/doc.svg +22 -22
  84. package/ueditor-resource/themes/default/exts/docx.svg +22 -22
  85. package/ueditor-resource/themes/default/exts/dwg.svg +16 -16
  86. package/ueditor-resource/themes/default/exts/folder.svg +3 -3
  87. package/ueditor-resource/themes/default/exts/gif.svg +14 -14
  88. package/ueditor-resource/themes/default/exts/html.svg +12 -12
  89. package/ueditor-resource/themes/default/exts/jpeg.svg +14 -14
  90. package/ueditor-resource/themes/default/exts/jpg.svg +14 -14
  91. package/ueditor-resource/themes/default/exts/log.svg +12 -12
  92. package/ueditor-resource/themes/default/exts/mp3.svg +14 -14
  93. package/ueditor-resource/themes/default/exts/mp4.svg +12 -12
  94. package/ueditor-resource/themes/default/exts/pdf.svg +14 -14
  95. package/ueditor-resource/themes/default/exts/png.svg +14 -14
  96. package/ueditor-resource/themes/default/exts/ppt.svg +24 -24
  97. package/ueditor-resource/themes/default/exts/pptx.svg +24 -24
  98. package/ueditor-resource/themes/default/exts/psd.svg +12 -12
  99. package/ueditor-resource/themes/default/exts/rar.svg +12 -12
  100. package/ueditor-resource/themes/default/exts/svg.svg +12 -12
  101. package/ueditor-resource/themes/default/exts/torrent.svg +14 -14
  102. package/ueditor-resource/themes/default/exts/txt.svg +14 -14
  103. package/ueditor-resource/themes/default/exts/unknown.svg +12 -12
  104. package/ueditor-resource/themes/default/exts/xls.svg +25 -25
  105. package/ueditor-resource/themes/default/exts/xlsx.svg +25 -25
  106. package/ueditor-resource/themes/default/exts/zip.svg +12 -12
  107. package/ueditor-resource/themes/iframe.css +63 -63
  108. package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +3655 -3655
  109. package/ueditor-resource/third-party/clipboard/clipboard.js +752 -752
  110. package/ueditor-resource/third-party/codemirror/codemirror.css +106 -106
  111. package/ueditor-resource/third-party/codemirror/codemirror.js +3581 -3581
  112. package/ueditor-resource/third-party/jquery-3.5.1.js +1 -1
  113. package/ueditor-resource/third-party/jquery-3.5.1_1.js +4314 -4314
  114. package/ueditor-resource/third-party/webuploader/webuploader.css +88 -88
  115. package/ueditor-resource/third-party/webuploader/webuploader.js +3 -3
  116. package/ueditor-resource/third-party/zeroclipboard/ZeroClipboard.js +1255 -1255
  117. package/ueditor-resource/{lcdp-ueditor.all.js → ueditor.all.js} +5270 -5269
  118. package/ueditor-resource/ueditor.config.js +655 -655
  119. package/ueditor-resource/{lcdp-ueditor.parse.js → ueditor.parse.js} +13 -13
  120. package/ueditor-resource/index.html +0 -146
package/es/type.d.ts CHANGED
@@ -23,6 +23,10 @@ export interface ILcdpUeditorProps {
23
23
  * 富文本配置
24
24
  */
25
25
  config?: {
26
+ /**
27
+ * 是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴 默认false
28
+ */
29
+ pasteplain?: boolean;
26
30
  /**
27
31
  * 编辑器高度 默认300px
28
32
  */
@@ -63,7 +67,9 @@ export interface ILcdpUeditorProps {
63
67
  * 上传视频格式限制
64
68
  */
65
69
  videoAllowFiles?: string[];
70
+ maximumWords?: number;
66
71
  };
72
+ toolbars?: string[][];
67
73
  /**
68
74
  * 语言 默认 zh-cn
69
75
  * zh-cn 中文 en 英文
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,aAAc,SAAQ,KAAK,CAAC,aAAa;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAGD,MAAM,WAAW,iBAAiB;IAE9B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE;QAEL;;WAEG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;QAErB;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAEhB;;WAEG;QACH,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;QAE7B;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QAEtB;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAE3B;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC;QAErB;;WAEG;QACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAE1B;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QAEtB;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAE3B;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,CAAC;QAEtB;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAG3B,YAAY,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IAEF,QAAQ,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IAEtB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC;IAEhC;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;QAChC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC;QAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAA;KACpB,CAAC,CAAC;IAEH;;;OAGG;IACH,OAAO,CAAC,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAEvC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,QAAQ,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAGD,MAAM,WAAW,gBAAgB;IAE7B;;OAEG;IACH,UAAU,IAAI,MAAM,CAAC;IAErB;;OAEG;IACH,UAAU,IAAI,MAAM,CAAC;IAErB;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEtD;;OAEG;IACH,aAAa,IAAI,MAAM,CAAC;IAExB;;OAEG;IACH,WAAW,IAAI,MAAM,CAAC;IAEtB;;OAEG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC;IAEnB;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;IAEhB;;OAEG;IACH,aAAa,IAAI,MAAM,CAAC;CAC3B"}
@@ -57,6 +57,7 @@ declare class LcdpUeditor extends React.Component<ILcdpUeditorProps, {}> {
57
57
  componentWillUnmount(): void;
58
58
  private onContentChange;
59
59
  private getExtString;
60
+ private initConfig;
60
61
  /**
61
62
  * 文件选择
62
63
  * @param cb 回调给编辑器
@@ -36,7 +36,8 @@ var import_react = __toESM(require("react"));
36
36
  var import_const = require("./const");
37
37
  var import_defaultConfig = __toESM(require("./defaultConfig.json"));
38
38
  var import_UeditorResourceLoader = __toESM(require("./tools/UeditorResourceLoader"));
39
- var import_lodash = require("lodash");
39
+ var import_debounce = __toESM(require("lodash/debounce"));
40
+ var import_filterHtmlNode = require("./tools/filterHtmlNode");
40
41
  var LcdpUeditor = class extends import_react.default.Component {
41
42
  constructor(props) {
42
43
  super(props);
@@ -83,7 +84,6 @@ var LcdpUeditor = class extends import_react.default.Component {
83
84
  if (this.props.ueditorPath) {
84
85
  this.ueditorPath = this.props.ueditorPath;
85
86
  }
86
- this.currentContent = this.props.value;
87
87
  this.uploadFunction = (file, type) => {
88
88
  var _a;
89
89
  if (type === "image" && ((_a = this.props.config) == null ? void 0 : _a.imageType) === "base64") {
@@ -105,15 +105,17 @@ var LcdpUeditor = class extends import_react.default.Component {
105
105
  };
106
106
  this.editorConfig = {
107
107
  ...import_defaultConfig.default,
108
+ maximumWords: (config == null ? void 0 : config.maximumWords) || 1e4,
108
109
  initialFrameHeight: (config == null ? void 0 : config.height) || 300,
109
110
  autoHeightEnabled: false,
110
111
  selectCallback: (cb, type) => {
111
112
  this.fileSelect(cb, type);
112
113
  },
113
114
  uploadFunction: this.uploadFunction,
114
- initialContent: this.props.value || ""
115
+ initialContent: "",
116
+ pasteplain: (config == null ? void 0 : config.pasteplain) === true
115
117
  };
116
- this.debounceContentChange = (0, import_lodash.debounce)(this.onContentChange.bind(this), 300);
118
+ this.debounceContentChange = (0, import_debounce.default)(this.onContentChange.bind(this), 300);
117
119
  }
118
120
  componentDidMount() {
119
121
  this.initUeditor();
@@ -122,7 +124,7 @@ var LcdpUeditor = class extends import_react.default.Component {
122
124
  if (this.isReady) {
123
125
  if ("value" in nextProps && this.currentContent !== nextProps.value) {
124
126
  this.isReportFlag = false;
125
- this.ueditorInst.setContent(nextProps.value);
127
+ this.ueditorInst.setContent((0, import_filterHtmlNode.filterHtmlNode)(nextProps.value || "").str);
126
128
  }
127
129
  if (nextProps.disabled !== this.props.disabled) {
128
130
  if (nextProps.disabled) {
@@ -135,14 +137,17 @@ var LcdpUeditor = class extends import_react.default.Component {
135
137
  }
136
138
  componentWillUnmount() {
137
139
  var _a, _b;
138
- (_b = (_a = this.ueditorInst) == null ? void 0 : _a.destroy) == null ? void 0 : _b.call(_a);
140
+ if (this.isReady) {
141
+ (_b = (_a = this.ueditorInst) == null ? void 0 : _a.destroy) == null ? void 0 : _b.call(_a);
142
+ }
139
143
  }
140
144
  onContentChange() {
141
145
  if (!this.isReportFlag) {
142
146
  this.isReportFlag = true;
143
147
  } else if (this.props.onChange) {
144
- this.currentContent = this.ueditorInst.getContent();
145
- this.props.onChange(this.currentContent);
148
+ this.currentContent = this.ueditorInst.getContent() || "";
149
+ const { str, flag, source } = (0, import_filterHtmlNode.filterHtmlNode)(this.currentContent);
150
+ this.props.onChange(flag ? str : source);
146
151
  }
147
152
  }
148
153
  getExtString(str) {
@@ -151,6 +156,16 @@ var LcdpUeditor = class extends import_react.default.Component {
151
156
  }
152
157
  return str || "";
153
158
  }
159
+ initConfig() {
160
+ if (this.props.toolbars) {
161
+ this.editorConfig.toolbars = this.props.toolbars;
162
+ }
163
+ const nextValue = (0, import_filterHtmlNode.filterHtmlNode)(this.props.value || "").str;
164
+ this.currentContent = nextValue;
165
+ if (nextValue) {
166
+ this.editorConfig.initialContent = nextValue;
167
+ }
168
+ }
154
169
  /**
155
170
  * 文件选择
156
171
  * @param cb 回调给编辑器
@@ -220,6 +235,7 @@ var LcdpUeditor = class extends import_react.default.Component {
220
235
  */
221
236
  async initUeditor() {
222
237
  import_UeditorResourceLoader.default.onReady(() => {
238
+ this.initConfig();
223
239
  this.ueditorInst = window.UE.getEditor(this.containerId, this.editorConfig);
224
240
  this.ueditorInst.ready(() => {
225
241
  this.isReady = true;
@@ -1,77 +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
- ]
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
77
  }
@@ -0,0 +1,5 @@
1
+ export declare const filterHtmlNode: (str: string) => {
2
+ str: string;
3
+ flag: boolean;
4
+ source: string;
5
+ };
@@ -0,0 +1,61 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/tools/filterHtmlNode.ts
20
+ var filterHtmlNode_exports = {};
21
+ __export(filterHtmlNode_exports, {
22
+ filterHtmlNode: () => filterHtmlNode
23
+ });
24
+ module.exports = __toCommonJS(filterHtmlNode_exports);
25
+ var filterHtmlNode = (str) => {
26
+ let flag = false;
27
+ if (typeof str !== "string")
28
+ return str || "";
29
+ const blacklist = ["script", "style", "iframe"];
30
+ const parser = new DOMParser();
31
+ const doc = parser.parseFromString(str, "text/html");
32
+ function cleanNode(node) {
33
+ var _a;
34
+ if (node.nodeType === 1) {
35
+ if (blacklist.indexOf(node.nodeName.toLowerCase()) !== -1) {
36
+ (_a = node.parentNode) == null ? void 0 : _a.removeChild(node);
37
+ return;
38
+ }
39
+ for (let i = node.attributes.length - 1; i >= 0; i -= 1) {
40
+ const attr = node.attributes[i];
41
+ if (attr.name.startsWith("on") || String(node.getAttribute(attr.name)).toLowerCase().indexOf("javascript:") !== -1) {
42
+ node.removeAttribute(attr.name);
43
+ flag = true;
44
+ }
45
+ }
46
+ }
47
+ for (let i = 0; i < node.childNodes.length; i += 1) {
48
+ cleanNode(node.childNodes[i]);
49
+ }
50
+ }
51
+ cleanNode(doc.body);
52
+ return {
53
+ str: doc.body.innerHTML,
54
+ flag,
55
+ source: str
56
+ };
57
+ };
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {
60
+ filterHtmlNode
61
+ });
package/lib/type.d.ts CHANGED
@@ -23,6 +23,10 @@ export interface ILcdpUeditorProps {
23
23
  * 富文本配置
24
24
  */
25
25
  config?: {
26
+ /**
27
+ * 是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴 默认false
28
+ */
29
+ pasteplain?: boolean;
26
30
  /**
27
31
  * 编辑器高度 默认300px
28
32
  */
@@ -63,7 +67,9 @@ export interface ILcdpUeditorProps {
63
67
  * 上传视频格式限制
64
68
  */
65
69
  videoAllowFiles?: string[];
70
+ maximumWords?: number;
66
71
  };
72
+ toolbars?: string[][];
67
73
  /**
68
74
  * 语言 默认 zh-cn
69
75
  * zh-cn 中文 en 英文
package/package.json CHANGED
@@ -1,34 +1,35 @@
1
- {
2
- "name": "@lingxiteam/lcdp-ueditor-react",
3
- "version": "1.0.0-alpha.9",
4
- "module": "es/index.js",
5
- "main": "lib/index.js",
6
- "license": "MIT",
7
- "files": [
8
- "ueditor-resource",
9
- "es",
10
- "lib"
11
- ],
12
- "publishConfig": {
13
- "access": "public",
14
- "registry": "https://registry.npmjs.org/"
15
- },
16
- "types": "es/index.d.ts",
17
- "typings": "es/index.d.ts",
18
- "scripts": {
19
- "build": "father build",
20
- "dev": "father dev",
21
- "prepublishOnly": "npm run build && cd ../../ueditor-plus && npm run prepublish"
22
- },
23
- "peerDependencies": {
24
- "react": "^16.12.0 || ^17.0.0"
25
- },
26
- "dependencies": {
27
- "lodash": "^4.0.0"
28
- },
29
- "devDependencies": {
30
- "father": "^4.1.9",
31
- "@types/lodash": "^4.14.180"
32
- },
33
- "gitHead": "be7b48f706ff0186d2f2f42d59a25b4973f935d4"
34
- }
1
+ {
2
+ "name": "@lingxiteam/lcdp-ueditor-react",
3
+ "version": "1.0.2",
4
+ "license": "MIT",
5
+ "main": "lib/index.js",
6
+ "module": "es/index.js",
7
+ "types": "es/index.d.ts",
8
+ "typings": "es/index.d.ts",
9
+ "files": [
10
+ "ueditor-resource",
11
+ "es",
12
+ "lib"
13
+ ],
14
+ "scripts": {
15
+ "build": "father build",
16
+ "dev": "father dev",
17
+ "prepublishOnly": "npm run build && cd ../../ueditor-plus && npm run prepublish"
18
+ },
19
+ "devDependencies": {
20
+ "@types/lodash": "^4.14.180",
21
+ "father": "^4.1.9"
22
+ },
23
+ "peerDependencies": {
24
+ "react": "^16.12.0 || ^17.0.0",
25
+ "lodash": "^4.0.0"
26
+ },
27
+ "dependencies": {
28
+ "@babel/runtime": "7.23.2"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public",
32
+ "registry": "https://registry.npmjs.org/"
33
+ },
34
+ "gitHead": "be7b48f706ff0186d2f2f42d59a25b4973f935d4"
35
+ }
@@ -1,62 +1,62 @@
1
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
- "http://www.w3.org/TR/html4/loose.dtd">
3
- <html>
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
6
- <title></title>
7
- <style type="text/css">
8
- * {
9
- color: #838383;
10
- margin: 0;
11
- padding: 0
12
- }
13
-
14
- html, body {
15
- font-size: 12px;
16
- overflow: hidden;
17
- }
18
-
19
- .content {
20
- padding: 5px 0 0 15px;
21
- }
22
-
23
- input {
24
- margin-left: 4px;
25
- box-sizing: border-box;
26
- width: 210px;
27
- height: 30px;
28
- line-height: 30px;
29
- border: 1px solid #d7d7d7;
30
- border-radius: 3px;
31
- padding: 0 5px;
32
- outline: none;
33
- }
34
- </style>
35
- </head>
36
- <body>
37
- <div class="content">
38
- <span><var id="lang_input_anchorName"></var></span><input id="anchorName" value=""/>
39
- </div>
40
- <script type="text/javascript" src="../internal.js?32939b8e"></script>
41
- <script type="text/javascript">
42
- var anchorInput = $G('anchorName'),
43
- node = editor.selection.getRange().getClosedNode();
44
- if (node && node.tagName == 'IMG' && (node = node.getAttribute('anchorname'))) {
45
- anchorInput.value = node;
46
- }
47
- anchorInput.onkeydown = function (evt) {
48
- evt = evt || window.event;
49
- if (evt.keyCode == 13) {
50
- editor.execCommand('anchor', anchorInput.value);
51
- dialog.close();
52
- domUtils.preventDefault(evt)
53
- }
54
- };
55
- dialog.onok = function () {
56
- editor.execCommand('anchor', anchorInput.value);
57
- dialog.close();
58
- };
59
- $focus(anchorInput);
60
- </script>
61
- </body>
62
- </html>
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
6
+ <title></title>
7
+ <style type="text/css">
8
+ * {
9
+ color: #838383;
10
+ margin: 0;
11
+ padding: 0
12
+ }
13
+
14
+ html, body {
15
+ font-size: 12px;
16
+ overflow: hidden;
17
+ }
18
+
19
+ .content {
20
+ padding: 5px 0 0 15px;
21
+ }
22
+
23
+ input {
24
+ margin-left: 4px;
25
+ box-sizing: border-box;
26
+ width: 210px;
27
+ height: 30px;
28
+ line-height: 30px;
29
+ border: 1px solid #d7d7d7;
30
+ border-radius: 3px;
31
+ padding: 0 5px;
32
+ outline: none;
33
+ }
34
+ </style>
35
+ </head>
36
+ <body>
37
+ <div class="content">
38
+ <span><var id="lang_input_anchorName"></var></span><input id="anchorName" value=""/>
39
+ </div>
40
+ <script type="text/javascript" src="../internal.js?aea0c61c"></script>
41
+ <script type="text/javascript">
42
+ var anchorInput = $G('anchorName'),
43
+ node = editor.selection.getRange().getClosedNode();
44
+ if (node && node.tagName == 'IMG' && (node = node.getAttribute('anchorname'))) {
45
+ anchorInput.value = node;
46
+ }
47
+ anchorInput.onkeydown = function (evt) {
48
+ evt = evt || window.event;
49
+ if (evt.keyCode == 13) {
50
+ editor.execCommand('anchor', anchorInput.value);
51
+ dialog.close();
52
+ domUtils.preventDefault(evt)
53
+ }
54
+ };
55
+ dialog.onok = function () {
56
+ editor.execCommand('anchor', anchorInput.value);
57
+ dialog.close();
58
+ };
59
+ $focus(anchorInput);
60
+ </script>
61
+ </body>
62
+ </html>