Skip to content

Commit

Permalink
Add RichTextInput
Browse files Browse the repository at this point in the history
  • Loading branch information
filmaj committed Sep 29, 2023
1 parent eb96cbf commit 77b8fa9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
21 changes: 13 additions & 8 deletions packages/types/src/block-kit/block-elements.ts
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
*/
6 changes: 3 additions & 3 deletions 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;
Expand Down Expand Up @@ -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)[];
}

/**
Expand Down Expand Up @@ -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`.
Expand Down

0 comments on commit 77b8fa9

Please sign in to comment.