Skip to content

Commit

Permalink
Merge pull request #16571 from craftcms/bugfix/16554-ui-elements-inst…
Browse files Browse the repository at this point in the history
…antiation

UI element instantiation (part 2 of 16554)
  • Loading branch information
brandonkelly authored Jan 29, 2025
2 parents 2d64efb + 1da0bae commit 26ffd0b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed an error that could occur when eager-loading nested elements’ owners, if any of the queried elements didn’t have an owner ID. ([#16570](https://github.com/craftcms/cms/issues/16570), [#16572](https://github.com/craftcms/cms/issues/16572), [#16576](https://github.com/craftcms/cms/issues/16576))
- Fixed a bug where collapsed elements within element indexes in structure view weren’t showing their expand/collapse toggles.
- Fixed a bug where Color fields weren’t getting fully instantiated within slideouts, Live Preview, and after copying the field value from another site. ([#16571](https://github.com/craftcms/cms/pull/16571))

## 5.6.2 - 2024-01-28

Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js.map

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/web/assets/cp/src/js/CpScreenSlideout.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,11 @@ Craft.CpScreenSlideout = Craft.Slideout.extend(
this.$footer.removeClass('hidden');

Garnish.requestAnimationFrame(async () => {
Craft.initUiElements(this.$content);
// Execute the response JS first so any Selectize inputs, etc.,
// get instantiated before field toggles
await Craft.appendHeadHtml(data.headHtml);
await Craft.appendBodyHtml(data.bodyHtml);
Craft.initUiElements(this.$content);
Craft.cp.elementThumbLoader.load($(this.$content));

if (data.sidebar) {
Expand Down
4 changes: 3 additions & 1 deletion src/web/assets/cp/src/js/ElementEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,11 @@ Craft.ElementEditor = Garnish.Base.extend(

const $newField = $(fieldHtml);
$field.replaceWith($newField);
Craft.initUiElements($newField);
// Execute the response JS first so any Selectize inputs, etc.,
// get instantiated before field toggles
await Craft.appendHeadHtml(headHtml);
await Craft.appendBodyHtml(bodyHtml);
Craft.initUiElements($newField);

Craft.cp.displaySuccess(message);
} finally {
Expand Down
4 changes: 3 additions & 1 deletion src/web/assets/cp/src/js/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,11 @@ Craft.Preview = Garnish.Base.extend(
this.$editorContainer.serialize()
);

Craft.initUiElements(this.$editorContainer);
// Execute the response JS first so any Selectize inputs, etc.,
// get instantiated before field toggles
await Craft.appendHeadHtml(data.headHtml);
await Craft.appendBodyHtml(data.bodyHtml);
Craft.initUiElements(this.$editorContainer);

this.elementEditor = new Craft.ElementEditor(
this.$editorContainer,
Expand Down

0 comments on commit 26ffd0b

Please sign in to comment.