Skip to content

Commit

Permalink
Add rich text types
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisronline authored and filmaj committed Sep 26, 2023
1 parent d0b04a0 commit b374882
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
7 changes: 7 additions & 0 deletions packages/types/src/block-kit/block-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,3 +673,10 @@ export interface WorkflowButton extends Confirmable {
*/
accessibility_label?: string;
}

export interface RichTextInput extends Action, Dispatchable, Focusable, Placeholdable {
type: 'rich_text_input';
initial_value?: RichTextBlock;
dispatch_action_config?: DispatchActionConfig;
focus_on_load?: boolean;
}
15 changes: 11 additions & 4 deletions packages/types/src/block-kit/blocks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file contains objects documented here: https://api.slack.com/reference/block-kit/blocks

import { PlainTextElement, MrkdwnElement } from './composition-objects';
import { Button, Checkboxes, Datepicker, DateTimepicker, EmailInput, ImageElement, MultiSelect, NumberInput, Overflow, PlainTextInput, RadioButtons, Select, Timepicker, URLInput, WorkflowButton } from './block-elements';
import { Button, Checkboxes, Datepicker, DateTimepicker, EmailInput, ImageElement, MultiSelect, NumberInput, Overflow, PlainTextInput, RadioButtons, Select, Timepicker, URLInput, WorkflowButton, RichTextInput } from './block-elements';
import { Action } from './extensions';

export interface Block {
Expand All @@ -17,7 +17,7 @@ export interface Block {
}

export type KnownBlock = ImageBlock | ContextBlock | ActionsBlock | DividerBlock |
SectionBlock | InputBlock | FileBlock | HeaderBlock | VideoBlock;
SectionBlock | InputBlock | FileBlock | HeaderBlock | VideoBlock | RichTextBlock;

/**
* @description Holds multiple interactive elements.
Expand All @@ -28,13 +28,12 @@ export interface ActionsBlock extends Block {
* @description The type of block. For an actions block, `type` is always `actions`.
*/
type: 'actions';
// TODO: add rich text input to this list once ready
/**
* @description An array of {@link InteractiveElements} objects.
* There is a maximum of 25 elements in each action block.
*/
elements: (Button | Checkboxes | Datepicker | DateTimepicker | MultiSelect | Overflow | RadioButtons | Select |
Timepicker | WorkflowButton)[];
Timepicker | WorkflowButton | RichTextInput)[];
}

/**
Expand Down Expand Up @@ -260,3 +259,11 @@ export interface VideoBlock extends Block {
*/
description?: PlainTextElement;
}

export interface RichTextBlock extends Block {
type: 'rich_text',
elements: {
type: 'rich_text_section' | 'rich_text_list' | 'rich_text_quote' | 'rich_text_performatted';
elements: object[];
}[];
}

0 comments on commit b374882

Please sign in to comment.