@haluo/biz 2.0.49 → 2.0.50-beta.1

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.
package/dist/haluo-biz.js CHANGED
@@ -5495,6 +5495,7 @@ const _sfc_main = {
5495
5495
  editor: {},
5496
5496
  editorDom: {},
5497
5497
  uploadStore: {},
5498
+ failedUploads: [],
5498
5499
  linkContent: "",
5499
5500
  loadingText: "",
5500
5501
  progressPercent: "",
@@ -6201,8 +6202,6 @@ const _sfc_main = {
6201
6202
  }
6202
6203
  }
6203
6204
  this.updateData(true);
6204
- } else {
6205
- this.setToast(rst.origin.name + "\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
6206
6205
  }
6207
6206
  },
6208
6207
  insertVideoBtns(editor, node) {
@@ -7089,7 +7088,7 @@ const _sfc_main = {
7089
7088
  };
7090
7089
  },
7091
7090
  isHaloImage(url = "") {
7092
- return url.indexOf("jddmoto") > -1 || url.indexOf("58moto") > -1 || url.indexOf("emotofine") > -1 || url.indexOf("dronefine") > -1 || url.indexOf("evtolfine") > -1 || url.indexOf("biaofine") > -1;
7091
+ return url.indexOf("jddmoto") > -1 || url.indexOf("58moto") > -1 || url.indexOf("emotofine") > -1 || url.indexOf("dronefine") > -1 || url.indexOf("evtolfine") > -1 || url.indexOf("biaofine") > -1 || url.indexOf("robotbaodian") > -1;
7093
7092
  },
7094
7093
  updateUploads() {
7095
7094
  const me2 = this;
@@ -7097,6 +7096,7 @@ const _sfc_main = {
7097
7096
  const uploads = document.querySelectorAll(".no-upload") || [];
7098
7097
  me2.uploadStore = {};
7099
7098
  me2.currentIndex = 0;
7099
+ me2.failedUploads = [];
7100
7100
  Array.from(uploads).map((_, index) => {
7101
7101
  const id = _.getAttribute("id");
7102
7102
  const key = index + "|" + id;
@@ -7160,6 +7160,12 @@ const _sfc_main = {
7160
7160
  upload && upload.click();
7161
7161
  };
7162
7162
  }
7163
+ const imgId = currentImg2.getAttribute("id") || "";
7164
+ const imgSrc = currentImg2.getAttribute("src") || "";
7165
+ const failedInfo = { id: imgId, src: imgSrc, element: currentImg2 };
7166
+ if (!me2.failedUploads.find((item) => item.id === imgId)) {
7167
+ me2.failedUploads.push(failedInfo);
7168
+ }
7163
7169
  };
7164
7170
  return this.uploadImageByOther({
7165
7171
  itemId,
@@ -7203,6 +7209,32 @@ const _sfc_main = {
7203
7209
  parent.appendChild(arr[0]);
7204
7210
  parent.appendChild(arr[2]);
7205
7211
  }
7212
+ const imgId = currentImg.getAttribute("id") || "";
7213
+ this.failedUploads = this.failedUploads.filter((item) => item.id !== imgId);
7214
+ },
7215
+ scrollToFirstFailedImage() {
7216
+ this.failedUploads = this.failedUploads.filter((item) => {
7217
+ return item.element && document.body.contains(item.element);
7218
+ });
7219
+ if (this.failedUploads.length === 0) {
7220
+ return false;
7221
+ }
7222
+ let firstFailed = null;
7223
+ let minPosition = Infinity;
7224
+ for (const item of this.failedUploads) {
7225
+ if (item.element) {
7226
+ const position = item.element.getBoundingClientRect().top;
7227
+ if (position < minPosition) {
7228
+ minPosition = position;
7229
+ firstFailed = item;
7230
+ }
7231
+ }
7232
+ }
7233
+ if (firstFailed && firstFailed.element) {
7234
+ firstFailed.element.scrollIntoView({ behavior: "smooth", block: "center" });
7235
+ return true;
7236
+ }
7237
+ return false;
7206
7238
  },
7207
7239
  getSticker(type, handler) {
7208
7240
  this.setSticker(type.fragment.children);
@@ -5497,6 +5497,7 @@
5497
5497
  editor: {},
5498
5498
  editorDom: {},
5499
5499
  uploadStore: {},
5500
+ failedUploads: [],
5500
5501
  linkContent: "",
5501
5502
  loadingText: "",
5502
5503
  progressPercent: "",
@@ -6203,8 +6204,6 @@
6203
6204
  }
6204
6205
  }
6205
6206
  this.updateData(true);
6206
- } else {
6207
- this.setToast(rst.origin.name + "\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
6208
6207
  }
6209
6208
  },
6210
6209
  insertVideoBtns(editor, node) {
@@ -7091,7 +7090,7 @@
7091
7090
  };
7092
7091
  },
