wedocs-plugin
wedocs-plugin copied to clipboard
Configured wedocs new package system
Summary by CodeRabbit
-
New Features
- Added a dynamic Table of Contents block with editor UI, preview, server-rendered output, front-end behavior (scroll‑spy, smooth scrolling, mobile collapsible) and comprehensive styling options.
- Enhanced Docs Grid: new styling controls, hover effects, improved pagination and section toggle behavior.
-
Refactor
- Streamlined block registration to conditionally register multiple blocks.
-
Chores
- Updated build tooling/dev scripts versions.
Walkthrough
Adds a new dynamic Table of Contents block (editor, frontend, styles, server render), refactors DocsGrid PHP rendering with guarded functions and inline styles/JS, updates block registration to conditionally register blocks from block.json, tweaks webpack entry invocation, updates devDependencies in package.json, and disables a template_include filter in includes/Frontend.php.
Changes
| Cohort / File(s) | Summary of changes |
|---|---|
Dependenciespackage.json |
Added @wordpress/block-editor@^14.5.0 and upgraded @wordpress/scripts from ^25.0.0 to ^30.25.0. |
DocsGrid render refactorsrc/blocks/DocsGrid/render.php |
Wrapped functions with if (!function_exists(...)) guards, moved rendering into a returnable guarded function and echoed the caller, reorganized pagination/query/content flow, added dynamic inline CSS and JS (DOMContentLoaded toggle), preserved output buffering. |
New Table of Contents blocksrc/blocks/TableOfContents/block.json, src/blocks/TableOfContents/edit.js, src/blocks/TableOfContents/index.js, src/blocks/TableOfContents/render.php, src/blocks/TableOfContents/view.js, src/blocks/TableOfContents/style.scss, src/blocks/TableOfContents/editor.scss, src/blocks/TableOfContents/save.js |
Introduced a dynamic TOC block: manifest with attributes and assets, editor UI (Edit component, Inspector controls, mock headings), editor & frontend styles, frontend view script (TOC generation, scroll spy, smooth scrolling, mobile collapse), and server-side render helpers to extract and render headings safely. |
Block registration flowwedocs.php |
Replaced direct require/register for a single block with a loop that conditionally calls register_block_type for a list of blocks when each block.json exists; removed explicit require_once-based DocsGrid registration. |
Blocks index importsrc/blocks/index.js |
Added import/registration of the new TableOfContents block alongside existing blocks. |
Build configurationwebpack.config.js |
Changed entry composition to call defaultConfig.entry() instead of spreading defaultConfig.entry. |
Frontend hook disabledincludes/Frontend.php |
Commented out/disables the add_filter('template_include', ...) template loader hook. |
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~60 minutes
Extra attention recommended:
src/blocks/DocsGrid/render.php— confirm function guard names, echo/return behavior, inline CSS/JS sanitization, and edge-case rendering paths.src/blocks/TableOfContents/*— review server-side heading extraction for correctness and XSS/ID uniqueness, and frontend view script scroll/spy performance and resilience.webpack.config.js— verify build behavior when usingdefaultConfig.entry()in this project's webpack configuration.
Possibly related PRs
- weDevsOfficial/wedocs-plugin#203 — overlapping changes touching
src/blocks/DocsGrid/render.phpand related DocsGrid additions; likely code-level related.
Suggested labels
Needs Review
Poem
I nibble code by moonlit burrow light,
A TOC sprouts leaves and blocks take flight.
DocsGrid learned to dress with style and JS flair,
Webpack called its entry — handle with care.
I thump my foot — the patch hops bright! 🥕✨
Pre-merge checks and finishing touches
❌ Failed checks (2 warnings)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Title Check | ⚠️ Warning | The PR title "Configured wedocs new package system" is vague and does not accurately reflect the primary changes in the pull request. While the changeset does include minor dependency updates in package.json and configuration changes, the most significant work involves implementing a new TableOfContents Gutenberg block (with complete editor, render, styling, and frontend JavaScript components) and refactoring the block registration system in wedocs.php to conditionally register multiple blocks. The term "package system" is ambiguous—it could refer to NPM package management, WordPress block architecture, or plugin architecture—and fails to convey that the main objective is adding a major new block feature. The title does not highlight the primary architectural or feature changes, making it misleading about the true scope and intent of the pull request. | Consider revising the title to more accurately reflect the main changes, such as "Add TableOfContents block with dynamic rendering and refactor block registration" or "Implement dynamic TableOfContents Gutenberg block with updated block system." This would clearly communicate the primary objective of the PR and help team members understand the scope when reviewing commit history. |
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 64.71% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
✅ Passed checks (1 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
feat/blocks
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.