From a092907d5dedeaa09745c2819b6fa2f296700a65 Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Mon, 9 Dec 2024 10:55:26 +0100 Subject: [PATCH 1/2] Fixed circular import error in dev with HMR in core Blocks shadow customizations --- packages/volto/src/config/Blocks.jsx | 9 +++++++++ packages/volto/src/config/index.js | 20 ++++---------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/packages/volto/src/config/Blocks.jsx b/packages/volto/src/config/Blocks.jsx index 573bdce903..0110a6616c 100644 --- a/packages/volto/src/config/Blocks.jsx +++ b/packages/volto/src/config/Blocks.jsx @@ -530,6 +530,15 @@ const requiredBlocks = ['title']; const initialBlocks = {}; const initialBlocksFocus = {}; //{Document:'title'} +export function installDefaultBlocks(config) { + config.blocks.requiredBlocks = requiredBlocks; + config.blocks.blocksConfig = blocksConfig; + config.blocks.groupBlocksOrder = groupBlocksOrder; + config.blocks.initialBlocks = initialBlocks; + config.blocks.initialBlocksFocus = initialBlocksFocus; + config.blocks.showEditBlocksInBabelView = false; +} + export { groupBlocksOrder, requiredBlocks, diff --git a/packages/volto/src/config/index.js b/packages/volto/src/config/index.js index c689a84b73..cf912fbaf0 100644 --- a/packages/volto/src/config/index.js +++ b/packages/volto/src/config/index.js @@ -1,3 +1,4 @@ +import ConfigRegistry from '@plone/volto/registry'; import { parse as parseUrl } from 'url'; import { defaultWidget, widgetMapping } from './Widgets'; import { @@ -9,13 +10,6 @@ import { } from './Views'; import { nonContentRoutes } from './NonContentRoutes'; import { nonContentRoutesPublic } from './NonContentRoutesPublic'; -import { - groupBlocksOrder, - requiredBlocks, - blocksConfig, - initialBlocks, - initialBlocksFocus, -} from './Blocks'; import { loadables } from './Loadables'; import { workflowMapping } from './Workflows'; import slots from './slots'; @@ -31,8 +25,8 @@ import { import applyAddonConfiguration, { addonsInfo } from 'load-volto-addons'; -import ConfigRegistry from '@plone/volto/registry'; import { installDefaultComponents } from './Components'; +import { installDefaultBlocks } from './Blocks'; import { getSiteAsyncPropExtender } from '@plone/volto/helpers/Site'; import { registerValidators } from './validation'; @@ -206,14 +200,7 @@ let config = { errorViews, layoutViewsNamesMapping, }, - blocks: { - requiredBlocks, - blocksConfig, - groupBlocksOrder, - initialBlocks, - initialBlocksFocus, - showEditBlocksInBabelView: false, - }, + blocks: {}, addonRoutes: [], addonReducers: {}, components: {}, @@ -262,5 +249,6 @@ Object.entries(slots).forEach(([slotName, components]) => { registerValidators(ConfigRegistry); installDefaultComponents(ConfigRegistry); +installDefaultBlocks(ConfigRegistry); applyAddonConfiguration(ConfigRegistry); From 26069ce28714eb3620b179680997d49acb6fb799 Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Mon, 9 Dec 2024 10:58:00 +0100 Subject: [PATCH 2/2] Changelog --- packages/volto/news/6525.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 packages/volto/news/6525.bugfix diff --git a/packages/volto/news/6525.bugfix b/packages/volto/news/6525.bugfix new file mode 100644 index 0000000000..39351c4afc --- /dev/null +++ b/packages/volto/news/6525.bugfix @@ -0,0 +1 @@ +Fixed circular import error in dev with HMR in core Blocks shadow customizations. @sneridagh