@haluo/biz 1.0.4 → 1.0.6

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
@@ -767,7 +767,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
767
767
  ]),
768
768
  _: 1
769
769
  }),
770
- !$data.showToolsArticle ? (openBlock(), createBlock(_component_el_tooltip, {
770
+ $data.showToolsArticle ? (openBlock(), createBlock(_component_el_tooltip, {
771
771
  key: 0,
772
772
  class: "item",
773
773
  effect: "dark",
@@ -805,7 +805,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
805
805
  ])
806
806
  ])) : createCommentVNode("", true);
807
807
  }
808
- const ToolBar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$4], ["__scopeId", "data-v-3c4bc6f8"]]);
808
+ const ToolBar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$4], ["__scopeId", "data-v-aad1f7ce"]]);
809
809
  var script$2 = defineComponent({
810
810
  name: "CircleCloseFilled"
811
811
  });
@@ -1242,8 +1242,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1242
1242
  key: 1,
1243
1243
  "infinite-scroll-immediate": false,
1244
1244
  class: "insert-article_list",
1245
- "infinite-scroll-disabled": unref(disable),
1246
- "infinite-scroll-distance": 10
1245
+ "infinite-scroll-disabled": unref(disable)
1247
1246
  }, [
1248
1247
  (openBlock(true), createElementBlock(Fragment, null, renderList(data.data, (item, index) => {
1249
1248
  return openBlock(), createElementBlock("div", {
@@ -2021,7 +2020,7 @@ const _sfc_main = {
2021
2020
  return;
2022
2021
  }
2023
2022
  children.forEach((child) => {
2024
- if (child.nodeType === 1 && !child.className.includes("halo")) {
2023
+ if (child.nodeType === 1 && (child.tagName !== "svg" && !child.classList.includes("halo") || child.tagName === "svg")) {
2025
2024
  const parent = child.parentNode;
2026
2025
  parent.removeChild(child);
2027
2026
  }
@@ -2238,6 +2237,7 @@ const _sfc_main = {
2238
2237
  });
2239
2238
  },
2240
2239
  imgUploadHandler(type, imgSrc) {
2240
+ const me = this;
2241
2241
  if (type && imgSrc) {
2242
2242
  if (type === "uploadAgainImages") {
2243
2243
  this.updateImage(imgSrc, this.currentImg);
@@ -2249,7 +2249,7 @@ const _sfc_main = {
2249
2249
  src: imgSrc,
2250
2250
  img: imgSrc,
2251
2251
  selected: false,
2252
- seamlessFlag: this.replaceSeamless,
2252
+ seamlessFlag: me.replaceSeamless,
2253
2253
  type: "2"
2254
2254
  }, this.range);
2255
2255
  } else {
@@ -2316,7 +2316,7 @@ const _sfc_main = {
2316
2316
  return;
2317
2317
  const current = me.findParentByClass(e.target, "halo-img-content");
2318
2318
  const range = document.createRange();
2319
- range.setEnd(current.previousElementSibling || current, 1);
2319
+ range.setEnd(current.previousElementSibling, 1);
2320
2320
  range.collapse(false);
2321
2321
  me.range = range;
2322
2322
  me.replaceSeamless = data.seamlessFlag || "0";
@@ -2324,6 +2324,30 @@ const _sfc_main = {
2324
2324
  me.removePreviousImg = () => me.removeParentByClass(e.target, "halo-img-content");
2325
2325
  replaceInput.click();
2326
2326
  };
2327
+ delBtn.onclick = function(e) {
2328
+ if (me.disabled)
2329
+ return;
2330
+ const cur = me.findParentByClass(e.target, "halo-img-content");
2331
+ const currentImg = cur.getElementsByClassName("halo-picture-area")[0];
2332
+ const currentData = JSON.parse(currentImg.getAttribute("data"));
2333
+ if (currentData.seamlessFlag === "0") {
2334
+ if (!cur.previousElementSibling)
2335
+ return;
2336
+ try {
2337
+ const imgcont = cur.previousElementSibling.previousElementSibling;
2338
+ const input = imgcont.getElementsByClassName("desc-input-wrap")[0];
2339
+ const pic = imgcont.getElementsByClassName("halo-picture-area")[0];
2340
+ const data2 = JSON.parse(pic.getAttribute("data"));
2341
+ data2.seamlessFlag = "0";
2342
+ pic.setAttribute("data", JSON.stringify(data2));
2343
+ input.style.display = "";
2344
+ } catch (e2) {
2345
+ console.log(e2);
2346
+ }
2347
+ }
2348
+ me.removeParentByClass(e.target, "halo-img-content");
2349
+ me.updateData(true);
2350
+ };
2327
2351
  replaceBtn.innerHTML = "\u66FF\u6362";
2328
2352
  return [replaceBtn, delBtn, descInputWrap];
2329
2353
  },
@@ -2425,6 +2449,7 @@ const _sfc_main = {
2425
2449
  window.Squire.prototype.insertImages = function(src, data = {}, range) {
2426
2450
  var isHaloImage = me.isHaloImage(src);
2427
2451
  var scrollTop = document.documentElement.scrollTop;
2452
+ const isSeameless = data.seamlessFlag === "1";
2428
2453
  var loading = this.createElement("div", {
2429
2454
  "class": "img-loading",
2430
2455
  "contenteditable": "false"
@@ -2452,7 +2477,7 @@ const _sfc_main = {
2452
2477
  "src": src,
2453
2478
  "class": isHaloImage ? "halo-picture-area" : "halo-picture-area no-upload",
2454
2479
  "data": JSON.stringify(data),
2455
- "style": data.seamlessFlag === "1" ? "margin: 0" : "margin-top: 0",
2480
+ "style": isSeameless ? "margin: 0" : "margin-top: 0",
2456
2481
  "data-content": data.content || "",
2457
2482
  "contenteditable": "false"
2458
2483
  });
@@ -2467,16 +2492,11 @@ const _sfc_main = {
2467
2492
  "class": "halo-img-content",
2468
2493
  "contenteditable": "false"
2469
2494
  }, [...childList]);
2470
- if (me.imgType === "seamless") {
2471
- me.countList.push(p);
2472
- if (me.countList.length === me.imgList.length) {
2473
- var ct = this.createElement("div", {}, [...me.countList]);
2474
- this.insertElement(ct, range);
2475
- this.imgType = "normal";
2476
- }
2477
- return;
2478
- }
2479
2495
  this.insertElement(p, range);
2496
+ if (isSeameless) {
2497
+ me.removeDefault(p, "nextElementSibling");
2498
+ me.removeDefault(p, "previousElementSibling");
2499
+ }
2480
2500
  setTimeout(() => {
2481
2501
  document.documentElement.scrollTop = scrollTop;
2482
2502
  }, 50);
@@ -2551,6 +2571,23 @@ const _sfc_main = {
2551
2571
  };
2552
2572
  me.sticky();
2553
2573
  },
2574
+ removeDefault(next, key) {
2575
+ const me = this;
2576
+ const cur = next[key];
2577
+ if (!cur || cur.innerText !== "\n")
2578
+ return;
2579
+ const blockDefault = cur.classList.contains("halo-paragraph") || false;
2580
+ const isLasterBlock = next.classList.contains("halo-paragraph") || false;
2581
+ if (blockDefault && isLasterBlock) {
2582
+ cur.remove();
2583
+ me.removeDefault(cur, key);
2584
+ } else {
2585
+ if (blockDefault) {
2586
+ cur.style.display = "none";
2587
+ me.removeDefault(cur, key);
2588
+ }
2589
+ }
2590
+ },
2554
2591
  generateDelLinkIcon() {
2555
2592
  const me = this;
2556
2593
  const del = this.editor.createElement("img", {
@@ -771,7 +771,7 @@
771
771
  ]),
772
772
  _: 1
773
773
  }),
774
- !$data.showToolsArticle ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
774
+ $data.showToolsArticle ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
775
775
  key: 0,
776
776
  class: "item",
777
777
  effect: "dark",
@@ -809,7 +809,7 @@
809
809
  ])
810
810
  ])) : vue.createCommentVNode("", true);
811
811
  }
812
- const ToolBar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$4], ["__scopeId", "data-v-3c4bc6f8"]]);
812
+ const ToolBar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$4], ["__scopeId", "data-v-aad1f7ce"]]);
813
813
  var script$2 = vue.defineComponent({
814
814
  name: "CircleCloseFilled"
815
815
  });
