Comments (5)
The reading time plug-in works on the lifecycle of beforeCreate
and beforeUpdate
and when those events fire the components have already been created/updated and the data
for the lifecycle event is just a reference to the record(s) for the components.
For example, if you have an SEO
component on an Article
then when you save the data for the Article
in the lifecycle event would be something like
{
...
readingTime: "",
seo: {
id: 1,
__pivot: { order: 1, field: 'seo', component_type: 'seo' }
},
}
So while you can do the work and get the required data from the component(s), it is beyond what this plug-in is doing at this time.
We are always accepting of PRs if you would like this to be implemented.
from strapi-plugin-reading-time.
What version of Strapi?
Does the field exist that you are trying to reference?
from strapi-plugin-reading-time.
Thanks for the quick response. I believe it does but I may be referencing it incorrectly please see attached image. I also added readingTime
(type Text) under Information (not pictured here). Is this the correct config for my setup?
"reading-time": { enabled: true, config: { contentTypes: { articles: { field: "readingTime", references: "information", }, }, }, }
from strapi-plugin-reading-time.
In your case information
is a component
, not a field
. For example, if you had an Article
collection with a readingTime
field that references a content
rich text field. On Save, the reading time for the content
field will be put into the readingTime
field.
This plug-in does not calculate the reading time for a component as it wouldn't know which field would be valid.
Does that make sense?
from strapi-plugin-reading-time.
Yes it does; I got it working thanks. Is it possible to use this on fields within a component?
from strapi-plugin-reading-time.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strapi-plugin-reading-time.