Skip to content

Commit c42182f

Browse files
committed
Fix editor name for blocks inside repeaters
1 parent 60fcf11 commit c42182f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

frontend/js/utils/getFormData.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const isBlockField = (name, id) => {
2828

2929
export const stripOutBlockNamespace = (name, id) => {
3030
const nameWithoutBlock = name.replace('blocks[' + id + '][', '')
31-
return nameWithoutBlock.match(/]/gi).length > 1 ? nameWithoutBlock.replace(']', '') : nameWithoutBlock.slice(0, -1)
31+
return nameWithoutBlock.match(/]/gi).length > 1 ? nameWithoutBlock.replace(']', '') : nameWithoutBlock
3232
}
3333

3434
export const buildBlock = (block, rootState, isRepeater = false, isInsideRepeater = isRepeater) => {
@@ -81,7 +81,7 @@ export const buildBlock = (block, rootState, isRepeater = false, isInsideRepeate
8181
}
8282
return isInsideRepeater
8383
? { ...content, ...base, repeater_target_id: block.repeater_target_id, blocks, repeaters}
84-
: { ...base, content, is_repeater: isRepeater, type: block.type, editor_name: block.name, blocks: {...blocks, ...repeaters} }
84+
: { ...base, content, is_repeater: isRepeater, type: block.type, editor_name: block.name?.split('|').pop(), blocks: {...blocks, ...repeaters} }
8585
}
8686

8787
export const isBlockEmpty = (blockData) => {

0 commit comments

Comments
 (0)