-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Table of Contents block #2871
Conversation
Interesting approach. When I was going to tackle this one I thought it might be interesting to make it static—it'd update whenever you interact with the editor, and would save HTML directly. That would be regenerated whenever you edited headings in the editor. |
Yah, I thought about that - having to write duplicate code (one for the block render in JS, one for the frontend render in PHP) isn't ideal, but it means that any headers added by not-Gutenberg will be correctly rendered. I tend to lean towards implementing this kind of logic in the server side, instead of requiring every editor that interacts with a WordPress site to implement it. |
Codecov Report
@@ Coverage Diff @@
## master #2871 +/- ##
==========================================
- Coverage 34.07% 34.07% -0.01%
==========================================
Files 192 193 +1
Lines 5675 5681 +6
Branches 996 997 +1
==========================================
+ Hits 1934 1936 +2
- Misses 3165 3169 +4
Partials 576 576
Continue to review full report at Codecov.
|
c1c600c
to
69e87d4
Compare
In order to show the ToC in the block render inside Gutenberg, I believe I'm blocked on #2473. |
I think you are no longer blocked. It is possible to access every piece of the state through |
@pento, feel free to reopen this one. For now, with the branch stale, I'll close it as we're making sense of all open PRs. 🙇 |
Description
This is a first pass at creating a dynamically generated table of contents block. It still lacks... most things, and is at least partially a sandbox for me to play around with creating more complex blocks. 🙂
Fixes #1760.