Giter Site home page Giter Site logo

Comments (6)

s5no5t avatar s5no5t commented on June 2, 2024 3

@lotas @Swissbite this seems to work just fine. Thank you for implementing this!

from contentful-graph.

Swissbite avatar Swissbite commented on June 2, 2024 1

@lotas I just saw the issue and I added an example contentful export with richtext.

The schema includes two models:
Simple Image Caption
A simple content model to have a reference / filter for the other schema. It has 3 fields, a name, a caption and an asset reference for images.

Graph Example with Richttext Item
It has 4 fields

Title - A basic title, to be able to find it in the overview
Richtext all options enabled - All options enabled, no validation set. Therefore, all content models can be referenced in this richtext

{
          "id": "richtextAllOptionsEnabled",
          "name": "Richtext all options enabled",
          "type": "RichText",
          "localized": true,
          "required": true,
          "validations": [
            {
              "nodes": {
              }
            }
          ],
          "disabled": false,
          "omitted": false
}

Richtext only media assets - This has a basic filter to only enable formats, hyperlinks and links / inline reference to assets.

{
          "id": "richtextOnlyMediaAssets",
          "name": "Richtext only media assets",
          "type": "RichText",
          "localized": true,
          "required": false,
          "validations": [
            {
              "enabledNodeTypes": [
                "heading-1",
                "heading-2",
                "heading-3",
                "heading-4",
                "heading-5",
                "heading-6",
                "ordered-list",
                "unordered-list",
                "hr",
                "blockquote",
                "embedded-asset-block",
                "asset-hyperlink",
                "hyperlink"
              ],
              "message": "Only heading 1, heading 2, heading 3, heading 4, heading 5, heading 6, ordered list, unordered list, horizontal rule, quote, asset, link to asset, and link to Url nodes are allowed"
            },
            {
              "nodes": {
              }
            }
          ],
          "disabled": false,
          "omitted": false
        }

Richtext with defined reference to caption - This Richtext definition disabled link and embeding assets and allowing all other node types.

For references / links to content model, the nodeTypes "embedded-entry-block", "entry-hyperlink", "embedded-entry-inline" are possible items. They can be validated against specific content model definition or may have no validation. No validation means that all content models can be referenced.

{
          "id": "richtextWithDefinedReferenceToCaption",
          "name": "Richtext with defined reference to caption",
          "type": "RichText",
          "localized": true,
          "required": false,
          "validations": [
            {
              "enabledNodeTypes": [
                "heading-1",
                "heading-2",
                "heading-3",
                "heading-4",
                "heading-5",
                "heading-6",
                "ordered-list",
                "unordered-list",
                "hr",
                "blockquote",
                "embedded-entry-block",
                "entry-hyperlink",
                "embedded-entry-inline"
              ],
              "message": "Only heading 1, heading 2, heading 3, heading 4, heading 5, heading 6, ordered list, unordered list, horizontal rule, quote, block entry, link to entry, and inline entry nodes are allowed"
            },
            {
              "nodes": {
                "embedded-entry-block": [
                  {
                    "linkContentType": [
                      "simpleImageCaption"
                    ],
                    "message": null
                  }
                ],
                "embedded-entry-inline": [
                  {
                    "linkContentType": [
                      "simpleImageCaption"
                    ],
                    "message": null
                  }
                ],
                "entry-hyperlink": [
                  {
                    "linkContentType": [
                      "graphExampleWithRichttextItem"
                    ],
                    "message": null
                  }
                ]
              }
            }

The attached file contains the complete schema export with the models described above. contentful-export-richtext-example-2020-10-24T18-24-20.json.txt

PS: Github does not allow to upload a file with the ending json, so I added the .txt suffix :-)

from contentful-graph.

lotas avatar lotas commented on June 2, 2024

Hi @jugglingthebits! Thanks for the feedback :)

Yes, this is pretty much active, but I don't work with contentful anymore, so not actively developed, so to say ;)
Features and PRs are highly appreciated, thank you.

from contentful-graph.

lotas avatar lotas commented on June 2, 2024

Can you post an exported json schema? To have a look, why it is not picked up?

from contentful-graph.

lotas avatar lotas commented on June 2, 2024

@Swissbite I've merged your PR, thank you for the contribution 👍
@jugglingthebits can you please pull latest version and check if the issue was fixed for you?

from contentful-graph.

s5no5t avatar s5no5t commented on June 2, 2024

@lotas will do!

from contentful-graph.

Related Issues (15)

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.