From a3cf979b48c575d853d933bcf2de2b02e00b0403 Mon Sep 17 00:00:00 2001 From: acketon Date: Wed, 23 Aug 2023 14:38:12 -0400 Subject: [PATCH 1/2] disable generated anchors in Headline block --- dist/blocks.build.js | 2 +- src/blocks/headline/headline.js | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/dist/blocks.build.js b/dist/blocks.build.js index e450e02f..6bc140ee 100644 --- a/dist/blocks.build.js +++ b/dist/blocks.build.js @@ -199,7 +199,7 @@ eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true } /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_scss__ = __webpack_require__(/*! ./style.scss */ 12);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__style_scss__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__editor_scss__ = __webpack_require__(/*! ./editor.scss */ 13);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__editor_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__editor_scss__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__heading_toolbar__ = __webpack_require__(/*! ./heading-toolbar */ 7);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__pretext_format_js__ = __webpack_require__(/*! ./pretext-format.js */ 14);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__pretext_format_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__pretext_format_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__posttext_format_js__ = __webpack_require__(/*! ./posttext-format.js */ 15);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__posttext_format_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__posttext_format_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__global_allowed_formats__ = __webpack_require__(/*! ../../global/allowed-formats */ 2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__components_block_icons___ = __webpack_require__(/*! ../../components/block-icons/ */ 1);\n/**\n * BLOCK: bu-headline-cgb\n *\n * A headline with anchor support and pre- and post-text formatting options.\n */\n\n// Import CSS.\n\n\n\n// Import internal dependencies.\n\n\n\n\n\n\n// WordPress dependencies.\nvar __ = wp.i18n.__;\nvar registerBlockType = wp.blocks.registerBlockType;\nvar Fragment = wp.element.Fragment;\nvar PanelBody = wp.components.PanelBody;\n\nvar _ref = 'undefined' === typeof wp.blockEditor ? wp.editor : wp.blockEditor,\n RichText = _ref.RichText,\n BlockControls = _ref.BlockControls,\n InspectorControls = _ref.InspectorControls;\n\nvar select = wp.data.select;\n\n// Populate selectors that were in core/editor until WordPress 5.2 and are\n// now located in core/block-editor.\n\nvar _ref2 = 'undefined' === typeof select('core/block-editor') ? select('core/editor') : select('core/block-editor'),\n getBlocks = _ref2.getBlocks;\n\n// Register the block.\n\n\nregisterBlockType('editorial/headline', {\n\n\ttitle: __('Headline'),\n\tdescription: __('Add a section heading with an anchor and pre- and post-text formatting options.'),\n\ticon: Object(__WEBPACK_IMPORTED_MODULE_6__components_block_icons___[\"a\" /* default */])('headline'),\n\tcategory: 'bu-editorial',\n\tsupports: {\n\t\tanchor: true\n\t},\n\tattributes: {\n\t\tcontent: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: '.wp-block-editorial-headline'\n\t\t},\n\t\tlevel: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 2\n\t\t},\n\t\tanchor: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tattribute: 'id',\n\t\t\tselector: '.wp-block-editorial-headline'\n\t\t}\n\t},\n\tstyles: [{\n\t\tname: 'default',\n\t\tlabel: __('Regular'),\n\t\tisDefault: true\n\t}, {\n\t\tname: 'emphasis-weight',\n\t\tlabel: __('Emphasize weight')\n\t}, {\n\t\tname: 'emphasis-color',\n\t\tlabel: __('Emphasize color')\n\t}],\n\n\tedit: function edit(props) {\n\t\tvar attributes = props.attributes,\n\t\t setAttributes = props.setAttributes,\n\t\t className = props.className;\n\t\tvar content = attributes.content,\n\t\t level = attributes.level,\n\t\t anchor = attributes.anchor;\n\n\t\tvar tagName = 'h' + level;\n\n\t\t// Generate an index-based value for the anchor attribute if it is not set.\n\t\tif (!anchor) {\n\t\t\tvar headlineBlocks = getBlocks().filter(function (e) {\n\t\t\t\treturn e.name === 'editorial/headline';\n\t\t\t});\n\t\t\tvar id = 'headline-' + headlineBlocks.length;\n\n\t\t\tsetAttributes({ anchor: id });\n\t\t}\n\n\t\treturn wp.element.createElement(\n\t\t\tFragment,\n\t\t\tnull,\n\t\t\twp.element.createElement(\n\t\t\t\tInspectorControls,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(\n\t\t\t\t\tPanelBody,\n\t\t\t\t\t{ title: __('Help'), initialOpen: false },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tFragment,\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t'p',\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t'strong',\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t'PreText and PostText Formats'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement('br', null),\n\t\t\t\t\t\t\t'These formats are intended to style text such as \"Chapter 3:\" as part of a headline text either before or after the main Headline text. Enter the Headline and then select text in the headline and apply a pre or post text format from the Format Control Toolbar on the block.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t'p',\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t'strong',\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t'Emphasis Color & Weight'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement('br', null),\n\t\t\t\t\t\t\t'Emphasis Color and Emphasis weight can be selectively applied to a word(s) by selecting those characters and applying a ',\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t'strong',\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t'Bold'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t' style. The color or weight change will apply to any bold text inside the Headline tag.'\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t),\n\t\t\twp.element.createElement(\n\t\t\t\tBlockControls,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_2__heading_toolbar__[\"a\" /* default */], { minLevel: 1, maxLevel: 7, selectedLevel: level, onChange: function onChange(newLevel) {\n\t\t\t\t\t\treturn setAttributes({ level: newLevel });\n\t\t\t\t\t} })\n\t\t\t),\n\t\t\twp.element.createElement(RichText, {\n\t\t\t\ttagName: tagName,\n\t\t\t\tclassName: className,\n\t\t\t\tvalue: content,\n\t\t\t\tonChange: function onChange(content) {\n\t\t\t\t\treturn setAttributes({ content: content });\n\t\t\t\t},\n\t\t\t\tplaceholder: __('Write headline…'),\n\t\t\t\tformattingControls: Object(__WEBPACK_IMPORTED_MODULE_5__global_allowed_formats__[\"a\" /* default */])('formattingControls', ['pretext', 'posttext', 'bold', 'italic']),\n\t\t\t\tallowedFormats: Object(__WEBPACK_IMPORTED_MODULE_5__global_allowed_formats__[\"a\" /* default */])('allowedFormats', ['editorial/pretext', 'editorial/posttext', 'core/bold', 'core/italic']),\n\t\t\t\twithoutInteractiveFormats: true\n\t\t\t})\n\t\t);\n\t},\n\tsave: function save(_ref3) {\n\t\tvar attributes = _ref3.attributes;\n\t\tvar content = attributes.content,\n\t\t level = attributes.level;\n\n\t\tvar tagName = 'h' + level;\n\n\t\treturn wp.element.createElement(RichText.Content, {\n\t\t\ttagName: tagName,\n\t\t\tvalue: content\n\t\t});\n\t}\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvYmxvY2tzL2hlYWRsaW5lL2hlYWRsaW5lLmpzPzAwMGQiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBCTE9DSzogYnUtaGVhZGxpbmUtY2diXG4gKlxuICogQSBoZWFkbGluZSB3aXRoIGFuY2hvciBzdXBwb3J0IGFuZCBwcmUtIGFuZCBwb3N0LXRleHQgZm9ybWF0dGluZyBvcHRpb25zLlxuICovXG5cbi8vIEltcG9ydCBDU1MuXG5pbXBvcnQgJy4vc3R5bGUuc2Nzcyc7XG5pbXBvcnQgJy4vZWRpdG9yLnNjc3MnO1xuXG4vLyBJbXBvcnQgaW50ZXJuYWwgZGVwZW5kZW5jaWVzLlxuaW1wb3J0IEhlYWRpbmdUb29sYmFyIGZyb20gJy4vaGVhZGluZy10b29sYmFyJztcbmltcG9ydCAnLi9wcmV0ZXh0LWZvcm1hdC5qcyc7XG5pbXBvcnQgJy4vcG9zdHRleHQtZm9ybWF0LmpzJztcbmltcG9ydCBnZXRBbGxvd2VkRm9ybWF0cyBmcm9tICcuLi8uLi9nbG9iYWwvYWxsb3dlZC1mb3JtYXRzJztcbmltcG9ydCBibG9ja0ljb25zIGZyb20gJy4uLy4uL2NvbXBvbmVudHMvYmxvY2staWNvbnMvJztcblxuLy8gV29yZFByZXNzIGRlcGVuZGVuY2llcy5cbnZhciBfXyA9IHdwLmkxOG4uX187XG52YXIgcmVnaXN0ZXJCbG9ja1R5cGUgPSB3cC5ibG9ja3MucmVnaXN0ZXJCbG9ja1R5cGU7XG52YXIgRnJhZ21lbnQgPSB3cC5lbGVtZW50LkZyYWdtZW50O1xudmFyIFBhbmVsQm9keSA9IHdwLmNvbXBvbmVudHMuUGFuZWxCb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O0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///11\n"); +eval("/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_scss__ = __webpack_require__(/*! ./style.scss */ 12);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__style_scss__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__editor_scss__ = __webpack_require__(/*! ./editor.scss */ 13);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__editor_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__editor_scss__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__heading_toolbar__ = __webpack_require__(/*! ./heading-toolbar */ 7);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__pretext_format_js__ = __webpack_require__(/*! ./pretext-format.js */ 14);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__pretext_format_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__pretext_format_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__posttext_format_js__ = __webpack_require__(/*! ./posttext-format.js */ 15);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__posttext_format_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__posttext_format_js__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__global_allowed_formats__ = __webpack_require__(/*! ../../global/allowed-formats */ 2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__components_block_icons___ = __webpack_require__(/*! ../../components/block-icons/ */ 1);\n/**\n * BLOCK: bu-headline-cgb\n *\n * A headline with anchor support and pre- and post-text formatting options.\n */\n\n// Import CSS.\n\n\n\n// Import internal dependencies.\n\n\n\n\n\n\n// WordPress dependencies.\nvar __ = wp.i18n.__;\nvar registerBlockType = wp.blocks.registerBlockType;\nvar Fragment = wp.element.Fragment;\nvar PanelBody = wp.components.PanelBody;\n\nvar _ref = 'undefined' === typeof wp.blockEditor ? wp.editor : wp.blockEditor,\n RichText = _ref.RichText,\n BlockControls = _ref.BlockControls,\n InspectorControls = _ref.InspectorControls;\n\nvar select = wp.data.select;\n\n// Populate selectors that were in core/editor until WordPress 5.2 and are\n// now located in core/block-editor.\n\nvar _ref2 = 'undefined' === typeof select('core/block-editor') ? select('core/editor') : select('core/block-editor'),\n getBlocks = _ref2.getBlocks;\n\n// Register the block.\n\n\nregisterBlockType('editorial/headline', {\n\n\ttitle: __('Headline'),\n\tdescription: __('Add a section heading with an anchor and pre- and post-text formatting options.'),\n\ticon: Object(__WEBPACK_IMPORTED_MODULE_6__components_block_icons___[\"a\" /* default */])('headline'),\n\tcategory: 'bu-editorial',\n\tsupports: {\n\t\tanchor: true\n\t},\n\tattributes: {\n\t\tcontent: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: '.wp-block-editorial-headline'\n\t\t},\n\t\tlevel: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 2\n\t\t},\n\t\tanchor: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'attribute',\n\t\t\tattribute: 'id',\n\t\t\tselector: '.wp-block-editorial-headline'\n\t\t}\n\t},\n\tstyles: [{\n\t\tname: 'default',\n\t\tlabel: __('Regular'),\n\t\tisDefault: true\n\t}, {\n\t\tname: 'emphasis-weight',\n\t\tlabel: __('Emphasize weight')\n\t}, {\n\t\tname: 'emphasis-color',\n\t\tlabel: __('Emphasize color')\n\t}],\n\n\tedit: function edit(props) {\n\t\tvar attributes = props.attributes,\n\t\t setAttributes = props.setAttributes,\n\t\t className = props.className;\n\t\tvar content = attributes.content,\n\t\t level = attributes.level,\n\t\t anchor = attributes.anchor;\n\n\t\tvar tagName = 'h' + level;\n\n\t\t/**\n * August 2023: Disabling this Anchor ID Generator as it is creating duplicate anchor ids on all headings if:\n * - Headline blocks are duplicated, resulting in duplicate anchors\n * - When Headline blocks are child blocks of other blocks they aren't included in the count using the current getBlocks() method.\n * - Duplicate anchors are a problem for SiteImprove and cause us to fail accessibility checks. Better to force users to manually insert ids.\n * - Core Gutenberg is considering a new feature to support unique non-duplicatable attributes: https://github.com/WordPress/gutenberg/issues/29693\n */\n\t\t// Generate an index-based value for the anchor attribute if it is not set.\n\t\t// if ( ! anchor ) {\n\t\t// \tconst headlineBlocks = getBlocks().filter( e => e.name === 'editorial/headline' );\n\t\t// \tconst id = 'headline-' + ( headlineBlocks.length );\n\n\t\t// \tsetAttributes( { anchor: id } );\n\t\t// }\n\n\t\treturn wp.element.createElement(\n\t\t\tFragment,\n\t\t\tnull,\n\t\t\twp.element.createElement(\n\t\t\t\tInspectorControls,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(\n\t\t\t\t\tPanelBody,\n\t\t\t\t\t{ title: __('Help'), initialOpen: false },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tFragment,\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t'p',\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t'strong',\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t'PreText and PostText Formats'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement('br', null),\n\t\t\t\t\t\t\t'These formats are intended to style text such as \"Chapter 3:\" as part of a headline text either before or after the main Headline text. Enter the Headline and then select text in the headline and apply a pre or post text format from the Format Control Toolbar on the block.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t'p',\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t'strong',\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t'Emphasis Color & Weight'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\twp.element.createElement('br', null),\n\t\t\t\t\t\t\t'Emphasis Color and Emphasis weight can be selectively applied to a word(s) by selecting those characters and applying a ',\n\t\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t\t'strong',\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t'Bold'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t' style. The color or weight change will apply to any bold text inside the Headline tag.'\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t),\n\t\t\twp.element.createElement(\n\t\t\t\tBlockControls,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(__WEBPACK_IMPORTED_MODULE_2__heading_toolbar__[\"a\" /* default */], { minLevel: 1, maxLevel: 7, selectedLevel: level, onChange: function onChange(newLevel) {\n\t\t\t\t\t\treturn setAttributes({ level: newLevel });\n\t\t\t\t\t} })\n\t\t\t),\n\t\t\twp.element.createElement(RichText, {\n\t\t\t\ttagName: tagName,\n\t\t\t\tclassName: className,\n\t\t\t\tvalue: content,\n\t\t\t\tonChange: function onChange(content) {\n\t\t\t\t\treturn setAttributes({ content: content });\n\t\t\t\t},\n\t\t\t\tplaceholder: __('Write headline…'),\n\t\t\t\tformattingControls: Object(__WEBPACK_IMPORTED_MODULE_5__global_allowed_formats__[\"a\" /* default */])('formattingControls', ['pretext', 'posttext', 'bold', 'italic']),\n\t\t\t\tallowedFormats: Object(__WEBPACK_IMPORTED_MODULE_5__global_allowed_formats__[\"a\" /* default */])('allowedFormats', ['editorial/pretext', 'editorial/posttext', 'core/bold', 'core/italic']),\n\t\t\t\twithoutInteractiveFormats: true\n\t\t\t})\n\t\t);\n\t},\n\tsave: function save(_ref3) {\n\t\tvar attributes = _ref3.attributes;\n\t\tvar content = attributes.content,\n\t\t level = attributes.level;\n\n\t\tvar tagName = 'h' + level;\n\n\t\treturn wp.element.createElement(RichText.Content, {\n\t\t\ttagName: tagName,\n\t\t\tvalue: content\n\t\t});\n\t}\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvYmxvY2tzL2hlYWRsaW5lL2hlYWRsaW5lLmpzPzAwMGQiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBCTE9DSzogYnUtaGVhZGxpbmUtY2diXG4gKlxuICogQSBoZWFkbGluZSB3aXRoIGFuY2hvciBzdXBwb3J0IGFuZCBwcmUtIGFuZCBwb3N0LXRleHQgZm9ybWF0dGluZyBvcHRpb25zLlxuICovXG5cbi8vIEltcG9ydCBDU1MuXG5pbXBvcnQgJy4vc3R5bGUuc2Nzcyc7XG5pbXBvcnQgJy4vZWRpdG9yLnNjc3MnO1xuXG4vLyBJbXBvcnQgaW50ZXJuYWwgZGVwZW5kZW5jaWVzLlxuaW1w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 100644 --- a/src/blocks/headline/headline.js +++ b/src/blocks/headline/headline.js @@ -85,13 +85,20 @@ registerBlockType( 'editorial/headline', { const { content, level, anchor } = attributes; const tagName = 'h' + level; + /** + * August 2023: Disabling this Anchor ID Generator as it is creating duplicate anchor ids on all headings if: + * - Headline blocks are duplicated, resulting in duplicate anchors + * - When Headline blocks are child blocks of other blocks they aren't included in the count using the current getBlocks() method. + * - Duplicate anchors are a problem for SiteImprove and cause us to fail accessibility checks. Better to force users to manually insert ids. + * - Core Gutenberg is considering a new feature to support unique non-duplicatable attributes: https://github.com/WordPress/gutenberg/issues/29693 + */ // Generate an index-based value for the anchor attribute if it is not set. - if ( ! anchor ) { - const headlineBlocks = getBlocks().filter( e => e.name === 'editorial/headline' ); - const id = 'headline-' + ( headlineBlocks.length ); + // if ( ! anchor ) { + // const headlineBlocks = getBlocks().filter( e => e.name === 'editorial/headline' ); + // const id = 'headline-' + ( headlineBlocks.length ); - setAttributes( { anchor: id } ); - } + // setAttributes( { anchor: id } ); + // } return ( From c5635a18185ee37667f5883f88a8707ff4237859 Mon Sep 17 00:00:00 2001 From: acketon Date: Wed, 23 Aug 2023 15:27:34 -0400 Subject: [PATCH 2/2] update --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90350c55..da75dad7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Unreleased +- Fix #315 - disable autogenerated Anchor ID's in the Headline Block - Click to Tweet style fixes. Closes #320. Updates the styles to restore the styling for the Click to Tweet feature on Paragraph blocks. - Stats Block: - Update to block api 2 and fix alignment issues for WP 5.7