Skip to content

Commit

Permalink
Add RichTextPreformatted
Browse files Browse the repository at this point in the history
  • Loading branch information
filmaj committed Sep 29, 2023
1 parent 66f3e0a commit eb96cbf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions packages/types/src/block-kit/block-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,25 @@ export interface RichTextQuote {
elements: RichTextElement[];
}

/**
* @description A block of preformatted text within a rich text field.
*/
export interface RichTextPreformatted {
/**
* @description The type of element. In this case `type` is always `rich_text_preformatted`.
*/
type: 'rich_text_preformatted';
/**
* @description An array of either {@link RichTextLink} or {@link RichTextText} comprising the preformatted text.
*/
elements: (RichTextText | RichTextLink)[];
/**
* @description Whether to render a quote-block-like border on the inline side of the preformatted text.
* `0` renders no border, while `1` renders a border. Defaults to `0`.
*/
border?: 0 | 1;
}

/*
export interface RichTextInput extends Action, Dispatchable, Focusable, Placeholdable {
type: 'rich_text_input';
Expand Down
4 changes: 2 additions & 2 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, RichTextSection, RichTextList, RichTextInput, RichTextQuote } from './block-elements';
import { Button, Checkboxes, Datepicker, DateTimepicker, EmailInput, ImageElement, MultiSelect, NumberInput, Overflow, PlainTextInput, RadioButtons, Select, Timepicker, URLInput, WorkflowButton, RichTextSection, RichTextList, RichTextInput, RichTextQuote, RichTextPreformatted } from './block-elements';
import { Actionable } from './extensions';

export interface Block {
Expand Down Expand Up @@ -265,5 +265,5 @@ export interface RichTextBlock extends Block {
* @description The type of block. For a rich text block, `type` is always `rich_text`.
*/
type: 'rich_text',
elements: (RichTextSection | RichTextList | RichTextQuote)[]; // TODO:'rich_text_performatted';
elements: (RichTextSection | RichTextList | RichTextQuote | RichTextPreformatted)[];
}

0 comments on commit eb96cbf

Please sign in to comment.