@lingxiteam/lcdp-ueditor-react 1.0.0-alpha.14 → 1.0.0-alpha.16

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.
@@ -1 +1 @@
1
- {"version":3,"file":"LcdpUeditor.d.ts","sourceRoot":"","sources":["LcdpUeditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAQhD,cAAM,WAAY,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,EAAE,EAAE,CAAC;IAC9D;;OAEG;IACH,WAAW,EAAE,MAAM,CAAwB;IAE3C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAwD;IAExE;;OAEG;IACH,OAAO,CAAC,YAAY,CAAwD;IAE5E;;OAEG;IACH,OAAO,CAAC,WAAW,CAAS;IAE5B;;OAEG;IACH,OAAO,CAAC,WAAW,CAAa;IAEhC;;OAEG;IACH,OAAO,CAAC,YAAY,CAAiB;IAErC;;OAEG;IACH,OAAO,CAAC,qBAAqB,CAAW;IAExC;;OAEG;IACH,OAAO,CAAC,cAAc,CAAc;IAEpC;;OAEG;IACH,OAAO,CAAC,cAAc,CAAM;IAE5B;;OAEG;IACH,OAAO,CAAC,OAAO,CAAkB;IAEjC;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAC,CAAC,CAEnC;IAEF;;OAEG;IACH,YAAY,EAAE,GAAG,CAAM;gBAEX,KAAK,EAAE,iBAAiB;IA2CpC,iBAAiB,IAAI,IAAI;IAIzB,yBAAyB,CAAC,SAAS,EAAE,iBAAiB;IAiBtD,oBAAoB,IAAI,IAAI;IAM5B,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,YAAY;IAOpB;;;;OAIG;YACW,UAAU;IAqCxB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAMhB;;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S;IAcjB;;OAEG;IACG,WAAW;IAiCjB,MAAM,IAAI,KAAK,CAAC,SAAS;CAY1B;AAED,eAAe,WAAW,CAAC"}
package/es/LcdpUeditor.js CHANGED
@@ -85,7 +85,7 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
85
85
  if (_this.props.ueditorPath) {
86
86
  _this.ueditorPath = _this.props.ueditorPath;
87
87
  }
88
- var nextValue = filterHtmlNode(_this.props.value || '');
88
+ var nextValue = filterHtmlNode(_this.props.value || '').str;
89
89
  _this.currentContent = nextValue;
90
90
  _this.uploadFunction = function (file, type) {
91
91
  var _this$props$config;
@@ -133,7 +133,7 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
133
133
  if (this.isReady) {
134
134
  if ('value' in nextProps && this.currentContent !== nextProps.value) {
135
135
  this.isReportFlag = false;
136
- this.ueditorInst.setContent(filterHtmlNode(nextProps.value || ''));
136
+ this.ueditorInst.setContent(filterHtmlNode(nextProps.value || '').str);
137
137
  }
138
138
  // 禁用操作需要调用指定的api进行操作
139
139
  if (nextProps.disabled !== this.props.disabled) {
@@ -159,8 +159,12 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
159
159
  if (!this.isReportFlag) {
160
160
  this.isReportFlag = true;
161
161
  } else if (this.props.onChange) {
162
- this.currentContent = filterHtmlNode(this.ueditorInst.getContent() || '');
163
- this.props.onChange(this.currentContent);
162
+ this.currentContent = this.ueditorInst.getContent() || '';
163
+ var _filterHtmlNode = filterHtmlNode(this.currentContent),
164
+ str = _filterHtmlNode.str,
165
+ flag = _filterHtmlNode.flag,
166
+ source = _filterHtmlNode.source;
167
+ this.props.onChange(flag ? str : source);
164
168
  }
165
169
  }
166
170
  }, {
@@ -1 +1,5 @@
1
- export declare const filterHtmlNode: (str: string) => string;
1
+ export declare const filterHtmlNode: (str: string) => {
2
+ str: string;
3
+ flag: boolean;
4
+ source: string;
5
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"filterHtmlNode.d.ts","sourceRoot":"","sources":["filterHtmlNode.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,QAAS,MAAM,WAkCzC,CAAC"}
1
+ {"version":3,"file":"filterHtmlNode.d.ts","sourceRoot":"","sources":["filterHtmlNode.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,QAAS,MAAM;;;;CAwCzC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export var filterHtmlNode = function filterHtmlNode(str) {
2
+ var flag = false;
2
3
  if (typeof str !== 'string') return str || '';
3
4
  var blacklist = ['script', 'style', 'iframe'];
4
5
 
@@ -23,6 +24,7 @@ export var filterHtmlNode = function filterHtmlNode(str) {
23
24
  var attr = node.attributes[i];
24
25
  if (attr.name.startsWith('on') || String(node.getAttribute(attr.name)).toLowerCase().indexOf('javascript:') !== -1) {
25
26
  node.removeAttribute(attr.name);
27
+ flag = true;
26
28
  }
27
29
  }
28
30
  }
@@ -31,5 +33,9 @@ export var filterHtmlNode = function filterHtmlNode(str) {
31
33
  }
32
34
  }
33
35
  cleanNode(doc.body);
34
- return doc.body.innerHTML;
36
+ return {
37
+ str: doc.body.innerHTML,
38
+ flag: flag,
39
+ source: str
40
+ };
35
41
  };
@@ -84,7 +84,7 @@ var LcdpUeditor = class extends import_react.default.Component {
84
84
  if (this.props.ueditorPath) {
85
85
  this.ueditorPath = this.props.ueditorPath;
86
86
  }
87
- const nextValue = (0, import_filterHtmlNode.filterHtmlNode)(this.props.value || "");
87
+ const nextValue = (0, import_filterHtmlNode.filterHtmlNode)(this.props.value || "").str;
88
88
  this.currentContent = nextValue;
89
89
  this.uploadFunction = (file, type) => {
90
90
  var _a;
@@ -124,7 +124,7 @@ var LcdpUeditor = class extends import_react.default.Component {
124
124
  if (this.isReady) {
125
125
  if ("value" in nextProps && this.currentContent !== nextProps.value) {
126
126
  this.isReportFlag = false;
127
- this.ueditorInst.setContent((0, import_filterHtmlNode.filterHtmlNode)(nextProps.value || ""));
127
+ this.ueditorInst.setContent((0, import_filterHtmlNode.filterHtmlNode)(nextProps.value || "").str);
128
128
  }
129
129
  if (nextProps.disabled !== this.props.disabled) {
130
130
  if (nextProps.disabled) {
@@ -145,8 +145,9 @@ var LcdpUeditor = class extends import_react.default.Component {
145
145
  if (!this.isReportFlag) {
146
146
  this.isReportFlag = true;
147
147
  } else if (this.props.onChange) {
148
- this.currentContent = (0, import_filterHtmlNode.filterHtmlNode)(this.ueditorInst.getContent() || "");
149
- 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);
150
151
  }
151
152
  }
152
153
  getExtString(str) {
@@ -1 +1,5 @@
1
- export declare const filterHtmlNode: (str: string) => string;
1
+ export declare const filterHtmlNode: (str: string) => {
2
+ str: string;
3
+ flag: boolean;
4
+ source: string;
5
+ };
@@ -23,6 +23,7 @@ __export(filterHtmlNode_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(filterHtmlNode_exports);
25
25
  var filterHtmlNode = (str) => {
26
+ let flag = false;
26
27
  if (typeof str !== "string")
27
28
  return str || "";
28
29
  const blacklist = ["script", "style", "iframe"];
@@ -39,6 +40,7 @@ var filterHtmlNode = (str) => {
39
40
  const attr = node.attributes[i];
40
41
  if (attr.name.startsWith("on") || String(node.getAttribute(attr.name)).toLowerCase().indexOf("javascript:") !== -1) {
41
42
  node.removeAttribute(attr.name);
43
+ flag = true;
42
44
  }
43
45
  }
44
46
  }
@@ -47,7 +49,11 @@ var filterHtmlNode = (str) => {
47
49
  }
48
50
  }
49
51
  cleanNode(doc.body);
50
- return doc.body.innerHTML;
52
+ return {
53
+ str: doc.body.innerHTML,
54
+ flag,
55
+ source: str
56
+ };
51
57
  };
52
58
  // Annotate the CommonJS export names for ESM import in node:
53
59
  0 && (module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/lcdp-ueditor-react",
3
- "version": "1.0.0-alpha.14",
3
+ "version": "1.0.0-alpha.16",
4
4
  "module": "es/index.js",
5
5
  "main": "lib/index.js",
6
6
  "license": "MIT",
@@ -16435,6 +16435,7 @@ UE.plugins["paragraph"] = function () {
16435
16435
  me.commands["paragraph"] = {
16436
16436
  execCommand: function execCommand(cmdName, style, attrs, sourceCmdName) {
16437
16437
  var range = this.selection.getRange();
16438
+ var pN;
16438
16439
  //闭合时单独处理
16439
16440
  if (range.collapsed) {
16440
16441
  var txt = this.document.createTextNode("p");