@@ -1246,8 +1246,7 @@
1246
1246
  key: 1,
1247
1247
  "infinite-scroll-immediate": false,
1248
1248
  class: "insert-article_list",
1249
- "infinite-scroll-disabled": vue.unref(disable),
1250
- "infinite-scroll-distance": 10
1249
+ "infinite-scroll-disabled": vue.unref(disable)
1251
1250
  }, [
1252
1251
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(data.data, (item, index) => {
1253
1252
  return vue.openBlock(), vue.createElementBlock("div", {
@@ -2025,7 +2024,7 @@
2025
2024
  return;
2026
2025
  }
2027
2026
  children.forEach((child) => {
2028
- if (child.nodeType === 1 && !child.className.includes("halo")) {
2027
+ if (child.nodeType === 1 && (child.tagName !== "svg" && !child.classList.includes("halo") || child.tagName === "svg")) {
2029
2028
  const parent = child.parentNode;
2030
2029
  parent.removeChild(child);
2031
2030
  }
@@ -2242,6 +2241,7 @@
2242
2241
  });
2243
2242
  },
2244
2243
  imgUploadHandler(type, imgSrc) {
2244
+ const me = this;
2245
2245
  if (type && imgSrc) {
2246
2246
  if (type === "uploadAgainImages") {
2247
2247
  this.updateImage(imgSrc, this.currentImg);
@@ -2253,7 +2253,7 @@
2253
2253
  src: imgSrc,
2254
2254
  img: imgSrc,
2255
2255
  selected: false,
2256
- seamlessFlag: this.replaceSeamless,
2256
+ seamlessFlag: me.replaceSeamless,
2257
2257
  type: "2"
2258
2258
  }, this.range);
2259
2259
  } else {
@@ -2320,7 +2320,7 @@
2320
2320
  return;
2321
2321
  const current = me.findParentByClass(e.target, "halo-img-content");
2322
2322
  const range = document.createRange();
2323
- range.setEnd(current.previousElementSibling || current, 1);
2323
+ range.setEnd(current.previousElementSibling, 1);
2324
2324
  range.collapse(false);
2325
2325
  me.range = range;
2326
2326
  me.replaceSeamless = data.seamlessFlag || "0";
@@ -2328,6 +2328,30 @@
2328
2328
  me.removePreviousImg = () => me.removeParentByClass(e.target, "halo-img-content");
2329
2329
  replaceInput.click();
2330
2330
  };
2331
+ delBtn.onclick = function(e) {
2332
+ if (me.disabled)
2333
+ return;
2334
+ const cur = me.findParentByClass(e.target, "halo-img-content");
2335
+ const currentImg = cur.getElementsByClassName("halo-picture-area")[0];
2336
+ const currentData = JSON.parse(currentImg.getAttribute("data"));
2337
+ if (currentData.seamlessFlag === "0") {
2338
+ if (!cur.previousElementSibling)
2339
+ return;
2340
+ try {
2341
+ const imgcont = cur.previousElementSibling.previousElementSibling;
2342
+ const input = imgcont.getElementsByClassName("desc-input-wrap")[0];
2343
+ const pic = imgcont.getElementsByClassName("halo-picture-area")[0];
2344
+ const data2 = JSON.parse(pic.getAttribute("data"));
2345
+ data2.seamlessFlag = "0";
2346
+ pic.setAttribute("data", JSON.stringify(data2));
2347
+ input.style.display = "";
2348
+ } catch (e2) {
2349
+ console.log(e2);
2350
+ }
2351
+ }
2352
+ me.removeParentByClass(e.target, "halo-img-content");
2353
+ me.updateData(true);
2354
+ };
2331
2355
  replaceBtn.innerHTML = "\u66FF\u6362";
2332
2356
  return [replaceBtn, delBtn, descInputWrap];
2333
2357
  },
@@ -2429,6 +2453,7 @@
2429
2453
  window.Squire.prototype.insertImages = function(src, data = {}, range) {
2430
2454
  var isHaloImage = me.isHaloImage(src);
2431
2455
  var scrollTop = document.documentElement.scrollTop;
2456
+ const isSeameless = data.seamlessFlag === "1";
2432
2457
  var loading = this.createElement("div", {
2433
2458
  "class": "img-loading",
2434
2459
  "contenteditable": "false"
@@ -2456,7 +2481,7 @@
2456
2481
  "src": src,
2457
2482
  "class": isHaloImage ? "halo-picture-area" : "halo-picture-area no-upload",
2458
2483
  "data": JSON.stringify(data),
2459
- "style": data.seamlessFlag === "1" ? "margin: 0" : "margin-top: 0",
2484
+ "style": isSeameless ? "margin: 0" : "margin-top: 0",
2460
2485
  "data-content": data.content || "",
2461
2486
  "contenteditable": "false"
2462
2487
  });
@@ -2471,16 +2496,11 @@
2471
2496
  "class": "halo-img-content",
2472
2497
  "contenteditable": "false"
2473
2498
  }, [...childList]);
2474
- if (me.imgType === "seamless") {
2475
- me.countList.push(p);
2476
- if (me.countList.length === me.imgList.length) {
2477
- var ct = this.createElement("div", {}, [...me.countList]);
2478
- this.insertElement(ct, range);
2479
- this.imgType = "normal";
2480
- }
2481
- return;
2482
- }
2483
2499
  this.insertElement(p, range);
2500
+ if (isSeameless) {
2501
+ me.removeDefault(p, "nextElementSibling");
2502
+ me.removeDefault(p, "previousElementSibling");
2503
+ }
2484
2504
  setTimeout(() => {
2485
2505
  document.documentElement.scrollTop = scrollTop;
2486
2506
  }, 50);
@@ -2555,6 +2575,23 @@
2555
2575
  };
2556
2576
  me.sticky();
2557
2577
  },
