From c42182fb635364ce52eb47991e5b57a0e9ae2884 Mon Sep 17 00:00:00 2001 From: Tofandel Date: Mon, 1 Apr 2024 13:27:02 +0200 Subject: [PATCH] Fix editor name for blocks inside repeaters --- frontend/js/utils/getFormData.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/js/utils/getFormData.js b/frontend/js/utils/getFormData.js index f086368139..ab5c30dbe7 100755 --- a/frontend/js/utils/getFormData.js +++ b/frontend/js/utils/getFormData.js @@ -28,7 +28,7 @@ export const isBlockField = (name, id) => { export const stripOutBlockNamespace = (name, id) => { const nameWithoutBlock = name.replace('blocks[' + id + '][', '') - return nameWithoutBlock.match(/]/gi).length > 1 ? nameWithoutBlock.replace(']', '') : nameWithoutBlock.slice(0, -1) + return nameWithoutBlock.match(/]/gi).length > 1 ? nameWithoutBlock.replace(']', '') : nameWithoutBlock } export const buildBlock = (block, rootState, isRepeater = false, isInsideRepeater = isRepeater) => { @@ -81,7 +81,7 @@ export const buildBlock = (block, rootState, isRepeater = false, isInsideRepeate } return isInsideRepeater ? { ...content, ...base, repeater_target_id: block.repeater_target_id, blocks, repeaters} - : { ...base, content, is_repeater: isRepeater, type: block.type, editor_name: block.name, blocks: {...blocks, ...repeaters} } + : { ...base, content, is_repeater: isRepeater, type: block.type, editor_name: block.name?.split('|').pop(), blocks: {...blocks, ...repeaters} } } export const isBlockEmpty = (blockData) => {