wireless-desc-converter 1.0.8 → 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.
@@ -486,9 +486,9 @@ function buildTextModule(params) {
486
486
  { id: 'images', type: 'multiComplex', values: imageValues },
487
487
  singleCheckField('enable', 'true'),
488
488
  singleCheckField('countHeight', 'false'),
489
+ inputField('id', groupId),
489
490
  { id: 'textStyle', type: 'complex', value: { props: textStyleProps } }
490
491
  // sample(示意图)不传:官方文档确认为可选字段,缺省不报错
491
- // id 字段(groupId)不传:淘宝接口标记为只读字段,提交时不可携带
492
492
  ]
493
493
  }
494
494
  };
@@ -534,8 +534,8 @@ function buildImageModule(params) {
534
534
  singleCheckField('enable', 'true'),
535
535
  singleCheckField('countHeight', 'true'),
536
536
  { id: 'hot_area', type: 'multiComplex', values: hotAreaValues },
537
+ inputField('id', groupId),
537
538
  { id: 'sample', type: 'multiComplex', values: sampleValues }
538
- // id 字段(groupId)不传:淘宝接口标记为只读字段,提交时不可携带
539
539
  ]
540
540
  }
541
541
  };
@@ -552,6 +552,7 @@ function buildRichTextModule(params) {
552
552
  props: [
553
553
  singleCheckField('enable', 'false'),
554
554
  singleCheckField('countHeight', 'false'),
555
+ inputField('id', groupId),
555
556
  { id: 'html', type: 'complex', value: {
556
557
  props: [inputField('text', params.html || ''), inputField('width', ''), inputField('height', '')]
557
558
  }},
@@ -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
 
@@ -484,9 +484,9 @@ function buildTextModule(params) {
484
484
  { id: 'images', type: 'multiComplex', values: imageValues },
485
485
  singleCheckField('enable', 'true'),
486
486
  singleCheckField('countHeight', 'false'),
487
+ inputField('id', groupId),
487
488
  { id: 'textStyle', type: 'complex', value: { props: textStyleProps } }
488
489
  // sample(示意图)不传:官方文档确认为可选字段,缺省不报错
489
- // id 字段(groupId)不传:淘宝接口标记为只读字段,提交时不可携带
490
490
  ]
491
491
  }
492
492
  };
@@ -532,8 +532,8 @@ function buildImageModule(params) {
532
532
  singleCheckField('enable', 'true'),
533
533
  singleCheckField('countHeight', 'true'),
534
534
  { id: 'hot_area', type: 'multiComplex', values: hotAreaValues },
535
+ inputField('id', groupId),
535
536
  { id: 'sample', type: 'multiComplex', values: sampleValues }
536
- // id 字段(groupId)不传:淘宝接口标记为只读字段,提交时不可携带
537
537
  ]
538
538
  }
539
539
  };
@@ -550,6 +550,7 @@ function buildRichTextModule(params) {
550
550
  props: [
551
551
  singleCheckField('enable', 'false'),
552
552
  singleCheckField('countHeight', 'false'),
553
+ inputField('id', groupId),
553
554
  { id: 'html', type: 'complex', value: {
554
555
  props: [inputField('text', params.html || ''), inputField('width', ''), inputField('height', '')]
555
556
  }},
@@ -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
 
@@ -490,9 +490,9 @@
490
490
  { id: 'images', type: 'multiComplex', values: imageValues },
491
491
  singleCheckField('enable', 'true'),
492
492
  singleCheckField('countHeight', 'false'),
493
+ inputField('id', groupId),
493
494
  { id: 'textStyle', type: 'complex', value: { props: textStyleProps } }
494
495
  // sample(示意图)不传:官方文档确认为可选字段,缺省不报错
495
- // id 字段(groupId)不传:淘宝接口标记为只读字段,提交时不可携带
496
496
  ]
497
497
  }
498
498
  };
@@ -538,8 +538,8 @@
538
538
  singleCheckField('enable', 'true'),
539
539
  singleCheckField('countHeight', 'true'),
540
540
  { id: 'hot_area', type: 'multiComplex', values: hotAreaValues },
541
+ inputField('id', groupId),
541
542
  { id: 'sample', type: 'multiComplex', values: sampleValues }
542
- // id 字段(groupId)不传:淘宝接口标记为只读字段,提交时不可携带
543
543
  ]
544
544
  }
545
545
  };
@@ -556,6 +556,7 @@
556
556
  props: [
557
557
  singleCheckField('enable', 'false'),
558
558
  singleCheckField('countHeight', 'false'),
559
+ inputField('id', groupId),
559
560
  { id: 'html', type: 'complex', value: {
560
561
  props: [inputField('text', params.html || ''), inputField('width', ''), inputField('height', '')]
561
562
  }},
@@ -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.8",
3
+ "version": "1.0.9",
4
4
  "description": "淘宝新版图文编辑器 wirelessDesc 适配工具 - HTML 富文本转换为结构化 JSON",
5
5
  "type": "module",
6
6
  "main": "dist/wireless-desc-converter.umd.js",