From 77b8fa934083ed83574d728351e46422ec4e279e Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Fri, 29 Sep 2023 14:23:35 -0400 Subject: [PATCH] Add RichTextInput --- .../types/src/block-kit/block-elements.ts | 21 ++++++++++++------- packages/types/src/block-kit/blocks.ts | 6 +++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/types/src/block-kit/block-elements.ts b/packages/types/src/block-kit/block-elements.ts index 0ad9ad11c..da2b1530a 100644 --- a/packages/types/src/block-kit/block-elements.ts +++ b/packages/types/src/block-kit/block-elements.ts @@ -2,6 +2,7 @@ import { Actionable, Confirmable, Dispatchable, Focusable, Placeholdable, RichTextStyleable } from './extensions'; import { Option, PlainTextElement, PlainTextOption } from './composition-objects'; +import { RichTextBlock } from './blocks'; /** * @description Allows users a direct path to performing basic actions. @@ -901,10 +902,6 @@ export interface RichTextList { * or characters rendered as the list points. Also affected by the `style` property. */ indent?: number; - /** - * @description TODO: The offset of the list. Must be a number that is at least `0`. - */ - offset?: number; /** * @description Whether to render a quote-block-like border on the inline side of the list. `0` renders no border * while `1` renders a border. @@ -945,11 +942,19 @@ export interface RichTextPreformatted { border?: 0 | 1; } -/* +/** + * @description A rich text input creates a composer/WYSIWYG editor for entering formatted text, offering nearly the + * same experience you have writing messages in Slack. + * @see {@link https://api.slack.com/reference/block-kit/block-elements#rich_text_input Rich-text input element reference}. + * @see {@link https://api.slack.com/interactivity/handling This is an interactive component - see our guide to enabling interactivity}. + */ export interface RichTextInput extends Action, Dispatchable, Focusable, Placeholdable { + /** + * @description The type of element. In this case `type` is always `rich_text_input`. + */ type: 'rich_text_input'; + /** + * @description Initial contents of the input when it is loaded. + */ initial_value?: RichTextBlock; - dispatch_action_config?: DispatchActionConfig; - focus_on_load?: boolean; } -*/ diff --git a/packages/types/src/block-kit/blocks.ts b/packages/types/src/block-kit/blocks.ts index 95b078988..8f55d323c 100644 --- a/packages/types/src/block-kit/blocks.ts +++ b/packages/types/src/block-kit/blocks.ts @@ -1,8 +1,8 @@ // 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, RichTextPreformatted } from './block-elements'; import { Actionable } from './extensions'; +import { Button, Checkboxes, Datepicker, DateTimepicker, EmailInput, ImageElement, MultiSelect, NumberInput, Overflow, PlainTextInput, RadioButtons, Select, Timepicker, URLInput, WorkflowButton, RichTextSection, RichTextList, RichTextQuote, RichTextPreformatted, RichTextInput } from './block-elements'; export interface Block { type: string; @@ -33,7 +33,7 @@ export interface ActionsBlock extends Block { * There is a maximum of 25 elements in each action block. */ elements: (Button | Checkboxes | Datepicker | DateTimepicker | MultiSelect | Overflow | RadioButtons | Select | - Timepicker | WorkflowButton)[]; // TODO: add RichTextInput + Timepicker | WorkflowButton | RichTextInput)[]; } /** @@ -159,7 +159,7 @@ export interface InputBlock extends Block { * @description A block element. */ element: Select | MultiSelect | Datepicker | Timepicker | DateTimepicker | PlainTextInput | URLInput | EmailInput - | NumberInput | RadioButtons | Checkboxes; + | NumberInput | RadioButtons | Checkboxes | RichTextInput; /** * @description A boolean that indicates whether or not the use of elements in this block should dispatch a * {@link https://api.slack.com/reference/interaction-payloads/block-actions block_actions payload}. Defaults to `false`.