@lingxiteam/lcdp-ueditor-react 1.0.1 → 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.
@@ -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 回调给编辑器
@@ -0,0 +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;IA4CpC,iBAAiB,IAAI,IAAI;IAIzB,yBAAyB,CAAC,SAAS,EAAE,iBAAiB;IAiBtD,oBAAoB,IAAI,IAAI;IAM5B,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,UAAU;IAWlB;;;;OAIG;YACW,UAAU;IAqCxB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAMhB;;OAEG;IACH,OAAO,CAAC,SAAS;IAcjB;;OAEG;IACG,WAAW;IAkCjB,MAAM,IAAI,KAAK,CAAC,SAAS;CAY1B;AAED,eAAe,WAAW,CAAC"}
package/es/LcdpUeditor.js CHANGED
@@ -75,8 +75,6 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
75
75
  if (_this.props.ueditorPath) {
76
76
  _this.ueditorPath = _this.props.ueditorPath;
77
77
  }
78
- var nextValue = filterHtmlNode(_this.props.value || '').str;
79
- _this.currentContent = nextValue;
80
78
  _this.uploadFunction = function (file, type) {
81
79
  var _this$props$config;
82
80
  // TODO 内置上传 图片base64
@@ -108,7 +106,7 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
108
106
  _this.fileSelect(cb, type);
109
107
  },
110
108
  uploadFunction: _this.uploadFunction,
111
- initialContent: nextValue || '',
109
+ initialContent: '',
112
110
  pasteplain: (config === null || config === void 0 ? void 0 : config.pasteplain) === true
113
111
  });
114
112
  _this.debounceContentChange = debounce(_this.onContentChange.bind(_assertThisInitialized(_this)), 300);
@@ -167,6 +165,18 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
167
165
  }
168
166
  return str || '';
169
167
  }
168
+ }, {
169
+ key: "initConfig",
170
+ value: function initConfig() {
171
+ if (this.props.toolbars) {
172
+ this.editorConfig.toolbars = this.props.toolbars;
173
+ }
174
+ var nextValue = filterHtmlNode(this.props.value || '').str;
175
+ this.currentContent = nextValue;
176
+ if (nextValue) {
177
+ this.editorConfig.initialContent = nextValue;
178
+ }
179
+ }
170
180
 
171
181
  /**
172
182
  * 文件选择
@@ -297,9 +307,7 @@ var LcdpUeditor = /*#__PURE__*/function (_React$Component) {
297
307
  while (1) switch (_context3.prev = _context3.next) {
298
308
  case 0:
299
309
  UeditorResourceLoader.onReady(function () {
300
- if (_this3.props.toolbars) {
301
- _this3.editorConfig.toolbars = _this3.props.toolbars;
302
- }
310
+ _this3.initConfig();
303
311
  _this3.ueditorInst = window.UE.getEditor(_this3.containerId, _this3.editorConfig);
304
312
  _this3.ueditorInst.ready(function () {
305
313
  _this3.isReady = true;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["const.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;8BAMR,MAAM;CAChC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EACL,WAAW,EACX,iBAAiB,GAClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UeditorResourceLoader.d.ts","sourceRoot":"","sources":["UeditorResourceLoader.ts"],"names":[],"mappings":"AAGA,cAAM,qBAAqB;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAwB;IAE/C,OAAO,CAAC,YAAY,CAAkB;IAEtC,OAAO,CAAC,iBAAiB,CAAkB;IAE3C,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,SAAS,CAAkB;WAEf,SAAS,CAAE,MAAM,EAAE,MAAM,EAAE;WAgCjC,WAAW;IAOzB;;;OAGG;WACW,OAAO,CAAC,QAAQ,EAAE,QAAQ;IASxC;;;OAGG;WACW,WAAW,CAAC,QAAQ,EAAE,QAAQ;CAI7C;AAED,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterHtmlNode.d.ts","sourceRoot":"","sources":["filterHtmlNode.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,QAAS,MAAM;;;;CAwCzC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadScript.d.ts","sourceRoot":"","sources":["loadScript.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,eAAO,MAAM,cAAc,SAAgB,MAAM,EAAE,kBAUlD,CAAC"}
@@ -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,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I,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 回调给编辑器
@@ -84,8 +84,6 @@ 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 || "").str;
88
- this.currentContent = nextValue;
89
87
  this.uploadFunction = (file, type) => {
90
88
  var _a;
91
89
  if (type === "image" && ((_a = this.props.config) == null ? void 0 : _a.imageType) === "base64") {
@@ -114,7 +112,7 @@ var LcdpUeditor = class extends import_react.default.Component {
114
112
  this.fileSelect(cb, type);
115
113
  },
116
114
  uploadFunction: this.uploadFunction,
117
- initialContent: nextValue || "",
115
+ initialContent: "",
118
116
  pasteplain: (config == null ? void 0 : config.pasteplain) === true
119
117
  };
120
118
  this.debounceContentChange = (0, import_debounce.default)(this.onContentChange.bind(this), 300);
@@ -158,6 +156,16 @@ var LcdpUeditor = class extends import_react.default.Component {
158
156
  }
159
157
  return str || "";
160
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
+ }
161
169
  /**
162
170
  * 文件选择
163
171
  * @param cb 回调给编辑器
@@ -227,9 +235,7 @@ var LcdpUeditor = class extends import_react.default.Component {
227
235
  */
228
236
  async initUeditor() {
229
237
  import_UeditorResourceLoader.default.onReady(() => {
230
- if (this.props.toolbars) {
231
- this.editorConfig.toolbars = this.props.toolbars;
232
- }
238
+ this.initConfig();
233
239
  this.ueditorInst = window.UE.getEditor(this.containerId, this.editorConfig);
234
240
  this.ueditorInst.ready(() => {
235
241
  this.isReady = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/lcdp-ueditor-react",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -191,6 +191,7 @@ div.edui-box {
191
191
 
192
192
  .edui-default .edui-editor-iframeholder {
193
193
  position: relative;
194
+ width: 100% !important;
194
195
  /*for fix ie6 toolbarmsg under iframe bug. relative -> static */
195
196
  /*_position: static !important;*
196
197
  }
@@ -32444,7 +32444,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
32444
32444
  var editor = new UE.Editor(options);
32445
32445
  editor.options.editor = editor;
32446
32446
  utils.loadFile(document, {
32447
- href: editor.options.themePath + editor.options.theme + "/css/ueditor.css?aed2d77f",
32447
+ href: editor.options.themePath + editor.options.theme + "/css/ueditor.css?1381f83c",
32448
32448
  tag: "link",
32449
32449
  type: "text/css",
32450
32450
  rel: "stylesheet"