|
5 | 5 | from django import forms |
6 | 6 | from django.forms import Media |
7 | 7 | from django.utils.functional import cached_property |
8 | | -from wagtail.blocks import FieldBlock, StructBlock |
| 8 | +from collections.abc import Iterable |
| 9 | +from wagtail.blocks import Block, FieldBlock, StructBlock |
9 | 10 | from wagtail.blocks.field_block import CharBlock, FieldBlockAdapter |
10 | 11 |
|
11 | 12 | from .utils import html_table_to_dict |
|
17 | 18 | from wagtail.telepath import register |
18 | 19 |
|
19 | 20 |
|
| 21 | +type BlockDefinitions = Iterable[tuple[str, Block] | list[str | Block]] |
| 22 | + |
| 23 | + |
20 | 24 | class TinyTableFieldBlock(FieldBlock): |
21 | 25 | def __init__( |
22 | 26 | self, *, required: bool = True, help_text: str | None = None, **kwargs: Any |
@@ -86,7 +90,10 @@ class TinyTableBlock(StructBlock): |
86 | 90 | title = CharBlock(required=False) |
87 | 91 | caption = CharBlock(required=False) |
88 | 92 |
|
89 | | - def __init__(self, *, local_blocks=(), search_index=True, **kwargs): |
| 93 | + def __init__(self, local_blocks: BlockDefinitions | None = None, search_index: bool = True, **kwargs) -> None: # noqa: FBT001,FBT002 |
| 94 | + if local_blocks is None: |
| 95 | + local_blocks = () |
| 96 | + |
90 | 97 | # Manually define the data block so we can pass on configuration kwargs. |
91 | 98 | data_block = TinyTableFieldBlock( |
92 | 99 | required=False, |
|
0 commit comments