@willwade/aac-processors 0.2.11 → 0.2.12
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.
|
@@ -2417,6 +2417,43 @@ class GridsetProcessor extends BaseProcessor {
|
|
|
2417
2417
|
originalGrid.Grid.WordList.Items.WordListItem = allItems;
|
|
2418
2418
|
}
|
|
2419
2419
|
}
|
|
2420
|
+
// Process WordList items attached to the page (from personalisation)
|
|
2421
|
+
// These are tracked separately and shouldn't create new cells
|
|
2422
|
+
// Use a known symbol key to check for WordList items
|
|
2423
|
+
const WORDLIST_ITEMS_KEY = 'wordListItems';
|
|
2424
|
+
const wordListItems = page[WORDLIST_ITEMS_KEY];
|
|
2425
|
+
if (wordListItems && wordListItems.length > 0) {
|
|
2426
|
+
// Ensure WordList structure exists
|
|
2427
|
+
if (!originalGrid.Grid) {
|
|
2428
|
+
originalGrid.Grid = {};
|
|
2429
|
+
}
|
|
2430
|
+
if (!originalGrid.Grid.WordList) {
|
|
2431
|
+
originalGrid.Grid.WordList = {};
|
|
2432
|
+
}
|
|
2433
|
+
if (!originalGrid.Grid.WordList.Items) {
|
|
2434
|
+
originalGrid.Grid.WordList.Items = {};
|
|
2435
|
+
}
|
|
2436
|
+
const existingItems = originalGrid.Grid.WordList.Items.WordListItem ||
|
|
2437
|
+
originalGrid.Grid.WordList.Items.wordlistitem ||
|
|
2438
|
+
[];
|
|
2439
|
+
const itemsArray = Array.isArray(existingItems) ? existingItems : [existingItems];
|
|
2440
|
+
// Add new WordList items with proper Grid 3 format
|
|
2441
|
+
for (const item of wordListItems) {
|
|
2442
|
+
itemsArray.push({
|
|
2443
|
+
Text: {
|
|
2444
|
+
p: {
|
|
2445
|
+
s: {
|
|
2446
|
+
r: item.label,
|
|
2447
|
+
},
|
|
2448
|
+
},
|
|
2449
|
+
},
|
|
2450
|
+
Image: '',
|
|
2451
|
+
PartOfSpeech: 'Unknown',
|
|
2452
|
+
});
|
|
2453
|
+
}
|
|
2454
|
+
// Update the WordList
|
|
2455
|
+
originalGrid.Grid.WordList.Items.WordListItem = itemsArray;
|
|
2456
|
+
}
|
|
2420
2457
|
// Build the updated grid XML and format for Grid 3 compatibility
|
|
2421
2458
|
let builtXml = gridBuilder.build(originalGrid);
|
|
2422
2459
|
builtXml = formatGrid3XmlComplete(builtXml);
|
|
@@ -2443,6 +2443,43 @@ class GridsetProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
2443
2443
|
originalGrid.Grid.WordList.Items.WordListItem = allItems;
|
|
2444
2444
|
}
|
|
2445
2445
|
}
|
|
2446
|
+
// Process WordList items attached to the page (from personalisation)
|
|
2447
|
+
// These are tracked separately and shouldn't create new cells
|
|
2448
|
+
// Use a known symbol key to check for WordList items
|
|
2449
|
+
const WORDLIST_ITEMS_KEY = 'wordListItems';
|
|
2450
|
+
const wordListItems = page[WORDLIST_ITEMS_KEY];
|
|
2451
|
+
if (wordListItems && wordListItems.length > 0) {
|
|
2452
|
+
// Ensure WordList structure exists
|
|
2453
|
+
if (!originalGrid.Grid) {
|
|
2454
|
+
originalGrid.Grid = {};
|
|
2455
|
+
}
|
|
2456
|
+
if (!originalGrid.Grid.WordList) {
|
|
2457
|
+
originalGrid.Grid.WordList = {};
|
|
2458
|
+
}
|
|
2459
|
+
if (!originalGrid.Grid.WordList.Items) {
|
|
2460
|
+
originalGrid.Grid.WordList.Items = {};
|
|
2461
|
+
}
|
|
2462
|
+
const existingItems = originalGrid.Grid.WordList.Items.WordListItem ||
|
|
2463
|
+
originalGrid.Grid.WordList.Items.wordlistitem ||
|
|
2464
|
+
[];
|
|
2465
|
+
const itemsArray = Array.isArray(existingItems) ? existingItems : [existingItems];
|
|
2466
|
+
// Add new WordList items with proper Grid 3 format
|
|
2467
|
+
for (const item of wordListItems) {
|
|
2468
|
+
itemsArray.push({
|
|
2469
|
+
Text: {
|
|
2470
|
+
p: {
|
|
2471
|
+
s: {
|
|
2472
|
+
r: item.label,
|
|
2473
|
+
},
|
|
2474
|
+
},
|
|
2475
|
+
},
|
|
2476
|
+
Image: '',
|
|
2477
|
+
PartOfSpeech: 'Unknown',
|
|
2478
|
+
});
|
|
2479
|
+
}
|
|
2480
|
+
// Update the WordList
|
|
2481
|
+
originalGrid.Grid.WordList.Items.WordListItem = itemsArray;
|
|
2482
|
+
}
|
|
2446
2483
|
// Build the updated grid XML and format for Grid 3 compatibility
|
|
2447
2484
|
let builtXml = gridBuilder.build(originalGrid);
|
|
2448
2485
|
builtXml = (0, xmlFormatter_1.formatGrid3XmlComplete)(builtXml);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willwade/aac-processors",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "A comprehensive TypeScript library for processing AAC (Augmentative and Alternative Communication) file formats with translation support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"browser": "dist/browser/index.browser.js",
|