|
3 | 3 | import re |
4 | 4 | import warnings |
5 | 5 | from abc import ABCMeta |
6 | | -from typing import Iterator, List, Optional, Set, Type, Union, Sequence |
| 6 | +from typing import Iterator, List, Optional, Set, Type, Union, Sequence, Dict, Any |
7 | 7 |
|
8 | 8 | from slack_sdk.models import show_unknown_key_warning |
9 | 9 | from slack_sdk.models.basic_objects import ( |
@@ -1331,6 +1331,45 @@ def __init__( |
1331 | 1331 | self.max_selected_items = max_selected_items |
1332 | 1332 |
|
1333 | 1333 |
|
| 1334 | +# ------------------------------------------------- |
| 1335 | +# Rich Text Input Element |
| 1336 | +# ------------------------------------------------- |
| 1337 | + |
| 1338 | + |
| 1339 | +class RichTextInputElement(InputInteractiveElement): |
| 1340 | + type = "rich_text_input" |
| 1341 | + |
| 1342 | + @property |
| 1343 | + def attributes(self) -> Set[str]: |
| 1344 | + return super().attributes.union( |
| 1345 | + { |
| 1346 | + "initial_value", |
| 1347 | + "dispatch_action_config", |
| 1348 | + } |
| 1349 | + ) |
| 1350 | + |
| 1351 | + def __init__( |
| 1352 | + self, |
| 1353 | + *, |
| 1354 | + action_id: Optional[str] = None, |
| 1355 | + placeholder: Optional[Union[str, dict, TextObject]] = None, |
| 1356 | + initial_value: Optional[Dict[str, Any]] = None, # TODO: Add rich_text block class and its element classes |
| 1357 | + dispatch_action_config: Optional[Union[dict, DispatchActionConfig]] = None, |
| 1358 | + focus_on_load: Optional[bool] = None, |
| 1359 | + **others: dict, |
| 1360 | + ): |
| 1361 | + super().__init__( |
| 1362 | + type=self.type, |
| 1363 | + action_id=action_id, |
| 1364 | + placeholder=TextObject.parse(placeholder, PlainTextObject.type), |
| 1365 | + focus_on_load=focus_on_load, |
| 1366 | + ) |
| 1367 | + show_unknown_key_warning(self, others) |
| 1368 | + |
| 1369 | + self.initial_value = initial_value |
| 1370 | + self.dispatch_action_config = dispatch_action_config |
| 1371 | + |
| 1372 | + |
1334 | 1373 | # ------------------------------------------------- |
1335 | 1374 | # Plain Text Input Element |
1336 | 1375 | # ------------------------------------------------- |
|
0 commit comments