pro-editor-schema 0.1.14 → 0.1.15
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 +38 -38
- package/dist/index.mjs +38 -38
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1930,6 +1930,23 @@ var createElement = ({
|
|
|
1930
1930
|
return element;
|
|
1931
1931
|
};
|
|
1932
1932
|
|
|
1933
|
+
// src/validation/utils/generateValidationIssueId.ts
|
|
1934
|
+
var generateValidationIssueId = () => {
|
|
1935
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
1936
|
+
return crypto.randomUUID();
|
|
1937
|
+
}
|
|
1938
|
+
return `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
1939
|
+
};
|
|
1940
|
+
|
|
1941
|
+
// src/validation/addValidationIssue.ts
|
|
1942
|
+
var createValidationIssue = (issue) => ({
|
|
1943
|
+
id: generateValidationIssueId(),
|
|
1944
|
+
...issue
|
|
1945
|
+
});
|
|
1946
|
+
var addValidationIssue = (errors, issue) => {
|
|
1947
|
+
errors.push(createValidationIssue(issue));
|
|
1948
|
+
};
|
|
1949
|
+
|
|
1933
1950
|
// src/validation/utils/retrieveTextIgnoringNodesWithSelector.ts
|
|
1934
1951
|
var retrieveTextIgnoringNodesWithSelector = (element, selector = ".del") => {
|
|
1935
1952
|
const clonedElement = element.cloneNode(true);
|
|
@@ -1966,8 +1983,7 @@ var validateFootnoteCue = (footnoteElement, root) => {
|
|
|
1966
1983
|
return errors;
|
|
1967
1984
|
}
|
|
1968
1985
|
if (!footnoteNumber) {
|
|
1969
|
-
errors
|
|
1970
|
-
id: `footnote-number-missing-${store}`,
|
|
1986
|
+
addValidationIssue(errors, {
|
|
1971
1987
|
store,
|
|
1972
1988
|
title: "Footnote number missing",
|
|
1973
1989
|
kind: "missing",
|
|
@@ -1976,8 +1992,7 @@ var validateFootnoteCue = (footnoteElement, root) => {
|
|
|
1976
1992
|
});
|
|
1977
1993
|
}
|
|
1978
1994
|
const label = extractFootnoteNumber(footnoteNumber);
|
|
1979
|
-
errors
|
|
1980
|
-
id: `unreferenced-footnote-${store}`,
|
|
1995
|
+
addValidationIssue(errors, {
|
|
1981
1996
|
store,
|
|
1982
1997
|
title: "Unreferenced footnote",
|
|
1983
1998
|
kind: "unlinked",
|
|
@@ -2005,14 +2020,13 @@ var validateConsecutiveFootnotes = (root) => {
|
|
|
2005
2020
|
continue;
|
|
2006
2021
|
}
|
|
2007
2022
|
return [
|
|
2008
|
-
{
|
|
2009
|
-
id: `non-consecutive-footnote-numbers-${store}`,
|
|
2023
|
+
createValidationIssue({
|
|
2010
2024
|
store,
|
|
2011
2025
|
title: "Non-consecutive footnote numbers",
|
|
2012
2026
|
kind: "missing",
|
|
2013
2027
|
description: "Footnote numbers must be consecutive. Please reorder the footnotes.",
|
|
2014
2028
|
level: "warning"
|
|
2015
|
-
}
|
|
2029
|
+
})
|
|
2016
2030
|
];
|
|
2017
2031
|
}
|
|
2018
2032
|
return [];
|
|
@@ -2032,14 +2046,13 @@ var validateConsecutiveFootnoteCues = (root) => {
|
|
|
2032
2046
|
continue;
|
|
2033
2047
|
}
|
|
2034
2048
|
return [
|
|
2035
|
-
{
|
|
2036
|
-
id: `non-consecutive-footnote-cues-${store}`,
|
|
2049
|
+
createValidationIssue({
|
|
2037
2050
|
store,
|
|
2038
2051
|
title: "Non-consecutive footnote cues",
|
|
2039
2052
|
kind: "missing",
|
|
2040
2053
|
description: "Footnote cues must be consecutive. Please reorder the footnote cues.",
|
|
2041
2054
|
level: "warning"
|
|
2042
|
-
}
|
|
2055
|
+
})
|
|
2043
2056
|
];
|
|
2044
2057
|
}
|
|
2045
2058
|
return [];
|
|
@@ -2076,28 +2089,26 @@ var validateLinkend = (linkElement, root, referenceChapterLinkends = []) => {
|
|
|
2076
2089
|
return [];
|
|
2077
2090
|
}
|
|
2078
2091
|
return [
|
|
2079
|
-
{
|
|
2080
|
-
id: `unlinked-footnote-cue-${store}`,
|
|
2092
|
+
createValidationIssue({
|
|
2081
2093
|
store,
|
|
2082
2094
|
title: "Unlinked footnote cue",
|
|
2083
2095
|
kind: "unlinked",
|
|
2084
2096
|
description: "This footnote cue is not referenced to any footnote in this chapter. Please link it again manually.",
|
|
2085
2097
|
level: "blocker"
|
|
2086
|
-
}
|
|
2098
|
+
})
|
|
2087
2099
|
];
|
|
2088
2100
|
}
|
|
2089
2101
|
if (findElementInCurrentChapter(root, linkend) || findElementInReferenceChapters(linkend, referenceChapterLinkends)) {
|
|
2090
2102
|
return [];
|
|
2091
2103
|
}
|
|
2092
2104
|
return [
|
|
2093
|
-
{
|
|
2094
|
-
id: `unlinked-element-${store}`,
|
|
2105
|
+
createValidationIssue({
|
|
2095
2106
|
store,
|
|
2096
2107
|
title: "Unlinked element",
|
|
2097
2108
|
kind: "unlinked",
|
|
2098
2109
|
description: "This link is not referenced to any element in the current chapter or reference chapters. Please link it again manually.",
|
|
2099
2110
|
level: "blocker"
|
|
2100
|
-
}
|
|
2111
|
+
})
|
|
2101
2112
|
];
|
|
2102
2113
|
};
|
|
2103
2114
|
var validateLinkends = (root, referenceChapterLinkends = []) => {
|
|
@@ -2120,8 +2131,7 @@ var validateAttributes = (element, schema) => {
|
|
|
2120
2131
|
for (const attribute of schema.requiredAttributes) {
|
|
2121
2132
|
const name = getAttributeName(attribute);
|
|
2122
2133
|
if (!element.hasAttribute(name)) {
|
|
2123
|
-
errors
|
|
2124
|
-
id: `missing-required-attribute-${name}`,
|
|
2134
|
+
addValidationIssue(errors, {
|
|
2125
2135
|
store: element.id,
|
|
2126
2136
|
title: `Missing required attribute "${name}"`,
|
|
2127
2137
|
level: "warning",
|
|
@@ -2136,8 +2146,7 @@ var validateAttributes = (element, schema) => {
|
|
|
2136
2146
|
}
|
|
2137
2147
|
const definition = findAttributeDefinitionByName(definitions, name);
|
|
2138
2148
|
if (!definition) {
|
|
2139
|
-
errors
|
|
2140
|
-
id: `unexpected-attribute-${name}`,
|
|
2149
|
+
addValidationIssue(errors, {
|
|
2141
2150
|
store: element.id,
|
|
2142
2151
|
title: `Unexpected attribute "${name}"`,
|
|
2143
2152
|
level: "warning",
|
|
@@ -2154,8 +2163,7 @@ var validateAttributes = (element, schema) => {
|
|
|
2154
2163
|
continue;
|
|
2155
2164
|
}
|
|
2156
2165
|
if (!definition.values.includes(value)) {
|
|
2157
|
-
errors
|
|
2158
|
-
id: `forbidden-attribute-value-${name}-${value}`,
|
|
2166
|
+
addValidationIssue(errors, {
|
|
2159
2167
|
store: element.id,
|
|
2160
2168
|
title: `Invalid attribute value "${value}"`,
|
|
2161
2169
|
level: "warning",
|
|
@@ -2171,8 +2179,7 @@ var validateAttributes = (element, schema) => {
|
|
|
2171
2179
|
var validateElementAgainstSchema = (element, schema) => {
|
|
2172
2180
|
const errors = [];
|
|
2173
2181
|
if (element.tagName.toUpperCase() !== schema.tag) {
|
|
2174
|
-
errors
|
|
2175
|
-
id: `expected-element-${schema.tag}`,
|
|
2182
|
+
addValidationIssue(errors, {
|
|
2176
2183
|
store: element.id,
|
|
2177
2184
|
title: `Expected ${schema.tag}, got ${element.tagName}`,
|
|
2178
2185
|
level: "warning",
|
|
@@ -2181,8 +2188,7 @@ var validateElementAgainstSchema = (element, schema) => {
|
|
|
2181
2188
|
});
|
|
2182
2189
|
}
|
|
2183
2190
|
if (schema.code === "insertion" && !element.classList.contains("ins")) {
|
|
2184
|
-
errors
|
|
2185
|
-
id: `missing-class-ins-${element.id}`,
|
|
2191
|
+
addValidationIssue(errors, {
|
|
2186
2192
|
store: element.id,
|
|
2187
2193
|
title: 'Missing class "ins" for insertion element',
|
|
2188
2194
|
level: "warning",
|
|
@@ -2191,8 +2197,7 @@ var validateElementAgainstSchema = (element, schema) => {
|
|
|
2191
2197
|
});
|
|
2192
2198
|
}
|
|
2193
2199
|
if (schema.code === "deletion" && !element.classList.contains("del")) {
|
|
2194
|
-
errors
|
|
2195
|
-
id: `missing-class-del-${element.id}`,
|
|
2200
|
+
addValidationIssue(errors, {
|
|
2196
2201
|
store: element.id,
|
|
2197
2202
|
title: 'Missing class "del" for deletion element',
|
|
2198
2203
|
level: "warning",
|
|
@@ -2201,8 +2206,7 @@ var validateElementAgainstSchema = (element, schema) => {
|
|
|
2201
2206
|
});
|
|
2202
2207
|
}
|
|
2203
2208
|
if (schema.code === "commentQuerySection" && !element.classList.contains("cmtQurySection")) {
|
|
2204
|
-
errors
|
|
2205
|
-
id: `missing-class-cmtQurySection-${element.id}`,
|
|
2209
|
+
addValidationIssue(errors, {
|
|
2206
2210
|
store: element.id,
|
|
2207
2211
|
title: 'Missing class "cmtQurySection" for comment query section',
|
|
2208
2212
|
level: "warning",
|
|
@@ -2226,8 +2230,7 @@ var validateChildren = (element, schema) => {
|
|
|
2226
2230
|
(candidate) => candidate.tagName === childTag
|
|
2227
2231
|
);
|
|
2228
2232
|
if (!allowedChild) {
|
|
2229
|
-
errors
|
|
2230
|
-
id: `forbidden-child-element-${child.tagName}`,
|
|
2233
|
+
addValidationIssue(errors, {
|
|
2231
2234
|
store: child.id,
|
|
2232
2235
|
title: `Forbidden child element ${child.tagName}`,
|
|
2233
2236
|
level: "warning",
|
|
@@ -2238,8 +2241,7 @@ var validateChildren = (element, schema) => {
|
|
|
2238
2241
|
}
|
|
2239
2242
|
const childSchema = findSchemaByElement(child);
|
|
2240
2243
|
if (!childSchema) {
|
|
2241
|
-
errors
|
|
2242
|
-
id: `no-schema-found-for-child-element-${child.tagName}`,
|
|
2244
|
+
addValidationIssue(errors, {
|
|
2243
2245
|
store: child.id,
|
|
2244
2246
|
title: `No schema found for child element ${child.tagName}`,
|
|
2245
2247
|
level: "warning",
|
|
@@ -2258,8 +2260,7 @@ var validateChildren = (element, schema) => {
|
|
|
2258
2260
|
(child) => child.tagName.toUpperCase() === allowedChild.tagName
|
|
2259
2261
|
);
|
|
2260
2262
|
if (!hasChild) {
|
|
2261
|
-
errors
|
|
2262
|
-
id: `missing-required-child-element-${allowedChild.tagName}`,
|
|
2263
|
+
addValidationIssue(errors, {
|
|
2263
2264
|
store: element.id,
|
|
2264
2265
|
title: `Missing required child element ${allowedChild.tagName}`,
|
|
2265
2266
|
level: "warning",
|
|
@@ -2269,8 +2270,7 @@ var validateChildren = (element, schema) => {
|
|
|
2269
2270
|
}
|
|
2270
2271
|
}
|
|
2271
2272
|
if (schema.allowedChildTagNames.size === 0 && childElements.length > 0) {
|
|
2272
|
-
errors
|
|
2273
|
-
id: `leaf-element-cannot-contain-child-elements-${element.id}`,
|
|
2273
|
+
addValidationIssue(errors, {
|
|
2274
2274
|
store: element.id,
|
|
2275
2275
|
title: "Leaf element cannot contain child elements",
|
|
2276
2276
|
level: "warning",
|
package/dist/index.mjs
CHANGED
|
@@ -1705,6 +1705,23 @@ var createElement = ({
|
|
|
1705
1705
|
return element;
|
|
1706
1706
|
};
|
|
1707
1707
|
|
|
1708
|
+
// src/validation/utils/generateValidationIssueId.ts
|
|
1709
|
+
var generateValidationIssueId = () => {
|
|
1710
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
1711
|
+
return crypto.randomUUID();
|
|
1712
|
+
}
|
|
1713
|
+
return `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
1714
|
+
};
|
|
1715
|
+
|
|
1716
|
+
// src/validation/addValidationIssue.ts
|
|
1717
|
+
var createValidationIssue = (issue) => ({
|
|
1718
|
+
id: generateValidationIssueId(),
|
|
1719
|
+
...issue
|
|
1720
|
+
});
|
|
1721
|
+
var addValidationIssue = (errors, issue) => {
|
|
1722
|
+
errors.push(createValidationIssue(issue));
|
|
1723
|
+
};
|
|
1724
|
+
|
|
1708
1725
|
// src/validation/utils/retrieveTextIgnoringNodesWithSelector.ts
|
|
1709
1726
|
var retrieveTextIgnoringNodesWithSelector = (element, selector = ".del") => {
|
|
1710
1727
|
const clonedElement = element.cloneNode(true);
|
|
@@ -1741,8 +1758,7 @@ var validateFootnoteCue = (footnoteElement, root) => {
|
|
|
1741
1758
|
return errors;
|
|
1742
1759
|
}
|
|
1743
1760
|
if (!footnoteNumber) {
|
|
1744
|
-
errors
|
|
1745
|
-
id: `footnote-number-missing-${store}`,
|
|
1761
|
+
addValidationIssue(errors, {
|
|
1746
1762
|
store,
|
|
1747
1763
|
title: "Footnote number missing",
|
|
1748
1764
|
kind: "missing",
|
|
@@ -1751,8 +1767,7 @@ var validateFootnoteCue = (footnoteElement, root) => {
|
|
|
1751
1767
|
});
|
|
1752
1768
|
}
|
|
1753
1769
|
const label = extractFootnoteNumber(footnoteNumber);
|
|
1754
|
-
errors
|
|
1755
|
-
id: `unreferenced-footnote-${store}`,
|
|
1770
|
+
addValidationIssue(errors, {
|
|
1756
1771
|
store,
|
|
1757
1772
|
title: "Unreferenced footnote",
|
|
1758
1773
|
kind: "unlinked",
|
|
@@ -1780,14 +1795,13 @@ var validateConsecutiveFootnotes = (root) => {
|
|
|
1780
1795
|
continue;
|
|
1781
1796
|
}
|
|
1782
1797
|
return [
|
|
1783
|
-
{
|
|
1784
|
-
id: `non-consecutive-footnote-numbers-${store}`,
|
|
1798
|
+
createValidationIssue({
|
|
1785
1799
|
store,
|
|
1786
1800
|
title: "Non-consecutive footnote numbers",
|
|
1787
1801
|
kind: "missing",
|
|
1788
1802
|
description: "Footnote numbers must be consecutive. Please reorder the footnotes.",
|
|
1789
1803
|
level: "warning"
|
|
1790
|
-
}
|
|
1804
|
+
})
|
|
1791
1805
|
];
|
|
1792
1806
|
}
|
|
1793
1807
|
return [];
|
|
@@ -1807,14 +1821,13 @@ var validateConsecutiveFootnoteCues = (root) => {
|
|
|
1807
1821
|
continue;
|
|
1808
1822
|
}
|
|
1809
1823
|
return [
|
|
1810
|
-
{
|
|
1811
|
-
id: `non-consecutive-footnote-cues-${store}`,
|
|
1824
|
+
createValidationIssue({
|
|
1812
1825
|
store,
|
|
1813
1826
|
title: "Non-consecutive footnote cues",
|
|
1814
1827
|
kind: "missing",
|
|
1815
1828
|
description: "Footnote cues must be consecutive. Please reorder the footnote cues.",
|
|
1816
1829
|
level: "warning"
|
|
1817
|
-
}
|
|
1830
|
+
})
|
|
1818
1831
|
];
|
|
1819
1832
|
}
|
|
1820
1833
|
return [];
|
|
@@ -1851,28 +1864,26 @@ var validateLinkend = (linkElement, root, referenceChapterLinkends = []) => {
|
|
|
1851
1864
|
return [];
|
|
1852
1865
|
}
|
|
1853
1866
|
return [
|
|
1854
|
-
{
|
|
1855
|
-
id: `unlinked-footnote-cue-${store}`,
|
|
1867
|
+
createValidationIssue({
|
|
1856
1868
|
store,
|
|
1857
1869
|
title: "Unlinked footnote cue",
|
|
1858
1870
|
kind: "unlinked",
|
|
1859
1871
|
description: "This footnote cue is not referenced to any footnote in this chapter. Please link it again manually.",
|
|
1860
1872
|
level: "blocker"
|
|
1861
|
-
}
|
|
1873
|
+
})
|
|
1862
1874
|
];
|
|
1863
1875
|
}
|
|
1864
1876
|
if (findElementInCurrentChapter(root, linkend) || findElementInReferenceChapters(linkend, referenceChapterLinkends)) {
|
|
1865
1877
|
return [];
|
|
1866
1878
|
}
|
|
1867
1879
|
return [
|
|
1868
|
-
{
|
|
1869
|
-
id: `unlinked-element-${store}`,
|
|
1880
|
+
createValidationIssue({
|
|
1870
1881
|
store,
|
|
1871
1882
|
title: "Unlinked element",
|
|
1872
1883
|
kind: "unlinked",
|
|
1873
1884
|
description: "This link is not referenced to any element in the current chapter or reference chapters. Please link it again manually.",
|
|
1874
1885
|
level: "blocker"
|
|
1875
|
-
}
|
|
1886
|
+
})
|
|
1876
1887
|
];
|
|
1877
1888
|
};
|
|
1878
1889
|
var validateLinkends = (root, referenceChapterLinkends = []) => {
|
|
@@ -1895,8 +1906,7 @@ var validateAttributes = (element, schema) => {
|
|
|
1895
1906
|
for (const attribute of schema.requiredAttributes) {
|
|
1896
1907
|
const name = getAttributeName(attribute);
|
|
1897
1908
|
if (!element.hasAttribute(name)) {
|
|
1898
|
-
errors
|
|
1899
|
-
id: `missing-required-attribute-${name}`,
|
|
1909
|
+
addValidationIssue(errors, {
|
|
1900
1910
|
store: element.id,
|
|
1901
1911
|
title: `Missing required attribute "${name}"`,
|
|
1902
1912
|
level: "warning",
|
|
@@ -1911,8 +1921,7 @@ var validateAttributes = (element, schema) => {
|
|
|
1911
1921
|
}
|
|
1912
1922
|
const definition = findAttributeDefinitionByName(definitions, name);
|
|
1913
1923
|
if (!definition) {
|
|
1914
|
-
errors
|
|
1915
|
-
id: `unexpected-attribute-${name}`,
|
|
1924
|
+
addValidationIssue(errors, {
|
|
1916
1925
|
store: element.id,
|
|
1917
1926
|
title: `Unexpected attribute "${name}"`,
|
|
1918
1927
|
level: "warning",
|
|
@@ -1929,8 +1938,7 @@ var validateAttributes = (element, schema) => {
|
|
|
1929
1938
|
continue;
|
|
1930
1939
|
}
|
|
1931
1940
|
if (!definition.values.includes(value)) {
|
|
1932
|
-
errors
|
|
1933
|
-
id: `forbidden-attribute-value-${name}-${value}`,
|
|
1941
|
+
addValidationIssue(errors, {
|
|
1934
1942
|
store: element.id,
|
|
1935
1943
|
title: `Invalid attribute value "${value}"`,
|
|
1936
1944
|
level: "warning",
|
|
@@ -1946,8 +1954,7 @@ var validateAttributes = (element, schema) => {
|
|
|
1946
1954
|
var validateElementAgainstSchema = (element, schema) => {
|
|
1947
1955
|
const errors = [];
|
|
1948
1956
|
if (element.tagName.toUpperCase() !== schema.tag) {
|
|
1949
|
-
errors
|
|
1950
|
-
id: `expected-element-${schema.tag}`,
|
|
1957
|
+
addValidationIssue(errors, {
|
|
1951
1958
|
store: element.id,
|
|
1952
1959
|
title: `Expected ${schema.tag}, got ${element.tagName}`,
|
|
1953
1960
|
level: "warning",
|
|
@@ -1956,8 +1963,7 @@ var validateElementAgainstSchema = (element, schema) => {
|
|
|
1956
1963
|
});
|
|
1957
1964
|
}
|
|
1958
1965
|
if (schema.code === "insertion" && !element.classList.contains("ins")) {
|
|
1959
|
-
errors
|
|
1960
|
-
id: `missing-class-ins-${element.id}`,
|
|
1966
|
+
addValidationIssue(errors, {
|
|
1961
1967
|
store: element.id,
|
|
1962
1968
|
title: 'Missing class "ins" for insertion element',
|
|
1963
1969
|
level: "warning",
|
|
@@ -1966,8 +1972,7 @@ var validateElementAgainstSchema = (element, schema) => {
|
|
|
1966
1972
|
});
|
|
1967
1973
|
}
|
|
1968
1974
|
if (schema.code === "deletion" && !element.classList.contains("del")) {
|
|
1969
|
-
errors
|
|
1970
|
-
id: `missing-class-del-${element.id}`,
|
|
1975
|
+
addValidationIssue(errors, {
|
|
1971
1976
|
store: element.id,
|
|
1972
1977
|
title: 'Missing class "del" for deletion element',
|
|
1973
1978
|
level: "warning",
|
|
@@ -1976,8 +1981,7 @@ var validateElementAgainstSchema = (element, schema) => {
|
|
|
1976
1981
|
});
|
|
1977
1982
|
}
|
|
1978
1983
|
if (schema.code === "commentQuerySection" && !element.classList.contains("cmtQurySection")) {
|
|
1979
|
-
errors
|
|
1980
|
-
id: `missing-class-cmtQurySection-${element.id}`,
|
|
1984
|
+
addValidationIssue(errors, {
|
|
1981
1985
|
store: element.id,
|
|
1982
1986
|
title: 'Missing class "cmtQurySection" for comment query section',
|
|
1983
1987
|
level: "warning",
|
|
@@ -2001,8 +2005,7 @@ var validateChildren = (element, schema) => {
|
|
|
2001
2005
|
(candidate) => candidate.tagName === childTag
|
|
2002
2006
|
);
|
|
2003
2007
|
if (!allowedChild) {
|
|
2004
|
-
errors
|
|
2005
|
-
id: `forbidden-child-element-${child.tagName}`,
|
|
2008
|
+
addValidationIssue(errors, {
|
|
2006
2009
|
store: child.id,
|
|
2007
2010
|
title: `Forbidden child element ${child.tagName}`,
|
|
2008
2011
|
level: "warning",
|
|
@@ -2013,8 +2016,7 @@ var validateChildren = (element, schema) => {
|
|
|
2013
2016
|
}
|
|
2014
2017
|
const childSchema = findSchemaByElement(child);
|
|
2015
2018
|
if (!childSchema) {
|
|
2016
|
-
errors
|
|
2017
|
-
id: `no-schema-found-for-child-element-${child.tagName}`,
|
|
2019
|
+
addValidationIssue(errors, {
|
|
2018
2020
|
store: child.id,
|
|
2019
2021
|
title: `No schema found for child element ${child.tagName}`,
|
|
2020
2022
|
level: "warning",
|
|
@@ -2033,8 +2035,7 @@ var validateChildren = (element, schema) => {
|
|
|
2033
2035
|
(child) => child.tagName.toUpperCase() === allowedChild.tagName
|
|
2034
2036
|
);
|
|
2035
2037
|
if (!hasChild) {
|
|
2036
|
-
errors
|
|
2037
|
-
id: `missing-required-child-element-${allowedChild.tagName}`,
|
|
2038
|
+
addValidationIssue(errors, {
|
|
2038
2039
|
store: element.id,
|
|
2039
2040
|
title: `Missing required child element ${allowedChild.tagName}`,
|
|
2040
2041
|
level: "warning",
|
|
@@ -2044,8 +2045,7 @@ var validateChildren = (element, schema) => {
|
|
|
2044
2045
|
}
|
|
2045
2046
|
}
|
|
2046
2047
|
if (schema.allowedChildTagNames.size === 0 && childElements.length > 0) {
|
|
2047
|
-
errors
|
|
2048
|
-
id: `leaf-element-cannot-contain-child-elements-${element.id}`,
|
|
2048
|
+
addValidationIssue(errors, {
|
|
2049
2049
|
store: element.id,
|
|
2050
2050
|
title: "Leaf element cannot contain child elements",
|
|
2051
2051
|
level: "warning",
|