diff --git a/news/178.bugfix b/news/178.bugfix new file mode 100644 index 00000000..bc0d1af9 --- /dev/null +++ b/news/178.bugfix @@ -0,0 +1 @@ +Remove levels choices h1,h4,h5 and h6 from Toc block @iRohitSingh \ No newline at end of file diff --git a/src/components/Blocks/Toc/schema.js b/src/components/Blocks/Toc/schema.js new file mode 100644 index 00000000..40da102e --- /dev/null +++ b/src/components/Blocks/Toc/schema.js @@ -0,0 +1,7 @@ +export const tocBlockSchemaEnhancer = ({ formData, schema, intl }) => { + schema.properties.levels.choices = [ + ['h2', 'h2'], + ['h3', 'h3'], + ]; + return schema; +}; diff --git a/src/index.js b/src/index.js index 54b348ff..5539dbcb 100644 --- a/src/index.js +++ b/src/index.js @@ -17,6 +17,7 @@ import { AccordionSchemaEnhancer } from './components/Blocks/Accordion/schema'; import gridSVG from './icons/block_icn_grid.svg'; import accordionSVG from './icons/block_icn_accordion.svg'; import EventView from './components/Theme/EventView'; +import { tocBlockSchemaEnhancer } from './components/Blocks/Toc/schema'; const BG_COLORS = [ { name: 'transparent', label: 'Transparent' }, @@ -239,6 +240,12 @@ const applyConfig = (config) => { }; config.views.contentTypesViews.Event = EventView; + // TOC Block + config.blocks.blocksConfig.toc = { + ...config.blocks.blocksConfig.toc, + schemaEnhancer: tocBlockSchemaEnhancer, + }; + return config; };