diff --git a/CHANGELOG.md b/CHANGELOG.md index ba113b3ff..0ad30797f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [1.5.3] - 2026-11-19 + +- [PR-412](https://github.com/itk-dev/os2loop/pull/412) + - Fixed bug in toc + ## [1.5.2] - 2026-11-18 - [PR-410](https://github.com/itk-dev/os2loop/pull/410) diff --git a/web/profiles/custom/os2loop/modules/os2loop_toc_block/src/Plugin/Block/TocBlock.php b/web/profiles/custom/os2loop/modules/os2loop_toc_block/src/Plugin/Block/TocBlock.php index fba53caf3..79a9019a4 100644 --- a/web/profiles/custom/os2loop/modules/os2loop_toc_block/src/Plugin/Block/TocBlock.php +++ b/web/profiles/custom/os2loop/modules/os2loop_toc_block/src/Plugin/Block/TocBlock.php @@ -6,6 +6,7 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\Core\Render\RenderContext; use Drupal\Core\Render\RendererInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\node\NodeInterface; @@ -180,8 +181,14 @@ public function build() { $view_mode = 'full'; $node_view = $this->entityTypeManager->getViewBuilder('node')->view($node, $view_mode); - // Get the completely render node HTML. - $node_html = (string) $this->renderer->render($node_view); + // Get the completely render node HTML. The node (and the paragraph + // holding this block) is already being rendered, so render it in a + // separate render context. This runs in its own Fiber, which keeps + // core's entity recursive render protection from aborting the render. + $context = new RenderContext(); + $node_html = (string) $this->renderer->executeInRenderContext($context, function () use ($node_view) { + return $this->renderer->render($node_view); + }); $toc = $this->helper->createToc($node_html); @@ -191,7 +198,11 @@ public function build() { $build = [ 'toc' => $this->tocBuilder->buildToc($toc), ]; + } + // Let the node's cacheability bubble to the block. + if (!$context->isEmpty()) { + $context->pop()->applyTo($build); } } diff --git a/web/profiles/custom/os2loop/modules/os2loop_user_login/assets/user-login-form.css b/web/profiles/custom/os2loop/modules/os2loop_user_login/assets/user-login-form.css index b4a57fcf5..6af5fcf18 100644 --- a/web/profiles/custom/os2loop/modules/os2loop_user_login/assets/user-login-form.css +++ b/web/profiles/custom/os2loop/modules/os2loop_user_login/assets/user-login-form.css @@ -1,9 +1,9 @@ /* Hide the default Drupal login form … */ .user-login-form #drupal-login { - display: none; + display: none; } /* … unless it's explicitly targeted. */ .user-login-form #drupal-login:target { - display: block; + display: block; } diff --git a/web/profiles/custom/os2loop/themes/os2loop_theme/assets/components/blocks/table-of-contents.scss b/web/profiles/custom/os2loop/themes/os2loop_theme/assets/components/blocks/table-of-contents.scss index 2b3bd0b0e..f25f861b1 100644 --- a/web/profiles/custom/os2loop/themes/os2loop_theme/assets/components/blocks/table-of-contents.scss +++ b/web/profiles/custom/os2loop/themes/os2loop_theme/assets/components/blocks/table-of-contents.scss @@ -10,7 +10,7 @@ margin-left: 0; } - li > li { + li > ol > li { margin-left: 1em; } diff --git a/web/profiles/custom/os2loop/themes/os2loop_theme/assets/icons.scss b/web/profiles/custom/os2loop/themes/os2loop_theme/assets/icons.scss index 837212494..f386256f7 100644 --- a/web/profiles/custom/os2loop/themes/os2loop_theme/assets/icons.scss +++ b/web/profiles/custom/os2loop/themes/os2loop_theme/assets/icons.scss @@ -19,7 +19,7 @@ $icons-comment-types: ( "os2loop_post_comment": "\f383", // https://icons.getbootstrap.com/icons/exclamation-square/ (to match sqare // question icon). - "os2loop_question_answer": "\f50b" + "os2loop_question_answer": "\f50b", ); // svg content from node_modules/bootstrap-icons/icons/search.svg.