Skip to content

Commit

Permalink
Update docs for defaultBlockType setting (#5862)
Browse files Browse the repository at this point in the history
Co-authored-by: Steve Piercy <[email protected]>
  • Loading branch information
davisagli and stevepiercy authored Mar 11, 2024
1 parent 16ffad6 commit 03b30f9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
9 changes: 6 additions & 3 deletions docs/source/blocks/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,16 @@ Our new block should be ready to use in the editor.
It is a common pattern to use the block configuration to allow customization of a block's behavior or to provide block-specific implementation of various Volto mechanisms.
Some of these common options are described in the following sections.

(blockHasValue)=

### `blockHasValue`

`blockHasValue` returns `true` if the provided block data represents a value for the current block.
`blockHasValue` is a function that returns `true` if the provided block data represents a non-empty value for the current block.
Required for alternate default block types implementations.
It has the following signature.

```{seealso}
See also [Settings reference](../configuration/settings-reference).
```jsx
blockHasValue(data) => boolean
```

### `initialValue`
Expand Down
5 changes: 3 additions & 2 deletions docs/source/configuration/settings-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ navDepth
Navigation levels depth used in the navigation endpoint calls. Increasing this is useful for implementing fat navigation menus. Defaults to `1`.
defaultBlockType
The default block type in Volto is "text", which uses the current DraftJS-based implementation for the rich text editor. Future alternative rich text editors will need to use this setting and replace it with their block type. The block definition should also include the `blockHasValue` function, which is needed to activate the Block Chooser functionality. See this function signature in [Blocks > Settings](../blocks/settings.md).
The name of the default block type used when a new block is added.
The default value of this setting is `slate`, which uses the current Slate-based implementation for the rich text editor.
If you change this to a different type of block, make sure the block configuration includes the {ref}`blockHasValue` function.
sentryOptions
In Volto 16.0.0.alpha.45, Sentry integration was moved from core to the add-on [`@plone-collective/volto-sentry`](https://www.npmjs.com/package/@plone-collective/volto-sentry).
Expand Down
1 change: 1 addition & 0 deletions packages/volto/news/5854.documentation
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update docs for the `defaultBlockType` setting. @davisagli

0 comments on commit 03b30f9

Please sign in to comment.