@dosgato/templating 0.0.144 → 0.0.145
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/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
|