@wordpress/block-library 9.43.1-next.v.202604091042.0 → 9.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/cover/edit/index.cjs +8 -1
  3. package/build/cover/edit/index.cjs.map +2 -2
  4. package/build/embed/embed-preview.cjs +2 -1
  5. package/build/embed/embed-preview.cjs.map +2 -2
  6. package/build/image/image.cjs +28 -6
  7. package/build/image/image.cjs.map +2 -2
  8. package/build/navigation-link/link-ui/index.cjs +12 -1
  9. package/build/navigation-link/link-ui/index.cjs.map +2 -2
  10. package/build/paragraph/use-enter.cjs +4 -5
  11. package/build/paragraph/use-enter.cjs.map +2 -2
  12. package/build/search/block.json +5 -1
  13. package/build/search/edit.cjs +2 -0
  14. package/build/search/edit.cjs.map +2 -2
  15. package/build/separator/transforms.cjs +12 -4
  16. package/build/separator/transforms.cjs.map +2 -2
  17. package/build/tab/add-tab-toolbar-control.cjs +5 -17
  18. package/build/tab/add-tab-toolbar-control.cjs.map +2 -2
  19. package/build/tab/block.json +2 -1
  20. package/build/tab/remove-tab-toolbar-control.cjs +1 -4
  21. package/build/tab/remove-tab-toolbar-control.cjs.map +2 -2
  22. package/build/tabs/edit.cjs +45 -45
  23. package/build/tabs/edit.cjs.map +2 -2
  24. package/build/tabs-menu/block.json +1 -2
  25. package/build/tabs-menu-item/block.json +0 -6
  26. package/build/tabs-menu-item/edit.cjs +2 -8
  27. package/build/tabs-menu-item/edit.cjs.map +2 -2
  28. package/build-module/cover/edit/index.mjs +8 -1
  29. package/build-module/cover/edit/index.mjs.map +2 -2
  30. package/build-module/embed/embed-preview.mjs +2 -1
  31. package/build-module/embed/embed-preview.mjs.map +2 -2
  32. package/build-module/image/image.mjs +28 -6
  33. package/build-module/image/image.mjs.map +2 -2
  34. package/build-module/navigation-link/link-ui/index.mjs +12 -1
  35. package/build-module/navigation-link/link-ui/index.mjs.map +2 -2
  36. package/build-module/paragraph/use-enter.mjs +4 -5
  37. package/build-module/paragraph/use-enter.mjs.map +2 -2
  38. package/build-module/search/block.json +5 -1
  39. package/build-module/search/edit.mjs +2 -0
  40. package/build-module/search/edit.mjs.map +2 -2
  41. package/build-module/separator/transforms.mjs +17 -5
  42. package/build-module/separator/transforms.mjs.map +2 -2
  43. package/build-module/tab/add-tab-toolbar-control.mjs +6 -18
  44. package/build-module/tab/add-tab-toolbar-control.mjs.map +2 -2
  45. package/build-module/tab/block.json +2 -1
  46. package/build-module/tab/remove-tab-toolbar-control.mjs +1 -4
  47. package/build-module/tab/remove-tab-toolbar-control.mjs.map +2 -2
  48. package/build-module/tabs/edit.mjs +45 -45
  49. package/build-module/tabs/edit.mjs.map +2 -2
  50. package/build-module/tabs-menu/block.json +1 -2
  51. package/build-module/tabs-menu-item/block.json +0 -6
  52. package/build-module/tabs-menu-item/edit.mjs +3 -9
  53. package/build-module/tabs-menu-item/edit.mjs.map +2 -2
  54. package/build-style/post-author-biography/style-rtl.css +1 -0
  55. package/build-style/post-author-biography/style.css +1 -0
  56. package/build-style/style-rtl.css +10 -15
  57. package/build-style/style.css +10 -15
  58. package/build-style/tabs-menu-item/style-rtl.css +9 -6
  59. package/build-style/tabs-menu-item/style.css +9 -6
  60. package/package.json +38 -38
  61. package/src/cover/edit/index.js +9 -1
  62. package/src/embed/embed-preview.js +6 -5
  63. package/src/image/image.js +50 -5
  64. package/src/navigation-link/link-ui/index.js +12 -1
  65. package/src/paragraph/use-enter.js +5 -5
  66. package/src/post-author-biography/style.scss +1 -0
  67. package/src/search/block.json +5 -1
  68. package/src/search/edit.js +2 -0
  69. package/src/search/index.php +23 -3
  70. package/src/separator/transforms.js +19 -5
  71. package/src/style.scss +0 -1
  72. package/src/tab/add-tab-toolbar-control.js +24 -42
  73. package/src/tab/block.json +2 -1
  74. package/src/tab/index.php +21 -4
  75. package/src/tab/remove-tab-toolbar-control.js +1 -9
  76. package/src/tabs/edit.js +59 -66
  77. package/src/tabs/index.php +14 -15
  78. package/src/tabs-menu/block.json +1 -2
  79. package/src/tabs-menu/index.php +6 -17
  80. package/src/tabs-menu-item/block.json +0 -6
  81. package/src/tabs-menu-item/edit.js +3 -15
  82. package/src/tabs-menu-item/style.scss +10 -8
  83. package/build-style/tabs-menu/style-rtl.css +0 -8
  84. package/build-style/tabs-menu/style.css +0 -8
  85. package/src/tabs-menu/style.scss +0 -8
@@ -1,6 +1,6 @@
1
1
  // packages/block-library/src/tabs-menu-item/edit.js
2
2
  import clsx from "clsx";
