Skip to content

Commit

Permalink
feat: changed clone blocks structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Wagner3UB committed Oct 16, 2024
1 parent 437b242 commit 90525ea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,7 @@ module.exports = {
},
},
},
globals: {
structuredClone: true,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Icon } from '@plone/volto/components';
import { Plug } from '@plone/volto/components/manage/Pluggable';
import { load } from 'redux-localstorage-simple';
import { isEqual, omit, without } from 'lodash';
import { cloneBlock } from 'design-comuni-plone-theme/config/Blocks/ListingOptions';
import { cloneBlock } from 'design-comuni-plone-theme/helpers/blocks';
import { setBlocksClipboard, resetBlocksClipboard } from '@plone/volto/actions';
import config from '@plone/volto/registry';

Expand Down
8 changes: 8 additions & 0 deletions src/helpers/blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { v4 as uuid } from 'uuid';

export const cloneBlock = (blockData) => {
const blockID = uuid();
const clonedData = structuredClone(blockData);
clonedData.block = blockID;
return [blockID, clonedData];
};

0 comments on commit 90525ea

Please sign in to comment.