@dosgato/templating 0.0.144 → 0.0.146
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/apitemplate.d.ts +21 -0
- package/dist/component.d.ts +1 -0
- package/dist/component.js +4 -0
- package/dist/uitemplate.d.ts +4 -0
- package/package.json +1 -1
package/dist/apitemplate.d.ts
CHANGED
|
@@ -101,6 +101,27 @@ export interface APITemplate<DataType> {
|
|
|
101
101
|
* function during rendering to return a smaller set of pages for navigation.
|
|
102
102
|
*/
|
|
103
103
|
getTags?: FulltextGatheringFn<DataType>;
|
|
104
|
+
/**
|
|
105
|
+
* Copying components around is a core feature in DosGato, but sometimes the data stored
|
|
106
|
+
* is not suitable for copying, for example unique identifiers generated by FieldIdentifier
|
|
107
|
+
* should be regenerated during a copy.
|
|
108
|
+
*
|
|
109
|
+
* Provide this function to do work like that. It will only be called when content is being
|
|
110
|
+
* copied, i.e. the original still exists.
|
|
111
|
+
*
|
|
112
|
+
* The pageCopy parameter will be true when an entire page is being copied, and false when a
|
|
113
|
+
* component or data entry is being copied. Sometimes you will want to behave differently in
|
|
114
|
+
* those cases. For instance, if you generate a unique id and then make references to it on
|
|
115
|
+
* the same page, you would not want to regenerate those ids during a full page copy because
|
|
116
|
+
* all the references would break, but you would want to regenerate id on an in-page copy
|
|
117
|
+
* because you need new ids for the new objects.
|
|
118
|
+
*
|
|
119
|
+
* workspace is an initially empty object that onCopy methods from various components can use
|
|
120
|
+
* as shared memory. You would need this to do something like regenerating ids and also
|
|
121
|
+
* updating references. You would keep a map of original id -> new id in workspace.mynamespace
|
|
122
|
+
* and set it any time you encounter an id or reference.
|
|
123
|
+
*/
|
|
124
|
+
onCopy?: (data: DataType, pageCopy: boolean, workspace: Record<string, any>) => void;
|
|
104
125
|
/**
|
|
105
126
|
* The available component list in the main content area can get very long, among others. Therefore, each
|
|
106
127
|
* template may set a displayCategory and any templates that share a displayCategory will be grouped together
|
package/dist/component.d.ts
CHANGED
|
@@ -631,6 +631,7 @@ export declare abstract class Page<DataType extends PageData = any, FetchedType
|
|
|
631
631
|
* Get a URL for the current page with a different extension
|
|
632
632
|
*/
|
|
633
633
|
variationUrl(extension: string): string;
|
|
634
|
+
logError(e: Error): void;
|
|
634
635
|
protected passError(e: Error, path: string): void;
|
|
635
636
|
constructor(page: PageRecord<DataType>, editMode: boolean, extension: string);
|
|
636
637
|
}
|
package/dist/component.js
CHANGED
|
@@ -288,6 +288,10 @@ export class Page extends Component {
|
|
|
288
288
|
variationUrl(extension) {
|
|
289
289
|
return (this.url === '/' ? '/.root' : this.url.replace(/\.[^/]+$/, '')) + '.' + extension;
|
|
290
290
|
}
|
|
291
|
+
logError(e) {
|
|
292
|
+
this.hadError = true;
|
|
293
|
+
console.error(`Unrecoverable issue occurred during render of ${this.pageInfo.path}. Page template threw the following error:`, e);
|
|
294
|
+
}
|
|
291
295
|
passError(e, path) {
|
|
292
296
|
console.warn(`Recoverable issue occured during render of ${this.pageInfo.path}. Component at ${path} threw the following error:`, e);
|
|
293
297
|
}
|
package/dist/uitemplate.d.ts
CHANGED
|
@@ -276,6 +276,10 @@ export interface UIConfig {
|
|
|
276
276
|
* Optional CMS logo to be placed in the top left of the admin UI.
|
|
277
277
|
*/
|
|
278
278
|
logo?: IconOrSVG;
|
|
279
|
+
/**
|
|
280
|
+
* Page title for the <head>
|
|
281
|
+
*/
|
|
282
|
+
title?: string;
|
|
279
283
|
/**
|
|
280
284
|
* If you would like to collect more information about assets from editors, you may provide a dialog
|
|
281
285
|
* here. The data collected will be available when you retrieve assets.
|