ecinc-cloud-wappaio 9.7.70 → 9.7.71

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.
@@ -32796,7 +32796,7 @@ src.install = function (Vue) {
32796
32796
 
32797
32797
  /***/ }),
32798
32798
 
32799
- /***/ 56504:
32799
+ /***/ 49091:
32800
32800
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32801
32801
 
32802
32802
  "use strict";
@@ -32808,7 +32808,7 @@ __webpack_require__.d(__webpack_exports__, {
32808
32808
  "default": function() { return /* binding */ RichtextEditor; }
32809
32809
  });
32810
32810
 
32811
- ;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=template&id=0aca4eec&scoped=true
32811
+ ;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=template&id=b512d7b0&scoped=true
32812
32812
  var render = function render() {
32813
32813
  var _vm = this,
32814
32814
  _c = _vm._self._c;
@@ -32907,6 +32907,7 @@ var staticRenderFns = [];
32907
32907
  }
32908
32908
  },
32909
32909
  canEdit: function canEdit() {
32910
+ var _this = this;
32910
32911
  var readOnly = false;
32911
32912
  if (this.canEdit === 0 || this.canEdit === '0') {
32912
32913
  readOnly = true;
@@ -32914,13 +32915,18 @@ var staticRenderFns = [];
32914
32915
  this.ckeditor.destroy();
32915
32916
  this.initCkeditorToolbar(readOnly);
32916
32917
  var timer = window.setInterval(function () {
32917
- var ifrm = document.querySelector('.cke_wysiwyg_frame');
32918
- if (ifrm !== undefined && ifrm.contentDocument.body) {
32918
+ var editor = _this.ckeditor;
32919
+ if (!editor || editor.status !== 'ready' || !editor.window) return;
32920
+ var frame = editor.window.getFrame();
32921
+ var ifrm = frame && frame.$;
32922
+ if (ifrm && ifrm.contentDocument && ifrm.contentDocument.body) {
32919
32923
  window.clearInterval(timer);
32920
32924
  ifrm.contentDocument.body.style.margin = '5px';
32921
32925
  if (readOnly) {
32922
- document.querySelector('.cke_contents').style.height = ifrm.contentDocument.body.clientHeight + 90 + 'px';
32923
- document.querySelector('.cke_top').style.display = 'none';
32926
+ // 隐藏工具栏,内容区高度自适应正文内容高度(避免出现垂直滚动条)
32927
+ var topSpace = editor.ui.space('top');
32928
+ if (topSpace) topSpace.setStyle('display', 'none');
32929
+ _this.fitReadonlyHeight();
32924
32930
  }
32925
32931
  if (document.querySelector('.cke_browser_webkit')) {
32926
32932
  document.querySelector('.cke_browser_webkit').style.border = 0;
@@ -32930,7 +32936,7 @@ var staticRenderFns = [];
32930
32936
  }
32931
32937
  },
32932
32938
  mounted: function mounted() {
32933
- var _this = this;
32939
+ var _this2 = this;
32934
32940
  var toolbarBtns = [['Maximize'],
32935
32941
  // 加粗 斜体, 下划线
32936
32942
  ['Bold', 'Italic', 'Underline'],
@@ -33031,34 +33037,35 @@ var staticRenderFns = [];
33031
33037
  console.log('fileUploadResponse 上传结束.');
33032
33038
  var ifrm = document.querySelector('.cke_wysiwyg_frame');
33033
33039
  if (ifrm) {
33034
- var content = _this.ckeditor.getData().replace(/<span style="background: url.*?>.*?<\/span>/g, '');
33035
- _this.$emit('input', content);
33036
- _this.$emit('fileUploadResponse', res, content);
33040
+ var content = _this2.ckeditor.getData().replace(/<span style="background: url.*?>.*?<\/span>/g, '');
33041
+ _this2.$emit('input', content);
33042
+ _this2.$emit('fileUploadResponse', res, content);
33037
33043
  }
33038
33044
  });
33039
33045
  this.ckeditor.on('instanceReady', function () {
33040
33046
  console.log('instanceReady setData...');
33041
33047
 
33042
33048
  // 设置初始内容
33043
- _this.ckeditor.setData(_this.value);
33049
+ _this2.ckeditor.setData(_this2.value);
33044
33050
  var ifrm = document.querySelector('.cke_wysiwyg_frame');
33045
33051
  if (ifrm) {
33046
33052
  ifrm.contentDocument.body.style.margin = '5px';
33047
33053
  }
33048
- if (_this.startupMode !== 'source') {
33049
- _this.ckeditor.config.filebrowserImageUploadUrl = uploadUrl; // 上传图片的地址
33050
- _this.ckeditor.config.filebrowserImageBrowseUrl = _this.imageBrowseUrl; // 浏览图片的地址
33051
- _this.ckeditor.config.uploadUrl = _this.uploadUrl + '&paste=true'; // 剪贴版粘贴上传图片的地址
33052
- _this.ckeditor.config.filebrowserHtml5videoUploadUrl = uploadUrl; // 上传视频的地址
33053
- _this.ckeditor.config.filebrowserHtml5videoBrowseUrl = _this.videoBrowseUrl; // 浏览视频的地址
33054
- _this.ckeditor.config.filebrowserHtml5audioUploadUrl = uploadUrl; // 上传音频的地址
33055
- _this.ckeditor.config.filebrowserUploadUrl = _this.uploadUrl; // 上传附件的地址
33056
- _this.ckeditor.config.imageWidth = _this.imageWidth; // 图片/多图整体 - 宽度
33054
+ if (_this2.startupMode !== 'source') {
33055
+ _this2.ckeditor.config.filebrowserImageUploadUrl = uploadUrl; // 上传图片的地址
33056
+ _this2.ckeditor.config.filebrowserImageBrowseUrl = _this2.imageBrowseUrl; // 浏览图片的地址
33057
+ _this2.ckeditor.config.uploadUrl = _this2.uploadUrl + '&paste=true'; // 剪贴版粘贴上传图片的地址
33058
+ _this2.ckeditor.config.filebrowserHtml5videoUploadUrl = uploadUrl; // 上传视频的地址
33059
+ _this2.ckeditor.config.filebrowserHtml5videoBrowseUrl = _this2.videoBrowseUrl; // 浏览视频的地址
33060
+ _this2.ckeditor.config.filebrowserHtml5audioUploadUrl = uploadUrl; // 上传音频的地址
33061
+ _this2.ckeditor.config.filebrowserUploadUrl = _this2.uploadUrl; // 上传附件的地址
33062
+ _this2.ckeditor.config.imageWidth = _this2.imageWidth; // 图片/多图整体 - 宽度
33057
33063
 
33058
33064
  if (readOnly) {
33059
- var _ifrm = document.querySelector('.cke_wysiwyg_frame');
33060
- document.querySelector('.cke_contents').style.height = _ifrm.contentDocument.body.clientHeight + 90 + 'px';
33061
- document.querySelector('.cke_top').style.display = 'none';
33065
+ // 隐藏工具栏,内容区高度自适应正文内容高度(避免出现垂直滚动条)
33066
+ var topSpace = _this2.ckeditor.ui.space('top');
33067
+ if (topSpace) topSpace.setStyle('display', 'none');
33068
+ _this2.fitReadonlyHeight();
33062
33069
  }
33063
33070
  if (document.querySelector('.cke_browser_webkit')) {
33064
33071
  document.querySelector('.cke_browser_webkit').style.border = 0;
@@ -33066,21 +33073,26 @@ var staticRenderFns = [];
33066
33073
  }
33067
33074
  });
33068
33075
 
33076
+ // 只读模式下,内容加载完成后(含异步setData)重新自适应内容区高度
33077
+ this.ckeditor.on('dataReady', function () {
33078
+ if (readOnly) _this2.fitReadonlyHeight();
33079
+ });
33080
+
33069
33081
  // 监听数据加载完成事件,用于自动聚焦,光标定位到内容末尾
33070
33082
  if (this.autoFocus && !readOnly) {
33071
33083
  setTimeout(function () {
33072
- var range = _this.ckeditor.createRange();
33073
- range.selectNodeContents(_this.ckeditor.editable());
33084
+ var range = _this2.ckeditor.createRange();
33085
+ range.selectNodeContents(_this2.ckeditor.editable());
33074
33086
  range.shrink(CKEDITOR.SHRINK_ELEMENT, true);
33075
33087
  range.collapse();
33076
- _this.ckeditor.getSelection().selectRanges([range]);
33088
+ _this2.ckeditor.getSelection().selectRanges([range]);
33077
33089
  }, 50);
33078
33090
  }
33079
33091
 
33080
33092
  // 监听内容变更事件
33081
33093
  this.ckeditor.on('change', function () {
33082
- var content = _this.ckeditor.getData().replace(/<span style="background: url.*?>.*?<\/span>/g, '');
33083
- _this.$emit('input', content);
33094
+ var content = _this2.ckeditor.getData().replace(/<span style="background: url.*?>.*?<\/span>/g, '');
33095
+ _this2.$emit('input', content);
33084
33096
 
33085
33097
  // 绑定图片预览
33086
33098
  if (window.richtextEditorImgClick) {
@@ -33089,7 +33101,7 @@ var staticRenderFns = [];
33089
33101
  if (!readOnly) {
33090
33102
  ifrm.contentWindow.isCanRichtextEditor = true;
33091
33103
  }
33092
- _this.$nextTick(function () {
33104
+ _this2.$nextTick(function () {
33093
33105
  imgs.forEach(function (img) {
33094
33106
  img.setAttribute('onclick', 'if(!window.isCanRichtextEditor){window.open(this.src)}');
33095
33107
  });
@@ -33097,17 +33109,17 @@ var staticRenderFns = [];
33097
33109
  }
33098
33110
  });
33099
33111
  this.ckeditor.on('blur', function () {
33100
- var content = _this.ckeditor.getData().replace(/<span style="background: url.*?>.*?<\/span>/g, '');
33101
- _this.$emit('input', content);
33112
+ var content = _this2.ckeditor.getData().replace(/<span style="background: url.*?>.*?<\/span>/g, '');
33113
+ _this2.$emit('input', content);
33102
33114
  });
33103
33115
  this.ckeditor.on('key', function (evt) {
33104
- if (_this.startupMode !== 'source') {
33116
+ if (_this2.startupMode !== 'source') {
33105
33117
  // wysiwyg mode,将nbsp转为ensp、将tab转为4个ensp
33106
33118
  if (evt.data.keyCode === 32) {
33107
- _this.ckeditor.insertHtml('&ensp;');
33119
+ _this2.ckeditor.insertHtml('&ensp;');
33108
33120
  evt.cancel();
33109
33121
  } else if (evt.data.keyCode === 9) {
33110
- _this.ckeditor.insertHtml('&ensp;&ensp;&ensp;&ensp;');
33122
+ _this2.ckeditor.insertHtml('&ensp;&ensp;&ensp;&ensp;');
33111
33123
  evt.cancel();
33112
33124
  }
33113
33125
  }
@@ -33115,9 +33127,65 @@ var staticRenderFns = [];
33115
33127
  },
33116
33128
  beforeDestroy: function beforeDestroy() {
33117
33129
  delete window.isCanRichtextEditor;
33130
+ // 释放只读高度自适应相关资源
33131
+ if (this.fitReadonlyTimer) {
33132
+ clearTimeout(this.fitReadonlyTimer);
33133
+ this.fitReadonlyTimer = null;
33134
+ }
33135
+ if (this.fitResizeObserver) {
33136
+ this.fitResizeObserver.disconnect();
33137
+ this.fitResizeObserver = null;
33138
+ }
33118
33139
  this.ckeditor.destroy();
33119
33140
  },
33120
33141
  methods: {
33142
+ // 只读模式下,内容区高度自适应正文内容高度,确保不出现垂直滚动条
33143
+ fitReadonlyHeight: function fitReadonlyHeight(retry) {
33144
+ var _this3 = this;
33145
+ var editor = this.ckeditor;
33146
+ if (!editor || editor.status !== 'ready' || !editor.window) return;
33147
+ var frame = editor.window.getFrame();
33148
+ var ifrm = frame && frame.$;
33149
+ var contentsEl = editor.ui.space && editor.ui.space('contents');
33150
+ if (!ifrm || !ifrm.contentDocument || !ifrm.contentDocument.body || !contentsEl) {
33151
+ // 内容区尚未就绪,延迟重试
33152
+ if ((retry || 0) < 100) {
33153
+ this.fitReadonlyTimer = setTimeout(function () {
33154
+ return _this3.fitReadonlyHeight((retry || 0) + 1);
33155
+ }, 50);
33156
+ }
33157
+ return;
33158
+ }
33159
+ var body = ifrm.contentDocument.body;
33160
+ var bodyHeight = Math.ceil(body.scrollHeight);
33161
+ var currentHeight = parseInt(contentsEl.getStyle('height'), 10) || 0;
33162
+ // 仅在内容超出当前高度时上调(+12为body上下margin 5px*2及舍入余量),只增不减避免循环增高
33163
+ if (bodyHeight > 0 && bodyHeight > currentHeight) {
33164
+ contentsEl.setStyle('height', bodyHeight + 12 + 'px');
33165
+ }
33166
+
33167
+ // 图片异步加载完成后内容高度会变化,绑定加载事件重新自适应
33168
+ body.querySelectorAll('img').forEach(function (img) {
33169
+ if (!img.dataset.fitHeightBound) {
33170
+ img.dataset.fitHeightBound = '1';
33171
+ img.addEventListener('load', function () {
33172
+ clearTimeout(_this3.fitReadonlyTimer);
33173
+ _this3.fitReadonlyTimer = setTimeout(function () {
33174
+ return _this3.fitReadonlyHeight();
33175
+ }, 50);
33176
+ });
33177
+ }
33178
+ });
33179
+
33180
+ // 监听正文body尺寸变化(如字体加载、窗口宽度变化),持续自适应
33181
+ if (window.ResizeObserver) {
33182
+ if (this.fitResizeObserver) this.fitResizeObserver.disconnect();
33183
+ this.fitResizeObserver = new ResizeObserver(function () {
33184
+ _this3.fitReadonlyHeight();
33185
+ });
33186
+ this.fitResizeObserver.observe(body);
33187
+ }
33188
+ },
33121
33189
  initCkeditorToolbar: function initCkeditorToolbar(readOnly) {
33122
33190
  if (this.startupMode === 'source') {
33123
33191
  var richtext = document.querySelector('.richtext');
@@ -33165,9 +33233,9 @@ var staticRenderFns = [];
33165
33233
  });
33166
33234
  ;// CONCATENATED MODULE: ./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=script&lang=js
33167
33235
  /* harmony default export */ var RichtextEditor_srcvue_type_script_lang_js = (srcvue_type_script_lang_js);
33168
- // EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=style&index=0&id=0aca4eec&prod&scoped=true&lang=scss
33169
- var srcvue_type_style_index_0_id_0aca4eec_prod_scoped_true_lang_scss = __webpack_require__(8157);
33170
- ;// CONCATENATED MODULE: ./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=style&index=0&id=0aca4eec&prod&scoped=true&lang=scss
33236
+ // EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=style&index=0&id=b512d7b0&prod&scoped=true&lang=scss
33237
+ var srcvue_type_style_index_0_id_b512d7b0_prod_scoped_true_lang_scss = __webpack_require__(48928);
33238
+ ;// CONCATENATED MODULE: ./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=style&index=0&id=b512d7b0&prod&scoped=true&lang=scss
33171
33239
 
33172
33240
  // EXTERNAL MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
33173
33241
  var componentNormalizer = __webpack_require__(81656);
@@ -33186,7 +33254,7 @@ var component = (0,componentNormalizer/* default */.A)(
33186
33254
  staticRenderFns,
33187
33255
  false,
33188
33256
  null,
33189
- "0aca4eec",
33257
+ "b512d7b0",
33190
33258
  null
33191
33259
 
33192
33260
  )
@@ -169072,7 +169140,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, ".outter[data-v-0f959ac4]{position:rela
169072
169140
 
169073
169141
  /***/ }),
169074
169142
 
169075
- /***/ 54071:
169143
+ /***/ 60994:
169076
169144
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
169077
169145
 
169078
169146
  "use strict";
@@ -169086,7 +169154,7 @@ __webpack_require__.r(__webpack_exports__);
169086
169154
 
169087
169155
  var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
169088
169156
  // Module
169089
- ___CSS_LOADER_EXPORT___.push([module.id, ".richtext-container[data-v-0aca4eec]{margin:20px 0 0 0}", ""]);
169157
+ ___CSS_LOADER_EXPORT___.push([module.id, ".richtext-container[data-v-b512d7b0]{margin:20px 0 0 0}", ""]);
169090
169158
  // Exports
169091
169159
  /* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
169092
169160
 
@@ -255603,19 +255671,19 @@ var update = add("78ff4c32", content, true, {"sourceMap":false,"shadowMode":fals
255603
255671
 
255604
255672
  /***/ }),
255605
255673
 
255606
- /***/ 8157:
255674
+ /***/ 48928:
255607
255675
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
255608
255676
 
255609
255677
  // style-loader: Adds some css to the DOM by adding a <style> tag
255610
255678
 
255611
255679
  // load the styles
255612
- var content = __webpack_require__(54071);
255680
+ var content = __webpack_require__(60994);
255613
255681
  if(content.__esModule) content = content.default;
255614
255682
  if(typeof content === 'string') content = [[module.id, content, '']];
255615
255683
  if(content.locals) module.exports = content.locals;
255616
255684
  // add the styles to the DOM
255617
255685
  var add = (__webpack_require__(99548)/* ["default"] */ .A)
255618
- var update = add("0e32e1f4", content, true, {"sourceMap":false,"shadowMode":false});
255686
+ var update = add("eac6f806", content, true, {"sourceMap":false,"shadowMode":false});
255619
255687
 
255620
255688
  /***/ }),
255621
255689
 
@@ -280030,7 +280098,7 @@ var asyncComponents = [
280030
280098
  }], ['PdfTools', function () {
280031
280099
  return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 11289));
280032
280100
  }], ['RichtextEditor', function () {
280033
- return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 56504));
280101
+ return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 49091));
280034
280102
  }], ['PDFInjector', function () {
280035
280103
  return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 90820)).then(function (m) {
280036
280104
  return m.PDFInjector;
@@ -280478,7 +280546,7 @@ var PdfToolsModule = function PdfToolsModule() {
280478
280546
  return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 11289));
280479
280547
  };
280480
280548
  var RichtextEditorModule = function RichtextEditorModule() {
280481
- return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 56504));
280549
+ return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 49091));
280482
280550
  };
280483
280551
  var ModifyFormTraceModule = function ModifyFormTraceModule() {
280484
280552
  return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 26022));
@@ -32806,7 +32806,7 @@ src.install = function (Vue) {
32806
32806
 
32807
32807
  /***/ }),
32808
32808
 
32809
- /***/ 56410:
32809
+ /***/ 1444:
32810
32810
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32811
32811
 
32812
32812
  "use strict";
@@ -32818,7 +32818,7 @@ __webpack_require__.d(__webpack_exports__, {
32818
32818
  "default": function() { return /* binding */ RichtextEditor; }
32819
32819
  });
32820
32820
 
32821
- ;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[0]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=template&id=0aca4eec&scoped=true
32821
+ ;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js??clonedRuleSet-83.use[0]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=template&id=b512d7b0&scoped=true
32822
32822
  var render = function render() {
32823
32823
  var _vm = this,
32824
32824
  _c = _vm._self._c;
@@ -32917,6 +32917,7 @@ var staticRenderFns = [];
32917
32917
  }
32918
32918
  },
