pro-editor-schema 0.1.183 → 0.1.184
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 +20 -5
- package/dist/index.mjs +20 -5
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -2037,9 +2037,9 @@ var MATHPHRASE_SCHEMA = createSchema({
|
|
|
2037
2037
|
}
|
|
2038
2038
|
],
|
|
2039
2039
|
forbiddenElements: [
|
|
2040
|
-
{ code: QUERY_SCHEMA.code, resolveTo: "
|
|
2041
|
-
{ code: COMMENT_SCHEMA.code, resolveTo: "
|
|
2042
|
-
{ code: COMMENT_QUERY_SECTION_SCHEMA.code, resolveTo: "
|
|
2040
|
+
{ code: QUERY_SCHEMA.code, resolveTo: "skip" },
|
|
2041
|
+
{ code: COMMENT_SCHEMA.code, resolveTo: "skip" },
|
|
2042
|
+
{ code: COMMENT_QUERY_SECTION_SCHEMA.code, resolveTo: "skip" }
|
|
2043
2043
|
]
|
|
2044
2044
|
});
|
|
2045
2045
|
|
|
@@ -2601,6 +2601,21 @@ var validateChildren = (element, schema) => {
|
|
|
2601
2601
|
});
|
|
2602
2602
|
continue;
|
|
2603
2603
|
}
|
|
2604
|
+
if (schema.forbiddenElements) {
|
|
2605
|
+
const forbiddenChild = Array.from(schema.forbiddenElements).find(
|
|
2606
|
+
(candidate) => candidate.code === childSchema.code
|
|
2607
|
+
);
|
|
2608
|
+
if (forbiddenChild) {
|
|
2609
|
+
addValidationIssue(errors, {
|
|
2610
|
+
store: getStore(child),
|
|
2611
|
+
title: `Forbidden element ${child.tagName}`,
|
|
2612
|
+
level: "blocker",
|
|
2613
|
+
kind: "forbidden",
|
|
2614
|
+
description: `The element ${childSchema.code} is not permitted within ${schema.tag} content. Please delete the element or move it to a different location.`
|
|
2615
|
+
});
|
|
2616
|
+
continue;
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2604
2619
|
errors.push(...validateElementAgainstSchema(child, childSchema));
|
|
2605
2620
|
}
|
|
2606
2621
|
for (const allowedChild of allowedChildren) {
|
|
@@ -2623,10 +2638,10 @@ var validateChildren = (element, schema) => {
|
|
|
2623
2638
|
if (schema.allowedChildTagNames.size === 0 && childElements.length > 0) {
|
|
2624
2639
|
addValidationIssue(errors, {
|
|
2625
2640
|
store: getStore(element),
|
|
2626
|
-
title: "
|
|
2641
|
+
title: "Atom element cannot contain child elements",
|
|
2627
2642
|
level: "warning",
|
|
2628
2643
|
kind: "forbidden",
|
|
2629
|
-
description: `The element is
|
|
2644
|
+
description: `The element is an atom element and cannot contain child elements.`
|
|
2630
2645
|
});
|
|
2631
2646
|
}
|
|
2632
2647
|
return errors;
|
package/dist/index.mjs
CHANGED
|
@@ -1974,9 +1974,9 @@ var MATHPHRASE_SCHEMA = createSchema({
|
|
|
1974
1974
|
}
|
|
1975
1975
|
],
|
|
1976
1976
|
forbiddenElements: [
|
|
1977
|
-
{ code: QUERY_SCHEMA.code, resolveTo: "
|
|
1978
|
-
{ code: COMMENT_SCHEMA.code, resolveTo: "
|
|
1979
|
-
{ code: COMMENT_QUERY_SECTION_SCHEMA.code, resolveTo: "
|
|
1977
|
+
{ code: QUERY_SCHEMA.code, resolveTo: "skip" },
|
|
1978
|
+
{ code: COMMENT_SCHEMA.code, resolveTo: "skip" },
|
|
1979
|
+
{ code: COMMENT_QUERY_SECTION_SCHEMA.code, resolveTo: "skip" }
|
|
1980
1980
|
]
|
|
1981
1981
|
});
|
|
1982
1982
|
|
|
@@ -2538,6 +2538,21 @@ var validateChildren = (element, schema) => {
|
|
|
2538
2538
|
});
|
|
2539
2539
|
continue;
|
|
2540
2540
|
}
|
|
2541
|
+
if (schema.forbiddenElements) {
|
|
2542
|
+
const forbiddenChild = Array.from(schema.forbiddenElements).find(
|
|
2543
|
+
(candidate) => candidate.code === childSchema.code
|
|
2544
|
+
);
|
|
2545
|
+
if (forbiddenChild) {
|
|
2546
|
+
addValidationIssue(errors, {
|
|
2547
|
+
store: getStore(child),
|
|
2548
|
+
title: `Forbidden element ${child.tagName}`,
|
|
2549
|
+
level: "blocker",
|
|
2550
|
+
kind: "forbidden",
|
|
2551
|
+
description: `The element ${childSchema.code} is not permitted within ${schema.tag} content. Please delete the element or move it to a different location.`
|
|
2552
|
+
});
|
|
2553
|
+
continue;
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2541
2556
|
errors.push(...validateElementAgainstSchema(child, childSchema));
|
|
2542
2557
|
}
|
|
2543
2558
|
for (const allowedChild of allowedChildren) {
|
|
@@ -2560,10 +2575,10 @@ var validateChildren = (element, schema) => {
|
|
|
2560
2575
|
if (schema.allowedChildTagNames.size === 0 && childElements.length > 0) {
|
|
2561
2576
|
addValidationIssue(errors, {
|
|
2562
2577
|
store: getStore(element),
|
|
2563
|
-
title: "
|
|
2578
|
+
title: "Atom element cannot contain child elements",
|
|
2564
2579
|
level: "warning",
|
|
2565
2580
|
kind: "forbidden",
|
|
2566
|
-
description: `The element is
|
|
2581
|
+
description: `The element is an atom element and cannot contain child elements.`
|
|
2567
2582
|
});
|
|
2568
2583
|
}
|
|
2569
2584
|
return errors;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pro-editor-schema",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.184",
|
|
4
4
|
"description": "Pro Editor XML schemas",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
20
|
+
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
20
21
|
"typecheck": "tsc --noEmit",
|
|
21
22
|
"test": "vitest run",
|
|
22
23
|
"test:watch": "vitest"
|