| 1 |
import { registerBlockType } from "@wordpress/blocks"; |
| 2 |
import listIcon from "@tableberg/shared/icons/styled-list"; |
| 3 |
|
| 4 |
import metadata from "./block.json"; |
| 5 |
import { ListElement } from "./element"; |
| 6 |
import { createBridgedElementEdit } from "../element-bridge"; |
| 7 |
|
| 8 |
/** |
| 9 |
* The edit is the shared ListElement — the same component pro's styled list |
| 10 |
* runs — so the block gets its keyboard handling (Enter for a new item, |
| 11 |
* Tab/Shift+Tab to indent, Backspace to outdent or remove), its indent and |
| 12 |
* outdent toolbar buttons, and its real nested rendering. The block used to |
| 13 |
* have a hand-written edit that rendered a flat list of RichTexts with no key |
| 14 |
* handling at all, so Enter only inserted a line break. |
| 15 |
*/ |
| 16 |
export function registerListBlock() { |
| 17 |
registerBlockType(metadata.name, { |
| 18 |
...(metadata as any), |
| 19 |
icon: listIcon, |
| 20 |
edit: createBridgedElementEdit(metadata.name, ListElement), |
| 21 |
save: () => null, |
| 22 |
}); |
| 23 |
} |
| 24 |
|