Skip to content

Commit

Permalink
Update Edit.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
dobri1408 authored Mar 28, 2024
1 parent c24f627 commit 2c31ecd
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/components/Blocks/Hero/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ export default function Edit(props) {
const blockState = {};
const data_blocks = data?.data?.blocks;
if (data?.text || isEmpty(data_blocks)) {
let a = { ...data };
if (a.text) delete a.text;
let dataWithoutText = { ...data };
if (dataWithoutText) delete dataWithoutText.text;

onChangeBlock(block, {
...a,
...dataWithoutText,
data: data?.text
? {
blocks: {
Expand Down Expand Up @@ -99,20 +99,16 @@ export default function Edit(props) {
setSelectedBlock(s);
}}
onChangeFormData={(newFormData) => {
let a = { ...data };
if (a.text) delete a.text;
onChangeBlock(block, {
...a,
...data,
data: newFormData,
});
}}
onChangeField={(id, value) => {
if (['blocks', 'blocks_layout'].indexOf(id) > -1) {
blockState[id] = value;
let a = { ...data };
if (a.text) delete a.text;
onChangeBlock(block, {
...a,
...data,
data: {
...data.data,
...blockState,
Expand Down

0 comments on commit 2c31ecd

Please sign in to comment.