@wordpress/block-editor 12.3.6 → 12.3.7

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 (56) hide show
  1. package/build/components/block-draggable/index.js +6 -3
  2. package/build/components/block-draggable/index.js.map +1 -1
  3. package/build/components/inserter/reusable-block-rename-hint.js +1 -1
  4. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -1
  5. package/build/components/link-control/constants.js +1 -1
  6. package/build/components/link-control/constants.js.map +1 -1
  7. package/build/components/link-control/search-create-button.js +5 -21
  8. package/build/components/link-control/search-create-button.js.map +1 -1
  9. package/build/components/link-control/search-item.js +13 -30
  10. package/build/components/link-control/search-item.js.map +1 -1
  11. package/build/components/link-control/search-results.js +2 -2
  12. package/build/components/link-control/search-results.js.map +1 -1
  13. package/build/components/use-block-display-information/index.js +7 -3
  14. package/build/components/use-block-display-information/index.js.map +1 -1
  15. package/build/hooks/margin.js +1 -1
  16. package/build/hooks/margin.js.map +1 -1
  17. package/build/hooks/padding.js +1 -1
  18. package/build/hooks/padding.js.map +1 -1
  19. package/build/store/selectors.js +1 -1
  20. package/build/store/selectors.js.map +1 -1
  21. package/build-module/components/block-draggable/index.js +6 -3
  22. package/build-module/components/block-draggable/index.js.map +1 -1
  23. package/build-module/components/inserter/reusable-block-rename-hint.js +1 -1
  24. package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -1
  25. package/build-module/components/link-control/constants.js +1 -1
  26. package/build-module/components/link-control/constants.js.map +1 -1
  27. package/build-module/components/link-control/search-create-button.js +7 -20
  28. package/build-module/components/link-control/search-create-button.js.map +1 -1
  29. package/build-module/components/link-control/search-item.js +14 -28
  30. package/build-module/components/link-control/search-item.js.map +1 -1
  31. package/build-module/components/link-control/search-results.js +3 -3
  32. package/build-module/components/link-control/search-results.js.map +1 -1
  33. package/build-module/components/use-block-display-information/index.js +7 -3
  34. package/build-module/components/use-block-display-information/index.js.map +1 -1
  35. package/build-module/hooks/margin.js +1 -1
  36. package/build-module/hooks/margin.js.map +1 -1
  37. package/build-module/hooks/padding.js +1 -1
  38. package/build-module/hooks/padding.js.map +1 -1
  39. package/build-module/store/selectors.js +1 -1
  40. package/build-module/store/selectors.js.map +1 -1
  41. package/build-style/style-rtl.css +20 -83
  42. package/build-style/style.css +20 -83
  43. package/package.json +4 -4
  44. package/src/components/block-draggable/index.js +13 -4
  45. package/src/components/inserter/reusable-block-rename-hint.js +1 -1
  46. package/src/components/link-control/constants.js +1 -1
  47. package/src/components/link-control/search-create-button.js +8 -26
  48. package/src/components/link-control/search-item.js +21 -43
  49. package/src/components/link-control/search-results.js +48 -46
  50. package/src/components/link-control/style.scss +25 -95
  51. package/src/components/link-control/test/index.js +6 -7
  52. package/src/components/use-block-display-information/index.js +12 -5
  53. package/src/hooks/margin.js +4 -1
  54. package/src/hooks/padding.js +4 -1
  55. package/src/store/selectors.js +1 -1
  56. package/src/store/test/selectors.js +1 -1
@@ -30,17 +30,20 @@ const BlockDraggable = ({
30
30
  const {
31
31
  canMoveBlocks,
32
32
  getBlockRootClientId,
33
- getBlockName
33
+ getBlockName,
34
+ getBlockAttributes
34
35
  } = select(blockEditorStore);
35
36
  const {
36
- getBlockType
37
+ getBlockType,
38
+ getActiveBlockVariation
37
39
  } = select(blocksStore);
38
40
  const rootClientId = getBlockRootClientId(clientIds[0]);
39
41
  const blockName = getBlockName(clientIds[0]);
42
+ const variation = getActiveBlockVariation(blockName, getBlockAttributes(clientIds[0]));
40
43
  return {
41
44
  srcRootClientId: rootClientId,
42
45
  isDraggable: canMoveBlocks(clientIds, rootClientId),
43
- icon: getBlockType(blockName)?.icon
46
+ icon: variation?.icon || getBlockType(blockName)?.icon
44
47
  };
45
48
  }, [clientIds]);
