Skip to content

Commit

Permalink
Fix #786
Browse files Browse the repository at this point in the history
  • Loading branch information
ttempleton committed Sep 22, 2023
1 parent e1e212d commit 118c8d1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 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 that occurred when pasting Neo input blocks that use the child block UI element and have descendants, where the descendants would disappear after updating visible field layout elements for the Neo field

## 3.9.0 - 2023-09-19

### 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.

13 changes: 12 additions & 1 deletion src/assets/src/input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,18 @@ export default Garnish.Base.extend({
this._updateBlockChildren()
this._updateButtons()

this._visibleLayoutElements[block.getId()] = block.getBlockType().getDefaultVisibleLayoutElements()
// Construct the block's visible layout elements, since they might not be the default visible
// layout elements for the block type, e.g. if pasting a block
const visibleLayoutElements = {}
block.$contentContainer.children('[data-layout-tab]').each((_, layoutTab) => {
const $layoutTab = $(layoutTab)
const tabUid = $layoutTab.attr('data-layout-tab')
visibleLayoutElements[tabUid] = []
$layoutTab.children('[data-layout-element]').each((_, layoutElement) => {
visibleLayoutElements[tabUid].push($(layoutElement).attr('data-layout-element'))
})
})
this._visibleLayoutElements[block.getId()] = visibleLayoutElements

// Create any required child blocks, if this block has only one child block type
const createChildBlocksIfAllowed = () => {
Expand Down

0 comments on commit 118c8d1

Please sign in to comment.