Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@okam/directus-flexible-content

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@okam/directus-flexible-content

## Exports - FlexibleEditorContent (Component) - TRenderingNodes (Type) - JSONContent (Type)

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

directus-flexible-content

Exports

  • FlexibleEditorContent (Component)
  • TRenderingNodes (Type)
  • JSONContent (Type)

FlexibleEditorContent Component

Props

nametypedescription
jsonContentJSONContentThis prop takes in the json data returned from the flexible editor in directus.
editorNodesEditorNodes[] | undefined | nullThis prop takes in the editor nodes data from directus.
serializersExtensions | undefinedThis prop takes in the different tiptap extensions that the flexible editor uses. There are already a bunch pre-installed in the package (see 'src/lib/components/FlexibleEditorContent/extensions')
configTBlockSerializerConfig | undefinedThis takes in a BlockDispatcher config object for relation blocks placed in the flexible editor.
nodesTRenderingNodes | undefinedThis takes in a config object for remapping default HTML semantic tags to React Components.
remappedAttributesRecord<string, string> | undefinedThis allows to remap HTML attributes to fix warnings or errors made by tiptap.

Configuring the flexible editor inside directus :

  • Basic usage
  • With relation nodes
  • With relation nodes and exisiting items

Adding blocks to the flexible editor options : the related blocks are handled in the Editor Nodes field beside the flexible editor field. You can add more collections by going in the relationship menu of the editor nodes and selecting additional collections in the associated collections section.

https://github.com/user-attachments/assets/576bdb52-f9bc-4835-ab2a-4c59995ae77f

Most of the time, if you want to insert blocks inside the flexible editor, you will need to follow the With relation nodes and exisiting items tutorial. Note that it is important to prefix related blocks for selection with related_ so that a related block would look like related_{block-collection} so if you have a block_faqs your related collection key should be related_block_faqs.

IMPORTANT: when configuring the many to many relation inside your related_{block-collection} collection. The key of the field should always be blocks. image

Querying

Here is an example of what querying should look like :

flexible_editor
editor_nodes {
  id
  collection
  item {
    ... on related_block_quote {
      id
      blocks {
        id # id should always be present in the query for the blocks otherwise the block will not be displayed.
        item: block_quote_id { # You should always rename `block_[x]_id` to item
          ...BlockQuote
        }
      }
    }
    ... on related_block_button {
      id
      blocks {
        id
        item: block_button_id {
          ...BlockButton
        }
      }
    }
    ... on related_block_faqs {
      id
      blocks {
        id
        item: block_faqs_id {
          ...BlockFaqs
        }
      }
    }
  }
}

FAQs

Package last updated on 20 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc