@dosgato/templating
Advanced tools
Comparing version 0.0.131 to 0.0.132
@@ -171,3 +171,5 @@ /// <reference types="node" /> | ||
*/ | ||
fetchRichText: (html: string | undefined) => Promise<void>; | ||
fetchRichText: (html: string | undefined, opts?: { | ||
absolute?: boolean; | ||
}) => Promise<void>; | ||
/** | ||
@@ -174,0 +176,0 @@ * This function will be provided by the rendering server and should be used during the render |
@@ -109,7 +109,12 @@ import type { ContextBase, DataData, PageData, PageRecord, PageRecordOptionalData } from './component.js'; | ||
/** | ||
* Exactly like resolveLink but also returns the title of the target page, if the target page | ||
* is internal to the CMS. If the target is a random web page outside the CMS, title will be | ||
* undefined. Perhaps in the future title could be scraped from the page HTML. | ||
* Exactly like resolveLink but also returns more data. | ||
* | ||
* First, the title of the target page, if the target page is internal to the CMS. If the | ||
* target is a random web page outside the CMS, title will be undefined. Perhaps in the future | ||
* title could be scraped from the page HTML. | ||
* | ||
* Second, a broken boolean that indicates whether the targeted page actually exists. See getHrefPlus | ||
* for a detailed explanation. | ||
*/ | ||
resolveLinkAndTitle: (lnk: string | LinkDefinition | undefined, opts?: { | ||
resolveLinkPlus: (lnk: string | LinkDefinition | undefined, opts?: { | ||
absolute?: boolean; | ||
@@ -120,2 +125,3 @@ extension?: string; | ||
title?: string; | ||
broken: boolean; | ||
}>; | ||
@@ -138,2 +144,22 @@ /** | ||
/** | ||
* Exactly like getHref except it also returns whether or not the link it's returning is actually | ||
* a broken link. | ||
* | ||
* When an internal link points at a page that has since been deleted, we don't want to return | ||
* undefined or empty string or something like that, because it would mask the issue that a link has | ||
* stopped working. Instead we return the path that we once pointed at, which we know won't work, but | ||
* is at least something the user can read, and then reason about why the link broke and how to fix it. | ||
* | ||
* Since we are returning data we know is broken, it's nice to have a boolean that indicates that fact. | ||
* Based on that boolean, components can be configured to render a shiny red warning message in edit mode | ||
* so that editors can quickly identify broken links on their pages. | ||
*/ | ||
getHrefPlus: (page: PageRecordOptionalData, opts?: { | ||
absolute?: boolean; | ||
extension?: string; | ||
}) => { | ||
href: string | undefined; | ||
broken: boolean; | ||
}; | ||
/** | ||
* Get assets by link | ||
@@ -140,0 +166,0 @@ * |
@@ -192,7 +192,7 @@ import type { ComponentData, PageData } from './component.js'; | ||
init?: (env: TracingEnvironment) => void; | ||
startTransaction?: (name: string, details: any, env: TracingEnvironment) => void; | ||
endTransaction?: (name: string, details: any, env: TracingEnvironment) => void; | ||
event?: (name: string, details: any, env: TracingEnvironment) => void; | ||
startTransaction?: (name: string, details: any, env?: TracingEnvironment) => void; | ||
endTransaction?: (name: string, details: any, env?: TracingEnvironment) => void; | ||
event?: (name: string, details: any, env?: TracingEnvironment) => void; | ||
}; | ||
} | ||
export {}; |
{ | ||
"name": "@dosgato/templating", | ||
"version": "0.0.131", | ||
"version": "0.0.132", | ||
"description": "A library to support building templates for dosgato CMS.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
105801
2315