hoeditor-web 3.1.227 → 3.1.228

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.
@@ -104640,7 +104640,7 @@ var component = (0,componentNormalizer/* default */.A)(
104640
104640
 
104641
104641
  /***/ }),
104642
104642
 
104643
- /***/ 33316:
104643
+ /***/ 63224:
104644
104644
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
104645
104645
 
104646
104646
  "use strict";
@@ -104654,7 +104654,7 @@ __webpack_require__.d(__webpack_exports__, {
104654
104654
 
104655
104655
  // EXTERNAL MODULE: ./src/i18n/index.ts + 1 modules
104656
104656
  var i18n = __webpack_require__(49850);
104657
- ;// ./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[3].use[0]!./node_modules/unplugin/dist/webpack/loaders/transform.js?unpluginName=vite-plugin-i18n-helper!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[5]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/controls/upload/UploadImageDialog.vue?vue&type=template&id=379bed81
104657
+ ;// ./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[3].use[0]!./node_modules/unplugin/dist/webpack/loaders/transform.js?unpluginName=vite-plugin-i18n-helper!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[5]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/controls/upload/UploadImageDialog.vue?vue&type=template&id=188a8ada
104658
104658
 
104659
104659
  var render = function render() {
104660
104660
  var _vm = this,
@@ -104679,6 +104679,41 @@ var render = function render() {
104679
104679
  staticClass: "control-item"
104680
104680
  }, [_c('span', {
104681
104681
  staticClass: "label"
104682
+ }, [_vm._v("多图片")]), _c('a-checkbox', {
104683
+ attrs: {
104684
+ "size": "small"
104685
+ },
104686
+ model: {
104687
+ value: _vm.multiple,
104688
+ callback: function ($$v) {
104689
+ _vm.multiple = $$v;
104690
+ },
104691
+ expression: "multiple"
104692
+ }
104693
+ })], 1), _vm.multiple ? [_c('a-upload', {
104694
+ attrs: {
104695
+ "action": "",
104696
+ "accept": "image/*",
104697
+ "list-type": "picture-card",
104698
+ "multiple": _vm.multiple,
104699
+ "auto-upload": false,
104700
+ "show-upload-list": {
104701
+ showPreviewIcon: false,
104702
+ showRemoveIcon: true
104703
+ },
104704
+ "before-upload": _vm.multipleUpload,
104705
+ "remove": _vm.multipleRemove
104706
+ }
104707
+ }, [_c('div', [_c('a-icon', {
104708
+ attrs: {
104709
+ "type": "plus"
104710
+ }
104711
+ }), _c('div', {
104712
+ staticClass: "ant-upload-text"
104713
+ }, [_vm._v(/*#__PURE__*/(0,i18n/* i18nHelper */.p)("04-001-009-EMR.3.3.552", null, "选择图片"))])], 1)])] : [_c('li', {
104714
+ staticClass: "control-item"
104715
+ }, [_c('span', {
104716
+ staticClass: "label"
104682
104717
  }, [_vm._v(/*#__PURE__*/(0,i18n/* i18nHelper */.p)("04-001-009-EMR.3.3.243", null, "设置图片占位回填"))]), _c('a-checkbox', {
104683
104718
  attrs: {
104684
104719
  "size": "small"
@@ -104883,7 +104918,7 @@ var render = function render() {
104883
104918
  "width": this.width,
104884
104919
  "src": _vm.imageUrl
104885
104920
  }
104886
- }) : _vm._e()])])]], 2)]), _c('footer', {
104921
+ }) : _vm._e()])])]]], 2)]), _c('footer', {
104887
104922
  staticClass: "ho-modal-footer"
104888
104923
  }, [!_vm.isBackFill ? _c('a-button', {
104889
104924
  attrs: {
@@ -104911,8 +104946,20 @@ var render = function render() {
104911
104946
  };
104912
104947
  var staticRenderFns = [];
104913
104948
 
104914
- ;// ./src/components/controls/upload/UploadImageDialog.vue?vue&type=template&id=379bed81
104949
+ ;// ./src/components/controls/upload/UploadImageDialog.vue?vue&type=template&id=188a8ada
104915
104950
 
104951
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
104952
+ var es_array_push = __webpack_require__(44114);
104953
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.exec.js
104954
+ var es_regexp_exec = __webpack_require__(27495);
104955
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.replace.js
104956
+ var es_string_replace = __webpack_require__(25440);
104957
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/esnext.iterator.constructor.js
104958
+ var esnext_iterator_constructor = __webpack_require__(98992);
104959
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/esnext.iterator.filter.js
104960
+ var esnext_iterator_filter = __webpack_require__(54520);
104961
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/esnext.iterator.for-each.js
104962
+ var esnext_iterator_for_each = __webpack_require__(3949);
104916
104963
  // EXTERNAL MODULE: ./src/plugins/ajax.ts
104917
104964
  var ajax = __webpack_require__(46887);
104918
104965
  // EXTERNAL MODULE: ./src/plugins/util.ts
@@ -104921,6 +104968,26 @@ var util = __webpack_require__(14865);
104921
104968
 
104922
104969
 
104923
104970
 
104971
+
104972
+
104973
+
104974
+
104975
+
104976
+
104977
+
104978
+
104979
+
104980
+
104981
+
104982
+
104983
+ function getBase64(file) {
104984
+ return new Promise((resolve, reject) => {
104985
+ const reader = new FileReader();
104986
+ reader.readAsDataURL(file);
104987
+ reader.onload = () => resolve(reader.result);
104988
+ reader.onerror = error => reject(error);
104989
+ });
104990
+ }
104924
104991
  /* harmony default export */ var UploadImageDialogvue_type_script_lang_js = ({
104925
104992
  name: 'UploadImageDialog',
104926
104993
  props: {
@@ -104936,6 +105003,10 @@ var util = __webpack_require__(14865);
104936
105003
  },
104937
105004
  data() {
104938
105005
  return {
105006
+ multiple: false,
105007
+ previewVisible: false,
105008
+ previewImage: '',
105009
+ multipleFileList: [],
104939
105010
  animationClassNames: 'control-modal-contents image-modal animation-in',
104940
105011
  fileList: [],
104941
105012
  file: null,
@@ -104963,6 +105034,10 @@ var util = __webpack_require__(14865);
104963
105034
  width: 0,
104964
105035
  height: 0
104965
105036
  },
105037
+ maxBoundingClientRect: {
105038
+ maxWidth: 0,
105039
+ maxHeight: 0
105040
+ },
104966
105041
  isBackFill: false,
104967
105042
  backFillWidth: 0,
104968
105043
  backFillHeight: 0,
@@ -104999,8 +105074,61 @@ var util = __webpack_require__(14865);
104999
105074
  this.upload = true;
105000
105075
  }
105001
105076
  this.mainBounds = this.vueController.getMainBounds();
105077
+ this.maxBoundingClientRect = this.vueController.getBoundingClientRect();
105002
105078
  },
105003
105079
  methods: {
105080
+ multipleUpload(file) {
105081
+ const reader = new FileReader();
105082
+ // 读取文件
105083
+ reader.readAsDataURL(file);
105084
+ reader.onload = e => {
105085
+ var _e$target;
105086
+ if ((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.result) {
105087
+ const img = new Image();
105088
+ img.onload = () => {
105089
+ // 获取 canvas 元素并绘制图片
105090
+ const canvas = document.createElement('canvas');
105091
+ let width = img.naturalWidth;
105092
+ let height = img.naturalHeight;
105093
+ if (width > this.maxBoundingClientRect.maxWidth) {
105094
+ height *= this.maxBoundingClientRect.maxWidth / width;
105095
+ width = this.maxBoundingClientRect.maxWidth;
105096
+ }
105097
+ if (height > this.maxBoundingClientRect.maxHeight) {
105098
+ width *= this.maxBoundingClientRect.maxHeight / height;
105099
+ height = this.maxBoundingClientRect.maxHeight;
105100
+ }
105101
+ canvas.width = width;
105102
+ canvas.height = height;
105103
+ const ctx = canvas.getContext('2d');
105104
+ ctx.fillStyle = "#FFFFFF";
105105
+ ctx.fillRect(0, 0, width, height);
105106
+ ctx.drawImage(img, 0, 0, width, height);
105107
+ const base64Url = canvas.toDataURL("image/png").replace('data:image/png;base64,', '');
105108
+ this.multipleFileList.push({
105109
+ url: base64Url,
105110
+ width: width,
105111
+ height: height
105112
+ });
105113
+ };
105114
+ img.onerror = error => {};
105115
+ img.src = e.target.result;
105116
+ }
105117
+ };
105118
+ return false;
105119
+ },
105120
+ multipleRemove(file) {
105121
+ this.multipleFileList = this.multipleFileList.filter(item => item.url !== file.url);
105122
+ },
105123
+ handleCancel() {
105124
+ this.previewVisible = false;
105125
+ },
105126
+ handleChange({
105127
+ fileList
105128
+ }) {
105129
+ // console.log(fileList);
105130
+ // this.multipleFileList = fileList;
105131
+ },
105004
105132
  uploadImage(file) {
105005
105133
  this.file = file;
105006
105134
  this.scale = 0;
@@ -105135,9 +105263,47 @@ var util = __webpack_require__(14865);
105135
105263
  this.handleClose();
105136
105264
  });
105137
105265
  },
105138
- sure() {
105139
- if (this.file) {
105140
- this.uploadfwq(this.file);
105266
+ async sure() {
105267
+ if (this.multiple) {
105268
+ if (this.vueController.uploadImage) {
105269
+ this.uploadLoading = true;
105270
+ const imgList = [];
105271
+ this.multipleFileList.forEach(item => {
105272
+ imgList.push(item.url);
105273
+ });
105274
+ const result = await this.vueController.uploadImage(imgList);
105275
+ if (result.data) {
105276
+ if (Array.isArray(result.data)) {
105277
+ result.data.forEach((url, index) => {
105278
+ this.vueController.insertImage(result.suffix + url, Number(this.multipleFileList[index].width), Number(this.multipleFileList[index].height));
105279
+ });
105280
+ this.handleClose();
105281
+ return;
105282
+ }
105283
+ }
105284
+ }
105285
+ this.multipleFileList.forEach((item, index) => {
105286
+ this.vueController.insertImage('data:image/png;base64,' + item.url, Number(item.width), Number(item.height));
105287
+ });
105288
+ this.handleClose();
105289
+ } else if (this.file) {
105290
+ if (this.vueController.uploadImage) {
105291
+ this.uploadLoading = true;
105292
+ const imgList = [];
105293
+ const result = await this.vueController.uploadImage([this.imageUrl.replace('data:image/png;base64,', '')]);
105294
+ if (result.data) {
105295
+ if (Array.isArray(result.data)) {
105296
+ result.data.forEach((url, index) => {
105297
+ this.vueController.insertImage(result.suffix + url, Number(this.width), Number(this.height));
105298
+ });
105299
+ this.handleClose();
105300
+ return;
105301
+ }
105302
+ }
105303
+ this.insertBase64Image();
105304
+ } else {
105305
+ this.uploadfwq(this.file);
105306
+ }
105141
105307
  } else {
105142
105308
  this.$message.warn(/*#__PURE__*/(0,i18n/* i18nHelper */.p)("04-001-009-EMR.3.3.492", null, "请选择图片"));
105143
105309
  }
@@ -105160,6 +105326,7 @@ var util = __webpack_require__(14865);
105160
105326
  this.compress = true;
105161
105327
  this.size = 0;
105162
105328
  this.animationClassNames = 'control-modal-contents image-modal animation-out';
105329
+ this.uploadLoading = false;
105163
105330
  this.$emit('closed');
105164
105331
  }
105165
105332
  }
@@ -105168,10 +105335,10 @@ var util = __webpack_require__(14865);
105168
105335
 
105169
105336
  /* harmony default export */ var upload_UploadImageDialogvue_type_script_lang_js = (UploadImageDialogvue_type_script_lang_js);
105170
105337
 
105171
- ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-32.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-32.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-32.use[2]!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-32.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/controls/upload/UploadImageDialog.vue?vue&type=style&index=0&id=379bed81&prod&lang=less
105338
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-32.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-32.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-32.use[2]!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-32.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/controls/upload/UploadImageDialog.vue?vue&type=style&index=0&id=188a8ada&prod&lang=less
105172
105339
  // extracted by mini-css-extract-plugin
105173
105340
 
105174
- ;// ./src/components/controls/upload/UploadImageDialog.vue?vue&type=style&index=0&id=379bed81&prod&lang=less
105341
+ ;// ./src/components/controls/upload/UploadImageDialog.vue?vue&type=style&index=0&id=188a8ada&prod&lang=less
105175
105342
 
105176
105343
  // EXTERNAL MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
105177
105344
  var componentNormalizer = __webpack_require__(81656);
@@ -108044,7 +108211,7 @@ const textParams = {
108044
108211
  /***/ (function(__unused_webpack_module, __webpack_exports__) {
108045
108212
 
108046
108213
  "use strict";
108047
- /* harmony default export */ __webpack_exports__.A = ('3.1.227');
108214
+ /* harmony default export */ __webpack_exports__.A = ('3.1.228');
108048
108215
 
108049
108216
  /***/ }),
108050
108217
 
@@ -142870,6 +143037,16 @@ class DrawCombineNode extends _DrawContainer__WEBPACK_IMPORTED_MODULE_2__/* .Dra
142870
143037
  }
142871
143038
  this.on('click', e => {
142872
143039
  if (e.nativeEvent.button === 0) {
143040
+ if (hoEditorFactory.drawTree.paintStatus === _drawTree_DrawTree__WEBPACK_IMPORTED_MODULE_5__/* .PaintState */ .ak.psEdit && (hoEditorFactory.forbidEditBeforeSign || hoEditorFactory.lockContent)) {
143041
+ const endPos = hoEditorFactory.drawTree.selectRange.spEnd;
143042
+ const node = hoEditorFactory.drawTree.getDNodeByPath(endPos.path);
143043
+ const dline = hoEditorFactory.drawTree.getDrawLineByDNode(node);
143044
+ const stagePt = dline.localToGlobal(node.x, node.y);
143045
+ const result = hoEditorFactory.vueController.isCanEdit(endPos.page.pageIndex, stagePt.y);
143046
+ if (!result) {
143047
+ return;
143048
+ }
143049
+ }
142873
143050
  hoEditorFactory.nodeMouseMove.NodeClick(this._node, _editor_events_DmouseEvent__WEBPACK_IMPORTED_MODULE_3__/* .DmouseEventType */ .e.detClick);
142874
143051
  }
142875
143052
  });
@@ -162082,7 +162259,7 @@ var map = {
162082
162259
  "./textDialog/VerifyTip.vue": 7900,
162083
162260
  "./upload/CanvasImageDialog.vue": 97377,
162084
162261
  "./upload/HoFabric.vue": 7843,
162085
- "./upload/UploadImageDialog.vue": 33316,
162262
+ "./upload/UploadImageDialog.vue": 63224,
162086
162263
  "./upload/hoFabricRight.vue": 52075,
162087
162264
  "./verifyTip/VerifyTip.vue": 24833
162088
162265
  };
@@ -228661,7 +228838,31 @@ class entry_lib_VueController {
228661
228838
  }
228662
228839
  }
228663
228840
  }
228664
- pasteImageToInsert(clipboardData) {
228841
+ getBoundingClientRect() {
228842
+ const hoEditorFactory = entry_lib_HOEditorFactorys/* HOEditorFactorys */.O.instance().getFactory(this._hoEditorFactoryID);
228843
+ const curDomRange = hoEditorFactory.docTree.curDomRange.normalize();
228844
+ const npStart = curDomRange.npStart;
228845
+ let maxWidth = 0;
228846
+ let maxHeight = 0;
228847
+ let nodes = [];
228848
+ if (npStart && npStart.node) {
228849
+ const [isInTable, table, scell, ecell] = curDomRange.inSameTableCell();
228850
+ maxWidth = hoEditorFactory.pageProperty.widthPixes - hoEditorFactory.pageProperty.leftMarginPixes - hoEditorFactory.pageProperty.rightMarginPixes - 20;
228851
+ maxHeight = hoEditorFactory.pageProperty.heightPixes - hoEditorFactory.drawTree.caret.Y - hoEditorFactory.pageProperty.bottomMarginPixes - 30;
228852
+ if (isInTable && scell) {
228853
+ maxWidth = scell.drawCell.dWidth - 10;
228854
+ const rowInfos = scell.table.rowInfos[scell.table.rows.indexOf(scell.row)];
228855
+ if (rowInfos.rowProperty.isSpecifyHeight) {
228856
+ maxHeight = rowInfos.rowHeight - 10;
228857
+ }
228858
+ }
228859
+ }
228860
+ return {
228861
+ maxWidth: maxWidth,
228862
+ maxHeight: maxHeight
228863
+ };
228864
+ }
228865
+ async pasteImageToInsert(clipboardData) {
228665
228866
  const hoEditorFactory = entry_lib_HOEditorFactorys/* HOEditorFactorys */.O.instance().getFactory(this._hoEditorFactoryID);
228666
228867
  const clipboardItems = clipboardData.items;
228667
228868
  const curDomRange = hoEditorFactory.docTree.curDomRange.normalize();
@@ -228688,6 +228889,7 @@ class entry_lib_VueController {
228688
228889
  hoEditorFactory.docController.parseNodeData(nodes);
228689
228890
  }
228690
228891
  }
228892
+ const imagePromises = [];
228691
228893
  for (const item of clipboardItems) {
228692
228894
  if (item.kind === 'file') {
228693
228895
  const file = item.getAsFile();
@@ -228696,39 +228898,67 @@ class entry_lib_VueController {
228696
228898
  // 读取文件
228697
228899
  reader.readAsDataURL(file);
228698
228900
  // 读取完文件之后会回来这里
228699
- reader.onload = e => {
228700
- var _e$target;
228701
- if ((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.result) {
228702
- var _e$target2;
228703
- const img = new Image();
228704
- img.onload = () => {
228705
- // 获取 canvas 元素并绘制图片
228706
- const canvas = document.createElement('canvas');
228707
- let width = img.naturalWidth;
228708
- let height = img.naturalHeight;
228709
- if (width > maxWidth) {
228710
- height *= maxWidth / width;
228711
- width = maxWidth;
228712
- }
228713
- if (height > maxHeight) {
228714
- width *= maxHeight / height;
228715
- height = maxHeight;
228716
- }
228717
- canvas.width = width;
228718
- canvas.height = height;
228719
- const ctx = canvas.getContext('2d');
228720
- ctx.fillStyle = "#FFFFFF";
228721
- ctx.fillRect(0, 0, width, height);
228722
- ctx.drawImage(img, 0, 0, width, height);
228723
- hoEditorFactory.vueController.insertImage(canvas.toDataURL("image/jpeg"), Number(width), Number(height));
228724
- };
228725
- img.onerror = ev => {};
228726
- img.src = (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.result;
228727
- }
228728
- };
228901
+ const imagePromise = new Promise((resolve, reject) => {
228902
+ reader.onload = e => {
228903
+ var _e$target;
228904
+ if ((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.result) {
228905
+ const img = new Image();
228906
+ img.onload = () => resolve(img);
228907
+ img.onerror = ev => reject(ev);
228908
+ img.src = e.target.result;
228909
+ } else {
228910
+ reject(new Error('Failed to load image'));
228911
+ }
228912
+ };
228913
+ });
228914
+ imagePromises.push(imagePromise);
228729
228915
  }
228730
228916
  }
228731
228917
  }
228918
+ const images = await Promise.all(imagePromises);
228919
+ const imglist = [];
228920
+ for (const img of images) {
228921
+ // 获取 canvas 元素并绘制图片
228922
+ const canvas = document.createElement('canvas');
228923
+ let width = img.naturalWidth;
228924
+ let height = img.naturalHeight;
228925
+ if (width > maxWidth) {
228926
+ height *= maxWidth / width;
228927
+ width = maxWidth;
228928
+ }
228929
+ if (height > maxHeight) {
228930
+ width *= maxHeight / height;
228931
+ height = maxHeight;
228932
+ }
228933
+ canvas.width = width;
228934
+ canvas.height = height;
228935
+ const ctx = canvas.getContext('2d');
228936
+ ctx.fillStyle = "#FFFFFF";
228937
+ ctx.fillRect(0, 0, width, height);
228938
+ ctx.drawImage(img, 0, 0, width, height);
228939
+ const base64Url = canvas.toDataURL("image/png").replace('data:image/png;base64,', '');
228940
+ imglist.push(base64Url);
228941
+ }
228942
+ try {
228943
+ // 在这里处理 imglist
228944
+
228945
+ if (this.uploadImage) {
228946
+ const result = await this.uploadImage(imglist);
228947
+ if (result.data) {
228948
+ if (Array.isArray(result.data)) {
228949
+ result.data.forEach((url, index) => {
228950
+ hoEditorFactory.vueController.insertImage(result.suffix + url, Number(images[index].width), Number(images[index].height));
228951
+ });
228952
+ return;
228953
+ }
228954
+ }
228955
+ }
228956
+ imglist.forEach((base64Url, index) => {
228957
+ hoEditorFactory.vueController.insertImage('data:image/png;base64,' + base64Url, Number(images[index].width), Number(images[index].height));
228958
+ });
228959
+ } catch (error) {
228960
+ console.error('Error loading images:', error);
228961
+ }
228732
228962
  }
228733
228963
  /**
228734
228964
  * 删除文本或者元素