7093
7092
  isHaloImage(url = "") {
7094
- return url.indexOf("jddmoto") > -1 || url.indexOf("58moto") > -1 || url.indexOf("emotofine") > -1 || url.indexOf("dronefine") > -1 || url.indexOf("evtolfine") > -1 || url.indexOf("biaofine") > -1;
7093
+ return url.indexOf("jddmoto") > -1 || url.indexOf("58moto") > -1 || url.indexOf("emotofine") > -1 || url.indexOf("dronefine") > -1 || url.indexOf("evtolfine") > -1 || url.indexOf("biaofine") > -1 || url.indexOf("robotbaodian") > -1;
7095
7094
  },
7096
7095
  updateUploads() {
7097
7096
  const me2 = this;
@@ -7099,6 +7098,7 @@
7099
7098
  const uploads = document.querySelectorAll(".no-upload") || [];
7100
7099
  me2.uploadStore = {};
7101
7100
  me2.currentIndex = 0;
7101
+ me2.failedUploads = [];
7102
7102
  Array.from(uploads).map((_, index) => {
7103
7103
  const id = _.getAttribute("id");
7104
7104
  const key = index + "|" + id;
@@ -7162,6 +7162,12 @@
7162
7162
  upload && upload.click();
7163
7163
  };
7164
7164
  }
7165
+ const imgId = currentImg2.getAttribute("id") || "";
7166
+ const imgSrc = currentImg2.getAttribute("src") || "";
7167
+ const failedInfo = { id: imgId, src: imgSrc, element: currentImg2 };
7168
+ if (!me2.failedUploads.find((item) => item.id === imgId)) {
7169
+ me2.failedUploads.push(failedInfo);
7170
+ }
7165
7171
  };
7166
7172
  return this.uploadImageByOther({
7167
7173
  itemId,
@@ -7205,6 +7211,32 @@
7205
7211
  parent.appendChild(arr[0]);
7206
7212
  parent.appendChild(arr[2]);
7207
7213
  }
7214
+ const imgId = currentImg.getAttribute("id") || "";
7215
+ this.failedUploads = this.failedUploads.filter((item) => item.id !== imgId);
7216
+ },
7217
+ scrollToFirstFailedImage() {
7218
+ this.failedUploads = this.failedUploads.filter((item) => {
7219
+ return item.element && document.body.contains(item.element);
7220
+ });
7221
+ if (this.failedUploads.length === 0) {
7222
+ return false;
7223
+ }
7224
+ let firstFailed = null;
7225
+ let minPosition = Infinity;
7226
+ for (const item of this.failedUploads) {
7227
+ if (item.element) {
7228
+ const position = item.element.getBoundingClientRect().top;
7229
+ if (position < minPosition) {
7230
+ minPosition = position;
7231
+ firstFailed = item;
7232
+ }
7233
+ }
7234
+ }
7235
+ if (firstFailed && firstFailed.element) {
7236
+ firstFailed.element.scrollIntoView({ behavior: "smooth", block: "center" });
7237
+ return true;
7238
+ }
7239
+ return false;
7208
7240
  },
7209
7241
  getSticker(type, handler) {
7210
7242
  this.setSticker(type.fragment.children);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@haluo/biz",
3
3
  "description": "rich text",
4
- "version": "2.0.49",
4
+ "version": "2.0.50-beta.1",
5
5
  "type": "module",
6
6
  "module": "./dist/haluo-biz.js",
7
7
  "main": "./dist/haluo-biz.umd.cjs",