fix(widgets): restore article table of contents behavior and styles

This commit is contained in:
kate522 committed 2026-10-30 13:18:40 +08:00
1 parent fc04bf65e6
commit ea80cd96cc
15 files changed
+965 -407

No files matched your search

+7 -1
View File
@@ -23,6 +23,12 @@ final class FrontendRenderer {
}
AssetManager::enqueue_for($definition);
if ($definition->slug() === 'posts_toc') {
// The TOC renderer owns the reference widget-container wrapper and
// displays its title inside the generated directory, not above it.
echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
return;
}
if (in_array($definition->slug(), ['user_card', 'author_card', 'tab_posts', 'posts'], true)) {
self::render_reference_widget($definition, $instance, $widget, $content);
return;
@@ -31,7 +37,7 @@ final class FrontendRenderer {
'post_pay', 'oneline_posts', 'hot_posts',
'slider', 'slider_media_combo', 'icon_cards', 'icon_cover_cards',
'buttons', 'notice', 'term_cards', 'term_aggregation', 'media_cards',
'combo_info', 'partners', 'recent_comments', 'posts_toc',
'combo_info', 'partners', 'recent_comments',
], true)) {
echo (string) ($args['before_widget'] ?? '');
if ($definition->slug() !== 'post_pay') echo self::reference_title($instance);
+3 -1
View File
@@ -72,7 +72,9 @@ final class WidgetCatalog {
'common' => [
'title' => !in_array($slug, ['post_pay', 'layout_gap', 'slider', 'slider_media_combo', 'buttons', 'posts_toc'], true),
'affix' => ($size === 'sidebar' && $slug !== 'posts_toc') || in_array($slug, ['buttons', 'notice', 'posts'], true),
'animation' => !in_array($slug, ['buttons', 'term_cards', 'term_aggregation', 'media_cards', 'combo_info', 'slider_media_combo'], true),
'visibility' => $slug !== 'posts_toc',
'layout' => $slug !== 'posts_toc',
'animation' => !in_array($slug, ['buttons', 'term_cards', 'term_aggregation', 'media_cards', 'combo_info', 'slider_media_combo', 'posts_toc'], true),
],
'fields' => WidgetSchemas::for($slug),
'assets' => self::assets($slug),