apostrophe-schema-widgets
Advanced tools
Comparing version 0.5.21 to 0.5.22
14
index.js
@@ -44,2 +44,6 @@ /* jshint node:true */ | ||
if (options.afterLoad) { | ||
widget.afterLoad = options.afterLoad; | ||
} | ||
if (_.find(options.schema, function(field) { | ||
@@ -98,4 +102,10 @@ return (field.name === 'content'); | ||
return self._schemas.join(req, options.schema, items, undefined, function(err) { | ||
req.aposSchemaWidgetLoading = false; | ||
return setImmediate(_.partial(callback, err)); | ||
if (err || typeof widget.afterLoad !== 'function'){ | ||
req.aposSchemaWidgetLoading = false; | ||
return setImmediate(_.partial(callback, err)); | ||
} | ||
return widget.afterLoad(req, items[0], function(err) { | ||
req.aposSchemaWidgetLoading = false; | ||
return setImmediate(_.partial(callback, err)); | ||
}); | ||
}); | ||
@@ -102,0 +112,0 @@ }; |
{ | ||
"name": "apostrophe-schema-widgets", | ||
"version": "0.5.21", | ||
"version": "0.5.22", | ||
"description": "An easy form widget builder for the Apostrophe content management system", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -66,2 +66,3 @@ # apostrophe-schema-widgets | ||
instructions: 'Click "add" to add your first link. Enter a label and paste a URL for each link.', | ||
type: 'array', | ||
schema: [ | ||
@@ -147,2 +148,12 @@ { | ||
If you need to fetch more data that is dependent on all of the joins being hydrated, | ||
you can execute custom code after the widget is finished loading in your `index.js`: | ||
```javascript | ||
self.widgets.menuBuilder.afterLoad = function(req, item, callback) { | ||
// Fetch more data | ||
return callback(null); | ||
} | ||
``` | ||
You also have `afterConvertFields` available to you for treating fields after they are sanitized. You can use it in `index.js` like this: | ||
@@ -156,2 +167,1 @@ | ||
``` | ||
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
16137
214
165
1