@dosgato/templating
Advanced tools
Comparing version 0.0.144 to 0.0.145
@@ -105,2 +105,23 @@ import type { ComponentData, DataData, PageData } from './component.js'; | ||
/** | ||
* Copying components around is a core feature in DosGato, but sometimes the data stored | ||
* is not suitable for copying, for example unique identifiers generated by FieldIdentifier | ||
* should be regenerated during a copy. | ||
* | ||
* Provide this function to do work like that. It will only be called when content is being | ||
* copied, i.e. the original still exists. | ||
* | ||
* The pageCopy parameter will be true when an entire page is being copied, and false when a | ||
* component or data entry is being copied. Sometimes you will want to behave differently in | ||
* those cases. For instance, if you generate a unique id and then make references to it on | ||
* the same page, you would not want to regenerate those ids during a full page copy because | ||
* all the references would break, but you would want to regenerate id on an in-page copy | ||
* because you need new ids for the new objects. | ||
* | ||
* workspace is an initially empty object that onCopy methods from various components can use | ||
* as shared memory. You would need this to do something like regenerating ids and also | ||
* updating references. You would keep a map of original id -> new id in workspace.mynamespace | ||
* and set it any time you encounter an id or reference. | ||
*/ | ||
onCopy?: (data: DataType, pageCopy: boolean, workspace: Record<string, any>) => void; | ||
/** | ||
* The available component list in the main content area can get very long, among others. Therefore, each | ||
@@ -107,0 +128,0 @@ * template may set a displayCategory and any templates that share a displayCategory will be grouped together |
{ | ||
"name": "@dosgato/templating", | ||
"version": "0.0.144", | ||
"version": "0.0.145", | ||
"description": "A library to support building templates for dosgato CMS.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
116429
2531