Skip to content

Commit ba544dd

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

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

frontend/js/utils/getFormData.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ export const isBlockField = (name, id) => {
2727
}
2828

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

3433
export const buildBlock = (block, rootState, isRepeater = false, isInsideRepeater = isRepeater) => {
@@ -81,7 +80,7 @@ export const buildBlock = (block, rootState, isRepeater = false, isInsideRepeate
8180
}
8281
return isInsideRepeater
8382
? { ...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} }
83+
: { ...base, content, is_repeater: isRepeater, type: block.type, editor_name: block.name?.split('|').pop(), blocks: {...blocks, ...repeaters} }
8584
}
8685

8786
export const isBlockEmpty = (blockData) => {

0 commit comments

Comments
 (0)