@digitalculture/ochre-sdk 0.4.12 → 0.4.14
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.cjs +9 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +9 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -275,7 +275,12 @@ function parseStringDocumentItem(item, footnotes) {
|
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
if ("links" in item) {
|
|
278
|
-
|
|
278
|
+
let itemString = "";
|
|
279
|
+
if (typeof item.string === "object") {
|
|
280
|
+
itemString = parseStringContent(item.string);
|
|
281
|
+
} else {
|
|
282
|
+
itemString = parseFakeString(item.string).replaceAll("<", String.raw`\<`).replaceAll("{", String.raw`\{`);
|
|
283
|
+
}
|
|
279
284
|
const itemLinks = Array.isArray(item.links) ? item.links : [item.links];
|
|
280
285
|
for (const link of itemLinks) {
|
|
281
286
|
if ("resource" in link) {
|
|
@@ -316,6 +321,9 @@ function parseStringDocumentItem(item, footnotes) {
|
|
|
316
321
|
return `<TooltipSpan type="externalDocument" ${linkContent !== null ? `content="${linkContent}"` : ""}>${itemString}</TooltipSpan>`;
|
|
317
322
|
}
|
|
318
323
|
}
|
|
324
|
+
case "webpage": {
|
|
325
|
+
return `<ExternalLink href="${linkResource.href}" type="webpage" ${linkContent !== null ? `content="${linkContent}"` : ""}>${itemString}</ExternalLink>`;
|
|
326
|
+
}
|
|
319
327
|
default: {
|
|
320
328
|
return "";
|
|
321
329
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -751,7 +751,7 @@ type OchreStringRichTextItemContent = {
|
|
|
751
751
|
*/
|
|
752
752
|
type OchreStringRichTextItemAnnotation = {
|
|
753
753
|
annotation: string; // UUID
|
|
754
|
-
string: FakeString;
|
|
754
|
+
string: FakeString | OchreStringRichTextItemContent;
|
|
755
755
|
links: OchreLink | Array<OchreLink>;
|
|
756
756
|
};
|
|
757
757
|
|
|
@@ -1028,6 +1028,7 @@ type OchreLinkItem = {
|
|
|
1028
1028
|
widthPreview?: number;
|
|
1029
1029
|
height?: number;
|
|
1030
1030
|
width?: number;
|
|
1031
|
+
href?: string;
|
|
1031
1032
|
};
|
|
1032
1033
|
|
|
1033
1034
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -751,7 +751,7 @@ type OchreStringRichTextItemContent = {
|
|
|
751
751
|
*/
|
|
752
752
|
type OchreStringRichTextItemAnnotation = {
|
|
753
753
|
annotation: string; // UUID
|
|
754
|
-
string: FakeString;
|
|
754
|
+
string: FakeString | OchreStringRichTextItemContent;
|
|
755
755
|
links: OchreLink | Array<OchreLink>;
|
|
756
756
|
};
|
|
757
757
|
|
|
@@ -1028,6 +1028,7 @@ type OchreLinkItem = {
|
|
|
1028
1028
|
widthPreview?: number;
|
|
1029
1029
|
height?: number;
|
|
1030
1030
|
width?: number;
|
|
1031
|
+
href?: string;
|
|
1031
1032
|
};
|
|
1032
1033
|
|
|
1033
1034
|
/**
|
package/dist/index.js
CHANGED
|
@@ -198,7 +198,12 @@ function parseStringDocumentItem(item, footnotes) {
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
if ("links" in item) {
|
|
201
|
-
|
|
201
|
+
let itemString = "";
|
|
202
|
+
if (typeof item.string === "object") {
|
|
203
|
+
itemString = parseStringContent(item.string);
|
|
204
|
+
} else {
|
|
205
|
+
itemString = parseFakeString(item.string).replaceAll("<", String.raw`\<`).replaceAll("{", String.raw`\{`);
|
|
206
|
+
}
|
|
202
207
|
const itemLinks = Array.isArray(item.links) ? item.links : [item.links];
|
|
203
208
|
for (const link of itemLinks) {
|
|
204
209
|
if ("resource" in link) {
|
|
@@ -239,6 +244,9 @@ function parseStringDocumentItem(item, footnotes) {
|
|
|
239
244
|
return `<TooltipSpan type="externalDocument" ${linkContent !== null ? `content="${linkContent}"` : ""}>${itemString}</TooltipSpan>`;
|
|
240
245
|
}
|
|
241
246
|
}
|
|
247
|
+
case "webpage": {
|
|
248
|
+
return `<ExternalLink href="${linkResource.href}" type="webpage" ${linkContent !== null ? `content="${linkContent}"` : ""}>${itemString}</ExternalLink>`;
|
|
249
|
+
}
|
|
242
250
|
default: {
|
|
243
251
|
return "";
|
|
244
252
|
}
|
package/package.json
CHANGED