pro-editor-schema 0.1.199 → 0.1.200
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -1
- package/dist/index.mjs +7 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -31,6 +31,7 @@ declare const isIgnoredAttribute: (attribute: string) => boolean;
|
|
|
31
31
|
declare const isIgnoredElement: (element: Element) => boolean;
|
|
32
32
|
declare const isIgnoredValidation: (code: SchemaCode) => boolean;
|
|
33
33
|
declare const findSchemaByCode: (code: SchemaCode) => Schema | undefined;
|
|
34
|
+
declare const findSchemaByTagName: (tagName: string) => Schema[];
|
|
34
35
|
declare const findSchemaByElement: (element: Element) => Schema | undefined;
|
|
35
36
|
declare const isAttributeRestricted: (attr: AttributeDefinition) => attr is RestrictedAttribute;
|
|
36
37
|
declare const getAttributeName: (attribute: AttributeDefinition) => string;
|
|
@@ -106,4 +107,4 @@ type ValidationError = {
|
|
|
106
107
|
*/
|
|
107
108
|
declare const validateXml: (xml: Element, elementsToLink: readonly string[], linkElements: readonly string[], schemasToValidateAgainst: SchemaCode[]) => ValidationError[];
|
|
108
109
|
|
|
109
|
-
export { ALIGNMENT_ATTRIBUTE, ATOM_SCHEMAS, type AllowedChildren, type AtomSchemaCode, type AttributeDefinition, ELEMENT_SCHEMAS, ELE_ID_ATTRIBUTE, ElementLabel, type ElementSchemaCode, FIGURE_PLACEMENT_ATTRIBUTE, type FreeAttribute, ID_ATTRS, IGNORED_ATTRIBUTES, IGNORED_ATTRIBUTES_STARTS_WITH, IGNORED_ELEMENT_SELECTORS, IGNORED_VALIDATION_ELEMENT_SELECTORS, INDENT_TYPE_ATTRIBUTE, INLINE_ELEMENT_SCHEMAS, type InlineSchemaCode, LAYOUT_ATTRIBUTES, LAYOUT_CELL_WIDTH_ATTRIBUTE, LAYOUT_TABLE_ORIENTATION_ATTRIBUTE, LAYOUT_TABLE_PLACEMENT_ATTRIBUTE, LAYOUT_USER_ATTRIBUTE, LEFT_INDENT_ATTRIBUTE, RIGHT_INDENT_ATTRIBUTE, type RestrictedAttribute, SCHEMAS, SPACE_ABOVE_ATTRIBUTE, SPACE_BELOW_ATTRIBUTE, SPECIAL_INDENT_ATTRIBUTE, STORE_ATTRIBUTE, STYLE_NAME_ATTRIBUTE, type Schema, type SchemaCode, type SchemaKind, TRACK_CHANGES_ATTRS, TRACK_CHANGES_ATTR_DATA_DATE, TRACK_CHANGES_ATTR_DATA_TIME, TRACK_CHANGES_ATTR_DATA_USERID, TRACK_CHANGES_ATTR_DATA_USERNAME, type ValidationError, type ValidationErrorKind, type ValidationErrorLevel, createElement, findAttributeDefinitionByName, findSchemaByCode, findSchemaByElement, getAttributeName, isAttributeRestricted, isIgnoredAttribute, isIgnoredElement, isIgnoredValidation, validateXml };
|
|
110
|
+
export { ALIGNMENT_ATTRIBUTE, ATOM_SCHEMAS, type AllowedChildren, type AtomSchemaCode, type AttributeDefinition, ELEMENT_SCHEMAS, ELE_ID_ATTRIBUTE, ElementLabel, type ElementSchemaCode, FIGURE_PLACEMENT_ATTRIBUTE, type FreeAttribute, ID_ATTRS, IGNORED_ATTRIBUTES, IGNORED_ATTRIBUTES_STARTS_WITH, IGNORED_ELEMENT_SELECTORS, IGNORED_VALIDATION_ELEMENT_SELECTORS, INDENT_TYPE_ATTRIBUTE, INLINE_ELEMENT_SCHEMAS, type InlineSchemaCode, LAYOUT_ATTRIBUTES, LAYOUT_CELL_WIDTH_ATTRIBUTE, LAYOUT_TABLE_ORIENTATION_ATTRIBUTE, LAYOUT_TABLE_PLACEMENT_ATTRIBUTE, LAYOUT_USER_ATTRIBUTE, LEFT_INDENT_ATTRIBUTE, RIGHT_INDENT_ATTRIBUTE, type RestrictedAttribute, SCHEMAS, SPACE_ABOVE_ATTRIBUTE, SPACE_BELOW_ATTRIBUTE, SPECIAL_INDENT_ATTRIBUTE, STORE_ATTRIBUTE, STYLE_NAME_ATTRIBUTE, type Schema, type SchemaCode, type SchemaKind, TRACK_CHANGES_ATTRS, TRACK_CHANGES_ATTR_DATA_DATE, TRACK_CHANGES_ATTR_DATA_TIME, TRACK_CHANGES_ATTR_DATA_USERID, TRACK_CHANGES_ATTR_DATA_USERNAME, type ValidationError, type ValidationErrorKind, type ValidationErrorLevel, createElement, findAttributeDefinitionByName, findSchemaByCode, findSchemaByElement, findSchemaByTagName, getAttributeName, isAttributeRestricted, isIgnoredAttribute, isIgnoredElement, isIgnoredValidation, validateXml };
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ declare const isIgnoredAttribute: (attribute: string) => boolean;
|
|
|
31
31
|
declare const isIgnoredElement: (element: Element) => boolean;
|
|
32
32
|
declare const isIgnoredValidation: (code: SchemaCode) => boolean;
|
|
33
33
|
declare const findSchemaByCode: (code: SchemaCode) => Schema | undefined;
|
|
34
|
+
declare const findSchemaByTagName: (tagName: string) => Schema[];
|
|
34
35
|
declare const findSchemaByElement: (element: Element) => Schema | undefined;
|
|
35
36
|
declare const isAttributeRestricted: (attr: AttributeDefinition) => attr is RestrictedAttribute;
|
|
36
37
|
declare const getAttributeName: (attribute: AttributeDefinition) => string;
|
|
@@ -106,4 +107,4 @@ type ValidationError = {
|
|
|
106
107
|
*/
|
|
107
108
|
declare const validateXml: (xml: Element, elementsToLink: readonly string[], linkElements: readonly string[], schemasToValidateAgainst: SchemaCode[]) => ValidationError[];
|
|
108
109
|
|
|
109
|
-
export { ALIGNMENT_ATTRIBUTE, ATOM_SCHEMAS, type AllowedChildren, type AtomSchemaCode, type AttributeDefinition, ELEMENT_SCHEMAS, ELE_ID_ATTRIBUTE, ElementLabel, type ElementSchemaCode, FIGURE_PLACEMENT_ATTRIBUTE, type FreeAttribute, ID_ATTRS, IGNORED_ATTRIBUTES, IGNORED_ATTRIBUTES_STARTS_WITH, IGNORED_ELEMENT_SELECTORS, IGNORED_VALIDATION_ELEMENT_SELECTORS, INDENT_TYPE_ATTRIBUTE, INLINE_ELEMENT_SCHEMAS, type InlineSchemaCode, LAYOUT_ATTRIBUTES, LAYOUT_CELL_WIDTH_ATTRIBUTE, LAYOUT_TABLE_ORIENTATION_ATTRIBUTE, LAYOUT_TABLE_PLACEMENT_ATTRIBUTE, LAYOUT_USER_ATTRIBUTE, LEFT_INDENT_ATTRIBUTE, RIGHT_INDENT_ATTRIBUTE, type RestrictedAttribute, SCHEMAS, SPACE_ABOVE_ATTRIBUTE, SPACE_BELOW_ATTRIBUTE, SPECIAL_INDENT_ATTRIBUTE, STORE_ATTRIBUTE, STYLE_NAME_ATTRIBUTE, type Schema, type SchemaCode, type SchemaKind, TRACK_CHANGES_ATTRS, TRACK_CHANGES_ATTR_DATA_DATE, TRACK_CHANGES_ATTR_DATA_TIME, TRACK_CHANGES_ATTR_DATA_USERID, TRACK_CHANGES_ATTR_DATA_USERNAME, type ValidationError, type ValidationErrorKind, type ValidationErrorLevel, createElement, findAttributeDefinitionByName, findSchemaByCode, findSchemaByElement, getAttributeName, isAttributeRestricted, isIgnoredAttribute, isIgnoredElement, isIgnoredValidation, validateXml };
|
|
110
|
+
export { ALIGNMENT_ATTRIBUTE, ATOM_SCHEMAS, type AllowedChildren, type AtomSchemaCode, type AttributeDefinition, ELEMENT_SCHEMAS, ELE_ID_ATTRIBUTE, ElementLabel, type ElementSchemaCode, FIGURE_PLACEMENT_ATTRIBUTE, type FreeAttribute, ID_ATTRS, IGNORED_ATTRIBUTES, IGNORED_ATTRIBUTES_STARTS_WITH, IGNORED_ELEMENT_SELECTORS, IGNORED_VALIDATION_ELEMENT_SELECTORS, INDENT_TYPE_ATTRIBUTE, INLINE_ELEMENT_SCHEMAS, type InlineSchemaCode, LAYOUT_ATTRIBUTES, LAYOUT_CELL_WIDTH_ATTRIBUTE, LAYOUT_TABLE_ORIENTATION_ATTRIBUTE, LAYOUT_TABLE_PLACEMENT_ATTRIBUTE, LAYOUT_USER_ATTRIBUTE, LEFT_INDENT_ATTRIBUTE, RIGHT_INDENT_ATTRIBUTE, type RestrictedAttribute, SCHEMAS, SPACE_ABOVE_ATTRIBUTE, SPACE_BELOW_ATTRIBUTE, SPECIAL_INDENT_ATTRIBUTE, STORE_ATTRIBUTE, STYLE_NAME_ATTRIBUTE, type Schema, type SchemaCode, type SchemaKind, TRACK_CHANGES_ATTRS, TRACK_CHANGES_ATTR_DATA_DATE, TRACK_CHANGES_ATTR_DATA_TIME, TRACK_CHANGES_ATTR_DATA_USERID, TRACK_CHANGES_ATTR_DATA_USERNAME, type ValidationError, type ValidationErrorKind, type ValidationErrorLevel, createElement, findAttributeDefinitionByName, findSchemaByCode, findSchemaByElement, findSchemaByTagName, getAttributeName, isAttributeRestricted, isIgnoredAttribute, isIgnoredElement, isIgnoredValidation, validateXml };
|
package/dist/index.js
CHANGED
|
@@ -55,6 +55,7 @@ __export(index_exports, {
|
|
|
55
55
|
findAttributeDefinitionByName: () => findAttributeDefinitionByName,
|
|
56
56
|
findSchemaByCode: () => findSchemaByCode,
|
|
57
57
|
findSchemaByElement: () => findSchemaByElement,
|
|
58
|
+
findSchemaByTagName: () => findSchemaByTagName,
|
|
58
59
|
getAttributeName: () => getAttributeName,
|
|
59
60
|
isAttributeRestricted: () => isAttributeRestricted,
|
|
60
61
|
isIgnoredAttribute: () => isIgnoredAttribute,
|
|
@@ -2502,6 +2503,9 @@ var isIgnoredAttribute = (attribute) => IGNORED_ATTRIBUTES.includes(attribute) |
|
|
|
2502
2503
|
var isIgnoredElement = (element) => IGNORED_ELEMENT_SELECTORS.some((selector) => element.matches(selector));
|
|
2503
2504
|
var isIgnoredValidation = (code) => IGNORED_VALIDATION_ELEMENT_SELECTORS.includes(code);
|
|
2504
2505
|
var findSchemaByCode = (code) => SCHEMAS[code];
|
|
2506
|
+
var findSchemaByTagName = (tagName) => Object.values(SCHEMAS).filter(
|
|
2507
|
+
(schema) => schema.tag === tagName.toUpperCase()
|
|
2508
|
+
);
|
|
2505
2509
|
var findSchemaByElement = (element) => {
|
|
2506
2510
|
const tagName = element.tagName.toUpperCase();
|
|
2507
2511
|
const isInsertion = element.classList.contains("ins");
|
|
@@ -2533,6 +2537,8 @@ var findSchemaByElement = (element) => {
|
|
|
2533
2537
|
return findSchemaByCode("footnoteSection");
|
|
2534
2538
|
}
|
|
2535
2539
|
}
|
|
2540
|
+
const candidates = findSchemaByTagName(tagName);
|
|
2541
|
+
return candidates[0];
|
|
2536
2542
|
};
|
|
2537
2543
|
var isAttributeRestricted = (attr) => typeof attr !== "string";
|
|
2538
2544
|
var getAttributeName = (attribute) => typeof attribute === "string" ? attribute.toLowerCase() : attribute.name.toLowerCase();
|
|
@@ -2913,7 +2919,7 @@ var validateElement = (element, root, elementsToLink, linkElements, schemasToVal
|
|
|
2913
2919
|
errors.push(...validateFootnoteCue(element, root));
|
|
2914
2920
|
}
|
|
2915
2921
|
if (isIgnoredValidation(schema.code)) {
|
|
2916
|
-
return
|
|
2922
|
+
return errors;
|
|
2917
2923
|
}
|
|
2918
2924
|
}
|
|
2919
2925
|
for (const child of Array.from(element.children)) {
|
|
@@ -2983,6 +2989,7 @@ var validateXml = (xml, elementsToLink, linkElements, schemasToValidateAgainst)
|
|
|
2983
2989
|
findAttributeDefinitionByName,
|
|
2984
2990
|
findSchemaByCode,
|
|
2985
2991
|
findSchemaByElement,
|
|
2992
|
+
findSchemaByTagName,
|
|
2986
2993
|
getAttributeName,
|
|
2987
2994
|
isAttributeRestricted,
|
|
2988
2995
|
isIgnoredAttribute,
|
package/dist/index.mjs
CHANGED
|
@@ -2436,6 +2436,9 @@ var isIgnoredAttribute = (attribute) => IGNORED_ATTRIBUTES.includes(attribute) |
|
|
|
2436
2436
|
var isIgnoredElement = (element) => IGNORED_ELEMENT_SELECTORS.some((selector) => element.matches(selector));
|
|
2437
2437
|
var isIgnoredValidation = (code) => IGNORED_VALIDATION_ELEMENT_SELECTORS.includes(code);
|
|
2438
2438
|
var findSchemaByCode = (code) => SCHEMAS[code];
|
|
2439
|
+
var findSchemaByTagName = (tagName) => Object.values(SCHEMAS).filter(
|
|
2440
|
+
(schema) => schema.tag === tagName.toUpperCase()
|
|
2441
|
+
);
|
|
2439
2442
|
var findSchemaByElement = (element) => {
|
|
2440
2443
|
const tagName = element.tagName.toUpperCase();
|
|
2441
2444
|
const isInsertion = element.classList.contains("ins");
|
|
@@ -2467,6 +2470,8 @@ var findSchemaByElement = (element) => {
|
|
|
2467
2470
|
return findSchemaByCode("footnoteSection");
|
|
2468
2471
|
}
|
|
2469
2472
|
}
|
|
2473
|
+
const candidates = findSchemaByTagName(tagName);
|
|
2474
|
+
return candidates[0];
|
|
2470
2475
|
};
|
|
2471
2476
|
var isAttributeRestricted = (attr) => typeof attr !== "string";
|
|
2472
2477
|
var getAttributeName = (attribute) => typeof attribute === "string" ? attribute.toLowerCase() : attribute.name.toLowerCase();
|
|
@@ -2847,7 +2852,7 @@ var validateElement = (element, root, elementsToLink, linkElements, schemasToVal
|
|
|
2847
2852
|
errors.push(...validateFootnoteCue(element, root));
|
|
2848
2853
|
}
|
|
2849
2854
|
if (isIgnoredValidation(schema.code)) {
|
|
2850
|
-
return
|
|
2855
|
+
return errors;
|
|
2851
2856
|
}
|
|
2852
2857
|
}
|
|
2853
2858
|
for (const child of Array.from(element.children)) {
|
|
@@ -2916,6 +2921,7 @@ export {
|
|
|
2916
2921
|
findAttributeDefinitionByName,
|
|
2917
2922
|
findSchemaByCode,
|
|
2918
2923
|
findSchemaByElement,
|
|
2924
|
+
findSchemaByTagName,
|
|
2919
2925
|
getAttributeName,
|
|
2920
2926
|
isAttributeRestricted,
|
|
2921
2927
|
isIgnoredAttribute,
|