pro-editor-schema 0.2.24 → 1.0.0

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 CHANGED
@@ -2336,12 +2336,13 @@ var LINK_SCHEMA = createSchema({
2336
2336
  });
2337
2337
 
2338
2338
  // src/schema/elementSchemas/inlineElements/uri.ts
2339
+ var LINK_ATTRIBUTE = "xlinkhref";
2339
2340
  var URI_SCHEMA = createSchema({
2340
2341
  code: "uri",
2341
2342
  kind: "inline",
2342
2343
  tag: URI_TAG,
2343
- requiredAttributes: [],
2344
- optionalAttributes: ["xlinkhref"],
2344
+ requiredAttributes: [LINK_ATTRIBUTE],
2345
+ optionalAttributes: [],
2345
2346
  allowedChildrenCodes: [...ATOM_CODES_ALLOWED_CHILDREN]
2346
2347
  });
2347
2348
 
@@ -2723,9 +2724,9 @@ var validateFootnoteCue = (footnoteElement, linkElements) => {
2723
2724
  });
2724
2725
  return errors;
2725
2726
  };
2726
- var validateConsecutiveFootnotes = (element) => {
2727
+ var validateConsecutiveFootnotes = (root) => {
2727
2728
  const footnotes = getElementsSelector({
2728
- element,
2729
+ element: root,
2729
2730
  selector: FOOTNOTE_SCHEMA.tag,
2730
2731
  filterDeletedNodes: true
2731
2732
  });
@@ -2756,9 +2757,9 @@ var validateConsecutiveFootnotes = (element) => {
2756
2757
  }
2757
2758
  return [];
2758
2759
  };
2759
- var validateConsecutiveFootnoteCues = (element) => {
2760
+ var validateConsecutiveFootnoteCues = (root) => {
2760
2761
  const footnoteLinks = getElementsSelector({
2761
- element,
2762
+ element: root,
2762
2763
  selector: FOOTNOTE_LINK_SCHEMA.tag,
2763
2764
  filterDeletedNodes: true
2764
2765
  });
@@ -2950,7 +2951,18 @@ var isValidUri = (uri) => {
2950
2951
  return WEB_URI_REGEX.test(uri);
2951
2952
  };
2952
2953
  var validateUri = (uriElement) => {
2953
- const url = uriElement.textContent.trim();
2954
+ const url = uriElement.getAttribute(LINK_ATTRIBUTE);
2955
+ if (!url) {
2956
+ return [
2957
+ createValidationIssue({
2958
+ store: getStore(uriElement),
2959
+ title: "URL is required",
2960
+ kind: "missing",
2961
+ description: "URL is required. Please check and adjust.",
2962
+ level: "warning"
2963
+ })
2964
+ ];
2965
+ }
2954
2966
  if (isValidUri(url)) {
2955
2967
  return [];
2956
2968
  }
package/dist/index.mjs CHANGED
@@ -2268,12 +2268,13 @@ var LINK_SCHEMA = createSchema({
2268
2268
  });
2269
2269
 
2270
2270
  // src/schema/elementSchemas/inlineElements/uri.ts
2271
+ var LINK_ATTRIBUTE = "xlinkhref";
2271
2272
  var URI_SCHEMA = createSchema({
2272
2273
  code: "uri",
2273
2274
  kind: "inline",
2274
2275
  tag: URI_TAG,
2275
- requiredAttributes: [],
2276
- optionalAttributes: ["xlinkhref"],
2276
+ requiredAttributes: [LINK_ATTRIBUTE],
2277
+ optionalAttributes: [],
2277
2278
  allowedChildrenCodes: [...ATOM_CODES_ALLOWED_CHILDREN]
2278
2279
  });
2279
2280
 
@@ -2655,9 +2656,9 @@ var validateFootnoteCue = (footnoteElement, linkElements) => {
2655
2656
  });
2656
2657
  return errors;
2657
2658
  };
2658
- var validateConsecutiveFootnotes = (element) => {
2659
+ var validateConsecutiveFootnotes = (root) => {
2659
2660
  const footnotes = getElementsSelector({
2660
- element,
2661
+ element: root,
2661
2662
  selector: FOOTNOTE_SCHEMA.tag,
2662
2663
  filterDeletedNodes: true
2663
2664
  });
@@ -2688,9 +2689,9 @@ var validateConsecutiveFootnotes = (element) => {
2688
2689
  }
2689
2690
  return [];
2690
2691
  };
2691
- var validateConsecutiveFootnoteCues = (element) => {
2692
+ var validateConsecutiveFootnoteCues = (root) => {
2692
2693
  const footnoteLinks = getElementsSelector({
2693
- element,
2694
+ element: root,
2694
2695
  selector: FOOTNOTE_LINK_SCHEMA.tag,
2695
2696
  filterDeletedNodes: true
2696
2697
  });
@@ -2882,7 +2883,18 @@ var isValidUri = (uri) => {
2882
2883
  return WEB_URI_REGEX.test(uri);
2883
2884
  };
2884
2885
  var validateUri = (uriElement) => {
2885
- const url = uriElement.textContent.trim();
2886
+ const url = uriElement.getAttribute(LINK_ATTRIBUTE);
2887
+ if (!url) {
2888
+ return [
2889
+ createValidationIssue({
2890
+ store: getStore(uriElement),
2891
+ title: "URL is required",
2892
+ kind: "missing",
2893
+ description: "URL is required. Please check and adjust.",
2894
+ level: "warning"
2895
+ })
2896
+ ];
2897
+ }
2886
2898
  if (isValidUri(url)) {
2887
2899
  return [];
2888
2900
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pro-editor-schema",
3
- "version": "0.2.24",
3
+ "version": "1.0.0",
4
4
  "description": "Pro Editor XML schemas",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",