@examind/block-sdk 0.2.6 → 0.3.4
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.
- package/dist/index.js +15 -6
- package/dist/index.mjs +15 -6
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -264,6 +264,7 @@ var FillInTheBlankSpaceNodeHandler = class extends NodeHandler {
|
|
|
264
264
|
`id="${node.id}"`,
|
|
265
265
|
`data-x-type="${node.spaceType}"`,
|
|
266
266
|
`data-x-matches="${node.matches}"`,
|
|
267
|
+
`data-x-use-regex="${!!node.useRegex}"`,
|
|
267
268
|
`data-x-case-sensitive="${!!node.caseSensitive}"`,
|
|
268
269
|
`data-x-errors-allowed="${node.errorsAllowed ?? 0}"`,
|
|
269
270
|
`data-x-min-decimals="${node.minDecimals ?? ""}"`,
|
|
@@ -347,7 +348,9 @@ var FinancialStatementQuestionNodeHandler = class extends NodeHandler {
|
|
|
347
348
|
const amountHintAttr = row.isAmountHint ? ' data-x-is-amount-hint="true"' : "";
|
|
348
349
|
rowElements.push(
|
|
349
350
|
`<x-line id="${row.id}" data-x-depth="${row.depth}"${entryHintAttr}${amountHintAttr}>`,
|
|
350
|
-
`<x-entry>${row.entry
|
|
351
|
+
`<x-entry>${createHtmlFromNestedEditor(row.entry, {
|
|
352
|
+
parentNode: node
|
|
353
|
+
})}</x-entry>`,
|
|
351
354
|
`<x-amount>${createHtmlFromNestedEditor(row.amount, {
|
|
352
355
|
parentNode: node
|
|
353
356
|
})}</x-amount>`,
|
|
@@ -362,7 +365,12 @@ var FinancialStatementQuestionNodeHandler = class extends NodeHandler {
|
|
|
362
365
|
return "";
|
|
363
366
|
}
|
|
364
367
|
const distractorElements = node.distractors.map(
|
|
365
|
-
(distractor) => `<x-distractor id="${distractor.id}">${
|
|
368
|
+
(distractor) => `<x-distractor id="${distractor.id}">${createHtmlFromNestedEditor(
|
|
369
|
+
distractor.entry,
|
|
370
|
+
{
|
|
371
|
+
parentNode: node
|
|
372
|
+
}
|
|
373
|
+
)}</x-distractor>`
|
|
366
374
|
);
|
|
367
375
|
return `<x-distractors>${distractorElements.join("")}</x-distractors>`;
|
|
368
376
|
}
|
|
@@ -1508,6 +1516,7 @@ var FillInTheBlankSpaceNodeHandler2 = class extends NodeHandler2 {
|
|
|
1508
1516
|
processTextSpace(node, baseNode) {
|
|
1509
1517
|
return {
|
|
1510
1518
|
...baseNode,
|
|
1519
|
+
useRegex: node.getAttribute("data-x-use-regex") === "true",
|
|
1511
1520
|
caseSensitive: node.getAttribute("data-x-case-sensitive") === "true",
|
|
1512
1521
|
errorsAllowed: node.getAttribute("data-x-errors-allowed") ? Number(node.getAttribute("data-x-errors-allowed")) : void 0
|
|
1513
1522
|
};
|
|
@@ -1574,9 +1583,7 @@ var FinancialStatementQuestionNodeHandler2 = class extends NodeHandler2 {
|
|
|
1574
1583
|
continue;
|
|
1575
1584
|
jsonNode.distractors.push({
|
|
1576
1585
|
id: distractorsChild.getAttribute("id") || (0, import_nanoid4.nanoid)(),
|
|
1577
|
-
entry:
|
|
1578
|
-
distractorsChild.childNodes
|
|
1579
|
-
)
|
|
1586
|
+
entry: createNestedEditorFromHtml(distractorsChild)
|
|
1580
1587
|
});
|
|
1581
1588
|
}
|
|
1582
1589
|
}
|
|
@@ -1630,7 +1637,9 @@ var FinancialStatementQuestionNodeHandler2 = class extends NodeHandler2 {
|
|
|
1630
1637
|
role: "line-item",
|
|
1631
1638
|
id: lineNode.getAttribute("id") || "",
|
|
1632
1639
|
depth: Number(lineNode.getAttribute("data-x-depth") || 0),
|
|
1633
|
-
entry:
|
|
1640
|
+
entry: createNestedEditorFromHtml(
|
|
1641
|
+
lineNode.querySelector(TAG_X_ENTRY)
|
|
1642
|
+
),
|
|
1634
1643
|
amount: createNestedEditorFromHtml(
|
|
1635
1644
|
lineNode.querySelector(TAG_X_AMOUNT)
|
|
1636
1645
|
),
|
package/dist/index.mjs
CHANGED
|
@@ -237,6 +237,7 @@ var FillInTheBlankSpaceNodeHandler = class extends NodeHandler {
|
|
|
237
237
|
`id="${node.id}"`,
|
|
238
238
|
`data-x-type="${node.spaceType}"`,
|
|
239
239
|
`data-x-matches="${node.matches}"`,
|
|
240
|
+
`data-x-use-regex="${!!node.useRegex}"`,
|
|
240
241
|
`data-x-case-sensitive="${!!node.caseSensitive}"`,
|
|
241
242
|
`data-x-errors-allowed="${node.errorsAllowed ?? 0}"`,
|
|
242
243
|
`data-x-min-decimals="${node.minDecimals ?? ""}"`,
|
|
@@ -320,7 +321,9 @@ var FinancialStatementQuestionNodeHandler = class extends NodeHandler {
|
|
|
320
321
|
const amountHintAttr = row.isAmountHint ? ' data-x-is-amount-hint="true"' : "";
|
|
321
322
|
rowElements.push(
|
|
322
323
|
`<x-line id="${row.id}" data-x-depth="${row.depth}"${entryHintAttr}${amountHintAttr}>`,
|
|
323
|
-
`<x-entry>${row.entry
|
|
324
|
+
`<x-entry>${createHtmlFromNestedEditor(row.entry, {
|
|
325
|
+
parentNode: node
|
|
326
|
+
})}</x-entry>`,
|
|
324
327
|
`<x-amount>${createHtmlFromNestedEditor(row.amount, {
|
|
325
328
|
parentNode: node
|
|
326
329
|
})}</x-amount>`,
|
|
@@ -335,7 +338,12 @@ var FinancialStatementQuestionNodeHandler = class extends NodeHandler {
|
|
|
335
338
|
return "";
|
|
336
339
|
}
|
|
337
340
|
const distractorElements = node.distractors.map(
|
|
338
|
-
(distractor) => `<x-distractor id="${distractor.id}">${
|
|
341
|
+
(distractor) => `<x-distractor id="${distractor.id}">${createHtmlFromNestedEditor(
|
|
342
|
+
distractor.entry,
|
|
343
|
+
{
|
|
344
|
+
parentNode: node
|
|
345
|
+
}
|
|
346
|
+
)}</x-distractor>`
|
|
339
347
|
);
|
|
340
348
|
return `<x-distractors>${distractorElements.join("")}</x-distractors>`;
|
|
341
349
|
}
|
|
@@ -1481,6 +1489,7 @@ var FillInTheBlankSpaceNodeHandler2 = class extends NodeHandler2 {
|
|
|
1481
1489
|
processTextSpace(node, baseNode) {
|
|
1482
1490
|
return {
|
|
1483
1491
|
...baseNode,
|
|
1492
|
+
useRegex: node.getAttribute("data-x-use-regex") === "true",
|
|
1484
1493
|
caseSensitive: node.getAttribute("data-x-case-sensitive") === "true",
|
|
1485
1494
|
errorsAllowed: node.getAttribute("data-x-errors-allowed") ? Number(node.getAttribute("data-x-errors-allowed")) : void 0
|
|
1486
1495
|
};
|
|
@@ -1547,9 +1556,7 @@ var FinancialStatementQuestionNodeHandler2 = class extends NodeHandler2 {
|
|
|
1547
1556
|
continue;
|
|
1548
1557
|
jsonNode.distractors.push({
|
|
1549
1558
|
id: distractorsChild.getAttribute("id") || nanoid4(),
|
|
1550
|
-
entry:
|
|
1551
|
-
distractorsChild.childNodes
|
|
1552
|
-
)
|
|
1559
|
+
entry: createNestedEditorFromHtml(distractorsChild)
|
|
1553
1560
|
});
|
|
1554
1561
|
}
|
|
1555
1562
|
}
|
|
@@ -1603,7 +1610,9 @@ var FinancialStatementQuestionNodeHandler2 = class extends NodeHandler2 {
|
|
|
1603
1610
|
role: "line-item",
|
|
1604
1611
|
id: lineNode.getAttribute("id") || "",
|
|
1605
1612
|
depth: Number(lineNode.getAttribute("data-x-depth") || 0),
|
|
1606
|
-
entry:
|
|
1613
|
+
entry: createNestedEditorFromHtml(
|
|
1614
|
+
lineNode.querySelector(TAG_X_ENTRY)
|
|
1615
|
+
),
|
|
1607
1616
|
amount: createNestedEditorFromHtml(
|
|
1608
1617
|
lineNode.querySelector(TAG_X_AMOUNT)
|
|
1609
1618
|
),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@examind/block-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"@comment version": [
|
|
5
5
|
"Don't specify package version here. It will be injected by publish workflow."
|
|
6
6
|
],
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"nanoid": ">=3.0.0",
|
|
23
23
|
"node-html-parser": ">=6.0.0",
|
|
24
|
-
"@examind/block-types": "^0.
|
|
24
|
+
"@examind/block-types": "^0.3.4"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@eslint/js": "^9.17.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"tsup": "^8.3.5",
|
|
37
37
|
"typescript": "^5.7.2",
|
|
38
38
|
"typescript-eslint": "^8.18.2",
|
|
39
|
-
"@examind/block-types": "0.
|
|
39
|
+
"@examind/block-types": "0.3.4"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"lodash-es": "4.17.21"
|