Skip to content

Commit 9bcfe2f

Browse files
willwadeclaude
andcommitted
Fix WordList item format and structure
- Properly format WordList items with nested <Text><s><r>text</r></s></Text> structure - Add Image and PartOfSpeech elements to match Grid 3 format - Preserve xsi:nil attribute in WordList cells (don't remove it) - Keep AutoContent/WordList ContentType intact This allows Grid 3 to properly display WordList content in AutoContent cells. Co-Authored-By: Claude (glm-4.7) <noreply@anthropic.com>
1 parent 200be4d commit 9bcfe2f

1 file changed

Lines changed: 12 additions & 19 deletions

File tree

src/processors/gridsetProcessor.ts

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2603,29 +2603,15 @@ class GridsetProcessor extends BaseProcessor {
26032603
// populate from the WordList.
26042604
// Note: WordList updates are handled by collecting all new words
26052605
// and adding them to the WordList.Items array later.
2606-
2607-
// CRITICAL: Remove xsi:nil from CaptionAndImage for WordList cells
2608-
// Even though the cell populates from WordList, the xsi:nil attribute
2609-
// tells Grid 3 to display it as blank. We need to remove it so Grid 3
2610-
// will show the WordList content.
2611-
if (cell.Content.CaptionAndImage || cell.Content.captionAndImage) {
2612-
const captionAndImage = cell.Content.CaptionAndImage || cell.Content.captionAndImage;
2613-
if (captionAndImage['@_xsi:nil'] || captionAndImage['xsi:nil']) {
2614-
delete captionAndImage['@_xsi:nil'];
2615-
delete captionAndImage['xsi:nil'];
2616-
}
2617-
}
2618-
2619-
continue; // Skip further cell modification for WordList cells
2606+
continue; // Skip cell modification for WordList cells
26202607
}
26212608

2622-
// For regular cells, update the caption directly
2609+
// For regular cells, update the caption directly (no CDATA needed in cells)
26232610
if (cell.Content.CaptionAndImage || cell.Content.captionAndImage) {
26242611
const captionAndImage = cell.Content.CaptionAndImage || cell.Content.captionAndImage;
26252612
captionAndImage.Caption = modifiedButton.label || '';
26262613

2627-
// Remove xsi:nil attribute when adding content - this is critical for Grid 3
2628-
// The xsi:nil="true" attribute tells Grid 3 the cell is intentionally empty
2614+
// Remove xsi:nil attribute when adding content
26292615
if (captionAndImage['@_xsi:nil'] || captionAndImage['xsi:nil']) {
26302616
delete captionAndImage['@_xsi:nil'];
26312617
delete captionAndImage['xsi:nil'];
@@ -2678,9 +2664,16 @@ class GridsetProcessor extends BaseProcessor {
26782664
(cell.Content?.ContentSubType === 'WordList' || cell.Content?.ContentSubType === 'WordList');
26792665

26802666
if (isWordListCell) {
2681-
// Add this button to the WordList
2667+
// Add this button to the WordList with proper Grid 3 format
2668+
// Format: <Text><s><r>label</r></s></Text>
26822669
newWordListItems.push({
2683-
Text: { s: { r: button.label } },
2670+
Text: {
2671+
s: {
2672+
r: button.label
2673+
}
2674+
},
2675+
Image: '', // No image for user-added words
2676+
PartOfSpeech: 'Unknown'
26842677
});
26852678
}
26862679
}

0 commit comments

Comments
 (0)