3
- import { __, sprintf } from "@wordpress/i18n";
3
+ import { __ } from "@wordpress/i18n";
4
4
  import {
5
5
  useBlockProps,
6
6
  store as blockEditorStore,
@@ -12,7 +12,6 @@ import Controls from "./controls.mjs";
12
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
13
  var EMPTY_ARRAY = [];
14
14
  function Edit({
15
- attributes,
16
15
  context,
17
16
  clientId,
18
17
  __unstableLayoutClassNames: layoutClassNames
@@ -51,8 +50,7 @@ function Edit({
51
50
  },
52
51
  [clientId, tabsList]
53
52
  );
54
- const tabAnchor = attributes.anchor?.replace(/-button$/, "") ?? "";
55
- const tab = tabAnchor && tabsList.find((t) => t.id === tabAnchor) || tabsList[menuItemIndex] || {};
53
+ const tab = tabsList[menuItemIndex] || {};
56
54
  const tabListIndex = tab.index ?? menuItemIndex;
57
55
  const tabId = tab.id || `tab-${menuItemIndex}`;
58
56
  const tabClientId = tab.clientId || "";
@@ -105,11 +103,7 @@ function Edit({
105
103
  {
106
104
  tagName: "span",
107
105
  withoutInteractiveFormatting: true,
108
- placeholder: sprintf(
109
- /* translators: %d is the tab index + 1 */
110
- __("Tab title %d"),
111
- menuItemIndex + 1
112
- ),
106
+ placeholder: __("Tab title"),
113
107
  value: label,
114
108
  onChange: handleLabelChange
115
109
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/tabs-menu-item/edit.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Controls from './controls';\n\nconst EMPTY_ARRAY = [];\n\nfunction Edit( {\n\tattributes,\n\tcontext,\n\tclientId,\n\t__unstableLayoutClassNames: layoutClassNames,\n} ) {\n\tconst tabsList = context[ 'core/tabs-list' ] || EMPTY_ARRAY;\n\tconst activeTabIndex = context[ 'core/tabs-activeTabIndex' ] ?? 0;\n\tconst editorActiveTabIndex = context[ 'core/tabs-editorActiveTabIndex' ];\n\n\tconst effectiveActiveIndex = useMemo( () => {\n\t\treturn editorActiveTabIndex ?? activeTabIndex;\n\t}, [ editorActiveTabIndex, activeTabIndex ] );\n\n\tconst { menuItemIndex, tabsClientId, selectedTabClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _tabsMenuClientId = getBlockRootClientId( clientId );\n\t\t\tconst _tabsClientId = _tabsMenuClientId\n\t\t\t\t? getBlockRootClientId( _tabsMenuClientId )\n\t\t\t\t: null;\n\n\t\t\tconst siblings = getBlockOrder( _tabsMenuClientId );\n\t\t\tconst _menuItemIndex = siblings.indexOf( clientId );\n\n\t\t\t// Find which tab panel block is currently selected.\n\t\t\tconst selectedIds = getSelectedBlockClientIds();\n\t\t\tlet _selectedTabClientId = null;\n\t\t\tfor ( const tab of tabsList ) {\n\t\t\t\tif (\n\t\t\t\t\tselectedIds.includes( tab.clientId ) ||\n\t\t\t\t\thasSelectedInnerBlock( tab.clientId, true )\n\t\t\t\t) {\n\t\t\t\t\t_selectedTabClientId = tab.clientId;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tmenuItemIndex: _menuItemIndex,\n\t\t\t\ttabsClientId: _tabsClientId,\n\t\t\t\tselectedTabClientId: _selectedTabClientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId, tabsList ]\n\t);\n\n\t// Find the corresponding tab's anchor from this menu item's anchor\n\t// attribute (e.g., \"tab-1-button\" \u2192 \"tab-1\"), then look it up in tabsList.\n\t// Falls back to positional lookup when no anchor is set.\n\tconst tabAnchor = attributes.anchor?.replace( /-button$/, '' ) ?? '';\n\tconst tab =\n\t\t( tabAnchor && tabsList.find( ( t ) => t.id === tabAnchor ) ) ||\n\t\ttabsList[ menuItemIndex ] ||\n\t\t{};\n\n\t// tabListIndex is the tab's position in tabsList, used for active-state\n\t// checks and click handling.\n\tconst tabListIndex = tab.index ?? menuItemIndex;\n\n\tconst tabId = tab.id || `tab-${ menuItemIndex }`;\n\tconst tabClientId = tab.clientId || '';\n\tconst label = tab.label || '';\n\n\tconst isActive = tabListIndex === effectiveActiveIndex;\n\tconst isSelected = tabClientId === selectedTabClientId;\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, updateBlockAttributes } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst handleTabClick = useCallback(\n\t\t( event ) => {\n\t\t\tevent.preventDefault();\n\t\t\tif ( tabsClientId && tabListIndex !== effectiveActiveIndex ) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tupdateBlockAttributes( tabsClientId, {\n\t\t\t\t\teditorActiveTabIndex: tabListIndex,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\ttabsClientId,\n\t\t\ttabListIndex,\n\t\t\teffectiveActiveIndex,\n\t\t\tupdateBlockAttributes,\n\t\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\t]\n\t);\n\n\tconst handleLabelChange = useCallback(\n\t\t( newLabel ) => {\n\t\t\tif ( tabClientId ) {\n\t\t\t\tupdateBlockAttributes( tabClientId, { label: newLabel } );\n\t\t\t}\n\t\t},\n\t\t[ tabClientId, updateBlockAttributes ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( layoutClassNames, {\n\t\t\t'is-active': isActive,\n\t\t\t'is-selected': isSelected,\n\t\t} ),\n\t\t'aria-controls': tabId,\n\t\t'aria-selected': isActive,\n\t\tid: `${ tabId }--tab`,\n\t\trole: 'tab',\n\t\ttabIndex: -1,\n\t\tonClick: handleTabClick,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<Controls tabsClientId={ tabsClientId } />\n\t\t\t<button { ...blockProps } type=\"button\">\n\t\t\t\t<RichText\n\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tplaceholder={ sprintf(\n\t\t\t\t\t\t/* translators: %d is the tab index + 1 */\n\t\t\t\t\t\t__( 'Tab title %d' ),\n\t\t\t\t\t\tmenuItemIndex + 1\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ handleLabelChange }\n\t\t\t\t/>\n\t\t\t</button>\n\t\t</>\n\t);\n}\n\nexport default Edit;\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,IAAI,eAAe;AAC5B;AAAA,EACC;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,mBAAmB;AAKrC,OAAO,cAAc;AA0HnB,mBACC,KADD;AAxHF,IAAM,cAAc,CAAC;AAErB,SAAS,KAAM;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,4BAA4B;AAC7B,GAAI;AACH,QAAM,WAAW,QAAS,gBAAiB,KAAK;AAChD,QAAM,iBAAiB,QAAS,0BAA2B,KAAK;AAChE,QAAM,uBAAuB,QAAS,gCAAiC;AAEvE,QAAM,uBAAuB,QAAS,MAAM;AAC3C,WAAO,wBAAwB;AAAA,EAChC,GAAG,CAAE,sBAAsB,cAAe,CAAE;AAE5C,QAAM,EAAE,eAAe,cAAc,oBAAoB,IAAI;AAAA,IAC5D,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,gBAAiB;AAE7B,YAAM,oBAAoB,qBAAsB,QAAS;AACzD,YAAM,gBAAgB,oBACnB,qBAAsB,iBAAkB,IACxC;AAEH,YAAM,WAAW,cAAe,iBAAkB;AAClD,YAAM,iBAAiB,SAAS,QAAS,QAAS;AAGlD,YAAM,cAAc,0BAA0B;AAC9C,UAAI,uBAAuB;AAC3B,iBAAYA,QAAO,UAAW;AAC7B,YACC,YAAY,SAAUA,KAAI,QAAS,KACnC,sBAAuBA,KAAI,UAAU,IAAK,GACzC;AACD,iCAAuBA,KAAI;AAC3B;AAAA,QACD;AAAA,MACD;AAEA,aAAO;AAAA,QACN,eAAe;AAAA,QACf,cAAc;AAAA,QACd,qBAAqB;AAAA,MACtB;AAAA,IACD;AAAA,IACA,CAAE,UAAU,QAAS;AAAA,EACtB;AAKA,QAAM,YAAY,WAAW,QAAQ,QAAS,YAAY,EAAG,KAAK;AAClE,QAAM,MACH,aAAa,SAAS,KAAM,CAAE,MAAO,EAAE,OAAO,SAAU,KAC1D,SAAU,aAAc,KACxB,CAAC;AAIF,QAAM,eAAe,IAAI,SAAS;AAElC,QAAM,QAAQ,IAAI,MAAM,OAAQ,aAAc;AAC9C,QAAM,cAAc,IAAI,YAAY;AACpC,QAAM,QAAQ,IAAI,SAAS;AAE3B,QAAM,WAAW,iBAAiB;AAClC,QAAM,aAAa,gBAAgB;AAEnC,QAAM,EAAE,yCAAyC,sBAAsB,IACtE,YAAa,gBAAiB;AAE/B,QAAM,iBAAiB;AAAA,IACtB,CAAE,UAAW;AACZ,YAAM,eAAe;AACrB,UAAK,gBAAgB,iBAAiB,sBAAuB;AAC5D,gDAAwC;AACxC,8BAAuB,cAAc;AAAA,UACpC,sBAAsB;AAAA,QACvB,CAAE;AAAA,MACH;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,QAAM,oBAAoB;AAAA,IACzB,CAAE,aAAc;AACf,UAAK,aAAc;AAClB,8BAAuB,aAAa,EAAE,OAAO,SAAS,CAAE;AAAA,MACzD;AAAA,IACD;AAAA,IACA,CAAE,aAAa,qBAAsB;AAAA,EACtC;AAEA,QAAM,aAAa,cAAe;AAAA,IACjC,WAAW,KAAM,kBAAkB;AAAA,MAClC,aAAa;AAAA,MACb,eAAe;AAAA,IAChB,CAAE;AAAA,IACF,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,IAAI,GAAI,KAAM;AAAA,IACd,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,EACV,CAAE;AAEF,SACC,iCACC;AAAA,wBAAC,YAAS,cAA8B;AAAA,IACxC,oBAAC,YAAS,GAAG,YAAa,MAAK,UAC9B;AAAA,MAAC;AAAA;AAAA,QACA,SAAQ;AAAA,QACR,8BAA4B;AAAA,QAC5B,aAAc;AAAA;AAAA,UAEb,GAAI,cAAe;AAAA,UACnB,gBAAgB;AAAA,QACjB;AAAA,QACA,OAAQ;AAAA,QACR,UAAW;AAAA;AAAA,IACZ,GACD;AAAA,KACD;AAEF;AAEA,IAAO,eAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Controls from './controls';\n\nconst EMPTY_ARRAY = [];\n\nfunction Edit( {\n\tcontext,\n\tclientId,\n\t__unstableLayoutClassNames: layoutClassNames,\n} ) {\n\tconst tabsList = context[ 'core/tabs-list' ] || EMPTY_ARRAY;\n\tconst activeTabIndex = context[ 'core/tabs-activeTabIndex' ] ?? 0;\n\tconst editorActiveTabIndex = context[ 'core/tabs-editorActiveTabIndex' ];\n\n\tconst effectiveActiveIndex = useMemo( () => {\n\t\treturn editorActiveTabIndex ?? activeTabIndex;\n\t}, [ editorActiveTabIndex, activeTabIndex ] );\n\n\tconst { menuItemIndex, tabsClientId, selectedTabClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _tabsMenuClientId = getBlockRootClientId( clientId );\n\t\t\tconst _tabsClientId = _tabsMenuClientId\n\t\t\t\t? getBlockRootClientId( _tabsMenuClientId )\n\t\t\t\t: null;\n\n\t\t\tconst siblings = getBlockOrder( _tabsMenuClientId );\n\t\t\tconst _menuItemIndex = siblings.indexOf( clientId );\n\n\t\t\t// Find which tab panel block is currently selected.\n\t\t\tconst selectedIds = getSelectedBlockClientIds();\n\t\t\tlet _selectedTabClientId = null;\n\t\t\tfor ( const tab of tabsList ) {\n\t\t\t\tif (\n\t\t\t\t\tselectedIds.includes( tab.clientId ) ||\n\t\t\t\t\thasSelectedInnerBlock( tab.clientId, true )\n\t\t\t\t) {\n\t\t\t\t\t_selectedTabClientId = tab.clientId;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tmenuItemIndex: _menuItemIndex,\n\t\t\t\ttabsClientId: _tabsClientId,\n\t\t\t\tselectedTabClientId: _selectedTabClientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId, tabsList ]\n\t);\n\n\tconst tab = tabsList[ menuItemIndex ] || {};\n\n\t// tabListIndex is the tab's position in tabsList, used for active-state\n\t// checks and click handling.\n\tconst tabListIndex = tab.index ?? menuItemIndex;\n\n\tconst tabId = tab.id || `tab-${ menuItemIndex }`;\n\tconst tabClientId = tab.clientId || '';\n\tconst label = tab.label || '';\n\n\tconst isActive = tabListIndex === effectiveActiveIndex;\n\tconst isSelected = tabClientId === selectedTabClientId;\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, updateBlockAttributes } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst handleTabClick = useCallback(\n\t\t( event ) => {\n\t\t\tevent.preventDefault();\n\t\t\tif ( tabsClientId && tabListIndex !== effectiveActiveIndex ) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tupdateBlockAttributes( tabsClientId, {\n\t\t\t\t\teditorActiveTabIndex: tabListIndex,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\ttabsClientId,\n\t\t\ttabListIndex,\n\t\t\teffectiveActiveIndex,\n\t\t\tupdateBlockAttributes,\n\t\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\t]\n\t);\n\n\tconst handleLabelChange = useCallback(\n\t\t( newLabel ) => {\n\t\t\tif ( tabClientId ) {\n\t\t\t\tupdateBlockAttributes( tabClientId, { label: newLabel } );\n\t\t\t}\n\t\t},\n\t\t[ tabClientId, updateBlockAttributes ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( layoutClassNames, {\n\t\t\t'is-active': isActive,\n\t\t\t'is-selected': isSelected,\n\t\t} ),\n\t\t'aria-controls': tabId,\n\t\t'aria-selected': isActive,\n\t\tid: `${ tabId }--tab`,\n\t\trole: 'tab',\n\t\ttabIndex: -1,\n\t\tonClick: handleTabClick,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<Controls tabsClientId={ tabsClientId } />\n\t\t\t<button { ...blockProps } type=\"button\">\n\t\t\t\t<RichText\n\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tplaceholder={ __( 'Tab title' ) }\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ handleLabelChange }\n\t\t\t\t/>\n\t\t\t</button>\n\t\t</>\n\t);\n}\n\nexport default Edit;\n"],
5
+ "mappings": "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",
6
6
  "names": ["tab"]
7
7
  }
@@ -1,3 +1,4 @@
1
1
  .wp-block-post-author-biography {
2
2
  box-sizing: border-box;
3
+ white-space: pre-wrap;
3
4
  }
@@ -1,3 +1,4 @@
1
1
  .wp-block-post-author-biography {
2
2
  box-sizing: border-box;
3
+ white-space: pre-wrap;
3
4
  }
@@ -3632,6 +3632,7 @@ p.has-text-align-left[style*="writing-mode:vertical-lr"] {
3632
3632
 
3633
3633
  .wp-block-post-author-biography {
3634
3634
  box-sizing: border-box;
3635
+ white-space: pre-wrap;
3635
3636
  }
3636
3637
 
3637
3638
  :where(.wp-block-post-comments-form textarea),
@@ -4918,15 +4919,6 @@ ul.wp-block-rss.is-grid li {
4918
4919
  display: none;
4919
4920
  }
4920
4921
 
4921
- .wp-block-tabs-menu {
4922
- display: flex;
4923
- align-items: flex-end;
4924
- min-width: fit-content;
4925
- border-bottom-width: 1px;
4926
- border-bottom-style: solid;
4927
- border-bottom-color: #000;
4928
- }
4929
-
4930
4922
  .wp-block-tabs-menu-item {
4931
4923
  box-sizing: border-box;
4932
4924
  color: inherit;
@@ -4936,6 +4928,7 @@ ul.wp-block-rss.is-grid li {
4936
4928
  cursor: pointer;
4937
4929
  flex-basis: inherit !important;
4938
4930
  flex-grow: inherit !important;
4931
+ position: relative;
4939
4932
  border: none;
4940
4933
  background: none;
4941
4934
  appearance: none;
@@ -4950,12 +4943,14 @@ ul.wp-block-rss.is-grid li {
4950
4943
  text-transform: inherit;
4951
4944
  text-align: inherit;
4952
4945
  }
4953
- .wp-block-tabs-menu-item:focus-visible {
4954
- outline-offset: 2px;
4955
- }
4956
- .wp-block-tabs-menu-item[aria-selected=true], .wp-block-tabs-menu-item.is-active {
4957
- background-color: #000;
4958
- color: #fff;
4946
+ .wp-block-tabs-menu-item[aria-selected=true]::before, .wp-block-tabs-menu-item.is-active::before {
4947
+ content: "";
4948
+ position: absolute;
4949
+ border-bottom: 2px solid currentColor;
4950
+ pointer-events: none;
4951
+ right: 0;
4952
+ width: 100%;
4953
+ bottom: 0;
4959
4954
  }
4960
4955
 
4961
4956
  .wp-block-term-count {
@@ -3662,6 +3662,7 @@ p.has-text-align-left[style*="writing-mode:vertical-lr"] {
3662
3662
 
3663
3663
  .wp-block-post-author-biography {
3664
3664
  box-sizing: border-box;
3665
+ white-space: pre-wrap;
3665
3666
  }
3666
3667
 
3667
3668
  :where(.wp-block-post-comments-form textarea),
@@ -4951,15 +4952,6 @@ ul.wp-block-rss.is-grid li {
4951
4952
  display: none;
4952
4953
  }
4953
4954
 
4954
- .wp-block-tabs-menu {
4955
- display: flex;
4956
- align-items: flex-end;
4957
- min-width: fit-content;
4958
- border-bottom-width: 1px;
4959
- border-bottom-style: solid;
4960
- border-bottom-color: #000;
4961
- }
4962
-
4963
4955
  .wp-block-tabs-menu-item {
4964
4956
  box-sizing: border-box;
4965
4957
  color: inherit;
@@ -4969,6 +4961,7 @@ ul.wp-block-rss.is-grid li {
4969
4961
  cursor: pointer;
4970
4962
  flex-basis: inherit !important;
4971
4963
  flex-grow: inherit !important;
4964
+ position: relative;
4972
4965
  border: none;
4973
4966
  background: none;
4974
4967
  appearance: none;
@@ -4983,12 +4976,14 @@ ul.wp-block-rss.is-grid li {
4983
4976
  text-transform: inherit;
4984
4977
  text-align: inherit;
4985
4978
  }
4986
- .wp-block-tabs-menu-item:focus-visible {
4987
- outline-offset: 2px;
4988
- }
4989
- .wp-block-tabs-menu-item[aria-selected=true], .wp-block-tabs-menu-item.is-active {
4990
- background-color: #000;
4991
- color: #fff;
4979
+ .wp-block-tabs-menu-item[aria-selected=true]::before, .wp-block-tabs-menu-item.is-active::before {
4980
+ content: "";
4981
+ position: absolute;
4982
+ border-bottom: 2px solid currentColor;
4983
+ pointer-events: none;
4984
+ left: 0;
4985
+ width: 100%;
4986
+ bottom: 0;
4992
4987
  }
4993
4988
 
4994
4989
  .wp-block-term-count {
@@ -7,6 +7,7 @@
7
7
  cursor: pointer;
8
8
  flex-basis: inherit !important;
9
9
  flex-grow: inherit !important;
10
+ position: relative;
10
11
  border: none;
11
12
  background: none;
12
13
  appearance: none;
@@ -21,10 +22,12 @@
21
22
  text-transform: inherit;
22
23
  text-align: inherit;
23
24
  }
24
- .wp-block-tabs-menu-item:focus-visible {
25
- outline-offset: 2px;
26
- }
27
- .wp-block-tabs-menu-item[aria-selected=true], .wp-block-tabs-menu-item.is-active {
28
- background-color: #000;
29
- color: #fff;
25
+ .wp-block-tabs-menu-item[aria-selected=true]::before, .wp-block-tabs-menu-item.is-active::before {
26
+ content: "";
27
+ position: absolute;
28
+ border-bottom: 2px solid currentColor;
29
+ pointer-events: none;
30
+ right: 0;
31
+ width: 100%;
32
+ bottom: 0;
30
33
  }
@@ -7,6 +7,7 @@
7
7
  cursor: pointer;
8
8
  flex-basis: inherit !important;
9
9
  flex-grow: inherit !important;
10
+ position: relative;
10
11
  border: none;
11
12
  background: none;
12
13
  appearance: none;
@@ -21,10 +22,12 @@
21
22
  text-transform: inherit;
22
23
  text-align: inherit;
23
24
  }
24
- .wp-block-tabs-menu-item:focus-visible {
25
- outline-offset: 2px;
26
- }
27
- .wp-block-tabs-menu-item[aria-selected=true], .wp-block-tabs-menu-item.is-active {
28
- background-color: #000;
29
- color: #fff;
25
+ .wp-block-tabs-menu-item[aria-selected=true]::before, .wp-block-tabs-menu-item.is-active::before {
26
+ content: "";
27
+ position: absolute;
28
+ border-bottom: 2px solid currentColor;
29
+ pointer-events: none;
30
+ left: 0;
31
+ width: 100%;
32
+ bottom: 0;
30
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "9.43.1-next.v.202604091042.0+668146787",
3
+ "version": "9.44.0",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -95,42 +95,42 @@
95
95
  ],
96
96
  "dependencies": {
97
97
  "@arraypress/waveform-player": "1.2.1",
98
- "@wordpress/a11y": "^4.43.1-next.v.202604091042.0+668146787",
99
- "@wordpress/api-fetch": "^7.43.1-next.v.202604091042.0+668146787",
100
- "@wordpress/autop": "^4.43.1-next.v.202604091042.0+668146787",
101
- "@wordpress/base-styles": "^6.19.1-next.v.202604091042.0+668146787",
102
- "@wordpress/blob": "^4.43.1-next.v.202604091042.0+668146787",
103
- "@wordpress/block-editor": "^15.16.1-next.v.202604091042.0+668146787",
104
- "@wordpress/blocks": "^15.16.1-next.v.202604091042.0+668146787",
105
- "@wordpress/components": "^32.5.2-next.v.202604091042.0+668146787",
106
- "@wordpress/compose": "^7.43.1-next.v.202604091042.0+668146787",
107
- "@wordpress/core-data": "^7.43.2-next.v.202604091042.0+668146787",
108
- "@wordpress/data": "^10.43.1-next.v.202604091042.0+668146787",
109
- "@wordpress/date": "^5.43.1-next.v.202604091042.0+668146787",
110
- "@wordpress/deprecated": "^4.43.1-next.v.202604091042.0+668146787",
111
- "@wordpress/dom": "^4.43.1-next.v.202604091042.0+668146787",
112
- "@wordpress/element": "^6.44.1-next.v.202604091042.0+668146787",
113
- "@wordpress/escape-html": "^3.43.1-next.v.202604091042.0+668146787",
114
- "@wordpress/hooks": "^4.43.1-next.v.202604091042.0+668146787",
115
- "@wordpress/html-entities": "^4.43.1-next.v.202604091042.0+668146787",
116
- "@wordpress/i18n": "^6.17.1-next.v.202604091042.0+668146787",
117
- "@wordpress/icons": "^12.1.1-next.v.202604091042.0+668146787",
118
- "@wordpress/interactivity": "^6.43.1-next.v.202604091042.0+668146787",
119
- "@wordpress/interactivity-router": "^2.43.1-next.v.202604091042.0+668146787",
120
- "@wordpress/keyboard-shortcuts": "^5.43.1-next.v.202604091042.0+668146787",
121
- "@wordpress/keycodes": "^4.43.1-next.v.202604091042.0+668146787",
122
- "@wordpress/latex-to-mathml": "^1.11.1-next.v.202604091042.0+668146787",
123
- "@wordpress/notices": "^5.43.1-next.v.202604091042.0+668146787",
124
- "@wordpress/patterns": "^2.43.1-next.v.202604091042.0+668146787",
125
- "@wordpress/primitives": "^4.43.1-next.v.202604091042.0+668146787",
126
- "@wordpress/private-apis": "^1.43.1-next.v.202604091042.0+668146787",
127
- "@wordpress/reusable-blocks": "^5.43.1-next.v.202604091042.0+668146787",
128
- "@wordpress/rich-text": "^7.43.1-next.v.202604091042.0+668146787",
129
- "@wordpress/server-side-render": "^6.19.1-next.v.202604091042.0+668146787",
130
- "@wordpress/upload-media": "^0.28.1-next.v.202604091042.0+668146787",
131
- "@wordpress/url": "^4.43.1-next.v.202604091042.0+668146787",
132
- "@wordpress/viewport": "^6.43.1-next.v.202604091042.0+668146787",
133
- "@wordpress/wordcount": "^4.43.1-next.v.202604091042.0+668146787",
98
+ "@wordpress/a11y": "^4.44.0",
99
+ "@wordpress/api-fetch": "^7.44.0",
100
+ "@wordpress/autop": "^4.44.0",
101
+ "@wordpress/base-styles": "^6.20.0",
102
+ "@wordpress/blob": "^4.44.0",
103
+ "@wordpress/block-editor": "^15.17.0",
104
+ "@wordpress/blocks": "^15.17.0",
105
+ "@wordpress/components": "^32.6.0",
106
+ "@wordpress/compose": "^7.44.0",
107
+ "@wordpress/core-data": "^7.44.0",
108
+ "@wordpress/data": "^10.44.0",
109
+ "@wordpress/date": "^5.44.0",
110
+ "@wordpress/deprecated": "^4.44.0",
111
+ "@wordpress/dom": "^4.44.0",
112
+ "@wordpress/element": "^6.44.0",
113
+ "@wordpress/escape-html": "^3.44.0",
114
+ "@wordpress/hooks": "^4.44.0",
115
+ "@wordpress/html-entities": "^4.44.0",
116
+ "@wordpress/i18n": "^6.17.0",
117
+ "@wordpress/icons": "^12.2.0",
118
+ "@wordpress/interactivity": "^6.44.0",
119
+ "@wordpress/interactivity-router": "^2.44.0",
120
+ "@wordpress/keyboard-shortcuts": "^5.44.0",
121
+ "@wordpress/keycodes": "^4.44.0",
122
+ "@wordpress/latex-to-mathml": "^1.12.0",
123
+ "@wordpress/notices": "^5.44.0",
124
+ "@wordpress/patterns": "^2.44.0",
125
+ "@wordpress/primitives": "^4.44.0",
126
+ "@wordpress/private-apis": "^1.44.0",
127
+ "@wordpress/reusable-blocks": "^5.44.0",
128
+ "@wordpress/rich-text": "^7.44.0",
129
+ "@wordpress/server-side-render": "^6.20.0",
130
+ "@wordpress/upload-media": "^0.29.0",
131
+ "@wordpress/url": "^4.44.0",
132
+ "@wordpress/viewport": "^6.44.0",
133
+ "@wordpress/wordcount": "^4.44.0",
134
134
  "change-case": "^4.1.2",
135
135
  "clsx": "^2.1.1",
136
136
  "colord": "^2.7.0",
@@ -151,5 +151,5 @@
151
151
  "publishConfig": {
152
152
  "access": "public"
153
153
  },
154
- "gitHead": "73606df74f1c38a084bfa5db97205259ef817593"
154
+ "gitHead": "b862d8c84121a47bbeff882f6c87e61681ce2e0d"
155
155
  }
@@ -191,7 +191,14 @@ function CoverEdit( {
191
191
  } );
192
192
  } )();
193
193
  // Update the block only when the featured image changes.
194
- }, [ mediaUrl ] );
194
+ // The other dependencies are stable references (dispatch actions / setters).
195
+ }, [
196
+ mediaUrl,
197
+ __unstableMarkNextChangeAsNotPersistent,
198
+ setAttributes,
199
+ setOverlayColor,
200
+ useFeaturedImage,
201
+ ] );
195
202
 
196
203
  // instead of destructuring the attributes
197
204
  // we define the url and background type
@@ -703,6 +710,7 @@ function CoverEdit( {
703
710
  style={ mediaStyle }
704
711
  >
705
712
  <SandBox
713
+ allowSameOrigin
706
714
  html={ embedHtml }
707
715
  title="Background video"
708
716
  styles={ [
@@ -1,8 +1,3 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { getPhotoHtml } from './util';
5
-
6
1
  /**
7
2
  * External dependencies
8
3
  */
@@ -17,6 +12,11 @@ import { BlockIcon } from '@wordpress/block-editor';
17
12
  import { useState } from '@wordpress/element';
18
13
  import { getAuthority } from '@wordpress/url';
19
14
 
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import { getPhotoHtml } from './util';
19
+
20
20
  /**
21
21
  * Internal dependencies
22
22
  */
@@ -75,6 +75,7 @@ export default function EmbedPreview( {
75
75
  ) : (
76
76
  <div className="wp-block-embed__wrapper">
77
77
  <SandBox
78
+ allowSameOrigin
78
79
  html={ html }
79
80
  scripts={ scripts }
80
81
  title={ iframeTitle }
@@ -313,7 +313,7 @@ export default function Image( {
313
313
  const setRefs = useMergeRefs( [ setImageElement, setResizeObserved ] );
314
314
  const { allowResize = true } = context;
315
315
 
316
- const { image, canUserEdit } = useSelect(
316
+ const { image, canUserEdit, attachmentResolutionError } = useSelect(
317
317
  ( select ) => {
318
318
  const imageRecord =
319
319
  id && isSingleSelected
@@ -325,6 +325,23 @@ export default function Image( {
325
325
  )
326
326
  : null;
327
327
 
328
+ // Check if the attachment resolution failed with a specific error.
329
+ // We use getResolutionError instead of hasFinishedResolution so we
330
+ // can distinguish 404 (attachment doesn't exist) from transient
331
+ // errors (500, 403, network) that shouldn't clear the id.
332
+ const resolutionError =
333
+ id && isSingleSelected
334
+ ? select( coreStore ).getResolutionError(
335
+ 'getEntityRecord',
336
+ [
337
+ 'postType',
338
+ 'attachment',
339
+ id,
340
+ { context: 'view' },
341
+ ]
342
+ )
343
+ : null;
344
+
328
345
  // Check edit permissions when the media editor experiment is enabled.
329
346
  // Only check when imageRecord is available to avoid unnecessary API requests.
330
347
  let canEdit = false;
@@ -339,11 +356,33 @@ export default function Image( {
339
356
  return {
340
357
  image: imageRecord,
341
358
  canUserEdit: canEdit,
359
+ attachmentResolutionError: resolutionError,
342
360
  };
343
361
  },
344
362
  [ id, isSingleSelected ]
345
363
  );
346
364
 
365
+ // If the image has an id but the attachment doesn't exist on this site,
366
+ // clear the id so Gutenberg treats the image as external.
367
+ // This handles content copied between WordPress sites.
368
+ //
369
+ // Known limitation: if a different attachment with the same id happens to
370
+ // exist on the destination site, the lookup will succeed and the wrong
371
+ // local image will be used. URL matching could address this in a follow-up.
372
+ // See: https://github.com/WordPress/gutenberg/issues/74156
373
+ useEffect( () => {
374
+ if ( ! id || ! isSingleSelected ) {
375
+ return;
376
+ }
377
+ // Only clear for confirmed 404s. apiFetch throws the Response object
378
+ // for HTTP errors, so checking .status === 404 avoids incorrectly
379
+ // clearing the id on 403, 500, or network failures, which would
380
+ // cause data loss for valid local attachments.
381
+ if ( attachmentResolutionError?.status === 404 ) {
382
+ setAttributes( { id: undefined } );
383
+ }
384
+ }, [ id, isSingleSelected, attachmentResolutionError, setAttributes ] );
385
+
347
386
  const {
348
387
  canInsertCover,
349
388
  imageEditing,
@@ -535,6 +574,7 @@ export default function Image( {
535
574
  if ( ! mediaUpload ) {
536
575
  return;
537
576
  }
577
+ let notified = false;
538
578
  mediaUpload( {
539
579
  filesList: [ externalBlob ],
540
580
  onFileChange( [ img ] ) {
@@ -544,10 +584,15 @@ export default function Image( {
544
584
  return;
545
585
  }
546
586
 
547
- setExternalBlob();
548
- createSuccessNotice( __( 'Image uploaded.' ), {
549
- type: 'snackbar',
550
- } );
587
+ // With client-side media processing, onFileChange fires
588
+ // for each generated sub-size. Only show the notice once.
589
+ if ( ! notified ) {
590
+ notified = true;
591
+ setExternalBlob();
592
+ createSuccessNotice( __( 'Image uploaded.' ), {
593
+ type: 'snackbar',
594
+ } );
595
+ }
551
596
  },
552
597
  allowedTypes: ALLOWED_MEDIA_TYPES,
553
598
  onError( message ) {
@@ -124,13 +124,24 @@ function UnforwardedLinkUI( props, ref ) {
124
124
  url,
125
125
  opensInNewTab,
126
126
  title: label && stripHTML( label ),
127
+ entityTitle: entityRecord?.title?.rendered || entityRecord?.name,
127
128
  kind,
128
129
  type,
129
130
  id,
130
131
  image,
131
132
  badges,
132
133
  } ),
133
- [ label, opensInNewTab, url, kind, type, id, image, badges ]
134
+ [
135
+ label,
136
+ opensInNewTab,
137
+ url,
138
+ kind,
139
+ type,
140
+ id,
141
+ image,
142
+ badges,
143
+ entityRecord,
144
+ ]
134
145
  );
135
146
 
136
147
  const handlePageCreated = ( pageLink ) => {
@@ -90,12 +90,12 @@ export function useOnEnter( props ) {
90
90
  }
91
91
 
92
92
  const defaultBlockName = getDefaultBlockName();
93
+ const wrapperBlockName = getBlockName( wrapperClientId );
94
+ const grandparentClientId = getBlockRootClientId( wrapperClientId );
93
95
 
94
96
  if (
95
- ! canInsertBlockType(
96
- defaultBlockName,
97
- getBlockRootClientId( wrapperClientId )
98
- )
97
+ ! canInsertBlockType( defaultBlockName, grandparentClientId ) ||
98
+ ! canInsertBlockType( wrapperBlockName, grandparentClientId )
99
99
  ) {
100
100
  return;
101
101
  }
@@ -119,7 +119,7 @@ export function useOnEnter( props ) {
119
119
  insertBlock(
120
120
  createBlock( defaultBlockName ),
121
121
  blockIndex + 1,
122
- getBlockRootClientId( wrapperClientId ),
122
+ grandparentClientId,
123
123
  true
124
124
  );
125
125
  } );
@@ -1,4 +1,5 @@
1
1
  .wp-block-post-author-biography {
2
2
  // This block has customizable padding, border-box makes that more predictable.
3
3
  box-sizing: border-box;
4
+ white-space: pre-wrap;
4
5
  }
@@ -88,5 +88,9 @@
88
88
  "html": false
89
89
  },
90
90
  "editorStyle": "wp-block-search-editor",
91
- "style": "wp-block-search"
91
+ "style": "wp-block-search",
92
+ "selectors": {
93
+ "color": ".wp-block-search .wp-block-search__button, .wp-block-search.wp-block-search__no-button .wp-block-search__input",
94
+ "border": ".wp-block-search.wp-block-search__button-outside .wp-block-search__input, .wp-block-search.wp-block-search__button-outside .wp-block-search__button, .wp-block-search.wp-block-search__no-button .wp-block-search__input, .wp-block-search.wp-block-search__button-only .wp-block-search__input, .wp-block-search.wp-block-search__button-only .wp-block-search__button, .wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper"
95
+ }
92
96
  }
@@ -204,10 +204,12 @@ export default function SearchEdit( {
204
204
  // If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.
205
205
  const textFieldClasses = clsx(
206
206
  'wp-block-search__input',
207
+ hasNoButton ? colorProps.className : undefined,
207
208
  isButtonPositionInside ? undefined : borderProps.className,
208
209
  typographyProps.className
209
210
  );
210
211
  const textFieldStyles = {
212
+ ...( hasNoButton ? colorProps.style : {} ),
211
213
  ...( isButtonPositionInside
212
214
  ? {
213
215
  borderRadius: borderProps.style?.borderRadius,
@@ -69,6 +69,9 @@ function render_block_core_search( $attributes ) {
69
69
  if ( ! empty( $typography_classes ) ) {
70
70
  $input_classes[] = $typography_classes;
71
71
  }
72
+ if ( ! $show_button && ! empty( $color_classes ) ) {
73
+ $input_classes[] = $color_classes;
74
+ }
72
75
  if ( $input->next_tag() ) {
73
76
  $input->add_class( implode( ' ', $input_classes ) );
74
77
  $input->set_attribute( 'id', $input_id );
@@ -430,20 +433,37 @@ function styles_for_block_core_search( $attributes ) {
430
433
  }
431
434
  }
432
435
 
436
+ $use_input_for_colors = ! empty( $attributes['buttonPosition'] ) && 'no-button' === $attributes['buttonPosition'];
437
+
433
438
  // Add color styles.
434
439
  $has_text_color = ! empty( $attributes['style']['color']['text'] );
435
440
  if ( $has_text_color ) {
436
- $button_styles[] = sprintf( 'color: %s;', $attributes['style']['color']['text'] );
441
+ $text_color_style = sprintf( 'color: %s;', $attributes['style']['color']['text'] );
442
+ if ( $use_input_for_colors ) {
443
+ $input_styles[] = $text_color_style;
444
+ } else {
445
+ $button_styles[] = $text_color_style;
446
+ }
437
447
  }
438
448
 
439
449
  $has_background_color = ! empty( $attributes['style']['color']['background'] );
440
450
  if ( $has_background_color ) {
441
- $button_styles[] = sprintf( 'background-color: %s;', $attributes['style']['color']['background'] );
451
+ $background_color_style = sprintf( 'background-color: %s;', $attributes['style']['color']['background'] );
452
+ if ( $use_input_for_colors ) {
453
+ $input_styles[] = $background_color_style;
454
+ } else {
455
+ $button_styles[] = $background_color_style;
456
+ }
442
457
  }
443
458
 
444
459
  $has_custom_gradient = ! empty( $attributes['style']['color']['gradient'] );
445
460
  if ( $has_custom_gradient ) {
446
- $button_styles[] = sprintf( 'background: %s;', $attributes['style']['color']['gradient'] );
461
+ $custom_gradient_style = sprintf( 'background: %s;', $attributes['style']['color']['gradient'] );
462
+ if ( $use_input_for_colors ) {
463
+ $input_styles[] = $custom_gradient_style;
464
+ } else {
465
+ $button_styles[] = $custom_gradient_style;
466
+ }
447
467
  }
448
468
 
449
469
  // Get typography styles to be shared across inner elements.