46
49
  const isDragging = useRef(false);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/block-draggable/index.js"],"names":["store","blocksStore","Draggable","useSelect","useDispatch","useEffect","useRef","BlockDraggableChip","useScrollWhenDragging","blockEditorStore","BlockDraggable","children","clientIds","cloneClassname","onDragStart","onDragEnd","srcRootClientId","isDraggable","icon","select","canMoveBlocks","getBlockRootClientId","getBlockName","getBlockType","rootClientId","blockName","isDragging","startScrolling","scrollOnDragOver","stopScrolling","startDraggingBlocks","stopDraggingBlocks","current","draggable","transferData","type","srcClientIds","event","window","requestAnimationFrame","length","onDraggableStart","onDraggableEnd"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,QAA0B,uBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,kBAA/B;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,SAASR,KAAK,IAAIS,gBAAlB,QAA0C,aAA1C;;AAEA,MAAMC,cAAc,GAAG,CAAE;AACxBC,EAAAA,QADwB;AAExBC,EAAAA,SAFwB;AAGxBC,EAAAA,cAHwB;AAIxBC,EAAAA,WAJwB;AAKxBC,EAAAA;AALwB,CAAF,KAMhB;AACN,QAAM;AAAEC,IAAAA,eAAF;AAAmBC,IAAAA,WAAnB;AAAgCC,IAAAA;AAAhC,MAAyCf,SAAS,CACrDgB,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA,oBAAjB;AAAuCC,MAAAA;AAAvC,QACLH,MAAM,CAAEV,gBAAF,CADP;AAEA,UAAM;AAAEc,MAAAA;AAAF,QAAmBJ,MAAM,CAAElB,WAAF,CAA/B;AACA,UAAMuB,YAAY,GAAGH,oBAAoB,CAAET,SAAS,CAAE,CAAF,CAAX,CAAzC;AACA,UAAMa,SAAS,GAAGH,YAAY,CAAEV,SAAS,CAAE,CAAF,CAAX,CAA9B;AAEA,WAAO;AACNI,MAAAA,eAAe,EAAEQ,YADX;AAENP,MAAAA,WAAW,EAAEG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AGc,gBAlBd;AAmBC,IAAA,SAAS,EAAG,MAAM;AACjBG,MAAAA,kBAAkB;AAClBL,MAAAA,UAAU,CAACM,OAAX,GAAqB,KAArB;AAEAH,MAAAA,aAAa;;AAEb,UAAKd,SAAL,EAAiB;AAChBA,QAAAA,SAAS;AACT;AACD,KA5BF;AA6BC,IAAA,2BAA2B,EAC1B,cAAC,kBAAD;AAAoB,MAAA,KAAK,EAAGH,SAAS,CAAC4B,MAAtC;AAA+C,MAAA,IAAI,EAAGtB;AAAtD;AA9BF,KAiCG,CAAE;AAAEuB,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,GAAF,KAA4C;AAC7C,WAAO/B,QAAQ,CAAE;AAChBsB,MAAAA,SAAS,EAAE,IADK;AAEhBnB,MAAAA,WAAW,EAAE2B,gBAFG;AAGhB1B,MAAAA,SAAS,EAAE2B;AAHK,KAAF,CAAf;AAKA,GAvCF,CADD;AA2CA,CA5FD;;AA8FA,eAAehC,cAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { Draggable } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockDraggableChip from './draggable-chip';\nimport useScrollWhenDragging from './use-scroll-when-dragging';\nimport { store as blockEditorStore } from '../../store';\n\nconst BlockDraggable = ( {\n\tchildren,\n\tclientIds,\n\tcloneClassname,\n\tonDragStart,\n\tonDragEnd,\n} ) => {\n\tconst { srcRootClientId, isDraggable, icon } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canMoveBlocks, getBlockRootClientId, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getBlockType } = select( blocksStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\tconst blockName = getBlockName( clientIds[ 0 ] );\n\n\t\t\treturn {\n\t\t\t\tsrcRootClientId: rootClientId,\n\t\t\t\tisDraggable: canMoveBlocks( clientIds, rootClientId ),\n\t\t\t\ticon: getBlockType( blockName )?.icon,\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\tconst isDragging = useRef( false );\n\tconst [ startScrolling, scrollOnDragOver, stopScrolling ] =\n\t\tuseScrollWhenDragging();\n\n\tconst { startDraggingBlocks, stopDraggingBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\t// Stop dragging blocks if the block draggable is unmounted.\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif ( isDragging.current ) {\n\t\t\t\tstopDraggingBlocks();\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\tif ( ! isDraggable ) {\n\t\treturn children( { draggable: false } );\n\t}\n\n\tconst transferData = {\n\t\ttype: 'block',\n\t\tsrcClientIds: clientIds,\n\t\tsrcRootClientId,\n\t};\n\n\treturn (\n\t\t<Draggable\n\t\t\tcloneClassname={ cloneClassname }\n\t\t\t__experimentalTransferDataType=\"wp-blocks\"\n\t\t\ttransferData={ transferData }\n\t\t\tonDragStart={ ( event ) => {\n\t\t\t\t// Defer hiding the dragged source element to the next\n\t\t\t\t// frame to enable dragging.\n\t\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\t\tstartDraggingBlocks( clientIds );\n\t\t\t\t\tisDragging.current = true;\n\n\t\t\t\t\tstartScrolling( event );\n\n\t\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\t\tonDragStart();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonDragOver={ scrollOnDragOver }\n\t\t\tonDragEnd={ () => {\n\t\t\t\tstopDraggingBlocks();\n\t\t\t\tisDragging.current = false;\n\n\t\t\t\tstopScrolling();\n\n\t\t\t\tif ( onDragEnd ) {\n\t\t\t\t\tonDragEnd();\n\t\t\t\t}\n\t\t\t} }\n\t\t\t__experimentalDragComponent={\n\t\t\t\t<BlockDraggableChip count={ clientIds.length } icon={ icon } />\n\t\t\t}\n\t\t>\n\t\t\t{ ( { onDraggableStart, onDraggableEnd } ) => {\n\t\t\t\treturn children( {\n\t\t\t\t\tdraggable: true,\n\t\t\t\t\tonDragStart: onDraggableStart,\n\t\t\t\t\tonDragEnd: onDraggableEnd,\n\t\t\t\t} );\n\t\t\t} }\n\t\t</Draggable>\n\t);\n};\n\nexport default BlockDraggable;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/block-draggable/index.js"],"names":["store","blocksStore","Draggable","useSelect","useDispatch","useEffect","useRef","BlockDraggableChip","useScrollWhenDragging","blockEditorStore","BlockDraggable","children","clientIds","cloneClassname","onDragStart","onDragEnd","srcRootClientId","isDraggable","icon","select","canMoveBlocks","getBlockRootClientId","getBlockName","getBlockAttributes","getBlockType","getActiveBlockVariation","rootClientId","blockName","variation","isDragging","startScrolling","scrollOnDragOver","stopScrolling","startDraggingBlocks","stopDraggingBlocks","current","draggable","transferData","type","srcClientIds","event","window","requestAnimationFrame","length","onDraggableStart","onDraggableEnd"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,QAA0B,uBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,kBAA/B;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,SAASR,KAAK,IAAIS,gBAAlB,QAA0C,aAA1C;;AAEA,MAAMC,cAAc,GAAG,CAAE;AACxBC,EAAAA,QADwB;AAExBC,EAAAA,SAFwB;AAGxBC,EAAAA,cAHwB;AAIxBC,EAAAA,WAJwB;AAKxBC,EAAAA;AALwB,CAAF,KAMhB;AACN,QAAM;AAAEC,IAAAA,eAAF;AAAmBC,IAAAA,WAAnB;AAAgCC,IAAAA;AAAhC,MAAyCf,SAAS,CACrDgB,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,aADK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;AACpBC,IAAAA,IAAI,EAAE,OADc;AAEpBC,IAAAA,YAAY,EAAE3B,SAFM;AAGpBI,IAAAA;AAHoB,GAArB;AAMA,SACC,cAAC,SAAD;AACC,IAAA,cAAc,EAAGH,cADlB;AAEC,IAAA,8BAA8B,EAAC,WAFhC;AAGC,IAAA,YAAY,EAAGwB,YAHhB;AAIC,IAAA,WAAW,EAAKG,KAAF,IAAa;AAC1B;AACA;AACAC,MAAAA,MAAM,CAACC,qBAAP,CAA8B,MAAM;AACnCT,QAAAA,mBAAmB,CAAErB,SAAF,CAAnB;AACAiB,QAAAA,UAAU,CAACM,OAAX,GAAqB,IAArB;AAEAL,QAAAA,cAAc,CAAEU,KAAF,CAAd;;AAEA,YAAK1B,WAAL,EAAmB;AAClBA,UAAAA,WAAW;AACX;AACD,OATD;AAUA,KAjBF;AAkBC,IAAA,UAAU,EAAGiB,gBAlBd;AAmBC,IAAA,SAAS,EAAG,MAAM;AACjBG,MAAAA,kBAAkB;AAClBL,MAAAA,UAAU,CAACM,OAAX,GAAqB,KAArB;AAEAH,MAAAA,aAAa;;AAEb,UAAKjB,SAAL,EAAiB;AAChBA,QAAAA,SAAS;AACT;AACD,KA5BF;AA6BC,IAAA,2BAA2B,EAC1B,cAAC,kBAAD;AAAoB,MAAA,KAAK,EAAGH,SAAS,CAAC+B,MAAtC;AAA+C,MAAA,IAAI,EAAGzB;AAAtD;AA9BF,KAiCG,CAAE;AAAE0B,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,GAAF,KAA4C;AAC7C,WAAOlC,QAAQ,CAAE;AAChByB,MAAAA,SAAS,EAAE,IADK;AAEhBtB,MAAAA,WAAW,EAAE8B,gBAFG;AAGhB7B,MAAAA,SAAS,EAAE8B;AAHK,KAAF,CAAf;AAKA,GAvCF,CADD;AA2CA,CArGD;;AAuGA,eAAenC,cAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { Draggable } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockDraggableChip from './draggable-chip';\nimport useScrollWhenDragging from './use-scroll-when-dragging';\nimport { store as blockEditorStore } from '../../store';\n\nconst BlockDraggable = ( {\n\tchildren,\n\tclientIds,\n\tcloneClassname,\n\tonDragStart,\n\tonDragEnd,\n} ) => {\n\tconst { srcRootClientId, isDraggable, icon } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanMoveBlocks,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockAttributes,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\tconst blockName = getBlockName( clientIds[ 0 ] );\n\t\t\tconst variation = getActiveBlockVariation(\n\t\t\t\tblockName,\n\t\t\t\tgetBlockAttributes( clientIds[ 0 ] )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tsrcRootClientId: rootClientId,\n\t\t\t\tisDraggable: canMoveBlocks( clientIds, rootClientId ),\n\t\t\t\ticon: variation?.icon || getBlockType( blockName )?.icon,\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\tconst isDragging = useRef( false );\n\tconst [ startScrolling, scrollOnDragOver, stopScrolling ] =\n\t\tuseScrollWhenDragging();\n\n\tconst { startDraggingBlocks, stopDraggingBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\t// Stop dragging blocks if the block draggable is unmounted.\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif ( isDragging.current ) {\n\t\t\t\tstopDraggingBlocks();\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\tif ( ! isDraggable ) {\n\t\treturn children( { draggable: false } );\n\t}\n\n\tconst transferData = {\n\t\ttype: 'block',\n\t\tsrcClientIds: clientIds,\n\t\tsrcRootClientId,\n\t};\n\n\treturn (\n\t\t<Draggable\n\t\t\tcloneClassname={ cloneClassname }\n\t\t\t__experimentalTransferDataType=\"wp-blocks\"\n\t\t\ttransferData={ transferData }\n\t\t\tonDragStart={ ( event ) => {\n\t\t\t\t// Defer hiding the dragged source element to the next\n\t\t\t\t// frame to enable dragging.\n\t\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\t\tstartDraggingBlocks( clientIds );\n\t\t\t\t\tisDragging.current = true;\n\n\t\t\t\t\tstartScrolling( event );\n\n\t\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\t\tonDragStart();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonDragOver={ scrollOnDragOver }\n\t\t\tonDragEnd={ () => {\n\t\t\t\tstopDraggingBlocks();\n\t\t\t\tisDragging.current = false;\n\n\t\t\t\tstopScrolling();\n\n\t\t\t\tif ( onDragEnd ) {\n\t\t\t\t\tonDragEnd();\n\t\t\t\t}\n\t\t\t} }\n\t\t\t__experimentalDragComponent={\n\t\t\t\t<BlockDraggableChip count={ clientIds.length } icon={ icon } />\n\t\t\t}\n\t\t>\n\t\t\t{ ( { onDraggableStart, onDraggableEnd } ) => {\n\t\t\t\treturn children( {\n\t\t\t\t\tdraggable: true,\n\t\t\t\t\tonDragStart: onDraggableStart,\n\t\t\t\t\tonDragEnd: onDraggableEnd,\n\t\t\t\t} );\n\t\t\t} }\n\t\t</Draggable>\n\t);\n};\n\nexport default BlockDraggable;\n"]}
@@ -31,7 +31,7 @@ export default function ReusableBlocksRenameHint() {
31
31
  className: "reusable-blocks-menu-items__rename-hint"
32
32
  }, createElement("div", {
33
33
  className: "reusable-blocks-menu-items__rename-hint-content"
34
- }, __('Reusable blocks are now called patterns. A synced pattern will behave in exactly the same way as a reusable block.')), createElement(Button, {
34
+ }, __('Reusable blocks are now synced patterns. A synced pattern will behave in exactly the same way as a reusable block.')), createElement(Button, {
35
35
  className: "reusable-blocks-menu-items__rename-hint-dismiss",
36
36
  icon: close,
37
37
  iconSize: "16",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/reusable-block-rename-hint.js"],"names":["Button","useDispatch","useSelect","focus","useRef","__","close","store","preferencesStore","PREFERENCE_NAME","ReusableBlocksRenameHint","isReusableBlocksRenameHint","select","get","ref","set","setPreference","previousElement","tabbable","findPrevious","current"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,kBAAtB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA,MAAMC,eAAe,GAAG,oCAAxB;AAEA,eAAe,SAASC,wBAAT,GAAoC;AAClD,QAAMC,0BAA0B,GAAGT,SAAS,CACzCU,MAAF;AAAA;;AAAA,0BACCA,MAAM,CAAEJ,gBAAF,CAAN,CAA2BK,GAA3B,CAAgC,MAAhC,EAAwCJ,eAAxC,CADD,qDAC8D,IAD9D;AAAA,GAD2C,EAG3C,EAH2C,CAA5C;AAMA,QAAMK,GAAG,GAAGV,MAAM,EAAlB;AAEA,QAAM;AAAEW,IAAAA,GAAG,EAAEC;AAAP,MAAyBf,WAAW,CAAEO,gBAAF,CAA1C;;AACA,MAAK,CAAEG,0BAAP,EAAoC;AACnC,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,GAAG,EAAGG,GAAX;AAAiB,IAAA,SAAS,EAAC;AAA3B,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGT,EAAE,CACH,oHADG,CADL,CADD,EAMC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,iDADX;AAEC,IAAA,IAAI,EAAGC,KAFR;AAGC,IAAA,QAAQ,EAAC,IAHV;AAIC,IAAA,KAAK,EAAGD,EAAE,CAAE,cAAF,CAJX;AAKC,IAAA,OAAO,EAAG,MAAM;AACf;AACA,YAAMY,eAAe,GAAGd,KAAK,CAACe,QAAN,CAAeC,YAAf,CACvBL,GAAG,CAACM,OADmB,CAAxB;AAGAH,MAAAA,eAAe,EAAEd,KAAjB;AACAa,MAAAA,aAAa,CAAE,MAAF,EAAUP,eAAV,EAA2B,KAA3B,CAAb;AACA,KAZF;AAaC,IAAA,WAAW,EAAG;AAbf,IAND,CADD;AAwBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { focus } from '@wordpress/dom';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { close } from '@wordpress/icons';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nconst PREFERENCE_NAME = 'isResuableBlocksrRenameHintVisible';\n\nexport default function ReusableBlocksRenameHint() {\n\tconst isReusableBlocksRenameHint = useSelect(\n\t\t( select ) =>\n\t\t\tselect( preferencesStore ).get( 'core', PREFERENCE_NAME ) ?? true,\n\t\t[]\n\t);\n\n\tconst ref = useRef();\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tif ( ! isReusableBlocksRenameHint ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div ref={ ref } className=\"reusable-blocks-menu-items__rename-hint\">\n\t\t\t<div className=\"reusable-blocks-menu-items__rename-hint-content\">\n\t\t\t\t{ __(\n\t\t\t\t\t'Reusable blocks are now called patterns. A synced pattern will behave in exactly the same way as a reusable block.'\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<Button\n\t\t\t\tclassName=\"reusable-blocks-menu-items__rename-hint-dismiss\"\n\t\t\t\ticon={ close }\n\t\t\t\ticonSize=\"16\"\n\t\t\t\tlabel={ __( 'Dismiss hint' ) }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\t// Retain focus when dismissing the element.\n\t\t\t\t\tconst previousElement = focus.tabbable.findPrevious(\n\t\t\t\t\t\tref.current\n\t\t\t\t\t);\n\t\t\t\t\tpreviousElement?.focus();\n\t\t\t\t\tsetPreference( 'core', PREFERENCE_NAME, false );\n\t\t\t\t} }\n\t\t\t\tshowTooltip={ false }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/reusable-block-rename-hint.js"],"names":["Button","useDispatch","useSelect","focus","useRef","__","close","store","preferencesStore","PREFERENCE_NAME","ReusableBlocksRenameHint","isReusableBlocksRenameHint","select","get","ref","set","setPreference","previousElement","tabbable","findPrevious","current"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,kBAAtB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA,MAAMC,eAAe,GAAG,oCAAxB;AAEA,eAAe,SAASC,wBAAT,GAAoC;AAClD,QAAMC,0BAA0B,GAAGT,SAAS,CACzCU,MAAF;AAAA;;AAAA,0BACCA,MAAM,CAAEJ,gBAAF,CAAN,CAA2BK,GAA3B,CAAgC,MAAhC,EAAwCJ,eAAxC,CADD,qDAC8D,IAD9D;AAAA,GAD2C,EAG3C,EAH2C,CAA5C;AAMA,QAAMK,GAAG,GAAGV,MAAM,EAAlB;AAEA,QAAM;AAAEW,IAAAA,GAAG,EAAEC;AAAP,MAAyBf,WAAW,CAAEO,gBAAF,CAA1C;;AACA,MAAK,CAAEG,0BAAP,EAAoC;AACnC,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,GAAG,EAAGG,GAAX;AAAiB,IAAA,SAAS,EAAC;AAA3B,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGT,EAAE,CACH,oHADG,CADL,CADD,EAMC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,iDADX;AAEC,IAAA,IAAI,EAAGC,KAFR;AAGC,IAAA,QAAQ,EAAC,IAHV;AAIC,IAAA,KAAK,EAAGD,EAAE,CAAE,cAAF,CAJX;AAKC,IAAA,OAAO,EAAG,MAAM;AACf;AACA,YAAMY,eAAe,GAAGd,KAAK,CAACe,QAAN,CAAeC,YAAf,CACvBL,GAAG,CAACM,OADmB,CAAxB;AAGAH,MAAAA,eAAe,EAAEd,KAAjB;AACAa,MAAAA,aAAa,CAAE,MAAF,EAAUP,eAAV,EAA2B,KAA3B,CAAb;AACA,KAZF;AAaC,IAAA,WAAW,EAAG;AAbf,IAND,CADD;AAwBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { focus } from '@wordpress/dom';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { close } from '@wordpress/icons';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nconst PREFERENCE_NAME = 'isResuableBlocksrRenameHintVisible';\n\nexport default function ReusableBlocksRenameHint() {\n\tconst isReusableBlocksRenameHint = useSelect(\n\t\t( select ) =>\n\t\t\tselect( preferencesStore ).get( 'core', PREFERENCE_NAME ) ?? true,\n\t\t[]\n\t);\n\n\tconst ref = useRef();\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tif ( ! isReusableBlocksRenameHint ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div ref={ ref } className=\"reusable-blocks-menu-items__rename-hint\">\n\t\t\t<div className=\"reusable-blocks-menu-items__rename-hint-content\">\n\t\t\t\t{ __(\n\t\t\t\t\t'Reusable blocks are now synced patterns. A synced pattern will behave in exactly the same way as a reusable block.'\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<Button\n\t\t\t\tclassName=\"reusable-blocks-menu-items__rename-hint-dismiss\"\n\t\t\t\ticon={ close }\n\t\t\t\ticonSize=\"16\"\n\t\t\t\tlabel={ __( 'Dismiss hint' ) }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\t// Retain focus when dismissing the element.\n\t\t\t\t\tconst previousElement = focus.tabbable.findPrevious(\n\t\t\t\t\t\tref.current\n\t\t\t\t\t);\n\t\t\t\t\tpreviousElement?.focus();\n\t\t\t\t\tsetPreference( 'core', PREFERENCE_NAME, false );\n\t\t\t\t} }\n\t\t\t\tshowTooltip={ false }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"]}
@@ -7,7 +7,7 @@ import { __ } from '@wordpress/i18n'; // Used as a unique identifier for the "Cr
7
7
 
8
8
  export const CREATE_TYPE = '__CREATE__';
9
9
  export const TEL_TYPE = 'tel';
10
- export const URL_TYPE = 'URL';
10
+ export const URL_TYPE = 'link';
11
11
  export const MAILTO_TYPE = 'mailto';
12
12
  export const INTERNAL_TYPE = 'internal';
13
13
  export const LINK_ENTRY_TYPES = [URL_TYPE, MAILTO_TYPE, TEL_TYPE, INTERNAL_TYPE];
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/constants.js"],"names":["__","CREATE_TYPE","TEL_TYPE","URL_TYPE","MAILTO_TYPE","INTERNAL_TYPE","LINK_ENTRY_TYPES","DEFAULT_LINK_SETTINGS","id","title"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB,C,CAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,YAApB;AACP,OAAO,MAAMC,QAAQ,GAAG,KAAjB;AACP,OAAO,MAAMC,QAAQ,GAAG,KAAjB;AACP,OAAO,MAAMC,WAAW,GAAG,QAApB;AACP,OAAO,MAAMC,aAAa,GAAG,UAAtB;AAEP,OAAO,MAAMC,gBAAgB,GAAG,CAC/BH,QAD+B,EAE/BC,WAF+B,EAG/BF,QAH+B,EAI/BG,aAJ+B,CAAzB;AAOP,OAAO,MAAME,qBAAqB,GAAG,CACpC;AACCC,EAAAA,EAAE,EAAE,eADL;AAECC,EAAAA,KAAK,EAAET,EAAE,CAAE,iBAAF;AAFV,CADoC,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n// Used as a unique identifier for the \"Create\" option within search results.\n// Used to help distinguish the \"Create\" suggestion within the search results in\n// order to handle it as a unique case.\nexport const CREATE_TYPE = '__CREATE__';\nexport const TEL_TYPE = 'tel';\nexport const URL_TYPE = 'URL';\nexport const MAILTO_TYPE = 'mailto';\nexport const INTERNAL_TYPE = 'internal';\n\nexport const LINK_ENTRY_TYPES = [\n\tURL_TYPE,\n\tMAILTO_TYPE,\n\tTEL_TYPE,\n\tINTERNAL_TYPE,\n];\n\nexport const DEFAULT_LINK_SETTINGS = [\n\t{\n\t\tid: 'opensInNewTab',\n\t\ttitle: __( 'Open in new tab' ),\n\t},\n];\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/constants.js"],"names":["__","CREATE_TYPE","TEL_TYPE","URL_TYPE","MAILTO_TYPE","INTERNAL_TYPE","LINK_ENTRY_TYPES","DEFAULT_LINK_SETTINGS","id","title"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB,C,CAEA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,YAApB;AACP,OAAO,MAAMC,QAAQ,GAAG,KAAjB;AACP,OAAO,MAAMC,QAAQ,GAAG,MAAjB;AACP,OAAO,MAAMC,WAAW,GAAG,QAApB;AACP,OAAO,MAAMC,aAAa,GAAG,UAAtB;AAEP,OAAO,MAAMC,gBAAgB,GAAG,CAC/BH,QAD+B,EAE/BC,WAF+B,EAG/BF,QAH+B,EAI/BG,aAJ+B,CAAzB;AAOP,OAAO,MAAME,qBAAqB,GAAG,CACpC;AACCC,EAAAA,EAAE,EAAE,eADL;AAECC,EAAAA,KAAK,EAAET,EAAE,CAAE,iBAAF;AAFV,CADoC,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n// Used as a unique identifier for the \"Create\" option within search results.\n// Used to help distinguish the \"Create\" suggestion within the search results in\n// order to handle it as a unique case.\nexport const CREATE_TYPE = '__CREATE__';\nexport const TEL_TYPE = 'tel';\nexport const URL_TYPE = 'link';\nexport const MAILTO_TYPE = 'mailto';\nexport const INTERNAL_TYPE = 'internal';\n\nexport const LINK_ENTRY_TYPES = [\n\tURL_TYPE,\n\tMAILTO_TYPE,\n\tTEL_TYPE,\n\tINTERNAL_TYPE,\n];\n\nexport const DEFAULT_LINK_SETTINGS = [\n\t{\n\t\tid: 'opensInNewTab',\n\t\ttitle: __( 'Open in new tab' ),\n\t},\n];\n"]}
@@ -1,22 +1,16 @@
1
1
  import { createElement } from "@wordpress/element";
2
2
 
3
- /**
4
- * External dependencies
5
- */
6
- import classnames from 'classnames';
7
3
  /**
8
4
  * WordPress dependencies
9
5
  */
10
-
11
6
  import { __, sprintf } from '@wordpress/i18n';
12
- import { Button } from '@wordpress/components';
7
+ import { MenuItem } from '@wordpress/components';
13
8
  import { createInterpolateElement } from '@wordpress/element';
14
- import { Icon, plus } from '@wordpress/icons';
9
+ import { plus } from '@wordpress/icons';
15
10
  export const LinkControlSearchCreate = ({
16
11
  searchTerm,
17
12
  onClick,
18
13
  itemProps,
19
- isSelected,
20
14
  buttonText
21
15
  }) => {
22
16
  if (!searchTerm) {
@@ -35,19 +29,12 @@ export const LinkControlSearchCreate = ({
35
29
  });
36
30
  }
37
31
 
38
- return createElement(Button, { ...itemProps,
39
- className: classnames('block-editor-link-control__search-create block-editor-link-control__search-item', {
40
- 'is-selected': isSelected
41
- }),
32
+ return createElement(MenuItem, { ...itemProps,
33
+ iconPosition: "left",
34
+ icon: plus,
35
+ className: "block-editor-link-control__search-item",
42
36
  onClick: onClick
43
- }, createElement(Icon, {
44
- className: "block-editor-link-control__search-item-icon",
45
- icon: plus
46
- }), createElement("span", {
47
- className: "block-editor-link-control__search-item-header"
48
- }, createElement("span", {
49
- className: "block-editor-link-control__search-item-title"
50
- }, text)));
37
+ }, text);
51
38
  };
52
39
  export default LinkControlSearchCreate;
53
40
  //# sourceMappingURL=search-create-button.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-create-button.js"],"names":["classnames","__","sprintf","Button","createInterpolateElement","Icon","plus","LinkControlSearchCreate","searchTerm","onClick","itemProps","isSelected","buttonText","text","mark"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AACA,SAASC,IAAT,EAAeC,IAAf,QAA2B,kBAA3B;AAEA,OAAO,MAAMC,uBAAuB,GAAG,CAAE;AACxCC,EAAAA,UADwC;AAExCC,EAAAA,OAFwC;AAGxCC,EAAAA,SAHwC;AAIxCC,EAAAA,UAJwC;AAKxCC,EAAAA;AALwC,CAAF,KAMhC;AACN,MAAK,CAAEJ,UAAP,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,MAAIK,IAAJ;;AACA,MAAKD,UAAL,EAAkB;AACjBC,IAAAA,IAAI,GACH,OAAOD,UAAP,KAAsB,UAAtB,GACGA,UAAU,CAAEJ,UAAF,CADb,GAEGI,UAHJ;AAIA,GALD,MAKO;AACNC,IAAAA,IAAI,GAAGT,wBAAwB,CAC9BF,OAAO;AACN;AACAD,IAAAA,EAAE,CAAE,yBAAF,CAFI,EAGNO,UAHM,CADuB,EAM9B;AAAEM,MAAAA,IAAI,EAAE;AAAR,KAN8B,CAA/B;AAQA;;AAED,SACC,cAAC,MAAD,OACMJ,SADN;AAEC,IAAA,SAAS,EAAGV,UAAU,CACrB,iFADqB,EAErB;AACC,qBAAeW;AADhB,KAFqB,CAFvB;AAQC,IAAA,OAAO,EAAGF;AARX,KAUC,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,IAAI,EAAGH;AAFR,IAVD,EAeC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGO,IADH,CADD,CAfD,CADD;AAuBA,CAnDM;AAqDP,eAAeN,uBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { Icon, plus } from '@wordpress/icons';\n\nexport const LinkControlSearchCreate = ( {\n\tsearchTerm,\n\tonClick,\n\titemProps,\n\tisSelected,\n\tbuttonText,\n} ) => {\n\tif ( ! searchTerm ) {\n\t\treturn null;\n\t}\n\n\tlet text;\n\tif ( buttonText ) {\n\t\ttext =\n\t\t\ttypeof buttonText === 'function'\n\t\t\t\t? buttonText( searchTerm )\n\t\t\t\t: buttonText;\n\t} else {\n\t\ttext = createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Create: <mark>%s</mark>' ),\n\t\t\t\tsearchTerm\n\t\t\t),\n\t\t\t{ mark: <mark /> }\n\t\t);\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\t{ ...itemProps }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-link-control__search-create block-editor-link-control__search-item',\n\t\t\t\t{\n\t\t\t\t\t'is-selected': isSelected,\n\t\t\t\t}\n\t\t\t) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t<Icon\n\t\t\t\tclassName=\"block-editor-link-control__search-item-icon\"\n\t\t\t\ticon={ plus }\n\t\t\t/>\n\n\t\t\t<span className=\"block-editor-link-control__search-item-header\">\n\t\t\t\t<span className=\"block-editor-link-control__search-item-title\">\n\t\t\t\t\t{ text }\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t</Button>\n\t);\n};\n\nexport default LinkControlSearchCreate;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-create-button.js"],"names":["__","sprintf","MenuItem","createInterpolateElement","plus","LinkControlSearchCreate","searchTerm","onClick","itemProps","buttonText","text","mark"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AACA,SAASC,IAAT,QAAqB,kBAArB;AAEA,OAAO,MAAMC,uBAAuB,GAAG,CAAE;AACxCC,EAAAA,UADwC;AAExCC,EAAAA,OAFwC;AAGxCC,EAAAA,SAHwC;AAIxCC,EAAAA;AAJwC,CAAF,KAKhC;AACN,MAAK,CAAEH,UAAP,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,MAAII,IAAJ;;AACA,MAAKD,UAAL,EAAkB;AACjBC,IAAAA,IAAI,GACH,OAAOD,UAAP,KAAsB,UAAtB,GACGA,UAAU,CAAEH,UAAF,CADb,GAEGG,UAHJ;AAIA,GALD,MAKO;AACNC,IAAAA,IAAI,GAAGP,wBAAwB,CAC9BF,OAAO;AACN;AACAD,IAAAA,EAAE,CAAE,yBAAF,CAFI,EAGNM,UAHM,CADuB,EAM9B;AAAEK,MAAAA,IAAI,EAAE;AAAR,KAN8B,CAA/B;AAQA;;AAED,SACC,cAAC,QAAD,OACMH,SADN;AAEC,IAAA,YAAY,EAAC,MAFd;AAGC,IAAA,IAAI,EAAGJ,IAHR;AAIC,IAAA,SAAS,EAAC,wCAJX;AAKC,IAAA,OAAO,EAAGG;AALX,KAOGG,IAPH,CADD;AAWA,CAtCM;AAwCP,eAAeL,uBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { plus } from '@wordpress/icons';\n\nexport const LinkControlSearchCreate = ( {\n\tsearchTerm,\n\tonClick,\n\titemProps,\n\tbuttonText,\n} ) => {\n\tif ( ! searchTerm ) {\n\t\treturn null;\n\t}\n\n\tlet text;\n\tif ( buttonText ) {\n\t\ttext =\n\t\t\ttypeof buttonText === 'function'\n\t\t\t\t? buttonText( searchTerm )\n\t\t\t\t: buttonText;\n\t} else {\n\t\ttext = createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Create: <mark>%s</mark>' ),\n\t\t\t\tsearchTerm\n\t\t\t),\n\t\t\t{ mark: <mark /> }\n\t\t);\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\t{ ...itemProps }\n\t\t\ticonPosition=\"left\"\n\t\t\ticon={ plus }\n\t\t\tclassName=\"block-editor-link-control__search-item\"\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ text }\n\t\t</MenuItem>\n\t);\n};\n\nexport default LinkControlSearchCreate;\n"]}
@@ -1,18 +1,13 @@
1
1
  import { createElement } from "@wordpress/element";
2
2
 
3
- /**
4
- * External dependencies
5
- */
6
- import classnames from 'classnames';
7
3
  /**
8
4
  * WordPress dependencies
9
5
  */
10
-
11
- import { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';
12
6
  import { __ } from '@wordpress/i18n';
13
- import { Button, TextHighlight } from '@wordpress/components';
7
+ import { MenuItem, TextHighlight } from '@wordpress/components';
14
8
  import { Icon, globe, page, tag, postList, category, file } from '@wordpress/icons';
15
9
  import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
10
+ import { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';
16
11
  const ICONS_MAP = {
17
12
  post: postList,
18
13
  page,
@@ -46,36 +41,27 @@ function SearchItemIcon({
46
41
  export const LinkControlSearchItem = ({
47
42
  itemProps,
48
43
  suggestion,
49
- isSelected = false,
44
+ searchTerm,
50
45
  onClick,
51
46
  isURL = false,
52
- searchTerm = '',
53
47
  shouldShowType = false
54
48
  }) => {
55
- return createElement(Button, { ...itemProps,
49
+ const info = isURL ? __('Press ENTER to add this link') : filterURLForDisplay(safeDecodeURI(suggestion?.url));
50
+ return createElement(MenuItem, { ...itemProps,
51
+ info: info,
52
+ iconPosition: "left",
53
+ icon: createElement(SearchItemIcon, {
54
+ suggestion: suggestion,
55
+ isURL: isURL
56
+ }),
56
57
  onClick: onClick,
57
- className: classnames('block-editor-link-control__search-item', {
58
- 'is-selected': isSelected,
59
- 'is-url': isURL,
60
- 'is-entity': !isURL
61
- })
62
- }, createElement(SearchItemIcon, {
63
- suggestion: suggestion,
64
- isURL: isURL
65
- }), createElement("span", {
66
- className: "block-editor-link-control__search-item-header"
67
- }, createElement("span", {
68
- className: "block-editor-link-control__search-item-title"
58
+ shortcut: shouldShowType && getVisualTypeName(suggestion),
59
+ className: "block-editor-link-control__search-item"
69
60
  }, createElement(TextHighlight // The component expects a plain text string.
70
61
  , {
71
62
  text: stripHTML(suggestion.title),
72
63
  highlight: searchTerm
73
- })), createElement("span", {
74
- "aria-hidden": !isURL,
75
- className: "block-editor-link-control__search-item-info"
76
- }, !isURL && (filterURLForDisplay(safeDecodeURI(suggestion.url)) || ''), isURL && __('Press ENTER to add this link'))), shouldShowType && suggestion.type && createElement("span", {
77
- className: "block-editor-link-control__search-item-type"
78
- }, getVisualTypeName(suggestion)));
64
+ }));
79
65
  };
80
66
 
81
67
  function getVisualTypeName(suggestion) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-item.js"],"names":["classnames","safeDecodeURI","filterURLForDisplay","__","Button","TextHighlight","Icon","globe","page","tag","postList","category","file","__unstableStripHTML","stripHTML","ICONS_MAP","post","post_tag","attachment","SearchItemIcon","isURL","suggestion","icon","type","LinkControlSearchItem","itemProps","isSelected","onClick","searchTerm","shouldShowType","title","url","getVisualTypeName","isFrontPage"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AAC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AGC,IAAA,SAAS,EAAG3B,UAAU,CAAE,wCAAF,EAA4C;AACjE,qBAAe0B,UADkD;AAEjE,gBAAUN,KAFuD;AAGjE,mBAAa,CAAEA;AAHkD,KAA5C;AAHvB,KASC,cAAC,cAAD;AAAgB,IAAA,UAAU,EAAGC,UAA7B;AAA0C,IAAA,KAAK,EAAGD;AAAlD,IATD,EAWC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,cAAC,aAAD,CACC;AADD;AAEC,IAAA,IAAI,EAAGN,SAAS,CAAEO,UAAU,CAACS,KAAb,CAFjB;AAGC,IAAA,SAAS,EAAGF;AAHb,IADD,CADD,EAQC;AACC,mBAAc,CAAER,KADjB;AAEC,IAAA,SAAS,EAAC;AAFX,KAIG,CAAEA,KAAF,KACClB,mBAAmB,CACpBD,aAAa,CAAEoB,UAAU,CAACU,GAAb,CADO,CAAnB,IAGD,EAJA,CAJH,EASGX,KAAK,IAAIjB,EAAE,CAAE,8BAAF,CATd,CARD,CAXD,EA+BG0B,cAAc,IAAIR,UAAU,CAACE,IAA7B,IACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGS,iBAAiB,CAAEX,UAAF,CADpB,CAhCF,CADD;AAuCA,CAhDM;;AAkDP,SAASW,iBAAT,CAA4BX,UAA5B,EAAyC;AACxC,MAAKA,UAAU,CAACY,WAAhB,EAA8B;AAC7B,WAAO,YAAP;AACA,GAHuC,CAKxC;;;AACA,SAAOZ,UAAU,CAACE,IAAX,KAAoB,UAApB,GAAiC,KAAjC,GAAyCF,UAAU,CAACE,IAA3D;AACA;;AAED,eAAeC,qBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';\nimport { __ } from '@wordpress/i18n';\nimport { Button, TextHighlight } from '@wordpress/components';\nimport {\n\tIcon,\n\tglobe,\n\tpage,\n\ttag,\n\tpostList,\n\tcategory,\n\tfile,\n} from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\nconst ICONS_MAP = {\n\tpost: postList,\n\tpage,\n\tpost_tag: tag,\n\tcategory,\n\tattachment: file,\n};\n\nfunction SearchItemIcon( { isURL, suggestion } ) {\n\tlet icon = null;\n\n\tif ( isURL ) {\n\t\ticon = globe;\n\t} else if ( suggestion.type in ICONS_MAP ) {\n\t\ticon = ICONS_MAP[ suggestion.type ];\n\t}\n\n\tif ( icon ) {\n\t\treturn (\n\t\t\t<Icon\n\t\t\t\tclassName=\"block-editor-link-control__search-item-icon\"\n\t\t\t\ticon={ icon }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nexport const LinkControlSearchItem = ( {\n\titemProps,\n\tsuggestion,\n\tisSelected = false,\n\tonClick,\n\tisURL = false,\n\tsearchTerm = '',\n\tshouldShowType = false,\n} ) => {\n\treturn (\n\t\t<Button\n\t\t\t{ ...itemProps }\n\t\t\tonClick={ onClick }\n\t\t\tclassName={ classnames( 'block-editor-link-control__search-item', {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-url': isURL,\n\t\t\t\t'is-entity': ! isURL,\n\t\t\t} ) }\n\t\t>\n\t\t\t<SearchItemIcon suggestion={ suggestion } isURL={ isURL } />\n\n\t\t\t<span className=\"block-editor-link-control__search-item-header\">\n\t\t\t\t<span className=\"block-editor-link-control__search-item-title\">\n\t\t\t\t\t<TextHighlight\n\t\t\t\t\t\t// The component expects a plain text string.\n\t\t\t\t\t\ttext={ stripHTML( suggestion.title ) }\n\t\t\t\t\t\thighlight={ searchTerm }\n\t\t\t\t\t/>\n\t\t\t\t</span>\n\t\t\t\t<span\n\t\t\t\t\taria-hidden={ ! isURL }\n\t\t\t\t\tclassName=\"block-editor-link-control__search-item-info\"\n\t\t\t\t>\n\t\t\t\t\t{ ! isURL &&\n\t\t\t\t\t\t( filterURLForDisplay(\n\t\t\t\t\t\t\tsafeDecodeURI( suggestion.url )\n\t\t\t\t\t\t) ||\n\t\t\t\t\t\t\t'' ) }\n\t\t\t\t\t{ isURL && __( 'Press ENTER to add this link' ) }\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t\t{ shouldShowType && suggestion.type && (\n\t\t\t\t<span className=\"block-editor-link-control__search-item-type\">\n\t\t\t\t\t{ getVisualTypeName( suggestion ) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</Button>\n\t);\n};\n\nfunction getVisualTypeName( suggestion ) {\n\tif ( suggestion.isFrontPage ) {\n\t\treturn 'front page';\n\t}\n\n\t// Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label.\n\treturn suggestion.type === 'post_tag' ? 'tag' : suggestion.type;\n}\n\nexport default LinkControlSearchItem;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-item.js"],"names":["__","MenuItem","TextHighlight","Icon","globe","page","tag","postList","category","file","__unstableStripHTML","stripHTML","safeDecodeURI","filterURLForDisplay","ICONS_MAP","post","post_tag","attachment","SearchItemIcon","isURL","suggestion","icon","type","LinkControlSearchItem","itemProps","searchTerm","onClick","shouldShowType","info","url","getVisualTypeName","title","isFrontPage"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,EAAmBC,aAAnB,QAAwC,uBAAxC;AACA,SACCC,IADD,EAECC,KAFD,EAGCC,IAHD,EAICC,GAJD,EAKCC,QALD,EAMCC,QAND,EAOCC,IAPD,QAQO,kBARP;AASA,SAASC,mBAAmB,IAAIC,SAAhC,QAAiD,gBAAjD;AACA,SAASC,aAAT,EAAwBC,mBAAxB,QAAmD,gBAAnD;AAEA,MAAMC,SAAS,GAAG;AACjBC,EAAAA,IAAI,EAAER,QADW;AAEjBF,EAAAA,IAFiB;AAGjBW,EAAAA,QAAQ,EAAEV,GAHO;AAIjBE,EAAAA,QAJiB;AAKjBS,EAAAA,UAAU,EAAER;AALK,CAAl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AAGN;AAHb,IAXD,CADD;AAmBA,CA/BM;;AAiCP,SAASK,iBAAT,CAA4BV,UAA5B,EAAyC;AACxC,MAAKA,UAAU,CAACY,WAAhB,EAA8B;AAC7B,WAAO,YAAP;AACA,GAHuC,CAKxC;;;AACA,SAAOZ,UAAU,CAACE,IAAX,KAAoB,UAApB,GAAiC,KAAjC,GAAyCF,UAAU,CAACE,IAA3D;AACA;;AAED,eAAeC,qBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem, TextHighlight } from '@wordpress/components';\nimport {\n\tIcon,\n\tglobe,\n\tpage,\n\ttag,\n\tpostList,\n\tcategory,\n\tfile,\n} from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';\n\nconst ICONS_MAP = {\n\tpost: postList,\n\tpage,\n\tpost_tag: tag,\n\tcategory,\n\tattachment: file,\n};\n\nfunction SearchItemIcon( { isURL, suggestion } ) {\n\tlet icon = null;\n\n\tif ( isURL ) {\n\t\ticon = globe;\n\t} else if ( suggestion.type in ICONS_MAP ) {\n\t\ticon = ICONS_MAP[ suggestion.type ];\n\t}\n\n\tif ( icon ) {\n\t\treturn (\n\t\t\t<Icon\n\t\t\t\tclassName=\"block-editor-link-control__search-item-icon\"\n\t\t\t\ticon={ icon }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nexport const LinkControlSearchItem = ( {\n\titemProps,\n\tsuggestion,\n\tsearchTerm,\n\tonClick,\n\tisURL = false,\n\tshouldShowType = false,\n} ) => {\n\tconst info = isURL\n\t\t? __( 'Press ENTER to add this link' )\n\t\t: filterURLForDisplay( safeDecodeURI( suggestion?.url ) );\n\n\treturn (\n\t\t<MenuItem\n\t\t\t{ ...itemProps }\n\t\t\tinfo={ info }\n\t\t\ticonPosition=\"left\"\n\t\t\ticon={\n\t\t\t\t<SearchItemIcon suggestion={ suggestion } isURL={ isURL } />\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t\tshortcut={ shouldShowType && getVisualTypeName( suggestion ) }\n\t\t\tclassName=\"block-editor-link-control__search-item\"\n\t\t>\n\t\t\t<TextHighlight\n\t\t\t\t// The component expects a plain text string.\n\t\t\t\ttext={ stripHTML( suggestion.title ) }\n\t\t\t\thighlight={ searchTerm }\n\t\t\t/>\n\t\t</MenuItem>\n\t);\n};\n\nfunction getVisualTypeName( suggestion ) {\n\tif ( suggestion.isFrontPage ) {\n\t\treturn 'front page';\n\t}\n\n\t// Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label.\n\treturn suggestion.type === 'post_tag' ? 'tag' : suggestion.type;\n}\n\nexport default LinkControlSearchItem;\n"]}
@@ -4,7 +4,7 @@ import { createElement } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { __, sprintf } from '@wordpress/i18n';
7
- import { VisuallyHidden } from '@wordpress/components';
7
+ import { VisuallyHidden, MenuGroup } from '@wordpress/components';
8
8
  /**
9
9
  * External dependencies
10
10
  */
@@ -53,7 +53,7 @@ export default function LinkControlSearchResults({
53
53
  }, searchResultsLabel, createElement("div", { ...suggestionsListProps,
54
54
  className: resultsListClasses,
55
55
  "aria-labelledby": searchResultsLabelId
56
- }, suggestions.map((suggestion, index) => {
56
+ }, createElement(MenuGroup, null, suggestions.map((suggestion, index) => {
57
57
  if (shouldShowCreateSuggestion && CREATE_TYPE === suggestion.type) {
58
58
  return createElement(LinkControlSearchCreate, {
59
59
  searchTerm: currentInputValue,
@@ -88,6 +88,6 @@ export default function LinkControlSearchResults({
88
88
  shouldShowType: shouldShowSuggestionsTypes,
89
89
  isFrontPage: suggestion?.isFrontPage
90
90
  });
91
- })));
91
+ }))));
92
92
  }
93
93
  //# sourceMappingURL=search-results.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-results.js"],"names":["__","sprintf","VisuallyHidden","classnames","LinkControlSearchCreate","LinkControlSearchItem","CREATE_TYPE","LINK_ENTRY_TYPES","LinkControlSearchResults","instanceId","withCreateSuggestion","currentInputValue","handleSuggestionClick","suggestionsListProps","buildSuggestionItemProps","suggestions","selectedSuggestion","isLoading","isInitialSuggestions","createSuggestionButtonText","suggestionsQuery","resultsListClasses","isSingleDirectEntryResult","length","includes","type","shouldShowCreateSuggestion","shouldShowSuggestionsTypes","searchResultsLabelId","labelText","searchResultsLabel","map","suggestion","index","id","isFrontPage"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,cAAT,QAA+B,uBAA/B;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,wBAApC;AACA,OAAOC,qBAAP,MAAkC,eAAlC;AACA,SAASC,WAAT,EAAsBC,gBAAtB,QAA8C,aAA9C;AAEA,eAAe,SAASC,wBAAT,CAAmC;AACjDC,EAAAA,UADiD;AAEjDC,EAAAA,oBAFiD;AAGjDC,EAAAA,iBAHiD;AAIjDC,EAAAA,qBAJiD;AAKjDC,EAAAA,oBALiD;AAMjDC,EAAAA,wBANiD;AAOjDC,EAAAA,WAPiD;AAQjDC,EAAAA,kBARiD;AASjDC,EAAAA,SATiD;AAUjDC,EAAAA,oBAViD;AAWjDC,EAAAA,0BAXiD;AAYjDC,EAAAA;AAZiD,CAAnC,EAaX;AACH,QAAMC,kBAAkB,GAAGlB,UAAU,CACpC,2CADoC,EAEpC;AACC,kBAAcc;AADf,GAFoC,CAArC;AAOA,QAAMK,yBAAyB,GAC9BP,WAAW,CAACQ,MAAZ,KAAuB,CAAvB,IACAhB,gBAAgB,CAACiB,QAAjB,CAA2BT,WAAW,CAAE,CAAF,CAAX,CAAiBU,IAA5C,CAFD;AAGA,QAAMC,0BAA0B,GAC/BhB,oBAAoB,IACpB,CAAEY,yBADF,IAEA,CAAEJ,oBAHH,CAX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ADmC,EAEnCC,KAFmC,CAFrC;AAMC,MAAA,UAAU,EAAGD,UANd;AAOC,MAAA,KAAK,EAAGC,KAPT;AAQC,MAAA,OAAO,EAAG,MAAM;AACfrB,QAAAA,qBAAqB,CAAEoB,UAAF,CAArB;AACA,OAVF;AAWC,MAAA,UAAU,EAAGC,KAAK,KAAKjB,kBAXxB;AAYC,MAAA,KAAK,EAAGT,gBAAgB,CAACiB,QAAjB,CACPQ,UAAU,CAACP,IADJ,CAZT;AAeC,MAAA,UAAU,EAAGd,iBAfd;AAgBC,MAAA,cAAc,EAAGgB,0BAhBlB;AAiBC,MAAA,WAAW,EAAGK,UAAU,EAAEG;AAjB3B,MADD;AAqBA,GApDC,CALH,CAFD,CADD;AAgEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { VisuallyHidden } from '@wordpress/components';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSearchCreate from './search-create-button';\nimport LinkControlSearchItem from './search-item';\nimport { CREATE_TYPE, LINK_ENTRY_TYPES } from './constants';\n\nexport default function LinkControlSearchResults( {\n\tinstanceId,\n\twithCreateSuggestion,\n\tcurrentInputValue,\n\thandleSuggestionClick,\n\tsuggestionsListProps,\n\tbuildSuggestionItemProps,\n\tsuggestions,\n\tselectedSuggestion,\n\tisLoading,\n\tisInitialSuggestions,\n\tcreateSuggestionButtonText,\n\tsuggestionsQuery,\n} ) {\n\tconst resultsListClasses = classnames(\n\t\t'block-editor-link-control__search-results',\n\t\t{\n\t\t\t'is-loading': isLoading,\n\t\t}\n\t);\n\n\tconst isSingleDirectEntryResult =\n\t\tsuggestions.length === 1 &&\n\t\tLINK_ENTRY_TYPES.includes( suggestions[ 0 ].type );\n\tconst shouldShowCreateSuggestion =\n\t\twithCreateSuggestion &&\n\t\t! isSingleDirectEntryResult &&\n\t\t! isInitialSuggestions;\n\t// If the query has a specified type, then we can skip showing them in the result. See #24839.\n\tconst shouldShowSuggestionsTypes = ! suggestionsQuery?.type;\n\n\t// According to guidelines aria-label should be added if the label\n\t// itself is not visible.\n\t// See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role\n\tconst searchResultsLabelId = `block-editor-link-control-search-results-label-${ instanceId }`;\n\tconst labelText = isInitialSuggestions\n\t\t? __( 'Suggestions' )\n\t\t: sprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Search results for \"%s\"' ),\n\t\t\t\tcurrentInputValue\n\t\t );\n\tconst searchResultsLabel = (\n\t\t<VisuallyHidden id={ searchResultsLabelId }>\n\t\t\t{ labelText }\n\t\t</VisuallyHidden>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-link-control__search-results-wrapper\">\n\t\t\t{ searchResultsLabel }\n\t\t\t<div\n\t\t\t\t{ ...suggestionsListProps }\n\t\t\t\tclassName={ resultsListClasses }\n\t\t\t\taria-labelledby={ searchResultsLabelId }\n\t\t\t>\n\t\t\t\t{ suggestions.map( ( suggestion, index ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tshouldShowCreateSuggestion &&\n\t\t\t\t\t\tCREATE_TYPE === suggestion.type\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<LinkControlSearchCreate\n\t\t\t\t\t\t\t\tsearchTerm={ currentInputValue }\n\t\t\t\t\t\t\t\tbuttonText={ createSuggestionButtonText }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\thandleSuggestionClick( suggestion )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Intentionally only using `type` here as\n\t\t\t\t\t\t\t\t// the constant is enough to uniquely\n\t\t\t\t\t\t\t\t// identify the single \"CREATE\" suggestion.\n\t\t\t\t\t\t\t\tkey={ suggestion.type }\n\t\t\t\t\t\t\t\titemProps={ buildSuggestionItemProps(\n\t\t\t\t\t\t\t\t\tsuggestion,\n\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tisSelected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// If we're not handling \"Create\" suggestions above then\n\t\t\t\t\t// we don't want them in the main results so exit early.\n\t\t\t\t\tif ( CREATE_TYPE === suggestion.type ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<LinkControlSearchItem\n\t\t\t\t\t\t\tkey={ `${ suggestion.id }-${ suggestion.type }` }\n\t\t\t\t\t\t\titemProps={ buildSuggestionItemProps(\n\t\t\t\t\t\t\t\tsuggestion,\n\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tsuggestion={ suggestion }\n\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\thandleSuggestionClick( suggestion );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisSelected={ index === selectedSuggestion }\n\t\t\t\t\t\t\tisURL={ LINK_ENTRY_TYPES.includes(\n\t\t\t\t\t\t\t\tsuggestion.type\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tsearchTerm={ currentInputValue }\n\t\t\t\t\t\t\tshouldShowType={ shouldShowSuggestionsTypes }\n\t\t\t\t\t\t\tisFrontPage={ suggestion?.isFrontPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-results.js"],"names":["__","sprintf","VisuallyHidden","MenuGroup","classnames","LinkControlSearchCreate","LinkControlSearchItem","CREATE_TYPE","LINK_ENTRY_TYPES","LinkControlSearchResults","instanceId","withCreateSuggestion","currentInputValue","handleSuggestionClick","suggestionsListProps","buildSuggestionItemProps","suggestions","selectedSuggestion","isLoading","isInitialSuggestions","createSuggestionButtonText","suggestionsQuery","resultsListClasses","isSingleDirectEntryResult","length","includes","type","shouldShowCreateSuggestion","shouldShowSuggestionsTypes","searchResultsLabelId","labelText","searchResultsLabel","map","suggestion","index","id","isFrontPage"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,cAAT,EAAyBC,SAAzB,QAA0C,uBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,wBAApC;AACA,OAAOC,qBAAP,MAAkC,eAAlC;AACA,SAASC,WAAT,EAAsBC,gBAAtB,QAA8C,aAA9C;AAEA,eAAe,SAASC,wBAAT,CAAmC;AACjDC,EAAAA,UADiD;AAEjDC,EAAAA,oBAFiD;AAGjDC,EAAAA,iBAHiD;AAIjDC,EAAAA,qBAJiD;AAKjDC,EAAAA,oBALiD;AAMjDC,EAAAA,wBANiD;AAOjDC,EAAAA,WAPiD;AAQjDC,EAAAA,kBARiD;AASjDC,EAAAA,SATiD;AAUjDC,EAAAA,oBAViD;AAWjDC,EAAAA,0BAXiD;AAYjDC,EAAAA;AAZiD,CAAnC,EAaX;AACH,QAAMC,kBAAkB,GAAGlB,UAAU,CACpC,2CADoC,EAEpC;AACC,kBAAcc;AADf,GAFoC,CAArC;AAOA,QAAMK,yBAAyB,GAC9BP,WAAW,CAACQ,MAAZ,KAAuB,CAAvB,IACAhB,gBAAgB,CAACiB,QAAjB,CAA2BT,WAAW,CAAE,CAAF,CAAX,CAAiBU,IAA5C,CAFD;AAGA,QAAMC,0BAA0B,GAC/BhB,oBAAoB,IACpB,CAAEY,yBADF,IAEA,CAAEJ,oBAHH,CAXG,CAeH;;AACA,QAAMS,0BAA0B,GAAG,CAAEP,gBAAgB,EAAEK,IAAvD,CAhBG,CAkBH;AACA;AACA;;AACA,QAAMG,oBAAoB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C,MAAA,OAAO,EAAG,MAAM;AACfrB,QAAAA,qBAAqB,CAAEoB,UAAF,CAArB;AACA,OAVF;AAWC,MAAA,UAAU,EAAGC,KAAK,KAAKjB,kBAXxB;AAYC,MAAA,KAAK,EAAGT,gBAAgB,CAACiB,QAAjB,CACPQ,UAAU,CAACP,IADJ,CAZT;AAeC,MAAA,UAAU,EAAGd,iBAfd;AAgBC,MAAA,cAAc,EAAGgB,0BAhBlB;AAiBC,MAAA,WAAW,EAAGK,UAAU,EAAEG;AAjB3B,MADD;AAqBA,GApDC,CADH,CALD,CAFD,CADD;AAkEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { VisuallyHidden, MenuGroup } from '@wordpress/components';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSearchCreate from './search-create-button';\nimport LinkControlSearchItem from './search-item';\nimport { CREATE_TYPE, LINK_ENTRY_TYPES } from './constants';\n\nexport default function LinkControlSearchResults( {\n\tinstanceId,\n\twithCreateSuggestion,\n\tcurrentInputValue,\n\thandleSuggestionClick,\n\tsuggestionsListProps,\n\tbuildSuggestionItemProps,\n\tsuggestions,\n\tselectedSuggestion,\n\tisLoading,\n\tisInitialSuggestions,\n\tcreateSuggestionButtonText,\n\tsuggestionsQuery,\n} ) {\n\tconst resultsListClasses = classnames(\n\t\t'block-editor-link-control__search-results',\n\t\t{\n\t\t\t'is-loading': isLoading,\n\t\t}\n\t);\n\n\tconst isSingleDirectEntryResult =\n\t\tsuggestions.length === 1 &&\n\t\tLINK_ENTRY_TYPES.includes( suggestions[ 0 ].type );\n\tconst shouldShowCreateSuggestion =\n\t\twithCreateSuggestion &&\n\t\t! isSingleDirectEntryResult &&\n\t\t! isInitialSuggestions;\n\t// If the query has a specified type, then we can skip showing them in the result. See #24839.\n\tconst shouldShowSuggestionsTypes = ! suggestionsQuery?.type;\n\n\t// According to guidelines aria-label should be added if the label\n\t// itself is not visible.\n\t// See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role\n\tconst searchResultsLabelId = `block-editor-link-control-search-results-label-${ instanceId }`;\n\tconst labelText = isInitialSuggestions\n\t\t? __( 'Suggestions' )\n\t\t: sprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Search results for \"%s\"' ),\n\t\t\t\tcurrentInputValue\n\t\t );\n\tconst searchResultsLabel = (\n\t\t<VisuallyHidden id={ searchResultsLabelId }>\n\t\t\t{ labelText }\n\t\t</VisuallyHidden>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-link-control__search-results-wrapper\">\n\t\t\t{ searchResultsLabel }\n\t\t\t<div\n\t\t\t\t{ ...suggestionsListProps }\n\t\t\t\tclassName={ resultsListClasses }\n\t\t\t\taria-labelledby={ searchResultsLabelId }\n\t\t\t>\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ suggestions.map( ( suggestion, index ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tshouldShowCreateSuggestion &&\n\t\t\t\t\t\t\tCREATE_TYPE === suggestion.type\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LinkControlSearchCreate\n\t\t\t\t\t\t\t\t\tsearchTerm={ currentInputValue }\n\t\t\t\t\t\t\t\t\tbuttonText={ createSuggestionButtonText }\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\thandleSuggestionClick( suggestion )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// Intentionally only using `type` here as\n\t\t\t\t\t\t\t\t\t// the constant is enough to uniquely\n\t\t\t\t\t\t\t\t\t// identify the single \"CREATE\" suggestion.\n\t\t\t\t\t\t\t\t\tkey={ suggestion.type }\n\t\t\t\t\t\t\t\t\titemProps={ buildSuggestionItemProps(\n\t\t\t\t\t\t\t\t\t\tsuggestion,\n\t\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tisSelected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If we're not handling \"Create\" suggestions above then\n\t\t\t\t\t\t// we don't want them in the main results so exit early.\n\t\t\t\t\t\tif ( CREATE_TYPE === suggestion.type ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<LinkControlSearchItem\n\t\t\t\t\t\t\t\tkey={ `${ suggestion.id }-${ suggestion.type }` }\n\t\t\t\t\t\t\t\titemProps={ buildSuggestionItemProps(\n\t\t\t\t\t\t\t\t\tsuggestion,\n\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tsuggestion={ suggestion }\n\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\thandleSuggestionClick( suggestion );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tisSelected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t\tisURL={ LINK_ENTRY_TYPES.includes(\n\t\t\t\t\t\t\t\t\tsuggestion.type\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tsearchTerm={ currentInputValue }\n\t\t\t\t\t\t\t\tshouldShowType={ shouldShowSuggestionsTypes }\n\t\t\t\t\t\t\t\tisFrontPage={ suggestion?.isFrontPage }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</MenuGroup>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
@@ -64,7 +64,8 @@ export default function useBlockDisplayInformation(clientId) {
64
64
  if (!clientId) return null;
65
65
  const {
66
66
  getBlockName,
67
- getBlockAttributes
67
+ getBlockAttributes,
68
+ __experimentalGetReusableBlockTitle
68
69
  } = select(blockEditorStore);
69
70
  const {
70
71
  getBlockType,
@@ -75,11 +76,14 @@ export default function useBlockDisplayInformation(clientId) {
75
76
  if (!blockType) return null;
76
77
  const attributes = getBlockAttributes(clientId);
77
78
  const match = getActiveBlockVariation(blockName, attributes);
78
- const isSynced = isReusableBlock(blockType) || isTemplatePart(blockType);
79
+ const isReusable = isReusableBlock(blockType);
80
+ const resusableTitle = isReusable ? __experimentalGetReusableBlockTitle(attributes.ref) : undefined;
81
+ const title = resusableTitle || blockType.title;
82
+ const isSynced = isReusable || isTemplatePart(blockType);
79
83
  const positionLabel = getPositionTypeLabel(attributes);
80
84
  const blockTypeInfo = {
81
85
  isSynced,
82
- title: blockType.title,
86
+ title,
83
87
  icon: blockType.icon,
84
88
  description: blockType.description,
85
89
  anchor: attributes?.anchor,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/use-block-display-information/index.js"],"names":["useSelect","store","blocksStore","isReusableBlock","isTemplatePart","__","blockEditorStore","getPositionTypeLabel","attributes","positionType","style","position","type","useBlockDisplayInformation","clientId","select","getBlockName","getBlockAttributes","getBlockType","getActiveBlockVariation","blockName","blockType","match","isSynced","positionLabel","blockTypeInfo","title","icon","description","anchor"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SACCC,KAAK,IAAIC,WADV,EAECC,eAFD,EAGCC,cAHD,QAIO,mBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASJ,KAAK,IAAIK,gBAAlB,QAA0C,aAA1C;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,oBAAT,CAA+BC,UAA/B,EAA4C;AAC3C,QAAMC,YAAY,GAAGD,UAAU,EAAEE,KAAZ,EAAmBC,QAAnB,EAA6BC,IAAlD;;AAEA,MAAKH,YAA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A,YAAY,EAAED,UAAU,EAAEE,KAAZ,EAAmBC,QAAnB,EAA6BC;AAPtB,KAAtB;AASA,QAAK,CAAEU,KAAP,EAAe,OAAOG,aAAP;AAEf,WAAO;AACNF,MAAAA,QADM;AAENG,MAAAA,KAAK,EAAEJ,KAAK,CAACI,KAAN,IAAeL,SAAS,CAACK,KAF1B;AAGNC,MAAAA,IAAI,EAAEL,KAAK,CAACK,IAAN,IAAcN,SAAS,CAACM,IAHxB;AAINC,MAAAA,WAAW,EAAEN,KAAK,CAACM,WAAN,IAAqBP,SAAS,CAACO,WAJtC;AAKNC,MAAAA,MAAM,EAAErB,UAAU,EAAEqB,MALd;AAMNL,MAAAA,aANM;AAONf,MAAAA,YAAY,EAAED,UAAU,EAAEE,KAAZ,EAAmBC,QAAnB,EAA6BC;AAPrC,KAAP;AASA,GAnCc,EAoCf,CAAEE,QAAF,CApCe,CAAhB;AAsCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */\n\n/**\n * Contains basic block's information for display reasons.\n *\n * @typedef {Object} WPBlockDisplayInformation\n *\n * @property {boolean} isSynced True if is a reusable block or template part\n * @property {string} title Human-readable block type label.\n * @property {WPIcon} icon Block type icon.\n * @property {string} description A detailed block type description.\n * @property {string} anchor HTML anchor.\n */\n\n/**\n * Get the display label for a block's position type.\n *\n * @param {Object} attributes Block attributes.\n * @return {string} The position type label.\n */\nfunction getPositionTypeLabel( attributes ) {\n\tconst positionType = attributes?.style?.position?.type;\n\n\tif ( positionType === 'sticky' ) {\n\t\treturn __( 'Sticky' );\n\t}\n\n\tif ( positionType === 'fixed' ) {\n\t\treturn __( 'Fixed' );\n\t}\n\n\treturn null;\n}\n\n/**\n * Hook used to try to find a matching block variation and return\n * the appropriate information for display reasons. In order to\n * to try to find a match we need to things:\n * 1. Block's client id to extract it's current attributes.\n * 2. A block variation should have set `isActive` prop to a proper function.\n *\n * If for any reason a block variation match cannot be found,\n * the returned information come from the Block Type.\n * If no blockType is found with the provided clientId, returns null.\n *\n * @param {string} clientId Block's client id.\n * @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found.\n */\n\nexport default function useBlockDisplayInformation( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) return null;\n\t\t\tconst { getBlockName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tif ( ! blockType ) return null;\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\t\t\tconst isSynced =\n\t\t\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\t\t\tconst positionLabel = getPositionTypeLabel( attributes );\n\t\t\tconst blockTypeInfo = {\n\t\t\t\tisSynced,\n\t\t\t\ttitle: blockType.title,\n\t\t\t\ticon: blockType.icon,\n\t\t\t\tdescription: blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t};\n\t\t\tif ( ! match ) return blockTypeInfo;\n\n\t\t\treturn {\n\t\t\t\tisSynced,\n\t\t\t\ttitle: match.title || blockType.title,\n\t\t\t\ticon: match.icon || blockType.icon,\n\t\t\t\tdescription: match.description || blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/use-block-display-information/index.js"],"names":["useSelect","store","blocksStore","isReusableBlock","isTemplatePart","__","blockEditorStore","getPositionTypeLabel","attributes","positionType","style","position","type","useBlockDisplayInformation","clientId","select","getBlockName","getBlockAttributes","__experimentalGetReusableBlockTitle","getBlockType","getActiveBlockVariation","blockName","blockType","match","isReusable","resusableTitle","ref","undefined","title","isSynced","positionLabel","blockTypeInfo","icon","description","anchor"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SACCC,KAAK,IAAIC,WADV,EAECC,eAFD,EAGCC,cAHD,QAIO,mBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASJ,KAAK,IAAIK,gBAAlB,QAA0C,aAA1C;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,oBAAT,CAA+BC,UAA/B,EAA4C;AAC3C,QAAMC,YAAY,GAAGD,UAAU,EAAEE,KAAZ,EAAmBC,QAAnB,EAA6BC,IAAlD;;AAEA,MAAKH,YAAY,KAAK,QAAtB,EAAiC;AAChC,WAAOJ,EAAE,CAAE,QAAF,CAAT;AACA;;AAED,MAAKI,YAAY,KAAK,OAAtB,EAAgC;AAC/B,WAAOJ,EAAE,CAAE,OAAF,CAAT;AACA;;AAED,SAAO,IAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA,eAAe,SAASQ,0BAAT,CAAqCC,QAArC,EAAgD;AAC9D,SAAOd,SAAS,CACbe,MAAF,IAAc;AACb,QAAK,CAAED,QAAP,EAAkB,OAAO,IAAP;AAClB,UAAM;AACLE,MAAAA,YADK;AAELC,MAAAA,kBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAET,gBAAF,CAJV;AAKA,UAAM;AAAEa,MAAAA,YAAF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,WAAN,IAAqBX,SAAS,CAACW,WAJtC;AAKNC,MAAAA,MAAM,EAAE1B,UAAU,EAAE0B,MALd;AAMNJ,MAAAA,aANM;AAONrB,MAAAA,YAAY,EAAED,UAAU,EAAEE,KAAZ,EAAmBC,QAAnB,EAA6BC;AAPrC,KAAP;AASA,GA1Cc,EA2Cf,CAAEE,QAAF,CA3Ce,CAAhB;AA6CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */\n\n/**\n * Contains basic block's information for display reasons.\n *\n * @typedef {Object} WPBlockDisplayInformation\n *\n * @property {boolean} isSynced True if is a reusable block or template part\n * @property {string} title Human-readable block type label.\n * @property {WPIcon} icon Block type icon.\n * @property {string} description A detailed block type description.\n * @property {string} anchor HTML anchor.\n */\n\n/**\n * Get the display label for a block's position type.\n *\n * @param {Object} attributes Block attributes.\n * @return {string} The position type label.\n */\nfunction getPositionTypeLabel( attributes ) {\n\tconst positionType = attributes?.style?.position?.type;\n\n\tif ( positionType === 'sticky' ) {\n\t\treturn __( 'Sticky' );\n\t}\n\n\tif ( positionType === 'fixed' ) {\n\t\treturn __( 'Fixed' );\n\t}\n\n\treturn null;\n}\n\n/**\n * Hook used to try to find a matching block variation and return\n * the appropriate information for display reasons. In order to\n * to try to find a match we need to things:\n * 1. Block's client id to extract it's current attributes.\n * 2. A block variation should have set `isActive` prop to a proper function.\n *\n * If for any reason a block variation match cannot be found,\n * the returned information come from the Block Type.\n * If no blockType is found with the provided clientId, returns null.\n *\n * @param {string} clientId Block's client id.\n * @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found.\n */\n\nexport default function useBlockDisplayInformation( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) return null;\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\t__experimentalGetReusableBlockTitle,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tif ( ! blockType ) return null;\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\t\t\tconst isReusable = isReusableBlock( blockType );\n\t\t\tconst resusableTitle = isReusable\n\t\t\t\t? __experimentalGetReusableBlockTitle( attributes.ref )\n\t\t\t\t: undefined;\n\t\t\tconst title = resusableTitle || blockType.title;\n\t\t\tconst isSynced = isReusable || isTemplatePart( blockType );\n\t\t\tconst positionLabel = getPositionTypeLabel( attributes );\n\t\t\tconst blockTypeInfo = {\n\t\t\t\tisSynced,\n\t\t\t\ttitle,\n\t\t\t\ticon: blockType.icon,\n\t\t\t\tdescription: blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t};\n\t\t\tif ( ! match ) return blockTypeInfo;\n\n\t\t\treturn {\n\t\t\t\tisSynced,\n\t\t\t\ttitle: match.title || blockType.title,\n\t\t\t\ticon: match.icon || blockType.icon,\n\t\t\t\tdescription: match.description || blockType.description,\n\t\t\t\tanchor: attributes?.anchor,\n\t\t\t\tpositionLabel,\n\t\t\t\tpositionType: attributes?.style?.position?.type,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"]}
@@ -25,7 +25,7 @@ export function MarginVisualizer({
25
25
  const [style, setStyle] = useState();
26
26
  const margin = attributes?.style?.spacing?.margin;
27
27
  useEffect(() => {
28
- if (!blockElement) {
28
+ if (!blockElement || null === blockElement.ownerDocument.defaultView) {
29
29
  return;
30
30
  }
31
31
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/margin.js"],"names":["useState","useRef","useEffect","isShallowEqual","BlockPopover","__unstableUseBlockElement","useBlockElement","getComputedCSS","element","property","ownerDocument","defaultView","getComputedStyle","getPropertyValue","MarginVisualizer","clientId","attributes","forceShow","blockElement","style","setStyle","margin","spacing","top","right","bottom","left","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","isActive","setIsActive","valueRef","timeoutRef","clearTimer","current","window","clearTimeout","setTimeout"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,MAAnB,EAA2BC,SAA3B,QAA4C,oBAA5C;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,6BAAzB;AACA,SAASC,yBAAyB,IAAIC,eAAtC,QAA6D,yDAA7D;;AAEA,SAASC,cAAT,CAAyBC,OAAzB,EAAkCC,QAAlC,EAA6C;AAC5C,SAAOD,OAAO,CAACE,aAAR,CAAsBC,WAAtB,CACLC,gBADK,CACaJ,OADb,EAELK,gBAFK,CAEaJ,QAFb,CAAP;AAGA;;AAED,OAAO,SAASK,gBAAT,CAA2B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,UAAZ;AAAwBC,EAAAA;AAAxB,CAA3B,EAAiE;AACvE,QAAMC,YAAY,GAAGZ,eAAe,CAAES,QAAF,CAApC;AACA,QAAM,CAAEI,KAAF,EAASC,QAAT,IAAsBpB,QAAQ,EAApC;AAEA,QAAMqB,MAAM,GAAGL,UAAU,EAAEG,KAAZ,EAAmBG,OAAnB,EAA4BD,MAA3C;AAEAnB,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAK,CAAEgB,YAAP,EAAsB;AACrB;AACA;;AAED,UAAMK,GAAG,GAAGhB,cAAc,CAAEW,YAAF,EAAgB,YAAhB,CAA1B;AACA,UAAMM,KAAK,GAAGjB,cAAc,CAAEW,YAA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f,MAAnB;AAEAa,MAAAA,UAAU,CAACE,OAAX,GAAqBG,UAAU,CAAE,MAAM;AACtCP,QAAAA,WAAW,CAAE,KAAF,CAAX;AACA,OAF8B,EAE5B,GAF4B,CAA/B;AAGA;;AAED,WAAO,MAAM;AACZA,MAAAA,WAAW,CAAE,KAAF,CAAX;AACAG,MAAAA,UAAU;AACV,KAHD;AAIA,GAdQ,EAcN,CAAEd,MAAF,EAAUJ,SAAV,CAdM,CAAT;;AAgBA,MAAK,CAAEc,QAAF,IAAc,CAAEd,SAArB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,SACC,cAAC,YAAD;AACC,IAAA,QAAQ,EAAGF,QADZ;AAEC,IAAA,qBAAqB,MAFtB;AAGC,IAAA,qBAAqB,EAAGM,MAHzB;AAIC,IAAA,qBAAqB,EAAC,eAJvB;AAKC,IAAA,KAAK,EAAG;AALT,KAOC;AAAK,IAAA,SAAS,EAAC,kCAAf;AAAkD,IAAA,KAAK,EAAGF;AAA1D,IAPD,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../components/block-popover';\nimport { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\nexport function MarginVisualizer( { clientId, attributes, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, setStyle ] = useState();\n\n\tconst margin = attributes?.style?.spacing?.margin;\n\n\tuseEffect( () => {\n\t\tif ( ! blockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst top = getComputedCSS( blockElement, 'margin-top' );\n\t\tconst right = getComputedCSS( blockElement, 'margin-right' );\n\t\tconst bottom = getComputedCSS( blockElement, 'margin-bottom' );\n\t\tconst left = getComputedCSS( blockElement, 'margin-left' );\n\n\t\tsetStyle( {\n\t\t\tborderTopWidth: top,\n\t\t\tborderRightWidth: right,\n\t\t\tborderBottomWidth: bottom,\n\t\t\tborderLeftWidth: left,\n\t\t\ttop: top ? `-${ top }` : 0,\n\t\t\tright: right ? `-${ right }` : 0,\n\t\t\tbottom: bottom ? `-${ bottom }` : 0,\n\t\t\tleft: left ? `-${ left }` : 0,\n\t\t} );\n\t}, [ blockElement, margin ] );\n\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst valueRef = useRef( margin );\n\tconst timeoutRef = useRef();\n\n\tconst clearTimer = () => {\n\t\tif ( timeoutRef.current ) {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! isShallowEqual( margin, valueRef.current ) && ! forceShow ) {\n\t\t\tsetIsActive( true );\n\t\t\tvalueRef.current = margin;\n\n\t\t\ttimeoutRef.current = setTimeout( () => {\n\t\t\t\tsetIsActive( false );\n\t\t\t}, 400 );\n\t\t}\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimer();\n\t\t};\n\t}, [ margin, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ clientId }\n\t\t\t__unstableCoverTarget\n\t\t\t__unstableRefreshSize={ margin }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t\tshift={ false }\n\t\t>\n\t\t\t<div className=\"block-editor__padding-visualizer\" style={ style } />\n\t\t</BlockPopover>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/margin.js"],"names":["useState","useRef","useEffect","isShallowEqual","BlockPopover","__unstableUseBlockElement","useBlockElement","getComputedCSS","element","property","ownerDocument","defaultView","getComputedStyle","getPropertyValue","MarginVisualizer","clientId","attributes","forceShow","blockElement","style","setStyle","margin","spacing","top","right","bottom","left","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","isActive","setIsActive","valueRef","timeoutRef","clearTimer","current","window","clearTimeout","setTimeout"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,MAAnB,EAA2BC,SAA3B,QAA4C,oBAA5C;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,6BAAzB;AACA,SAASC,yBAAyB,IAAIC,eAAtC,QAA6D,yDAA7D;;AAEA,SAASC,cAAT,CAAyBC,OAAzB,EAAkCC,QAAlC,EAA6C;AAC5C,SAAOD,OAAO,CAACE,aAAR,CAAsBC,WAAtB,CACLC,gBADK,CACaJ,OADb,EAELK,gBAFK,CAEaJ,QAFb,CAAP;AAGA;;AAED,OAAO,SAASK,gBAAT,CAA2B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,UAAZ;AAAwBC,EAAAA;AAAxB,CAA3B,EAAiE;AACvE,QAAMC,YAAY,GAAGZ,eAAe,CAAES,QAAF,CAApC;AACA,QAAM,CAAEI,KAAF,EAASC,QAAT,IAAsBpB,QAAQ,EAApC;AAEA,QAAMqB,MAAM,GAAGL,UAAU,EAAEG,KAAZ,EAAmBG,OAAnB,EAA4BD,MAA3C;AAEAnB,EAAAA,SAAS,CAAE,MAAM;AAChB,QACC,CAAEgB,YAAF,IACA,SAASA,YAAY,CAACR,aAAb,CAA2BC,WAFrC,EAGE;AACD;AACA;;AAED,UAAMY,GAAG,GAAGhB,cAAc,CAAEW,YAAF,EAAgB,YAAhB,CAA1B;AACA,UAAMM,KAAK,GAAGjB,cAAc,CAAEW,YAAF,EAAgB,cAAhB,CAA5B;AACA,UAAMO,MAAM,GAAGlB,cAAc,CAAEW,YAAF,EAAgB,eAAhB,CAA7B;AACA,UAAMQ,IAAI,GAAGnB,cAAc,CAAEW,YAAF,EAAgB,aAAhB,CAA3B;AAEAE,IAAAA,QAAQ,CAAE;AACTO,MAAAA,cAAc,E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G,MAAAA,UAAU;AACV,KAHD;AAIA,GAdQ,EAcN,CAAEd,MAAF,EAAUJ,SAAV,CAdM,CAAT;;AAgBA,MAAK,CAAEc,QAAF,IAAc,CAAEd,SAArB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,SACC,cAAC,YAAD;AACC,IAAA,QAAQ,EAAGF,QADZ;AAEC,IAAA,qBAAqB,MAFtB;AAGC,IAAA,qBAAqB,EAAGM,MAHzB;AAIC,IAAA,qBAAqB,EAAC,eAJvB;AAKC,IAAA,KAAK,EAAG;AALT,KAOC;AAAK,IAAA,SAAS,EAAC,kCAAf;AAAkD,IAAA,KAAK,EAAGF;AAA1D,IAPD,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../components/block-popover';\nimport { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\nexport function MarginVisualizer( { clientId, attributes, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, setStyle ] = useState();\n\n\tconst margin = attributes?.style?.spacing?.margin;\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! blockElement ||\n\t\t\tnull === blockElement.ownerDocument.defaultView\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst top = getComputedCSS( blockElement, 'margin-top' );\n\t\tconst right = getComputedCSS( blockElement, 'margin-right' );\n\t\tconst bottom = getComputedCSS( blockElement, 'margin-bottom' );\n\t\tconst left = getComputedCSS( blockElement, 'margin-left' );\n\n\t\tsetStyle( {\n\t\t\tborderTopWidth: top,\n\t\t\tborderRightWidth: right,\n\t\t\tborderBottomWidth: bottom,\n\t\t\tborderLeftWidth: left,\n\t\t\ttop: top ? `-${ top }` : 0,\n\t\t\tright: right ? `-${ right }` : 0,\n\t\t\tbottom: bottom ? `-${ bottom }` : 0,\n\t\t\tleft: left ? `-${ left }` : 0,\n\t\t} );\n\t}, [ blockElement, margin ] );\n\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst valueRef = useRef( margin );\n\tconst timeoutRef = useRef();\n\n\tconst clearTimer = () => {\n\t\tif ( timeoutRef.current ) {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! isShallowEqual( margin, valueRef.current ) && ! forceShow ) {\n\t\t\tsetIsActive( true );\n\t\t\tvalueRef.current = margin;\n\n\t\t\ttimeoutRef.current = setTimeout( () => {\n\t\t\t\tsetIsActive( false );\n\t\t\t}, 400 );\n\t\t}\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimer();\n\t\t};\n\t}, [ margin, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ clientId }\n\t\t\t__unstableCoverTarget\n\t\t\t__unstableRefreshSize={ margin }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t\tshift={ false }\n\t\t>\n\t\t\t<div className=\"block-editor__padding-visualizer\" style={ style } />\n\t\t</BlockPopover>\n\t);\n}\n"]}
@@ -25,7 +25,7 @@ export function PaddingVisualizer({
25
25
  const [style, setStyle] = useState();
26
26
  const padding = attributes?.style?.spacing?.padding;
27
27
  useEffect(() => {
28
- if (!blockElement) {
28
+ if (!blockElement || null === blockElement.ownerDocument.defaultView) {
29
29
  return;
30
30
  }
31
31
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/padding.js"],"names":["useState","useRef","useEffect","isShallowEqual","BlockPopover","__unstableUseBlockElement","useBlockElement","getComputedCSS","element","property","ownerDocument","defaultView","getComputedStyle","getPropertyValue","PaddingVisualizer","clientId","attributes","forceShow","blockElement","style","setStyle","padding","spacing","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","isActive","setIsActive","valueRef","timeoutRef","clearTimer","current","window","clearTimeout","setTimeout"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,MAAnB,EAA2BC,SAA3B,QAA4C,oBAA5C;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,6BAAzB;AACA,SAASC,yBAAyB,IAAIC,eAAtC,QAA6D,yDAA7D;;AAEA,SAASC,cAAT,CAAyBC,OAAzB,EAAkCC,QAAlC,EAA6C;AAC5C,SAAOD,OAAO,CAACE,aAAR,CAAsBC,WAAtB,CACLC,gBADK,CACaJ,OADb,EAELK,gBAFK,CAEaJ,QAFb,CAAP;AAGA;;AAED,OAAO,SAASK,iBAAT,CAA4B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,UAAZ;AAAwBC,EAAAA;AAAxB,CAA5B,EAAkE;AACxE,QAAMC,YAAY,GAAGZ,eAAe,CAAES,QAAF,CAApC;AACA,QAAM,CAAEI,KAAF,EAASC,QAAT,IAAsBpB,QAAQ,EAApC;AAEA,QAAMqB,OAAO,GAAGL,UAAU,EAAEG,KAAZ,EAAmBG,OAAnB,EAA4BD,OAA5C;AAEAnB,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAK,CAAEgB,YAAP,EAAsB;AACrB;AACA;;AAEDE,IAAAA,QAAQ,CAAE;AACTG,MAAAA,cAAc,EAAEhB,cAAc,CAAEW,YAAF,EAAgB,aAAhB,CADrB;AAETM,MAAAA,gBAAgB,EAAEjB,cAAc,CAAEW,YAAF,EAAgB,eAAhB,CAFvB;AAGTO,MAAAA,iBAAiB,EAAElB,cAAc,CAAEW,YAAF,EAAgB,gBAAhB,CAHxB;AAITQ,MAAAA,eAAe,EAAEnB,cAAc,CAAEW,YAAF,EAAgB,cAAhB;AAJtB,KAAF,CAAR;AAMA,GA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":["/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../components/block-popover';\nimport { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\nexport function PaddingVisualizer( { clientId, attributes, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, setStyle ] = useState();\n\n\tconst padding = attributes?.style?.spacing?.padding;\n\n\tuseEffect( () => {\n\t\tif ( ! blockElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetStyle( {\n\t\t\tborderTopWidth: getComputedCSS( blockElement, 'padding-top' ),\n\t\t\tborderRightWidth: getComputedCSS( blockElement, 'padding-right' ),\n\t\t\tborderBottomWidth: getComputedCSS( blockElement, 'padding-bottom' ),\n\t\t\tborderLeftWidth: getComputedCSS( blockElement, 'padding-left' ),\n\t\t} );\n\t}, [ blockElement, padding ] );\n\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst valueRef = useRef( padding );\n\tconst timeoutRef = useRef();\n\n\tconst clearTimer = () => {\n\t\tif ( timeoutRef.current ) {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! isShallowEqual( padding, valueRef.current ) && ! forceShow ) {\n\t\t\tsetIsActive( true );\n\t\t\tvalueRef.current = padding;\n\n\t\t\ttimeoutRef.current = setTimeout( () => {\n\t\t\t\tsetIsActive( false );\n\t\t\t}, 400 );\n\t\t}\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimer();\n\t\t};\n\t}, [ padding, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ clientId }\n\t\t\t__unstableCoverTarget\n\t\t\t__unstableRefreshSize={ padding }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t\tshift={ false }\n\t\t>\n\t\t\t<div className=\"block-editor__padding-visualizer\" style={ style } />\n\t\t</BlockPopover>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/padding.js"],"names":["useState","useRef","useEffect","isShallowEqual","BlockPopover","__unstableUseBlockElement","useBlockElement","getComputedCSS","element","property","ownerDocument","defaultView","getComputedStyle","getPropertyValue","PaddingVisualizer","clientId","attributes","forceShow","blockElement","style","setStyle","padding","spacing","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","isActive","setIsActive","valueRef","timeoutRef","clearTimer","current","window","clearTimeout","setTimeout"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,MAAnB,EAA2BC,SAA3B,QAA4C,oBAA5C;AACA,OAAOC,cAAP,MAA2B,6BAA3B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,6BAAzB;AACA,SAASC,yBAAyB,IAAIC,eAAtC,QAA6D,yDAA7D;;AAEA,SAASC,cAAT,CAAyBC,OAAzB,EAAkCC,QAAlC,EAA6C;AAC5C,SAAOD,OAAO,CAACE,aAAR,CAAsBC,WAAtB,CACLC,gBADK,CACaJ,OADb,EAELK,gBAFK,CAEaJ,QAFb,CAAP;AAGA;;AAED,OAAO,SAASK,iBAAT,CAA4B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,UAAZ;AAAwBC,EAAAA;AAAxB,CAA5B,EAAkE;AACxE,QAAMC,YAAY,GAAGZ,eAAe,CAAES,QAAF,CAApC;AACA,QAAM,CAAEI,KAAF,EAASC,QAAT,IAAsBpB,QAAQ,EAApC;AAEA,QAAMqB,OAAO,GAAGL,UAAU,EAAEG,KAAZ,EAAmBG,OAAnB,EAA4BD,OAA5C;AAEAnB,EAAAA,SAAS,CAAE,MAAM;AAChB,QACC,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,GAdQ,EAcN,CAAEV,OAAF,EAAWJ,SAAX,CAdM,CAAT;;AAgBA,MAAK,CAAEU,QAAF,IAAc,CAAEV,SAArB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,SACC,cAAC,YAAD;AACC,IAAA,QAAQ,EAAGF,QADZ;AAEC,IAAA,qBAAqB,MAFtB;AAGC,IAAA,qBAAqB,EAAGM,OAHzB;AAIC,IAAA,qBAAqB,EAAC,eAJvB;AAKC,IAAA,KAAK,EAAG;AALT,KAOC;AAAK,IAAA,SAAS,EAAC,kCAAf;AAAkD,IAAA,KAAK,EAAGF;AAA1D,IAPD,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../components/block-popover';\nimport { __unstableUseBlockElement as useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\nexport function PaddingVisualizer( { clientId, attributes, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, setStyle ] = useState();\n\n\tconst padding = attributes?.style?.spacing?.padding;\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! blockElement ||\n\t\t\tnull === blockElement.ownerDocument.defaultView\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetStyle( {\n\t\t\tborderTopWidth: getComputedCSS( blockElement, 'padding-top' ),\n\t\t\tborderRightWidth: getComputedCSS( blockElement, 'padding-right' ),\n\t\t\tborderBottomWidth: getComputedCSS( blockElement, 'padding-bottom' ),\n\t\t\tborderLeftWidth: getComputedCSS( blockElement, 'padding-left' ),\n\t\t} );\n\t}, [ blockElement, padding ] );\n\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst valueRef = useRef( padding );\n\tconst timeoutRef = useRef();\n\n\tconst clearTimer = () => {\n\t\tif ( timeoutRef.current ) {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! isShallowEqual( padding, valueRef.current ) && ! forceShow ) {\n\t\t\tsetIsActive( true );\n\t\t\tvalueRef.current = padding;\n\n\t\t\ttimeoutRef.current = setTimeout( () => {\n\t\t\t\tsetIsActive( false );\n\t\t\t}, 400 );\n\t\t}\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimer();\n\t\t};\n\t}, [ padding, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ clientId }\n\t\t\t__unstableCoverTarget\n\t\t\t__unstableRefreshSize={ padding }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t\tshift={ false }\n\t\t>\n\t\t\t<div className=\"block-editor__padding-visualizer\" style={ style } />\n\t\t</BlockPopover>\n\t);\n}\n"]}
@@ -1838,7 +1838,7 @@ export const getInserterItems = createSelector((state, rootClientId = null) => {
1838
1838
  title: reusableBlock.title.raw,
1839
1839
  icon,
1840
1840
  category: 'reusable',
1841
- keywords: [],
1841
+ keywords: ['reusable'],
1842
1842
  isDisabled: false,
1843
1843
  utility: 1,
1844
1844
  // Deprecated.