2578
+ removeDefault(next, key) {
2579
+ const me = this;
2580
+ const cur = next[key];
2581
+ if (!cur || cur.innerText !== "\n")
2582
+ return;
2583
+ const blockDefault = cur.classList.contains("halo-paragraph") || false;
2584
+ const isLasterBlock = next.classList.contains("halo-paragraph") || false;
2585
+ if (blockDefault && isLasterBlock) {
2586
+ cur.remove();
2587
+ me.removeDefault(cur, key);
2588
+ } else {
2589
+ if (blockDefault) {
2590
+ cur.style.display = "none";
2591
+ me.removeDefault(cur, key);
2592
+ }
2593
+ }
2594
+ },
2558
2595
  generateDelLinkIcon() {
2559
2596
  const me = this;
2560
2597
  const del = this.editor.createElement("img", {
package/dist/style.css CHANGED
@@ -1,24 +1,24 @@
1
- .m12[data-v-3c4bc6f8] {
1
+ .m12[data-v-aad1f7ce] {
2
2
  margin: 0 12px;
3
3
  }
4
- .ml16[data-v-3c4bc6f8] {
4
+ .ml16[data-v-aad1f7ce] {
5
5
  margin-left: 16px;
6
6
  }
7
- .mr12[data-v-3c4bc6f8] {
7
+ .mr12[data-v-aad1f7ce] {
8
8
  margin-right: 12px;
9
9
  }
10
- .ml12[data-v-3c4bc6f8] {
10
+ .ml12[data-v-aad1f7ce] {
11
11
  margin-left: 12px;
12
12
  }
13
- .mr18[data-v-3c4bc6f8] {
13
+ .mr18[data-v-aad1f7ce] {
14
14
  margin-right: 18px;
15
15
  }
16
- .tools[data-v-3c4bc6f8] {
16
+ .tools[data-v-aad1f7ce] {
17
17
  z-index: 2;
18
18
  position: relative;
19
19
  background: #FAFAFA;
20
20
  }
21
- .tools .tools-content[data-v-3c4bc6f8] {
21
+ .tools .tools-content[data-v-aad1f7ce] {
22
22
  display: -webkit-box;
23
23
  display: -ms-flexbox;
24
24
  display: flex;
@@ -26,13 +26,13 @@
26
26
  -ms-flex-align: center;
27
27
  align-items: center;
28
28
  }
29
- .tools img[data-v-3c4bc6f8] {
29
+ .tools img[data-v-aad1f7ce] {
30
30
  cursor: pointer;
31
31
  }
32
- .tools .box[data-v-3c4bc6f8] {
32
+ .tools .box[data-v-aad1f7ce] {
33
33
  position: relative;
34
34
  }
35
- .tools .box .box-mask[data-v-3c4bc6f8] {
35
+ .tools .box .box-mask[data-v-aad1f7ce] {
36
36
  width: 40px;
37
37
  height: 40px;
38
38
  background: black;
@@ -41,7 +41,7 @@
41
41
  position: absolute;
42
42
  pointer-events: none;
43
43
  }
44
- .tools .tools-title[data-v-3c4bc6f8] {
44
+ .tools .tools-title[data-v-aad1f7ce] {
45
45
  color: #333333;
46
46
  font-size: 18px;
47
47
  display: -webkit-box;
@@ -52,25 +52,25 @@
52
52
  align-items: center;
53
53
  cursor: pointer;
54
54
  }
55
- .tools .disable[data-v-3c4bc6f8] {
55
+ .tools .disable[data-v-aad1f7ce] {
56
56
  cursor: not-allowed;
57
57
  -webkit-filter: blur(0.6px);
58
58
  filter: blur(0.6px);
59
59
  }
60
- .tools .disable img[data-v-3c4bc6f8] {
60
+ .tools .disable img[data-v-aad1f7ce] {
61
61
  cursor: not-allowed;
62
62
  }
63
- .tools .wrap[data-v-3c4bc6f8] {
63
+ .tools .wrap[data-v-aad1f7ce] {
64
64
  position: relative;
65
65
  }
66
- .tools[data-v-3c4bc6f8] .m-colorPicker {
66
+ .tools[data-v-aad1f7ce] .m-colorPicker {
67
67
  position: absolute;
68
68
  width: 100%;
69
69
  left: 0;
70
70
  z-index: -1;
71
71
  height: 100%;
72
72
  }
73
- .tools[data-v-3c4bc6f8] .m-colorPicker .colorBtn {
73
+ .tools[data-v-aad1f7ce] .m-colorPicker .colorBtn {
74
74
  width: 100%;
75
75
  height: 100%;
76
76
  opacity: 0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@haluo/biz",
3
3
  "description": "rich text",
4
- "version": "1.0.4",
4
+ "version": "1.0.6",
5
5
  "type": "module",
6
6
  "module": "./dist/haluo-biz.js",
7
7
  "main": "./dist/haluo-biz.umd.cjs",