main

mattermost/focalboard

Last updated at: 29/12/2023 09:49

checkboxBlock.ts

TLDR

The checkboxBlock.ts file exports a function createCheckboxBlock that creates a CheckboxBlock object. The CheckboxBlock is a type that extends the ContentBlock type and includes additional properties specific to checkboxes.

Methods

createCheckboxBlock

The createCheckboxBlock method is used to create a CheckboxBlock object. It takes an optional block parameter which is used as the base for creating the CheckboxBlock object. The method returns a CheckboxBlock object with the type property set to 'checkbox'. The createBlock function from the block.ts file is used to create the base block.

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 CheckboxBlock = ContentBlock & {
    type: 'checkbox'
}

function createCheckboxBlock(block?: Block): CheckboxBlock {
    return {
        ...createBlock(block),
        type: 'checkbox',
    }
}

export {CheckboxBlock, createCheckboxBlock}