ochre-sdk 1.0.0-beta.5 → 1.0.0-beta.6
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.mjs +16 -9
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -879,9 +879,13 @@ function parseWhitespace(contentString, whitespace, rendering) {
|
|
|
879
879
|
* @internal
|
|
880
880
|
*/
|
|
881
881
|
function parseXMLStringVariant(string, options) {
|
|
882
|
-
let returnString = (string
|
|
882
|
+
let returnString = parseXMLStringPayload(string, options);
|
|
883
883
|
if (string.whitespace != null) returnString = parseWhitespace(returnString, string.whitespace, options.rendering);
|
|
884
884
|
if (string.rend != null) returnString = parseRenderOptions(returnString, string.rend, options.rendering);
|
|
885
|
+
return returnString;
|
|
886
|
+
}
|
|
887
|
+
function parseXMLStringPayload(string, options) {
|
|
888
|
+
const returnString = (string.payload ?? "").replaceAll("<", options.rendering === "rich" ? String.raw`\<` : "<").replaceAll("{", String.raw`\{`).replaceAll("}", String.raw`\}`);
|
|
885
889
|
return options.parseEmail ? parseEmail(returnString) : returnString;
|
|
886
890
|
}
|
|
887
891
|
function parseXMLString(string, options) {
|
|
@@ -1035,14 +1039,13 @@ function hasRichTextEnvelope(item) {
|
|
|
1035
1039
|
return item.properties?.property[0] != null || getXMLRichTextLinks(item).length > 0;
|
|
1036
1040
|
}
|
|
1037
1041
|
function parseXMLStringItem(item, contentItem, options) {
|
|
1038
|
-
if (item.payload != null) return
|
|
1039
|
-
|
|
1040
|
-
parseEmail: options.parseEmail
|
|
1041
|
-
});
|
|
1042
|
-
if (item.string == null && item.whitespace != null) return parseWhitespace("", item.whitespace, options.rendering);
|
|
1043
|
-
if (item.string == null) return "";
|
|
1042
|
+
if (item.payload == null && item.string == null && item.whitespace != null) return parseWhitespace("", item.whitespace, options.rendering);
|
|
1043
|
+
if (item.payload == null && item.string == null) return "";
|
|
1044
1044
|
if (hasRichTextEnvelope(item)) {
|
|
1045
|
-
let linkString =
|
|
1045
|
+
let linkString = item.payload != null ? parseXMLStringPayload(item, {
|
|
1046
|
+
rendering: options.rendering,
|
|
1047
|
+
parseEmail: false
|
|
1048
|
+
}) : parseNestedStringItems(item.string ?? [], contentItem, {
|
|
1046
1049
|
...options,
|
|
1047
1050
|
parseEmail: false
|
|
1048
1051
|
});
|
|
@@ -1050,7 +1053,11 @@ function parseXMLStringItem(item, contentItem, options) {
|
|
|
1050
1053
|
if (options.rendering === "plain") return applyWhitespaceToResult(linkString, item.whitespace, options.rendering);
|
|
1051
1054
|
return renderRichTextItem(item, linkString, contentItem, options);
|
|
1052
1055
|
}
|
|
1053
|
-
|
|
1056
|
+
if (item.payload != null) return parseXMLStringVariant(item, {
|
|
1057
|
+
rendering: options.rendering,
|
|
1058
|
+
parseEmail: options.parseEmail
|
|
1059
|
+
});
|
|
1060
|
+
let result = parseNestedStringItems(item.string ?? [], contentItem, options);
|
|
1054
1061
|
if (item.rend != null) result = parseRenderOptions(result, item.rend, options.rendering);
|
|
1055
1062
|
return applyWhitespaceToResult(result, item.whitespace, options.rendering);
|
|
1056
1063
|
}
|
package/package.json
CHANGED