wireless-desc-converter 1.0.8 → 1.0.10

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