@digitalculture/ochre-sdk 0.11.23 → 0.11.24
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 +32 -28
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -609,36 +609,40 @@ function parseStringDocumentItem(item) {
|
|
|
609
609
|
const linkBibliography = Array.isArray(link.bibliography) ? link.bibliography[0] : link.bibliography;
|
|
610
610
|
if (linkBibliography.publicationDateTime != null) return `<InternalLink uuid="${linkBibliography.uuid}">${itemString}</InternalLink>`;
|
|
611
611
|
else return `<TooltipSpan>${itemString}</TooltipSpan>`;
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}));
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
if ("properties" in item && item.properties != null) {
|
|
615
|
+
let itemString = "";
|
|
616
|
+
if (typeof item.string === "object") itemString = parseStringContent(item.string);
|
|
617
|
+
else itemString = parseFakeString(item.string).replaceAll("<", String.raw`\<`).replaceAll("{", String.raw`\{`);
|
|
618
|
+
const itemProperty = Array.isArray(item.properties.property) ? item.properties.property[0] : item.properties.property;
|
|
619
|
+
if (itemProperty != null) {
|
|
620
|
+
const itemPropertyLabelUuid = itemProperty.label.uuid;
|
|
621
|
+
const itemPropertyValueUuid = typeof itemProperty.value === "object" && "uuid" in itemProperty.value && itemProperty.value.uuid != null ? itemProperty.value.uuid : null;
|
|
622
|
+
if (itemPropertyLabelUuid === PRESENTATION_ITEM_UUID && itemPropertyValueUuid === TEXT_ANNOTATION_UUID) {
|
|
623
|
+
const textAnnotationProperty = itemProperty.property != null ? Array.isArray(itemProperty.property) ? itemProperty.property[0] : itemProperty.property : null;
|
|
624
|
+
if (textAnnotationProperty != null) {
|
|
625
|
+
if ((typeof textAnnotationProperty.value === "object" && "uuid" in textAnnotationProperty.value && textAnnotationProperty.value.uuid != null ? textAnnotationProperty.value.uuid : null) === TEXT_ANNOTATION_TEXT_STYLING_UUID && textAnnotationProperty.property != null) {
|
|
626
|
+
const textStylingType = "text-styling";
|
|
627
|
+
let textStylingVariant = "default";
|
|
628
|
+
let textStylingSize = "md";
|
|
629
|
+
let textStylingCss = [];
|
|
630
|
+
const textStylingProperties = Array.isArray(textAnnotationProperty.property) ? textAnnotationProperty.property : [textAnnotationProperty.property];
|
|
631
|
+
if (textStylingProperties.length > 0) {
|
|
632
|
+
const textStylingVariantProperty = textStylingProperties.find((property) => property.label.uuid === TEXT_ANNOTATION_TEXT_STYLING_VARIANT_UUID);
|
|
633
|
+
if (textStylingVariantProperty != null) {
|
|
634
|
+
const textStylingPropertyVariant = parseFakeString(textStylingVariantProperty.value.content);
|
|
635
|
+
const textStylingSizeProperty = textStylingVariantProperty.property != null ? Array.isArray(textStylingVariantProperty.property) ? textStylingVariantProperty.property[0] : textStylingVariantProperty.property : null;
|
|
636
|
+
if (textStylingSizeProperty != null) textStylingSize = parseFakeString(textStylingSizeProperty.value.content);
|
|
637
|
+
textStylingVariant = textStylingPropertyVariant;
|
|
639
638
|
}
|
|
640
|
-
|
|
639
|
+
const textStylingCssProperties = textStylingProperties.filter((property) => property.label.uuid !== TEXT_ANNOTATION_TEXT_STYLING_VARIANT_UUID);
|
|
640
|
+
if (textStylingCssProperties.length > 0) textStylingCss = textStylingCssProperties.map((property) => ({
|
|
641
|
+
label: parseFakeString(property.label.content),
|
|
642
|
+
value: parseFakeString(property.value.content)
|
|
643
|
+
}));
|
|
641
644
|
}
|
|
645
|
+
return `<Annotation type="${textStylingType}" variant="${textStylingVariant}" size="${textStylingSize}"${textStylingCss.length > 0 ? ` cssStyles={{default: ${JSON.stringify(textStylingCss)}, tablet: [], mobile: []}}` : ""}>${itemString}</Annotation>`;
|
|
642
646
|
}
|
|
643
647
|
}
|
|
644
648
|
}
|
package/package.json
CHANGED