Git Product home page Git Product logo

Comments (5)

shawncarr avatar shawncarr commented on September 3, 2024 1

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.

shawncarr avatar shawncarr commented on September 3, 2024

What version of Strapi?

Does the field exist that you are trying to reference?

from strapi-plugin-reading-time.

hyped0001 avatar hyped0001 commented on September 3, 2024

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", }, }, }, }

Screenshot 2022-12-15 at 4 40 17 PM

from strapi-plugin-reading-time.

shawncarr avatar shawncarr commented on September 3, 2024

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.

hyped0001 avatar hyped0001 commented on September 3, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.