feat: Add parent as a param for Area#669
Conversation
🦜 Chachalog
|
There was a problem hiding this comment.
Pull request overview
Adds an optional parent prop to the Area component (mirroring the JSP AreaTag capability), so areas can be stored as subnodes of an arbitrary JCR node rather than always under the current page node. When parent is provided, RenderHelper.renderArea computes an absolute path (parent.getPath() + "/" + name); otherwise the existing template-inheritance behavior is preserved.
Changes:
- Expose optional
parent?: JCRNodeWrapperinAreaand forward it toserver.render.renderArea. - Extend
RenderHelper.renderAreato acceptparentand build an absolute area path when set; allowparentinAREA_ALLOWED_ATTRIBUTES. - Add Cypress test coverage (
areaParentTest.cy.ts) and parent-based examples in thetestAreasview, plus a changelog entry.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| javascript-modules-library/src/components/Area.tsx | Adds optional parent prop and passes it through to the server render call. |
| javascript-modules-engine-java/.../RenderHelper.java | Allows parent attribute and computes absolute path when provided. |
| jahia-test-module/.../testAreas/TestAreas.tsx | Adds parent-based Area examples (current node, home, site root) to exercise the new prop. |
| tests/cypress/e2e/ui/areaParentTest.cy.ts | New Cypress spec verifying rendering and distinct subnode creation per parent. |
| .chachalog/MphU2FML.md | Changelog entry describing the new optional parent parameter. |
|
Based on @GauBen's comments #660 (comment) and after discussion with @pvollenweider, it seems that Need to discuss with Gautier if this is an acceptable solution or if we need to further rethink alternative solutions. |
Description
Follow-up alternative fix for this PR #660
Expose optional
parentparam for Area template that is available in the AreaTag jsp template https://github.com/Jahia/jahia-private/blob/master/taglib/src/main/java/org/jahia/taglibs/template/include/AreaTag.java#L113This allow areas to be distinctly defined within (multiple) declared component when parent node is passed, rather than shared under current page.
Checklist
Source code
Tests
Tip
Documentation to guide the reviews: How to do a code review