32919
32919
  canEdit: function canEdit() {
32920
+ var _this = this;
32920
32921
  var readOnly = false;
32921
32922
  if (this.canEdit === 0 || this.canEdit === '0') {
32922
32923
  readOnly = true;
@@ -32924,13 +32925,18 @@ var staticRenderFns = [];
32924
32925
  this.ckeditor.destroy();
32925
32926
  this.initCkeditorToolbar(readOnly);
32926
32927
  var timer = window.setInterval(function () {
32927
- var ifrm = document.querySelector('.cke_wysiwyg_frame');
32928
- if (ifrm !== undefined && ifrm.contentDocument.body) {
32928
+ var editor = _this.ckeditor;
32929
+ if (!editor || editor.status !== 'ready' || !editor.window) return;
32930
+ var frame = editor.window.getFrame();
32931
+ var ifrm = frame && frame.$;
32932
+ if (ifrm && ifrm.contentDocument && ifrm.contentDocument.body) {
32929
32933
  window.clearInterval(timer);
32930
32934
  ifrm.contentDocument.body.style.margin = '5px';
32931
32935
  if (readOnly) {
32932
- document.querySelector('.cke_contents').style.height = ifrm.contentDocument.body.clientHeight + 90 + 'px';
32933
- document.querySelector('.cke_top').style.display = 'none';
32936
+ // 隐藏工具栏,内容区高度自适应正文内容高度(避免出现垂直滚动条)
32937
+ var topSpace = editor.ui.space('top');
32938
+ if (topSpace) topSpace.setStyle('display', 'none');
32939
+ _this.fitReadonlyHeight();
32934
32940
  }
32935
32941
  if (document.querySelector('.cke_browser_webkit')) {
32936
32942
  document.querySelector('.cke_browser_webkit').style.border = 0;
@@ -32940,7 +32946,7 @@ var staticRenderFns = [];
32940
32946
  }
32941
32947
  },
32942
32948
  mounted: function mounted() {
32943
- var _this = this;
32949
+ var _this2 = this;
32944
32950
  var toolbarBtns = [['Maximize'],
32945
32951
  // 加粗 斜体, 下划线
32946
32952
  ['Bold', 'Italic', 'Underline'],
@@ -33041,34 +33047,35 @@ var staticRenderFns = [];
33041
33047
  console.log('fileUploadResponse 上传结束.');
33042
33048
  var ifrm = document.querySelector('.cke_wysiwyg_frame');
33043
33049
  if (ifrm) {
33044
- var content = _this.ckeditor.getData().replace(/<span style="background: url.*?>.*?<\/span>/g, '');
33045
- _this.$emit('input', content);
33046
- _this.$emit('fileUploadResponse', res, content);
33050
+ var content = _this2.ckeditor.getData().replace(/<span style="background: url.*?>.*?<\/span>/g, '');
33051
+ _this2.$emit('input', content);
33052
+ _this2.$emit('fileUploadResponse', res, content);
33047
33053
  }
33048
33054
  });
33049
33055
  this.ckeditor.on('instanceReady', function () {
33050
33056
  console.log('instanceReady setData...');
33051
33057
 
33052
33058
  // 设置初始内容
33053
- _this.ckeditor.setData(_this.value);
33059
+ _this2.ckeditor.setData(_this2.value);
33054
33060
  var ifrm = document.querySelector('.cke_wysiwyg_frame');
33055
33061
  if (ifrm) {
33056
33062
  ifrm.contentDocument.body.style.margin = '5px';
33057
33063
  }
33058
- if (_this.startupMode !== 'source') {
33059
- _this.ckeditor.config.filebrowserImageUploadUrl = uploadUrl; // 上传图片的地址
33060
- _this.ckeditor.config.filebrowserImageBrowseUrl = _this.imageBrowseUrl; // 浏览图片的地址
33061
- _this.ckeditor.config.uploadUrl = _this.uploadUrl + '&paste=true'; // 剪贴版粘贴上传图片的地址
33062
- _this.ckeditor.config.filebrowserHtml5videoUploadUrl = uploadUrl; // 上传视频的地址
33063
- _this.ckeditor.config.filebrowserHtml5videoBrowseUrl = _this.videoBrowseUrl; // 浏览视频的地址
33064
- _this.ckeditor.config.filebrowserHtml5audioUploadUrl = uploadUrl; // 上传音频的地址
33065
- _this.ckeditor.config.filebrowserUploadUrl = _this.uploadUrl; // 上传附件的地址
33066
- _this.ckeditor.config.imageWidth = _this.imageWidth; // 图片/多图整体 - 宽度
33064
+ if (_this2.startupMode !== 'source') {
33065
+ _this2.ckeditor.config.filebrowserImageUploadUrl = uploadUrl; // 上传图片的地址
33066
+ _this2.ckeditor.config.filebrowserImageBrowseUrl = _this2.imageBrowseUrl; // 浏览图片的地址
33067
+ _this2.ckeditor.config.uploadUrl = _this2.uploadUrl + '&paste=true'; // 剪贴版粘贴上传图片的地址
33068
+ _this2.ckeditor.config.filebrowserHtml5videoUploadUrl = uploadUrl; // 上传视频的地址
33069
+ _this2.ckeditor.config.filebrowserHtml5videoBrowseUrl = _this2.videoBrowseUrl; // 浏览视频的地址
33070
+ _this2.ckeditor.config.filebrowserHtml5audioUploadUrl = uploadUrl; // 上传音频的地址
33071
+ _this2.ckeditor.config.filebrowserUploadUrl = _this2.uploadUrl; // 上传附件的地址
33072
+ _this2.ckeditor.config.imageWidth = _this2.imageWidth; // 图片/多图整体 - 宽度
33067
33073
 
33068
33074
  if (readOnly) {
33069
- var _ifrm = document.querySelector('.cke_wysiwyg_frame');
33070
- document.querySelector('.cke_contents').style.height = _ifrm.contentDocument.body.clientHeight + 90 + 'px';
33071
- document.querySelector('.cke_top').style.display = 'none';
33075
+ // 隐藏工具栏,内容区高度自适应正文内容高度(避免出现垂直滚动条)
33076
+ var topSpace = _this2.ckeditor.ui.space('top');
33077
+ if (topSpace) topSpace.setStyle('display', 'none');
33078
+ _this2.fitReadonlyHeight();
33072
33079
  }
33073
33080
  if (document.querySelector('.cke_browser_webkit')) {
33074
33081
  document.querySelector('.cke_browser_webkit').style.border = 0;
@@ -33076,21 +33083,26 @@ var staticRenderFns = [];
33076
33083
  }
33077
33084
  });
33078
33085
 
33086
+ // 只读模式下,内容加载完成后(含异步setData)重新自适应内容区高度
33087
+ this.ckeditor.on('dataReady', function () {
33088
+ if (readOnly) _this2.fitReadonlyHeight();
33089
+ });
33090
+
33079
33091
  // 监听数据加载完成事件,用于自动聚焦,光标定位到内容末尾
33080
33092
  if (this.autoFocus && !readOnly) {
33081
33093
  setTimeout(function () {
33082
- var range = _this.ckeditor.createRange();
33083
- range.selectNodeContents(_this.ckeditor.editable());
33094
+ var range = _this2.ckeditor.createRange();
33095
+ range.selectNodeContents(_this2.ckeditor.editable());
33084
33096
  range.shrink(CKEDITOR.SHRINK_ELEMENT, true);
33085
33097
  range.collapse();
33086
- _this.ckeditor.getSelection().selectRanges([range]);
33098
+ _this2.ckeditor.getSelection().selectRanges([range]);
33087
33099
  }, 50);
33088
33100
  }
33089
33101
 
33090
33102
  // 监听内容变更事件
33091
33103
  this.ckeditor.on('change', function () {
33092
- var content = _this.ckeditor.getData().replace(/<span style="background: url.*?>.*?<\/span>/g, '');
33093
- _this.$emit('input', content);
33104
+ var content = _this2.ckeditor.getData().replace(/<span style="background: url.*?>.*?<\/span>/g, '');
33105
+ _this2.$emit('input', content);
33094
33106
 
33095
33107
  // 绑定图片预览
33096
33108
  if (window.richtextEditorImgClick) {
@@ -33099,7 +33111,7 @@ var staticRenderFns = [];
33099
33111
  if (!readOnly) {
33100
33112
  ifrm.contentWindow.isCanRichtextEditor = true;
33101
33113
  }
33102
- _this.$nextTick(function () {
33114
+ _this2.$nextTick(function () {
33103
33115
  imgs.forEach(function (img) {
33104
33116
  img.setAttribute('onclick', 'if(!window.isCanRichtextEditor){window.open(this.src)}');
33105
33117
  });
@@ -33107,17 +33119,17 @@ var staticRenderFns = [];
33107
33119
  }
33108
33120
  });
33109
33121
  this.ckeditor.on('blur', function () {
33110
- var content = _this.ckeditor.getData().replace(/<span style="background: url.*?>.*?<\/span>/g, '');
33111
- _this.$emit('input', content);
33122
+ var content = _this2.ckeditor.getData().replace(/<span style="background: url.*?>.*?<\/span>/g, '');
33123
+ _this2.$emit('input', content);
33112
33124
  });
33113
33125
  this.ckeditor.on('key', function (evt) {
33114
- if (_this.startupMode !== 'source') {
33126
+ if (_this2.startupMode !== 'source') {
33115
33127
  // wysiwyg mode,将nbsp转为ensp、将tab转为4个ensp
33116
33128
  if (evt.data.keyCode === 32) {
33117
- _this.ckeditor.insertHtml('&ensp;');
33129
+ _this2.ckeditor.insertHtml('&ensp;');
33118
33130
  evt.cancel();
33119
33131
  } else if (evt.data.keyCode === 9) {
33120
- _this.ckeditor.insertHtml('&ensp;&ensp;&ensp;&ensp;');
33132
+ _this2.ckeditor.insertHtml('&ensp;&ensp;&ensp;&ensp;');
33121
33133
  evt.cancel();
33122
33134
  }
33123
33135
  }
@@ -33125,9 +33137,65 @@ var staticRenderFns = [];
33125
33137
  },
33126
33138
  beforeDestroy: function beforeDestroy() {
33127
33139
  delete window.isCanRichtextEditor;
33140
+ // 释放只读高度自适应相关资源
33141
+ if (this.fitReadonlyTimer) {
33142
+ clearTimeout(this.fitReadonlyTimer);
33143
+ this.fitReadonlyTimer = null;
33144
+ }
33145
+ if (this.fitResizeObserver) {
33146
+ this.fitResizeObserver.disconnect();
33147
+ this.fitResizeObserver = null;
33148
+ }
33128
33149
  this.ckeditor.destroy();
33129
33150
  },
33130
33151
  methods: {
33152
+ // 只读模式下,内容区高度自适应正文内容高度,确保不出现垂直滚动条
33153
+ fitReadonlyHeight: function fitReadonlyHeight(retry) {
33154
+ var _this3 = this;
33155
+ var editor = this.ckeditor;
33156
+ if (!editor || editor.status !== 'ready' || !editor.window) return;
33157
+ var frame = editor.window.getFrame();
33158
+ var ifrm = frame && frame.$;
33159
+ var contentsEl = editor.ui.space && editor.ui.space('contents');
33160
+ if (!ifrm || !ifrm.contentDocument || !ifrm.contentDocument.body || !contentsEl) {
33161
+ // 内容区尚未就绪,延迟重试
33162
+ if ((retry || 0) < 100) {
33163
+ this.fitReadonlyTimer = setTimeout(function () {
33164
+ return _this3.fitReadonlyHeight((retry || 0) + 1);
33165
+ }, 50);
33166
+ }
33167
+ return;
33168
+ }
33169
+ var body = ifrm.contentDocument.body;
33170
+ var bodyHeight = Math.ceil(body.scrollHeight);
33171
+ var currentHeight = parseInt(contentsEl.getStyle('height'), 10) || 0;
33172
+ // 仅在内容超出当前高度时上调(+12为body上下margin 5px*2及舍入余量),只增不减避免循环增高
33173
+ if (bodyHeight > 0 && bodyHeight > currentHeight) {
33174
+ contentsEl.setStyle('height', bodyHeight + 12 + 'px');
33175
+ }
33176
+
33177
+ // 图片异步加载完成后内容高度会变化,绑定加载事件重新自适应
33178
+ body.querySelectorAll('img').forEach(function (img) {
33179
+ if (!img.dataset.fitHeightBound) {
33180
+ img.dataset.fitHeightBound = '1';
33181
+ img.addEventListener('load', function () {
33182
+ clearTimeout(_this3.fitReadonlyTimer);
33183
+ _this3.fitReadonlyTimer = setTimeout(function () {
33184
+ return _this3.fitReadonlyHeight();
33185
+ }, 50);
33186
+ });
33187
+ }
33188
+ });
33189
+
33190
+ // 监听正文body尺寸变化(如字体加载、窗口宽度变化),持续自适应
33191
+ if (window.ResizeObserver) {
33192
+ if (this.fitResizeObserver) this.fitResizeObserver.disconnect();
33193
+ this.fitResizeObserver = new ResizeObserver(function () {
33194
+ _this3.fitReadonlyHeight();
33195
+ });
33196
+ this.fitResizeObserver.observe(body);
33197
+ }
33198
+ },
33131
33199
  initCkeditorToolbar: function initCkeditorToolbar(readOnly) {
33132
33200
  if (this.startupMode === 'source') {
33133
33201
  var richtext = document.querySelector('.richtext');
@@ -33175,9 +33243,9 @@ var staticRenderFns = [];
33175
33243
  });
33176
33244
  ;// CONCATENATED MODULE: ./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=script&lang=js
33177
33245
  /* harmony default export */ var RichtextEditor_srcvue_type_script_lang_js = (srcvue_type_script_lang_js);
33178
- // EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-65.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-65.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-65.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-65.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-65.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=style&index=0&id=0aca4eec&prod&scoped=true&lang=scss
33179
- var srcvue_type_style_index_0_id_0aca4eec_prod_scoped_true_lang_scss = __webpack_require__(77198);
33180
- ;// CONCATENATED MODULE: ./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=style&index=0&id=0aca4eec&prod&scoped=true&lang=scss
33246
+ // EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-65.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-65.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-65.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-65.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-65.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=style&index=0&id=b512d7b0&prod&scoped=true&lang=scss
33247
+ var srcvue_type_style_index_0_id_b512d7b0_prod_scoped_true_lang_scss = __webpack_require__(64967);
33248
+ ;// CONCATENATED MODULE: ./packages/ecwapp/RichtextEditor/src/index.vue?vue&type=style&index=0&id=b512d7b0&prod&scoped=true&lang=scss
33181
33249
 
33182
33250
  // EXTERNAL MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
33183
33251
  var componentNormalizer = __webpack_require__(81656);
@@ -33196,7 +33264,7 @@ var component = (0,componentNormalizer/* default */.A)(
33196
33264
  staticRenderFns,
33197
33265
  false,
33198
33266
  null,
33199
- "0aca4eec",
33267
+ "b512d7b0",
33200
33268
  null
33201
33269
 
33202
33270
  )
@@ -169082,7 +169150,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, ".outter[data-v-0f959ac4]{position:rela
169082
169150
 
169083
169151
  /***/ }),
169084
169152
 
169085
- /***/ 1553:
169153
+ /***/ 54164:
169086
169154
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
169087
169155
 
169088
169156
  "use strict";
@@ -169096,7 +169164,7 @@ __webpack_require__.r(__webpack_exports__);
169096
169164
 
169097
169165
  var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
169098
169166
  // Module
169099
- ___CSS_LOADER_EXPORT___.push([module.id, ".richtext-container[data-v-0aca4eec]{margin:20px 0 0 0}", ""]);
169167
+ ___CSS_LOADER_EXPORT___.push([module.id, ".richtext-container[data-v-b512d7b0]{margin:20px 0 0 0}", ""]);
169100
169168
  // Exports
169101
169169
  /* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
169102
169170
 
@@ -255613,19 +255681,19 @@ var update = add("38d2fa45", content, true, {"sourceMap":false,"shadowMode":fals
255613
255681
 
255614
255682
  /***/ }),
255615
255683
 
255616
- /***/ 77198:
255684
+ /***/ 64967:
255617
255685
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
255618
255686
 
255619
255687
  // style-loader: Adds some css to the DOM by adding a <style> tag
255620
255688
 
255621
255689
  // load the styles
255622
- var content = __webpack_require__(1553);
255690
+ var content = __webpack_require__(54164);
255623
255691
  if(content.__esModule) content = content.default;
255624
255692
  if(typeof content === 'string') content = [[module.id, content, '']];
255625
255693
  if(content.locals) module.exports = content.locals;
255626
255694
  // add the styles to the DOM
255627
255695
  var add = (__webpack_require__(99548)/* ["default"] */ .A)
255628
- var update = add("0b6a1e38", content, true, {"sourceMap":false,"shadowMode":false});
255696
+ var update = add("e7fe344a", content, true, {"sourceMap":false,"shadowMode":false});
255629
255697
 
255630
255698
  /***/ }),
255631
255699
 
@@ -280048,7 +280116,7 @@ var asyncComponents = [
280048
280116
  }], ['PdfTools', function () {
280049
280117
  return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 44568));
280050
280118
  }], ['RichtextEditor', function () {
280051
- return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 56410));
280119
+ return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 1444));
280052
280120
  }], ['PDFInjector', function () {
280053
280121
  return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 91895)).then(function (m) {
280054
280122
  return m.PDFInjector;
@@ -280496,7 +280564,7 @@ var PdfToolsModule = function PdfToolsModule() {
280496
280564
  return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 44568));
280497
280565
  };
280498
280566
  var RichtextEditorModule = function RichtextEditorModule() {
280499
- return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 56410));
280567
+ return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 1444));
280500
280568
  };
280501
280569
  var ModifyFormTraceModule = function ModifyFormTraceModule() {
280502
280570
  return Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 81106));