textBlock.ts
TLDR
This file exports a function called createTextBlock
that creates a text block object with a specific type. It also exports the TextBlock
type, which extends the ContentBlock
type.
Methods
createTextBlock(block?: Block): TextBlock
This method takes an optional Block
object as a parameter and returns a new TextBlock
. The TextBlock
object is created by spreading the properties of the block
object and adding a type
property with the value 'text'.
Classes
None
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {ContentBlock} from './contentBlock'
import {Block, createBlock} from './block'
type TextBlock = ContentBlock & {
type: 'text'
}
function createTextBlock(block?: Block): TextBlock {
return {
...createBlock(block),
type: 'text',
}
}
export {TextBlock, createTextBlock}