@dosgato/templating 0.0.130 → 0.0.132
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/component.d.ts +6 -1
- package/dist/render.d.ts +30 -4
- package/dist/uitemplate.d.ts +3 -3
- package/package.json +1 -1
package/dist/component.d.ts
CHANGED
|
@@ -168,7 +168,9 @@ export declare abstract class Component<DataType extends ComponentData = any, Fe
|
|
|
168
168
|
* method to prepare editor-provided HTML for later rendering. It will do things like find and
|
|
169
169
|
* resolve link definitions in the internal dosgato format.
|
|
170
170
|
*/
|
|
171
|
-
fetchRichText: (html: string | undefined
|
|
171
|
+
fetchRichText: (html: string | undefined, opts?: {
|
|
172
|
+
absolute?: boolean;
|
|
173
|
+
}) => Promise<void>;
|
|
172
174
|
/**
|
|
173
175
|
* This function will be provided by the rendering server and should be used during the render
|
|
174
176
|
* phase to clean up editor-provided HTML. It will do things like clean up tags that were accidentally
|
|
@@ -350,6 +352,9 @@ export interface PageRecord<DataType extends PageData = PageData> {
|
|
|
350
352
|
publishedAt?: Date;
|
|
351
353
|
path: string;
|
|
352
354
|
data: DataType;
|
|
355
|
+
pagetree: {
|
|
356
|
+
id: string;
|
|
357
|
+
};
|
|
353
358
|
site: SiteInfo;
|
|
354
359
|
}
|
|
355
360
|
export interface PageRecordOptionalData<DataType extends PageData = PageData> extends Omit<PageRecord<DataType>, 'data'> {
|
package/dist/render.d.ts
CHANGED
|
@@ -106,16 +106,22 @@ export interface APIClient {
|
|
|
106
106
|
extension?: string;
|
|
107
107
|
}) => Promise<string | undefined>;
|
|
108
108
|
/**
|
|
109
|
-
* Exactly like resolveLink but also returns
|
|
110
|
-
*
|
|
111
|
-
*
|
|
109
|
+
* Exactly like resolveLink but also returns more data.
|
|
110
|
+
*
|
|
111
|
+
* First, the title of the target page, if the target page is internal to the CMS. If the
|
|
112
|
+
* target is a random web page outside the CMS, title will be undefined. Perhaps in the future
|
|
113
|
+
* title could be scraped from the page HTML.
|
|
114
|
+
*
|
|
115
|
+
* Second, a broken boolean that indicates whether the targeted page actually exists. See getHrefPlus
|
|
116
|
+
* for a detailed explanation.
|
|
112
117
|
*/
|
|
113
|
-
|
|
118
|
+
resolveLinkPlus: (lnk: string | LinkDefinition | undefined, opts?: {
|
|
114
119
|
absolute?: boolean;
|
|
115
120
|
extension?: string;
|
|
116
121
|
}) => Promise<{
|
|
117
122
|
href?: string;
|
|
118
123
|
title?: string;
|
|
124
|
+
broken: boolean;
|
|
119
125
|
}>;
|
|
120
126
|
/**
|
|
121
127
|
* Get a link href for a page
|
|
@@ -132,6 +138,26 @@ export interface APIClient {
|
|
|
132
138
|
absolute?: boolean;
|
|
133
139
|
extension?: string;
|
|
134
140
|
}) => string | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Exactly like getHref except it also returns whether or not the link it's returning is actually
|
|
143
|
+
* a broken link.
|
|
144
|
+
*
|
|
145
|
+
* When an internal link points at a page that has since been deleted, we don't want to return
|
|
146
|
+
* undefined or empty string or something like that, because it would mask the issue that a link has
|
|
147
|
+
* stopped working. Instead we return the path that we once pointed at, which we know won't work, but
|
|
148
|
+
* is at least something the user can read, and then reason about why the link broke and how to fix it.
|
|
149
|
+
*
|
|
150
|
+
* Since we are returning data we know is broken, it's nice to have a boolean that indicates that fact.
|
|
151
|
+
* Based on that boolean, components can be configured to render a shiny red warning message in edit mode
|
|
152
|
+
* so that editors can quickly identify broken links on their pages.
|
|
153
|
+
*/
|
|
154
|
+
getHrefPlus: (page: PageRecordOptionalData, opts?: {
|
|
155
|
+
absolute?: boolean;
|
|
156
|
+
extension?: string;
|
|
157
|
+
}) => {
|
|
158
|
+
href: string | undefined;
|
|
159
|
+
broken: boolean;
|
|
160
|
+
};
|
|
135
161
|
/**
|
|
136
162
|
* Get assets by link
|
|
137
163
|
*
|
package/dist/uitemplate.d.ts
CHANGED
|
@@ -189,9 +189,9 @@ export interface UIConfig {
|
|
|
189
189
|
assetMetaDialog?: UITemplate['dialog'];
|
|
190
190
|
tracing?: {
|
|
191
191
|
init?: (env: TracingEnvironment) => void;
|
|
192
|
-
startTransaction?: (name: string, details: any, env
|
|
193
|
-
endTransaction?: (name: string, details: any, env
|
|
194
|
-
event?: (name: string, details: any, env
|
|
192
|
+
startTransaction?: (name: string, details: any, env?: TracingEnvironment) => void;
|
|
193
|
+
endTransaction?: (name: string, details: any, env?: TracingEnvironment) => void;
|
|
194
|
+
event?: (name: string, details: any, env?: TracingEnvironment) => void;
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
197
|
export {};
|