Closed
Description
This issue is automatically created based on existing pull request: #869: Fix finding child content-type elements in stage-builder
Description (*)
Fixes a bug whereby child content-type elements will not be found, where other types of elements also exist at the same level.
Manual testing scenarios (*)
- Create a content type, where child content elements are mixed in with other elements. For example:
master.html:
<div data-bind="attr: data.main.attributes, style: data.main.style">
<div class="swiper">
<ul class="swiper-wrapper" each="contentType.getChildren()">
<li class="swiper-slide">
<render args="{ name: content.template, data: content }"></render>
</li>
</ul>
<div class="swiper-scrollbar"></div>
</div>
</div>
preview.html:
<div data-bind="attr: data.main.attributes, style: data.main.style"
event="{ mouseover: onMouseOver, mouseout: onMouseOut }, mouseoverBubble: false">
<render args="getOptions().template"></render>
<div class="swiper">
<ul class="swiper-wrapper element-children content-type-container"
each="contentType.getChildren()" css="getChildrenCss()" attr="{id: contentType.id + '-children'}"
data-bind="sortable: getSortableOptions()"
afterRender="function (element) { if (typeof afterChildrenRender === 'function') { afterChildrenRender(element); } }">
<li class="pagebuilder-content-type-wrapper swiper-slide">
<if args="$parent.isContainer()">
<div class="pagebuilder-drop-indicator"></div>
</if>
<div
template="{ name: preview.template, data: preview, afterRender: function () { preview.dispatchAfterRenderEvent.apply(preview, arguments); } }"
attr="{ id: id }" css="{'pagebuilder-content-type-hidden': !preview.display()}">
</div>
<if args="$parent.isContainer() && $index() === $parent.contentType.getChildren()().length - 1">
<div class="pagebuilder-drop-indicator"></div>
</if>
</li>
</ul>
<div class="swiper-scrollbar"></div>
</div>
</div>
It is possible to create this content type in Pagebuilder, and the correct result is rendered into the database and on the frontend. However, Pagebuilder cannot then load up the content back into the stage - the presence of the <li>
element causes only the last item to be found, and <div class="swiper-scrollbar">
causes even that to be forgotten.
This small fix corrects this, and all types of content can now be loaded into the stage correctly.
Checklist
- Pull request has a meaningful description of its purposeAll commits are accompanied by meaningful commit messagesAll new or changed code is covered with unit/integration tests (if applicable)README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an updateAll automated tests passed successfully (all builds are green)
Activity
engcom-Hotel commentedon Oct 14, 2024
@adobe export issue to Jira project PB
github-jira-sync-bot commentedon Oct 14, 2024
✅ Jira issue https://jira.corp.adobe.com/browse/PB-1605 is successfully created for this GitHub issue.