Skip to content

Commit

Permalink
Add rich_text_input block payload support
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Oct 3, 2023
1 parent f0d4960 commit 71ec0ae
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@slack/logger": "^4.0.0",
"@slack/oauth": "^2.6.1",
"@slack/socket-mode": "^1.3.2",
"@slack/types": "^2.8.0",
"@slack/types": "^2.9.0",
"@slack/web-api": "^6.7.1",
"@types/express": "^4.16.1",
"@types/promise.allsettled": "^1.0.3",
Expand Down
14 changes: 11 additions & 3 deletions src/types/actions/block-action.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PlainTextElement, Confirmation, Option } from '@slack/types';
import { PlainTextElement, Confirmation, Option, RichTextBlock } from '@slack/types';
import { StringIndexed } from '../helpers';
import { ViewOutput, ViewStateValue } from '../view';

Expand All @@ -24,7 +24,8 @@ export type BlockElementAction =
| TimepickerAction
| RadioButtonsAction
| CheckboxesAction
| PlainTextInputAction;
| PlainTextInputAction
| RichTextInputAction;

/**
* Any action from Slack's interactive elements
Expand Down Expand Up @@ -207,12 +208,19 @@ export interface CheckboxesAction extends BasicElementAction<'checkboxes'> {
}

/**
* An action from a plain_text_input element (must use dispatch_action: true)
* An action from a plain_text_input element (must use dispatch_action: true)
*/
export interface PlainTextInputAction extends BasicElementAction<'plain_text_input'> {
value: string;
}

/**
* An action from a rich_text_input element (must use dispatch_action: true)
*/
export interface RichTextInputAction extends BasicElementAction<'rich_text_input'> {
rich_text_value: RichTextBlock;
}

/**
* A Slack Block Kit element action wrapped in the standard metadata.
*
Expand Down
3 changes: 2 additions & 1 deletion src/types/view/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Block, KnownBlock, PlainTextElement, View } from '@slack/types';
import { Block, KnownBlock, PlainTextElement, RichTextBlock, View } from '@slack/types';
import { AckFn, RespondFn } from '../utilities';

/**
Expand Down Expand Up @@ -143,6 +143,7 @@ export interface ViewStateValue {
selected_channels?: string[];
selected_users?: string[];
selected_options?: ViewStateSelectedOption[];
rich_text_value?: RichTextBlock;
}

export interface ViewOutput {
Expand Down

0 comments on commit 71ec0ae

Please sign in to comment.