@haluo/biz 2.0.43 → 2.0.45

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
@@ -5246,7 +5246,7 @@ const _sfc_main$3 = {
5246
5246
  const topicElement = document.createElement("mdd-topic");
5247
5247
  topicElement.setAttribute("data-topic", JSON.stringify({
5248
5248
  topicId: topic.id,
5249
- topicType: 0,
5249
+ topicType: topic.type || 0,
5250
5250
  startIndex: 0,
5251
5251
  // 会在updateTopicPosition中更新
5252
5252
  endIndex: 0
@@ -7278,10 +7278,25 @@ const _sfc_main = {
7278
7278
  getSticker(type, handler) {
7279
7279
  this.setSticker(type.fragment.children);
7280
7280
  },
7281
+ // 粘贴表格内容,tr换行形成段落
7282
+ setStickerTableContent(data) {
7283
+ const me2 = this;
7284
+ const rows = data.querySelectorAll("tr") || [];
7285
+ Array.from(rows).forEach(function(row) {
7286
+ const text = (row.textContent || "").replace(/\u00A0/g, " ").trim();
7287
+ if (text) {
7288
+ me2.editor.makeParagraph(text);
7289
+ }
7290
+ });
7291
+ },
7281
7292
  setStickerTextContent(data) {
7282
7293
  const me2 = this;
7283
7294
  data = Array.from(data);
7284
7295
  data.map(function(value, index) {
7296
+ if (value.tagName === "TABLE") {
7297
+ me2.setStickerTableContent(value);
7298
+ return;
7299
+ }
7285
7300
  const htmlArr = (value.innerHTML || value.outerHTML).replace(/<p[^>]*>(.*?)<\/p>/gi, "(delimiter)$1(delimiter)").replace(/<(?!\/?p\b)[^>]+>/gi, "").replace(/<\/?p[^>]*>/gi, "").replace(/<\/?.+?>/g, "").split("(delimiter)");
7286
7301
  htmlArr.map(function(nValue) {
7287
7302
  if (!nValue || nValue === "&nbsp;") {
@@ -5245,7 +5245,7 @@
5245
5245
  const topicElement = document.createElement("mdd-topic");
5246
5246
  topicElement.setAttribute("data-topic", JSON.stringify({
5247
5247
  topicId: topic.id,
5248
- topicType: 0,
5248
+ topicType: topic.type || 0,
5249
5249
  startIndex: 0,
5250
5250
  // 会在updateTopicPosition中更新
5251
5251
  endIndex: 0
@@ -7277,10 +7277,25 @@
7277
7277
  getSticker(type, handler) {
7278
7278
  this.setSticker(type.fragment.children);
7279
7279
  },
7280
+ // 粘贴表格内容,tr换行形成段落
7281
+ setStickerTableContent(data) {
7282
+ const me2 = this;
7283
+ const rows = data.querySelectorAll("tr") || [];
7284
+ Array.from(rows).forEach(function(row) {
7285
+ const text = (row.textContent || "").replace(/\u00A0/g, " ").trim();
7286
+ if (text) {
7287
+ me2.editor.makeParagraph(text);
7288
+ }
7289
+ });
7290
+ },
7280
7291
  setStickerTextContent(data) {
7281
7292
  const me2 = this;
7282
7293
  data = Array.from(data);
7283
7294
  data.map(function(value, index) {
7295
+ if (value.tagName === "TABLE") {
7296
+ me2.setStickerTableContent(value);
7297
+ return;
7298
+ }
7284
7299
  const htmlArr = (value.innerHTML || value.outerHTML).replace(/<p[^>]*>(.*?)<\/p>/gi, "(delimiter)$1(delimiter)").replace(/<(?!\/?p\b)[^>]+>/gi, "").replace(/<\/?p[^>]*>/gi, "").replace(/<\/?.+?>/g, "").split("(delimiter)");
7285
7300
  htmlArr.map(function(nValue) {
7286
7301
  if (!nValue || nValue === "&nbsp;") {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@haluo/biz",
3
3
  "description": "rich text",
4
- "version": "2.0.43",
4
+ "version": "2.0.45",
5
5
  "type": "module",
6
6
  "module": "./dist/haluo-biz.js",
7
7
  "main": "./dist/haluo-biz.umd.cjs",