Issue #5768Opened March 19, 2024by rhoenerSBS0 reactions

BUG: Wrong Type for "content" property in BlockProperties

Question

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

Chrome v122

Reproducible demo link

not applicable

Describe the bug

The GrapeJs Docs indicate that it is possible to add mixed content to the "content" property of a block (see https://grapesjs.com/docs/modules/Blocks.html#mixed). But the type definition for the property is 'string | ComponentDefinition' (see https://github.com/GrapesJS/grapesjs/blob/dev/src/block_manager/model/Block.ts#L17). This leads to errors during compiling in TypeScript Projects.

How to reproduce the bug?

  1. define Block property "content" with a mixed value (e.g. an array of ComponentDefinitions)
const block: BlockProperties = {
    id: 'test',
    label: 'Test'
    content: [
        { type: 'image' },
        { type: 'text' }
    ]
}

What is the expected behavior? does compile

What is the current behavior? type error

Code of Conduct

  • I agree to follow this project's Code of Conduct

Answers (0)

No answers yet.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.