Checking for block inside container blocks #40172
Unanswered
stephencottontail
asked this question in
Q&A
Replies: 1 comment
-
There's a table of contents block that's being worked on in Gutenberg (I think it's pretty close to being shipped). It supports nested headings, so you might find inspiration in the code. This is the pull request with the latest changes to the block - #29739. It looks like it uses |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I made a table of contents block by getting all the blocks with
getBlocks()
and then picking out all thecore/heading
blocks. Now I’ve got a situation where a client is adding heading blocks insidecore/group
orcore/column
blocks and sincegetBlocks()
doesn’t checkinnerBlocks
, those heading blocks don’t go into the ToC. Been wracking my brain trying to think of how to get at these blocks and was hoping that someone here would have an ideaedit: Forgot to mention that there could be heading blocks inside of a container block inside of another containing block so a solution capable of going arbitrarily deep would be nice
Beta Was this translation helpful? Give feedback.
All reactions