Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apostrophecms/apostrophe-anchors
Improve apostrophe-widgets with anchoring capability
https://github.com/apostrophecms/apostrophe-anchors
Last synced: about 2 months ago
JSON representation
Improve apostrophe-widgets with anchoring capability
- Host: GitHub
- URL: https://github.com/apostrophecms/apostrophe-anchors
- Owner: apostrophecms
- License: mit
- Created: 2019-06-05T12:20:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-17T15:47:24.000Z (over 5 years ago)
- Last Synced: 2024-10-07T18:38:34.141Z (3 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# apostrophe-anchors
An `improve` module that adds an ID wrapper around `apostrophe-widgets`, useful for navigating to widgets via anchors.
## Options
### Use an existing schema field as a default value for the anchor
Pass `anchorDefault: MY-SCHEMA-STRING-FIELD-NAME` as part of your widget configuration. This will default back to a slugified version of the given field's value. In the case of `anchordId` already having a value, it will not be overwritten. If given default field is empty, don't try to assign a value.
```javascript
// app.js
// .. other configuration
'artwork-widgets':{
extend: 'apostrophe-pieces-widgets',
anchorDefault: 'title' // existing string field on the widget
},
```### Disable anchor fields for particular widget
Pass `anchors: false` as part of your widget configuration.
```javascript
// app.js
// .. other configuration
'artwork-widgets':{
extend: 'apostrophe-pieces-widgets',
anchors: false
},
```### Custom attribute in the markup
This would be useful if doing custom front-end behavior. The default attribute is `id`.```javascript
// app.js
// .. other configuration
'apostrophe-anchors-widgets': {
anchorsAttribute: 'data-override'
}
```
The above will wrap your widget in `