I need an unordered list, but with options selected for each list item. To achieve this I’ve created a custom block called icon-list which is a ul
element with InnerBlocks, which allows only my custom icon-list-item block as a child. My icon-list-item block is just a RichText element with tagName: li
and some controls. This all works fine, but currently pressing the enter key adds a line break to the current icon-list-item block – what I’d really like is for the enter key to insert a new icon-list-item block. Similarly pressing the backspace key when at the start of a icon-list-item block should remove that block – the exact same functionality of the core/list block.
I’ve had a dig through the Gutenberg docs and source and found that I need to implement the onSplit and onReplace properties for my RichText element, but it’s not clear to me how I actually do this. So far I have:
… obviously I’m completely lost when it comes to the onReplace function. Any pointers would be very much appreciated!
- Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
- Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
- Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.
Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com