wireless-desc-converter 1.0.7 → 1.0.9

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.
@@ -557,6 +557,7 @@ function buildRichTextModule(params) {
557
557
  props: [inputField('text', params.html || ''), inputField('width', ''), inputField('height', '')]
558
558
  }},
559
559
  { id: 'sample', type: 'multiComplex', values: [] }
560
+ // id 字段(groupId)不传:淘宝接口标记为只读字段,提交时不可携带
560
561
  ]
561
562
  }
562
563
  };
@@ -677,8 +678,8 @@ async function htmlToWirelessDesc(html, options) {
677
678
  }
678
679
 
679
680
  var segments = parseHtmlSegments(html);
680
- var textCounter = 0;
681
- var imageCounter = 0;
681
+ var textCounter = 1; // text_N 从 1 开始(淘宝示例:text_1)
682
+ var imageCounter = 0; // image_hot_area_N 从 0 开始(淘宝示例:image_hot_area_0)
682
683
  var props = [];
683
684
 
684
685
  if (options.existingModules && options.existingModules.length) {
@@ -695,11 +696,11 @@ async function htmlToWirelessDesc(html, options) {
695
696
  var seg = segments[i];
696
697
  if (seg.type === 'text') {
697
698
  if (!hasTextResolver) continue; // 无合图能力,跳过文字模块
698
- textCounter++;
699
699
  props.push(buildTextModule({ text: seg.content, styles: seg.styles, index: textCounter }));
700
+ textCounter++;
700
701
  } else if (seg.type === 'image') {
701
- imageCounter++;
702
702
  props.push(buildImageModule({ url: seg.url, width: MODULE_WIDTH, height: '', index: imageCounter }));
703
+ imageCounter++;
703
704
  }
704
705
  }
705
706
 
@@ -555,6 +555,7 @@ function buildRichTextModule(params) {
555
555
  props: [inputField('text', params.html || ''), inputField('width', ''), inputField('height', '')]
556
556
  }},
557
557
  { id: 'sample', type: 'multiComplex', values: [] }
558
+ // id 字段(groupId)不传:淘宝接口标记为只读字段,提交时不可携带
558
559
  ]
559
560
  }
560
561
  };
@@ -675,8 +676,8 @@ async function htmlToWirelessDesc(html, options) {
675
676
  }
676
677
 
677
678
  var segments = parseHtmlSegments(html);
678
- var textCounter = 0;
679
- var imageCounter = 0;
679
+ var textCounter = 1; // text_N 从 1 开始(淘宝示例:text_1)
680
+ var imageCounter = 0; // image_hot_area_N 从 0 开始(淘宝示例:image_hot_area_0)
680
681
  var props = [];
681
682
 
682
683
  if (options.existingModules && options.existingModules.length) {
@@ -693,11 +694,11 @@ async function htmlToWirelessDesc(html, options) {
693
694
  var seg = segments[i];
694
695
  if (seg.type === 'text') {
695
696
  if (!hasTextResolver) continue; // 无合图能力,跳过文字模块
696
- textCounter++;
697
697
  props.push(buildTextModule({ text: seg.content, styles: seg.styles, index: textCounter }));
698
+ textCounter++;
698
699
  } else if (seg.type === 'image') {
699
- imageCounter++;
700
700
  props.push(buildImageModule({ url: seg.url, width: MODULE_WIDTH, height: '', index: imageCounter }));
701
+ imageCounter++;
701
702
  }
702
703
  }
703
704
 
@@ -561,6 +561,7 @@
561
561
  props: [inputField('text', params.html || ''), inputField('width', ''), inputField('height', '')]
562
562
  }},
563
563
  { id: 'sample', type: 'multiComplex', values: [] }
564
+ // id 字段(groupId)不传:淘宝接口标记为只读字段,提交时不可携带
564
565
  ]
565
566
  }
566
567
  };
@@ -681,8 +682,8 @@
681
682
  }
682
683
 
683
684
  var segments = parseHtmlSegments(html);
684
- var textCounter = 0;
685
- var imageCounter = 0;
685
+ var textCounter = 1; // text_N 从 1 开始(淘宝示例:text_1)
686
+ var imageCounter = 0; // image_hot_area_N 从 0 开始(淘宝示例:image_hot_area_0)
686
687
  var props = [];
687
688
 
688
689
  if (options.existingModules && options.existingModules.length) {
@@ -699,11 +700,11 @@
699
700
  var seg = segments[i];
700
701
  if (seg.type === 'text') {
701
702
  if (!hasTextResolver) continue; // 无合图能力,跳过文字模块
702
- textCounter++;
703
703
  props.push(buildTextModule({ text: seg.content, styles: seg.styles, index: textCounter }));
704
+ textCounter++;
704
705
  } else if (seg.type === 'image') {
705
- imageCounter++;
706
706
  props.push(buildImageModule({ url: seg.url, width: MODULE_WIDTH, height: '', index: imageCounter }));
707
+ imageCounter++;
707
708
  }
708
709
  }
709
710
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wireless-desc-converter",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "淘宝新版图文编辑器 wirelessDesc 适配工具 - HTML 富文本转换为结构化 JSON",
5
5
  "type": "module",
6
6
  "main": "dist/wireless-desc-converter.umd.js",
@@ -29,7 +29,7 @@
29
29
  "license": "MIT",
30
30
  "repository": {
31
31
  "type": "git",
32
- "url": "https://github.com/chaorenzeng/wireless-desc-converter.git"
32
+ "url": "git+https://github.com/chaorenzeng/wireless-desc-converter.git"
33
33
  },
34
34
  "homepage": "https://github.com/chaorenzeng/wireless-desc-converter#readme",
35
35
  "bugs": {