Giter VIP home page Giter VIP logo

Comments (7)

ayobami303 avatar ayobami303 commented on June 1, 2024 1

any update on fixing this. it has reappeared again

from field-editors.

nekosaur avatar nekosaur commented on June 1, 2024

I am having the same issue. I am using the field like this.

const contentfulField = sdk.entry.fields[field.id].getForLocale(locale);

...

<RichTextEditor sdk={{ ...sdk, field: contentfulField }} />

from field-editors.

waelhasan avatar waelhasan commented on June 1, 2024

I have the same issue here: the rich text editor does not show the data coming from Contentful, and when i try to enter any thing in the rich text editor i have the error TypeError: Cannot use 'in' operator to search for 'type' in document.

I tried to take a look at the source code, and found out that the two issues comes from the way in which the @contentful/contentful-slatejs-adapter package is working; as it is the one that is used to translate the rich text content between Contentful and Slatejs.
The issue is that in the function toContentfulDocument we iterate over the fields in the document object, which contains the field type that has the value document:

{
  "type": "document"
}

then the function isSlateElement is called with type field as an argument:

function isSlateElement(node) {
    return 'type' in node;
}

Which causes the error; as in can not be used on a string value like this:

return 'type' in 'document'

I tried to play with the implementation to see if i can fix the issue, and managed to make the error disappear by changing the implementation of the function toContentfulDocument to be:

....
flatmap(document.nodes, ...
...

Notice that my change is only using document.nodes as an argument to flatmap function instead od document.
That made the error disappear, but it does not save the correct value in Contentful's entry.

I am not sure if what i have done is useful or not, but i surely hope to get this issue fixed soon :)

from field-editors.

cribbles avatar cribbles commented on June 1, 2024

Hi all

Thanks for bringing this to our attention. I believe this is due to an update in our rich text to slate format adapter library that was shipped recently. I'll make a task for our team to fix this library's version to the previous v14.1.2. Apologies for the disruption caused in the meantime.

Chris

from field-editors.

sssgordon avatar sssgordon commented on June 1, 2024

It seems the fix is pushed but on npm it's still the last version (0.8.13), when is 0.8.14 dropping?

from field-editors.

cribbles avatar cribbles commented on June 1, 2024

@ayobami303 @sssgordon Apologies - looks like this was published with the wrong dist/. Would you please try with v0.18.12 and report back if there are any issues?

from field-editors.

sssgordon avatar sssgordon commented on June 1, 2024

@cribbles Thanks for the response, it seems rolling back to 0.8.12 for @contentful/field-editor-rich-text does the trick as in I can use the rich-text field and save it no problem!

from field-editors.

Related Issues (20)

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.