Skip to content

Commit

Permalink
Fix #790
Browse files Browse the repository at this point in the history
  • Loading branch information
ttempleton committed Sep 27, 2023
1 parent c1a07b4 commit bfbc783
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Unreleased

### Fixed
- Fixed a bug where nested fields that depend on external CSS or JavaScript files weren't loading correctly when lazy loading new blocks

## 3.9.3 - 2023-09-27

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/assets/dist/neo-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/assets/dist/neo-main.js.map

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/assets/src/input/BlockType.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ export default Garnish.Base.extend({

const renderedBlocks = await Craft.sendActionRequest('POST', 'neo/input/render-blocks', { data })
if (renderedBlocks.data.success) {
if (renderedBlocks.data.headHtml) {
Craft.appendHeadHtml(renderedBlocks.data.headHtml)
}

if (renderedBlocks.data.bodyHtml) {
Craft.appendBodyHtml(renderedBlocks.data.bodyHtml)
}

const tabs = renderedBlocks.data.blocks[0].tabs
this._tabs = tabs.tabNames?.map(
tab => new Tab({
Expand Down
3 changes: 3 additions & 0 deletions src/controllers/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public function actionRenderBlocks(): Response
$this->requirePostRequest();

$requestService = Craft::$app->getRequest();
$view = $this->getView();

$blocks = $requestService->getRequiredBodyParam('blocks');
$namespace = $requestService->getParam('namespace');
Expand Down Expand Up @@ -121,6 +122,8 @@ public function actionRenderBlocks(): Response
return $this->asJson([
'success' => true,
'blocks' => $renderedBlocks,
'bodyHtml' => $view->getBodyHtml(),
'headHtml' => $view->getHeadHtml(),
]);
}

Expand Down

0 comments on commit bfbc783

Please sign in to comment.