diff --git a/package.json b/package.json index b3eba802..7e9f9352 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ }, "peerDependencies": { "@plone-collective/volto-slots-editor": "*", - "@plone/volto": ">= 16.20.1 < 17.0.0", + "@plone/volto": ">= 18.0.0-alpha.30", "react": ">= 16.8.0", "react-dom": ">= 16.8.0", "volto-form-block": ">=3.0.0" diff --git a/razzle.extend.cjs b/razzle.extend.cjs index 347b2aba..7ae061df 100644 --- a/razzle.extend.cjs +++ b/razzle.extend.cjs @@ -4,72 +4,45 @@ const fileLoaderFinder = makeLoaderFinder('file-loader'); const plugins = (defaultPlugins) => { return [...defaultPlugins]; }; -const modifyWebpackConfig = (config, { target, dev }, webpack) => { - const fileLoader = config.module.rules.find(fileLoaderFinder); - fileLoader.exclude = [ - /@mdi\/svg\/.*\.svg$/, - /@material-design-icons\/svg\/filled\.svg$/, - /nsw-design-system-plone6\/.*\.svg$/, - ...fileLoader.exclude, - ]; - const MDISVGLOADER = { - test: /@mdi\/svg\/.*\.svg$/, - use: [ - { - loader: 'svg-loader', - }, - { - loader: 'svgo-loader', - options: { - plugins: [ - { removeTitle: true }, - { convertPathData: false }, - { removeUselessStrokeAndFill: true }, - { removeViewBox: false }, - ], +const svgoOptions = { + plugins: [ + { + name: 'preset-default', + params: { + overrides: { + convertPathData: false, + removeViewBox: false, }, }, - ], - }; - const MATERIALICONSSVGLOADER = { - test: /@material-design-icons\/svg\/filled\.svg$/, - use: [ - { - loader: 'svg-loader', - }, - { - loader: 'svgo-loader', - options: { - plugins: [ - { removeTitle: true }, - { convertPathData: false }, - { removeUselessStrokeAndFill: true }, - { removeViewBox: false }, - ], - }, - }, - ], - }; - const NSWSVGLOEADER = { - test: /nsw-design-system-plone6\/.*\.svg$/, + }, + 'removeTitle', + 'removeUselessStrokeAndFill', + ], +}; + +function createSVGLoader(test) { + return { + test: test, use: [ { loader: 'svg-loader', }, { loader: 'svgo-loader', - options: { - plugins: [ - { removeTitle: true }, - { convertPathData: false }, - { removeUselessStrokeAndFill: false }, - { removeViewBox: false }, - ], - }, + options: svgoOptions, }, ], }; +} + +const modifyWebpackConfig = (config, { target, dev }, webpack) => { + const fileLoader = config.module.rules.find(fileLoaderFinder); + fileLoader.exclude = [/@mdi\/svg\/.*\.svg$/, /@material-design-icons\/svg\/filled\.svg$/, /nsw-design-system-plone6\/.*\.svg$/, ...fileLoader.exclude]; + + const MDISVGLOADER = createSVGLoader(/@mdi\/svg\/.*\.svg$/); + const MATERIALICONSSVGLOADER = createSVGLoader(/@material-design-icons\/svg\/filled\.svg$/); + const NSWSVGLOEADER = createSVGLoader(/nsw-design-system-plone6\/.*\.svg$/); webpack.module.rules.push(MDISVGLOADER); webpack.module.rules.push(MATERIALICONSSVGLOADER); diff --git a/src/config/apiExpanders.js b/src/config/apiExpanders.js deleted file mode 100644 index 7f908af5..00000000 --- a/src/config/apiExpanders.js +++ /dev/null @@ -1,15 +0,0 @@ -export const updateApiExpandersConfig = (config) => { - config.settings.apiExpanders = [ - { - match: '', - GET_CONTENT: ['actions', 'breadcrumbs', 'navigation'], - querystring: { - 'expand.navigation.depth': config.settings.navDepth, - }, - }, - ]; - - return config; -}; - -export default updateApiExpandersConfig; diff --git a/src/config/blocks/variations.js b/src/config/blocks/variations.js index 4b806c2d..42351ca3 100644 --- a/src/config/blocks/variations.js +++ b/src/config/blocks/variations.js @@ -50,132 +50,132 @@ const blockVariations = { template: CardListing, }, ], - hero: [ - { - id: 'default', - title: 'Default', - isDefault: true, - }, - { - id: 'heroWithLinks', - title: 'Text links', - template: HeroWithLinks, - schemaEnhancer: ({ schema, formData, intl }) => { - schema.properties.linksTitle = { - title: intl.formatMessage(messages.linksTitle), - type: 'string', - }; - schema.properties.links = { - title: intl.formatMessage(messages.links), - widget: 'object_list', - schema: { - title: intl.formatMessage(messages.link), - fieldsets: [ - { - id: 'default', - title: 'Default', - fields: ['title', 'url'], - }, - ], - properties: { - title: { - title: intl.formatMessage(messages.title), - }, - url: { - title: intl.formatMessage(messages.link), - widget: 'object_browser', - mode: 'link', - }, - }, - }, - }; + // hero: [ + // { + // id: 'default', + // title: 'Default', + // isDefault: true, + // }, + // { + // id: 'heroWithLinks', + // title: 'Text links', + // template: HeroWithLinks, + // schemaEnhancer: ({ schema, formData, intl }) => { + // schema.properties.linksTitle = { + // title: intl.formatMessage(messages.linksTitle), + // type: 'string', + // }; + // schema.properties.links = { + // title: intl.formatMessage(messages.links), + // widget: 'object_list', + // schema: { + // title: intl.formatMessage(messages.link), + // fieldsets: [ + // { + // id: 'default', + // title: 'Default', + // fields: ['title', 'url'], + // }, + // ], + // properties: { + // title: { + // title: intl.formatMessage(messages.title), + // }, + // url: { + // title: intl.formatMessage(messages.link), + // widget: 'object_browser', + // mode: 'link', + // }, + // }, + // }, + // }; - const defaultFieldsetIndex = schema.fieldsets.findIndex( - (fieldset) => fieldset.id === 'default', - ); + // const defaultFieldsetIndex = schema.fieldsets.findIndex( + // (fieldset) => fieldset.id === 'default', + // ); - schema.fieldsets[defaultFieldsetIndex].fields = [ - ...schema.fieldsets[defaultFieldsetIndex].fields, - 'linksTitle', - 'links', - ]; - return schema; - }, - }, - { - id: 'heroWithLinkList', - title: 'Link list', - template: HeroWithLinkList, - schemaEnhancer: ({ schema, formData, intl }) => { - schema.properties.linksTitle = { - title: intl.formatMessage(messages.linksTitle), - type: 'string', - }; - schema.properties.links = { - title: intl.formatMessage(messages.links), - widget: 'object_list', - schema: { - title: intl.formatMessage(messages.link), - fieldsets: [ - { - id: 'default', - title: 'Default', - fields: ['title', 'url'], - }, - ], - properties: { - title: { - title: intl.formatMessage(messages.title), - }, - url: { - title: intl.formatMessage(messages.link), - widget: 'object_browser', - mode: 'link', - }, - }, - }, - }; + // schema.fieldsets[defaultFieldsetIndex].fields = [ + // ...schema.fieldsets[defaultFieldsetIndex].fields, + // 'linksTitle', + // 'links', + // ]; + // return schema; + // }, + // }, + // { + // id: 'heroWithLinkList', + // title: 'Link list', + // template: HeroWithLinkList, + // schemaEnhancer: ({ schema, formData, intl }) => { + // schema.properties.linksTitle = { + // title: intl.formatMessage(messages.linksTitle), + // type: 'string', + // }; + // schema.properties.links = { + // title: intl.formatMessage(messages.links), + // widget: 'object_list', + // schema: { + // title: intl.formatMessage(messages.link), + // fieldsets: [ + // { + // id: 'default', + // title: 'Default', + // fields: ['title', 'url'], + // }, + // ], + // properties: { + // title: { + // title: intl.formatMessage(messages.title), + // }, + // url: { + // title: intl.formatMessage(messages.link), + // widget: 'object_browser', + // mode: 'link', + // }, + // }, + // }, + // }; - const defaultFieldsetIndex = schema.fieldsets.findIndex( - (fieldset) => fieldset.id === 'default', - ); + // const defaultFieldsetIndex = schema.fieldsets.findIndex( + // (fieldset) => fieldset.id === 'default', + // ); - schema.fieldsets[defaultFieldsetIndex].fields = [ - ...schema.fieldsets[defaultFieldsetIndex].fields, - 'linksTitle', - 'links', - ]; - return schema; - }, - }, - { - id: 'heroWithBlocks', - title: 'With blocks', - template: HeroWithBlocks, - }, - { - id: 'heroWithDropdownQuickNavigation', - title: 'With quick navigation', - template: HeroWithDropdownQuickNavigation, - schemaEnhancer: ({ schema, formData, intl }) => { - const dropdownQuickNavigationSchema = DropdownQuickNavigationSchema({ - intl, - }); - schema.properties = { - ...schema.properties, - ...dropdownQuickNavigationSchema.properties, - }; - const variationFieldset = { - id: 'dropdownQuickNavVariation', - title: 'Quick Navigation Settings', - fields: [...dropdownQuickNavigationSchema.fieldsets[0].fields], - required: [...dropdownQuickNavigationSchema.fieldsets[0].required], - }; - schema.fieldsets.push(variationFieldset); - return schema; - }, - }, - ], + // schema.fieldsets[defaultFieldsetIndex].fields = [ + // ...schema.fieldsets[defaultFieldsetIndex].fields, + // 'linksTitle', + // 'links', + // ]; + // return schema; + // }, + // }, + // { + // id: 'heroWithBlocks', + // title: 'With blocks', + // template: HeroWithBlocks, + // }, + // { + // id: 'heroWithDropdownQuickNavigation', + // title: 'With quick navigation', + // template: HeroWithDropdownQuickNavigation, + // schemaEnhancer: ({ schema, formData, intl }) => { + // const dropdownQuickNavigationSchema = DropdownQuickNavigationSchema({ + // intl, + // }); + // schema.properties = { + // ...schema.properties, + // ...dropdownQuickNavigationSchema.properties, + // }; + // const variationFieldset = { + // id: 'dropdownQuickNavVariation', + // title: 'Quick Navigation Settings', + // fields: [...dropdownQuickNavigationSchema.fieldsets[0].fields], + // required: [...dropdownQuickNavigationSchema.fieldsets[0].required], + // }; + // schema.fieldsets.push(variationFieldset); + // return schema; + // }, + // }, + // ], }; // Add schema enhancers to specific variations of existing blocks diff --git a/src/config/index.js b/src/config/index.js index 89d86d8a..1feff24d 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -1,4 +1,3 @@ -import updateApiExpandersConfig from './apiExpanders'; import updateAsyncConnectConfig from './asyncConnect'; import updateBlocksConfig from './blocks'; import updateLoadablesConfig from './loadables'; @@ -15,7 +14,6 @@ export const applyAddonConfig = (config) => { // Settings may be used by other configs updateSettingsConfig(config); - updateApiExpandersConfig(config); updateAsyncConnectConfig(config); updateBlocksConfig(config); updateLoadablesConfig(config); diff --git a/src/config/settings.js b/src/config/settings.js index cdd77099..6bc12756 100644 --- a/src/config/settings.js +++ b/src/config/settings.js @@ -1,7 +1,5 @@ export const updateSettingsConfig = (config) => { config.settings.navDepth = 2; - config.experimental.addBlockButton.enabled = true; - config.settings.fullWidthContentBlocks = [ ...(config.settings.fullWidthContentBlocks || []), 'form', diff --git a/src/customizations/volto/components/theme/Header/Header.jsx b/src/customizations/volto/components/theme/Header/Header.jsx index d0386787..b18352d5 100644 --- a/src/customizations/volto/components/theme/Header/Header.jsx +++ b/src/customizations/volto/components/theme/Header/Header.jsx @@ -81,10 +81,8 @@ const SearchStartButton = ({ searchInputElement }) => { }; const Header = ({ nswDesignSystem }) => { - const { siteSettings, siteTitle } = useSelector((state) => ({ - siteTitle: state.siteInfo.title, - siteSettings: state.nswSiteSettings.data, - })); + const siteTitle = useSelector((state) => state.siteInfo.title); + const siteSettings = useSelector((state) => state.nswSiteSettings.data); const searchInputElement = useRef(null); const searchInputController = useRef(null); if (__CLIENT__ && !searchInputController.current && searchInputElement) { diff --git a/src/customizations/volto/components/theme/Logo/Logo.jsx b/src/customizations/volto/components/theme/Logo/Logo.jsx index a2eec204..6735275f 100644 --- a/src/customizations/volto/components/theme/Logo/Logo.jsx +++ b/src/customizations/volto/components/theme/Logo/Logo.jsx @@ -5,13 +5,9 @@ import './Logo.custom.less'; const Logo = () => { const { settings } = config; - const { lang, logoUrl, siteTitle } = useSelector((state) => { - return { - lang: state.intl.locale, - logoUrl: state.siteInfo.logo_url, - siteTitle: state.siteInfo.title, - }; - }); + const lang = useSelector((state) => state.intl.locale); + const logoUrl = useSelector((state) => state.siteInfo.logo_url); + const siteTitle = useSelector((state) => state.siteInfo.title); return (