@wordpress/edit-widgets 5.16.0 → 5.17.1

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 (178) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/blocks/widget-area/edit/index.js +4 -16
  3. package/build/blocks/widget-area/edit/index.js.map +1 -1
  4. package/build/blocks/widget-area/edit/inner-blocks.js +5 -10
  5. package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
  6. package/build/blocks/widget-area/edit/use-is-dragging-within.js +5 -10
  7. package/build/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
  8. package/build/blocks/widget-area/index.js +0 -5
  9. package/build/blocks/widget-area/index.js.map +1 -1
  10. package/build/components/error-boundary/index.js +1 -15
  11. package/build/components/error-boundary/index.js.map +1 -1
  12. package/build/components/header/index.js +9 -32
  13. package/build/components/header/index.js.map +1 -1
  14. package/build/components/header/undo-redo/redo.js +3 -9
  15. package/build/components/header/undo-redo/redo.js.map +1 -1
  16. package/build/components/header/undo-redo/undo.js +3 -9
  17. package/build/components/header/undo-redo/undo.js.map +1 -1
  18. package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
  19. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  20. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -9
  21. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  22. package/build/components/keyboard-shortcut-help-modal/index.js +4 -20
  23. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  24. package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
  25. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  26. package/build/components/keyboard-shortcuts/index.js +1 -18
  27. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  28. package/build/components/layout/index.js +2 -19
  29. package/build/components/layout/index.js.map +1 -1
  30. package/build/components/layout/interface.js +5 -21
  31. package/build/components/layout/interface.js.map +1 -1
  32. package/build/components/layout/unsaved-changes-warning.js +0 -6
  33. package/build/components/layout/unsaved-changes-warning.js.map +1 -1
  34. package/build/components/more-menu/index.js +2 -17
  35. package/build/components/more-menu/index.js.map +1 -1
  36. package/build/components/more-menu/tools-more-menu-group.js +1 -5
  37. package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
  38. package/build/components/notices/index.js +1 -6
  39. package/build/components/notices/index.js.map +1 -1
  40. package/build/components/save-button/index.js +1 -7
  41. package/build/components/save-button/index.js.map +1 -1
  42. package/build/components/secondary-sidebar/index.js +1 -10
  43. package/build/components/secondary-sidebar/index.js.map +1 -1
  44. package/build/components/secondary-sidebar/inserter-sidebar.js +1 -11
  45. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  46. package/build/components/secondary-sidebar/list-view-sidebar.js +6 -15
  47. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  48. package/build/components/sidebar/index.js +12 -26
  49. package/build/components/sidebar/index.js.map +1 -1
  50. package/build/components/sidebar/widget-areas.js +1 -12
  51. package/build/components/sidebar/widget-areas.js.map +1 -1
  52. package/build/components/welcome-guide/index.js +3 -12
  53. package/build/components/welcome-guide/index.js.map +1 -1
  54. package/build/components/widget-areas-block-editor-content/index.js +1 -8
  55. package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
  56. package/build/components/widget-areas-block-editor-provider/index.js +8 -23
  57. package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
  58. package/build/constants.js.map +1 -1
  59. package/build/filters/index.js +0 -1
  60. package/build/filters/index.js.map +1 -1
  61. package/build/filters/move-to-widget-area.js +3 -9
  62. package/build/filters/move-to-widget-area.js.map +1 -1
  63. package/build/filters/replace-media-upload.js +1 -3
  64. package/build/filters/replace-media-upload.js.map +1 -1
  65. package/build/hooks/use-last-selected-widget-area.js +5 -13
  66. package/build/hooks/use-last-selected-widget-area.js.map +1 -1
  67. package/build/hooks/use-widget-library-insertion-point.js +6 -14
  68. package/build/hooks/use-widget-library-insertion-point.js.map +1 -1
  69. package/build/index.js +6 -34
  70. package/build/index.js.map +1 -1
  71. package/build/lock-unlock.js +1 -2
  72. package/build/lock-unlock.js.map +1 -1
  73. package/build/store/actions.js +41 -79
  74. package/build/store/actions.js.map +1 -1
  75. package/build/store/constants.js +0 -1
  76. package/build/store/constants.js.map +1 -1
  77. package/build/store/index.js +4 -15
  78. package/build/store/index.js.map +1 -1
  79. package/build/store/reducer.js +4 -16
  80. package/build/store/reducer.js.map +1 -1
  81. package/build/store/resolvers.js +1 -17
  82. package/build/store/resolvers.js.map +1 -1
  83. package/build/store/selectors.js +28 -49
  84. package/build/store/selectors.js.map +1 -1
  85. package/build/store/transformers.js +7 -16
  86. package/build/store/transformers.js.map +1 -1
  87. package/build/store/utils.js +7 -16
  88. package/build/store/utils.js.map +1 -1
  89. package/build-module/blocks/widget-area/edit/index.js +5 -8
  90. package/build-module/blocks/widget-area/edit/index.js.map +1 -1
  91. package/build-module/blocks/widget-area/edit/inner-blocks.js +6 -6
  92. package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
  93. package/build-module/blocks/widget-area/edit/use-is-dragging-within.js +6 -9
  94. package/build-module/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
  95. package/build-module/blocks/widget-area/index.js +1 -1
  96. package/build-module/blocks/widget-area/index.js.map +1 -1
  97. package/build-module/components/error-boundary/index.js +0 -9
  98. package/build-module/components/error-boundary/index.js.map +1 -1
  99. package/build-module/components/header/index.js +9 -17
  100. package/build-module/components/header/index.js.map +1 -1
  101. package/build-module/components/header/undo-redo/redo.js +2 -2
  102. package/build-module/components/header/undo-redo/redo.js.map +1 -1
  103. package/build-module/components/header/undo-redo/undo.js +2 -2
  104. package/build-module/components/header/undo-redo/undo.js.map +1 -1
  105. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  106. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -6
  107. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  108. package/build-module/components/keyboard-shortcut-help-modal/index.js +5 -13
  109. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  110. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -5
  111. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  112. package/build-module/components/keyboard-shortcuts/index.js +1 -10
  113. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  114. package/build-module/components/layout/index.js +2 -8
  115. package/build-module/components/layout/index.js.map +1 -1
  116. package/build-module/components/layout/interface.js +5 -9
  117. package/build-module/components/layout/interface.js.map +1 -1
  118. package/build-module/components/layout/unsaved-changes-warning.js +2 -3
  119. package/build-module/components/layout/unsaved-changes-warning.js.map +1 -1
  120. package/build-module/components/more-menu/index.js +2 -6
  121. package/build-module/components/more-menu/index.js.map +1 -1
  122. package/build-module/components/more-menu/tools-more-menu-group.js +0 -3
  123. package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
  124. package/build-module/components/notices/index.js +0 -3
  125. package/build-module/components/notices/index.js.map +1 -1
  126. package/build-module/components/save-button/index.js +1 -4
  127. package/build-module/components/save-button/index.js.map +1 -1
  128. package/build-module/components/secondary-sidebar/index.js +1 -6
  129. package/build-module/components/secondary-sidebar/index.js.map +1 -1
  130. package/build-module/components/secondary-sidebar/inserter-sidebar.js +1 -2
  131. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  132. package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -7
  133. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  134. package/build-module/components/sidebar/index.js +13 -18
  135. package/build-module/components/sidebar/index.js.map +1 -1
  136. package/build-module/components/sidebar/widget-areas.js +1 -4
  137. package/build-module/components/sidebar/widget-areas.js.map +1 -1
  138. package/build-module/components/welcome-guide/index.js +3 -7
  139. package/build-module/components/welcome-guide/index.js.map +1 -1
  140. package/build-module/components/widget-areas-block-editor-content/index.js +1 -2
  141. package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
  142. package/build-module/components/widget-areas-block-editor-provider/index.js +8 -7
  143. package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
  144. package/build-module/constants.js.map +1 -1
  145. package/build-module/filters/index.js.map +1 -1
  146. package/build-module/filters/move-to-widget-area.js +4 -4
  147. package/build-module/filters/move-to-widget-area.js.map +1 -1
  148. package/build-module/filters/replace-media-upload.js +0 -2
  149. package/build-module/filters/replace-media-upload.js.map +1 -1
  150. package/build-module/hooks/use-last-selected-widget-area.js +7 -9
  151. package/build-module/hooks/use-last-selected-widget-area.js.map +1 -1
  152. package/build-module/hooks/use-widget-library-insertion-point.js +6 -10
  153. package/build-module/hooks/use-widget-library-insertion-point.js.map +1 -1
  154. package/build-module/index.js +8 -20
  155. package/build-module/index.js.map +1 -1
  156. package/build-module/lock-unlock.js.map +1 -1
  157. package/build-module/store/actions.js +43 -56
  158. package/build-module/store/actions.js.map +1 -1
  159. package/build-module/store/constants.js.map +1 -1
  160. package/build-module/store/index.js +6 -6
  161. package/build-module/store/index.js.map +1 -1
  162. package/build-module/store/reducer.js +5 -11
  163. package/build-module/store/reducer.js.map +1 -1
  164. package/build-module/store/resolvers.js +3 -10
  165. package/build-module/store/resolvers.js.map +1 -1
  166. package/build-module/store/selectors.js +29 -38
  167. package/build-module/store/selectors.js.map +1 -1
  168. package/build-module/store/transformers.js +8 -13
  169. package/build-module/store/transformers.js.map +1 -1
  170. package/build-module/store/utils.js +7 -7
  171. package/build-module/store/utils.js.map +1 -1
  172. package/build-style/style-rtl.css +14 -11
  173. package/build-style/style.css +14 -11
  174. package/package.json +28 -27
  175. package/src/components/keyboard-shortcut-help-modal/style.scss +0 -5
  176. package/src/components/widget-areas-block-editor-provider/index.js +3 -3
  177. package/src/index.js +0 -1
  178. package/src/store/selectors.js +10 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/filters/move-to-widget-area.js"],"names":["withMoveToWidgetAreaToolbarItem","BlockEdit","props","clientId","name","blockName","widgetAreas","currentWidgetAreaId","canInsertBlockInWidgetArea","select","selectors","editWidgetsStore","widgetAreaBlock","getParentWidgetAreaBlock","getWidgetAreas","attributes","id","moveBlockToWidgetArea","hasMultipleWidgetAreas","length","isMoveToWidgetAreaVisible","widgetAreaId"],"mappings":";;;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAGA,MAAMA,+BAA+B,GAAG,yCACrCC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,IAAI,EAAEC;AAAlB,MAAgCH,KAAtC;AACA,QAAM;AAAEI,IAAAA,WAAF;AAAeC,IAAAA,mBAAf;AAAoCC,IAAAA;AAApC,MACL,qBACGC,MAAF,IAAc;AACb;AACA,QAAKJ,SAAS,KAAK,kBAAnB,EAAwC;AACvC,aAAO,EAAP;AACA;;AAED,UAAMK,SAAS,GAAGD,MAAM,CAAEE,YAAF,CAAxB;AAEA,UAAMC,eAAe,GACpBF,SAAS,CAACG,wBAAV,CAAoCV,QAApC,CADD;AAGA,WAAO;AACNG,MAAAA,WAAW,EAAEI,SAAS,CAACI,cAAV,EADP;AAENP,MAAAA,mBAAmB,EAAEK,eAAe,EAAEG,UAAjB,EAA6BC,EAF5C;AAGNR,MAAAA,0BAA0B,EACzBE,SAAS,CAACF,0BAAV,CAAsCH,SAAtC;AAJK,KAAP;AAMA,GAlBF,EAmBC,CAAEF,QAAF,EAAYE,SAAZ,CAnBD,CADD;AAuBA,QAAM;AAAEY,IAAAA;AAAF,MAA4B,uBAAaN,YAAb,CAAlC;AACA,QAAMO,sBAAsB,GAAGZ,WAAW,EAAEa,MAAb,GAAsB,CAArD;AACA,QAAMC,yBAAyB,GAC9Bf,SAAS,KAAK,kBAAd,IACAa,sBADA,IAEAV,0BAHD;AAKA,SACC,qDACC,4BAAC,SAAD,OAAgBN;AAAhB,IADD,EAEGkB,yBAAyB,IAC1B,4BAAC,0BAAD,QACC,4BAAC,yBAAD;AACC,IAAA,WAAW,EAAGd,WADf;AAEC,IAAA,mBAAmB,EAAGC,mBAFvB;AAGC,IAAA,QAAQ,EAAKc,YAAF,IAAoB;AAC9BJ,MAAAA,qBAAqB,CACpBf,KAAK,CAACC,QADc,EAEpBkB,YAFoB,CAArB;AAIA;AARF,IADD,CAHF,CADD;AAmBA,CApDsC,EAqDvC,iCArDuC,CAAxC;AAwDA,sBACC,kBADD,EAEC,8BAFD,EAGCrB,+BAHD","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { BlockControls } from '@wordpress/block-editor';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { MoveToWidgetArea } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../store';\n\nconst withMoveToWidgetAreaToolbarItem = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { clientId, name: blockName } = props;\n\t\tconst { widgetAreas, currentWidgetAreaId, canInsertBlockInWidgetArea } =\n\t\t\tuseSelect(\n\t\t\t\t( select ) => {\n\t\t\t\t\t// Component won't display for a widget area, so don't run selectors.\n\t\t\t\t\tif ( blockName === 'core/widget-area' ) {\n\t\t\t\t\t\treturn {};\n\t\t\t\t\t}\n\n\t\t\t\t\tconst selectors = select( editWidgetsStore );\n\n\t\t\t\t\tconst widgetAreaBlock =\n\t\t\t\t\t\tselectors.getParentWidgetAreaBlock( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\twidgetAreas: selectors.getWidgetAreas(),\n\t\t\t\t\t\tcurrentWidgetAreaId: widgetAreaBlock?.attributes?.id,\n\t\t\t\t\t\tcanInsertBlockInWidgetArea:\n\t\t\t\t\t\t\tselectors.canInsertBlockInWidgetArea( blockName ),\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ clientId, blockName ]\n\t\t\t);\n\n\t\tconst { moveBlockToWidgetArea } = useDispatch( editWidgetsStore );\n\t\tconst hasMultipleWidgetAreas = widgetAreas?.length > 1;\n\t\tconst isMoveToWidgetAreaVisible =\n\t\t\tblockName !== 'core/widget-area' &&\n\t\t\thasMultipleWidgetAreas &&\n\t\t\tcanInsertBlockInWidgetArea;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isMoveToWidgetAreaVisible && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<MoveToWidgetArea\n\t\t\t\t\t\t\twidgetAreas={ widgetAreas }\n\t\t\t\t\t\t\tcurrentWidgetAreaId={ currentWidgetAreaId }\n\t\t\t\t\t\t\tonSelect={ ( widgetAreaId ) => {\n\t\t\t\t\t\t\t\tmoveBlockToWidgetArea(\n\t\t\t\t\t\t\t\t\tprops.clientId,\n\t\t\t\t\t\t\t\t\twidgetAreaId\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\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withMoveToWidgetAreaToolbarItem'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-widgets/block-edit',\n\twithMoveToWidgetAreaToolbarItem\n);\n"]}
1
+ {"version":3,"names":["_blockEditor","require","_compose","_data","_hooks","_widgets","_store","withMoveToWidgetAreaToolbarItem","createHigherOrderComponent","BlockEdit","props","clientId","name","blockName","widgetAreas","currentWidgetAreaId","canInsertBlockInWidgetArea","useSelect","select","selectors","editWidgetsStore","widgetAreaBlock","getParentWidgetAreaBlock","getWidgetAreas","attributes","id","moveBlockToWidgetArea","useDispatch","hasMultipleWidgetAreas","length","isMoveToWidgetAreaVisible","_element","createElement","Fragment","BlockControls","MoveToWidgetArea","onSelect","widgetAreaId","addFilter"],"sources":["@wordpress/edit-widgets/src/filters/move-to-widget-area.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { BlockControls } from '@wordpress/block-editor';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { MoveToWidgetArea } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../store';\n\nconst withMoveToWidgetAreaToolbarItem = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { clientId, name: blockName } = props;\n\t\tconst { widgetAreas, currentWidgetAreaId, canInsertBlockInWidgetArea } =\n\t\t\tuseSelect(\n\t\t\t\t( select ) => {\n\t\t\t\t\t// Component won't display for a widget area, so don't run selectors.\n\t\t\t\t\tif ( blockName === 'core/widget-area' ) {\n\t\t\t\t\t\treturn {};\n\t\t\t\t\t}\n\n\t\t\t\t\tconst selectors = select( editWidgetsStore );\n\n\t\t\t\t\tconst widgetAreaBlock =\n\t\t\t\t\t\tselectors.getParentWidgetAreaBlock( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\twidgetAreas: selectors.getWidgetAreas(),\n\t\t\t\t\t\tcurrentWidgetAreaId: widgetAreaBlock?.attributes?.id,\n\t\t\t\t\t\tcanInsertBlockInWidgetArea:\n\t\t\t\t\t\t\tselectors.canInsertBlockInWidgetArea( blockName ),\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ clientId, blockName ]\n\t\t\t);\n\n\t\tconst { moveBlockToWidgetArea } = useDispatch( editWidgetsStore );\n\t\tconst hasMultipleWidgetAreas = widgetAreas?.length > 1;\n\t\tconst isMoveToWidgetAreaVisible =\n\t\t\tblockName !== 'core/widget-area' &&\n\t\t\thasMultipleWidgetAreas &&\n\t\t\tcanInsertBlockInWidgetArea;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isMoveToWidgetAreaVisible && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<MoveToWidgetArea\n\t\t\t\t\t\t\twidgetAreas={ widgetAreas }\n\t\t\t\t\t\t\tcurrentWidgetAreaId={ currentWidgetAreaId }\n\t\t\t\t\t\t\tonSelect={ ( widgetAreaId ) => {\n\t\t\t\t\t\t\t\tmoveBlockToWidgetArea(\n\t\t\t\t\t\t\t\t\tprops.clientId,\n\t\t\t\t\t\t\t\t\twidgetAreaId\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\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withMoveToWidgetAreaToolbarItem'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-widgets/block-edit',\n\twithMoveToWidgetAreaToolbarItem\n);\n"],"mappings":";;;AAIA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAbA;AACA;AACA;;AAQA;AACA;AACA;;AAGA,MAAMM,+BAA+B,GAAG,IAAAC,mCAA0B,EAC/DC,SAAS,IAAQC,KAAK,IAAM;EAC7B,MAAM;IAAEC,QAAQ;IAAEC,IAAI,EAAEC;EAAU,CAAC,GAAGH,KAAK;EAC3C,MAAM;IAAEI,WAAW;IAAEC,mBAAmB;IAAEC;EAA2B,CAAC,GACrE,IAAAC,eAAS,EACNC,MAAM,IAAM;IACb;IACA,IAAKL,SAAS,KAAK,kBAAkB,EAAG;MACvC,OAAO,CAAC,CAAC;IACV;IAEA,MAAMM,SAAS,GAAGD,MAAM,CAAEE,YAAiB,CAAC;IAE5C,MAAMC,eAAe,GACpBF,SAAS,CAACG,wBAAwB,CAAEX,QAAS,CAAC;IAE/C,OAAO;MACNG,WAAW,EAAEK,SAAS,CAACI,cAAc,CAAC,CAAC;MACvCR,mBAAmB,EAAEM,eAAe,EAAEG,UAAU,EAAEC,EAAE;MACpDT,0BAA0B,EACzBG,SAAS,CAACH,0BAA0B,CAAEH,SAAU;IAClD,CAAC;EACF,CAAC,EACD,CAAEF,QAAQ,EAAEE,SAAS,CACtB,CAAC;EAEF,MAAM;IAAEa;EAAsB,CAAC,GAAG,IAAAC,iBAAW,EAAEP,YAAiB,CAAC;EACjE,MAAMQ,sBAAsB,GAAGd,WAAW,EAAEe,MAAM,GAAG,CAAC;EACtD,MAAMC,yBAAyB,GAC9BjB,SAAS,KAAK,kBAAkB,IAChCe,sBAAsB,IACtBZ,0BAA0B;EAE3B,OACC,IAAAe,QAAA,CAAAC,aAAA,EAAAD,QAAA,CAAAE,QAAA,QACC,IAAAF,QAAA,CAAAC,aAAA,EAACvB,SAAS;IAAA,GAAMC;EAAK,CAAI,CAAC,EACxBoB,yBAAyB,IAC1B,IAAAC,QAAA,CAAAC,aAAA,EAAChC,YAAA,CAAAkC,aAAa,QACb,IAAAH,QAAA,CAAAC,aAAA,EAAC3B,QAAA,CAAA8B,gBAAgB;IAChBrB,WAAW,EAAGA,WAAa;IAC3BC,mBAAmB,EAAGA,mBAAqB;IAC3CqB,QAAQ,EAAKC,YAAY,IAAM;MAC9BX,qBAAqB,CACpBhB,KAAK,CAACC,QAAQ,EACd0B,YACD,CAAC;IACF;EAAG,CACH,CACa,CAEf,CAAC;AAEL,CAAC,EACD,iCACD,CAAC;AAED,IAAAC,gBAAS,EACR,kBAAkB,EAClB,8BAA8B,EAC9B/B,+BACD,CAAC"}
@@ -1,13 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _hooks = require("@wordpress/hooks");
4
-
5
4
  var _mediaUtils = require("@wordpress/media-utils");
6
-
7
5
  /**
8
6
  * WordPress dependencies
9
7
  */
10
- const replaceMediaUpload = () => _mediaUtils.MediaUpload;
11
8
 
9
+ const replaceMediaUpload = () => _mediaUtils.MediaUpload;
12
10
  (0, _hooks.addFilter)('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload);
13
11
  //# sourceMappingURL=replace-media-upload.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/filters/replace-media-upload.js"],"names":["replaceMediaUpload","MediaUpload"],"mappings":";;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,kBAAkB,GAAG,MAAMC,uBAAjC;;AAEA,sBACC,oBADD,EAEC,wCAFD,EAGCD,kBAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { MediaUpload } from '@wordpress/media-utils';\n\nconst replaceMediaUpload = () => MediaUpload;\n\naddFilter(\n\t'editor.MediaUpload',\n\t'core/edit-widgets/replace-media-upload',\n\treplaceMediaUpload\n);\n"]}
1
+ {"version":3,"names":["_hooks","require","_mediaUtils","replaceMediaUpload","MediaUpload","addFilter"],"sources":["@wordpress/edit-widgets/src/filters/replace-media-upload.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { MediaUpload } from '@wordpress/media-utils';\n\nconst replaceMediaUpload = () => MediaUpload;\n\naddFilter(\n\t'editor.MediaUpload',\n\t'core/edit-widgets/replace-media-upload',\n\treplaceMediaUpload\n);\n"],"mappings":";;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAME,kBAAkB,GAAGA,CAAA,KAAMC,uBAAW;AAE5C,IAAAC,gBAAS,EACR,oBAAoB,EACpB,wCAAwC,EACxCF,kBACD,CAAC"}
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _data = require("@wordpress/data");
9
-
10
8
  var _blockEditor = require("@wordpress/block-editor");
11
-
12
9
  var _coreData = require("@wordpress/core-data");
13
-
14
10
  var _store = require("../store");
15
-
16
11
  var _utils = require("../store/utils");
17
-
18
12
  /**
19
13
  * WordPress dependencies
20
14
  */
@@ -34,31 +28,29 @@ const useLastSelectedWidgetArea = () => (0, _data.useSelect)(select => {
34
28
  getBlockSelectionEnd,
35
29
  getBlockName
36
30
  } = select(_blockEditor.store);
37
- const selectionEndClientId = getBlockSelectionEnd(); // If the selected block is a widget area, return its clientId.
31
+ const selectionEndClientId = getBlockSelectionEnd();
38
32
 
33
+ // If the selected block is a widget area, return its clientId.
39
34
  if (getBlockName(selectionEndClientId) === 'core/widget-area') {
40
35
  return selectionEndClientId;
41
36
  }
42
-
43
37
  const {
44
38
  getParentWidgetAreaBlock
45
39
  } = select(_store.store);
46
40
  const widgetAreaBlock = getParentWidgetAreaBlock(selectionEndClientId);
47
41
  const widgetAreaBlockClientId = widgetAreaBlock?.clientId;
48
-
49
42
  if (widgetAreaBlockClientId) {
50
43
  return widgetAreaBlockClientId;
51
- } // If no widget area has been selected, return the clientId of the first
52
- // area.
53
-
44
+ }
54
45
 
46
+ // If no widget area has been selected, return the clientId of the first
47
+ // area.
55
48
  const {
56
49
  getEntityRecord
57
50
  } = select(_coreData.store);
58
51
  const widgetAreasPost = getEntityRecord(_utils.KIND, _utils.POST_TYPE, (0, _utils.buildWidgetAreasPostId)());
59
52
  return widgetAreasPost?.blocks[0]?.clientId;
60
53
  }, []);
61
-
62
54
  var _default = useLastSelectedWidgetArea;
63
55
  exports.default = _default;
64
56
  //# sourceMappingURL=use-last-selected-widget-area.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/hooks/use-last-selected-widget-area.js"],"names":["useLastSelectedWidgetArea","select","getBlockSelectionEnd","getBlockName","blockEditorStore","selectionEndClientId","getParentWidgetAreaBlock","widgetsEditorStore","widgetAreaBlock","widgetAreaBlockClientId","clientId","getEntityRecord","coreStore","widgetAreasPost","KIND","POST_TYPE","blocks"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,yBAAyB,GAAG,MACjC,qBAAaC,MAAF,IAAc;AACxB,QAAM;AAAEC,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MACLF,MAAM,CAAEG,kBAAF,CADP;AAEA,QAAMC,oBAAoB,GAAGH,oBAAoB,EAAjD,CAHwB,CAKxB;;AACA,MAAKC,YAAY,CAAEE,oBAAF,CAAZ,KAAyC,kBAA9C,EAAmE;AAClE,WAAOA,oBAAP;AACA;;AAED,QAAM;AAAEC,IAAAA;AAAF,MAA+BL,MAAM,CAAEM,YAAF,CAA3C;AACA,QAAMC,eAAe,GACpBF,wBAAwB,CAAED,oBAAF,CADzB;AAEA,QAAMI,uBAAuB,GAAGD,eAAe,EAAEE,QAAjD;;AAEA,MAAKD,uBAAL,EAA+B;AAC9B,WAAOA,uBAAP;AACA,GAjBuB,CAmBxB;AACA;;;AACA,QAAM;AAAEE,IAAAA;AAAF,MAAsBV,MAAM,CAAEW,eAAF,CAAlC;AACA,QAAMC,eAAe,GAAGF,eAAe,CACtCG,WADsC,EAEtCC,gBAFsC,EAGtC,oCAHsC,CAAvC;AAKA,SAAOF,eAAe,EAAEG,MAAjB,CAAyB,CAAzB,GAA8BN,QAArC;AACA,CA5BD,EA4BG,EA5BH,CADD;;eA+BeV,yB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as widgetsEditorStore } from '../store';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';\n\n/**\n * A react hook that returns the client id of the last widget area to have\n * been selected, or to have a selected block within it.\n *\n * @return {string} clientId of the widget area last selected.\n */\nconst useLastSelectedWidgetArea = () =>\n\tuseSelect( ( select ) => {\n\t\tconst { getBlockSelectionEnd, getBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionEndClientId = getBlockSelectionEnd();\n\n\t\t// If the selected block is a widget area, return its clientId.\n\t\tif ( getBlockName( selectionEndClientId ) === 'core/widget-area' ) {\n\t\t\treturn selectionEndClientId;\n\t\t}\n\n\t\tconst { getParentWidgetAreaBlock } = select( widgetsEditorStore );\n\t\tconst widgetAreaBlock =\n\t\t\tgetParentWidgetAreaBlock( selectionEndClientId );\n\t\tconst widgetAreaBlockClientId = widgetAreaBlock?.clientId;\n\n\t\tif ( widgetAreaBlockClientId ) {\n\t\t\treturn widgetAreaBlockClientId;\n\t\t}\n\n\t\t// If no widget area has been selected, return the clientId of the first\n\t\t// area.\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst widgetAreasPost = getEntityRecord(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tbuildWidgetAreasPostId()\n\t\t);\n\t\treturn widgetAreasPost?.blocks[ 0 ]?.clientId;\n\t}, [] );\n\nexport default useLastSelectedWidgetArea;\n"]}
1
+ {"version":3,"names":["_data","require","_blockEditor","_coreData","_store","_utils","useLastSelectedWidgetArea","useSelect","select","getBlockSelectionEnd","getBlockName","blockEditorStore","selectionEndClientId","getParentWidgetAreaBlock","widgetsEditorStore","widgetAreaBlock","widgetAreaBlockClientId","clientId","getEntityRecord","coreStore","widgetAreasPost","KIND","POST_TYPE","buildWidgetAreasPostId","blocks","_default","exports","default"],"sources":["@wordpress/edit-widgets/src/hooks/use-last-selected-widget-area.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as widgetsEditorStore } from '../store';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';\n\n/**\n * A react hook that returns the client id of the last widget area to have\n * been selected, or to have a selected block within it.\n *\n * @return {string} clientId of the widget area last selected.\n */\nconst useLastSelectedWidgetArea = () =>\n\tuseSelect( ( select ) => {\n\t\tconst { getBlockSelectionEnd, getBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionEndClientId = getBlockSelectionEnd();\n\n\t\t// If the selected block is a widget area, return its clientId.\n\t\tif ( getBlockName( selectionEndClientId ) === 'core/widget-area' ) {\n\t\t\treturn selectionEndClientId;\n\t\t}\n\n\t\tconst { getParentWidgetAreaBlock } = select( widgetsEditorStore );\n\t\tconst widgetAreaBlock =\n\t\t\tgetParentWidgetAreaBlock( selectionEndClientId );\n\t\tconst widgetAreaBlockClientId = widgetAreaBlock?.clientId;\n\n\t\tif ( widgetAreaBlockClientId ) {\n\t\t\treturn widgetAreaBlockClientId;\n\t\t}\n\n\t\t// If no widget area has been selected, return the clientId of the first\n\t\t// area.\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst widgetAreasPost = getEntityRecord(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tbuildWidgetAreasPostId()\n\t\t);\n\t\treturn widgetAreasPost?.blocks[ 0 ]?.clientId;\n\t}, [] );\n\nexport default useLastSelectedWidgetArea;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,yBAAyB,GAAGA,CAAA,KACjC,IAAAC,eAAS,EAAIC,MAAM,IAAM;EACxB,MAAM;IAAEC,oBAAoB;IAAEC;EAAa,CAAC,GAC3CF,MAAM,CAAEG,kBAAiB,CAAC;EAC3B,MAAMC,oBAAoB,GAAGH,oBAAoB,CAAC,CAAC;;EAEnD;EACA,IAAKC,YAAY,CAAEE,oBAAqB,CAAC,KAAK,kBAAkB,EAAG;IAClE,OAAOA,oBAAoB;EAC5B;EAEA,MAAM;IAAEC;EAAyB,CAAC,GAAGL,MAAM,CAAEM,YAAmB,CAAC;EACjE,MAAMC,eAAe,GACpBF,wBAAwB,CAAED,oBAAqB,CAAC;EACjD,MAAMI,uBAAuB,GAAGD,eAAe,EAAEE,QAAQ;EAEzD,IAAKD,uBAAuB,EAAG;IAC9B,OAAOA,uBAAuB;EAC/B;;EAEA;EACA;EACA,MAAM;IAAEE;EAAgB,CAAC,GAAGV,MAAM,CAAEW,eAAU,CAAC;EAC/C,MAAMC,eAAe,GAAGF,eAAe,CACtCG,WAAI,EACJC,gBAAS,EACT,IAAAC,6BAAsB,EAAC,CACxB,CAAC;EACD,OAAOH,eAAe,EAAEI,MAAM,CAAE,CAAC,CAAE,EAAEP,QAAQ;AAC9C,CAAC,EAAE,EAAG,CAAC;AAAC,IAAAQ,QAAA,GAEMnB,yBAAyB;AAAAoB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _data = require("@wordpress/data");
9
-
10
8
  var _blockEditor = require("@wordpress/block-editor");
11
-
12
9
  var _coreData = require("@wordpress/core-data");
13
-
14
10
  var _store = require("../store");
15
-
16
11
  var _utils = require("../store/utils");
17
-
18
12
  /**
19
13
  * WordPress dependencies
20
14
  */
@@ -22,6 +16,7 @@ var _utils = require("../store/utils");
22
16
  /**
23
17
  * Internal dependencies
24
18
  */
19
+
25
20
  const useWidgetLibraryInsertionPoint = () => {
26
21
  const firstRootId = (0, _data.useSelect)(select => {
27
22
  // Default to the first widget area
@@ -38,34 +33,31 @@ const useWidgetLibraryInsertionPoint = () => {
38
33
  getBlockOrder,
39
34
  getBlockIndex
40
35
  } = select(_blockEditor.store);
36
+ const insertionPoint = select(_store.store).__experimentalGetInsertionPoint();
41
37
 
42
- const insertionPoint = select(_store.store).__experimentalGetInsertionPoint(); // "Browse all" in the quick inserter will set the rootClientId to the current block.
38
+ // "Browse all" in the quick inserter will set the rootClientId to the current block.
43
39
  // Otherwise, it will just be undefined, and we'll have to handle it differently below.
44
-
45
-
46
40
  if (insertionPoint.rootClientId) {
47
41
  return insertionPoint;
48
42
  }
49
-
50
43
  const clientId = getBlockSelectionEnd() || firstRootId;
51
- const rootClientId = getBlockRootClientId(clientId); // If the selected block is at the root level, it's a widget area and
44
+ const rootClientId = getBlockRootClientId(clientId);
45
+
46
+ // If the selected block is at the root level, it's a widget area and
52
47
  // blocks can't be inserted here. Return this block as the root and the
53
48
  // last child clientId indicating insertion at the end.
54
-
55
49
  if (clientId && rootClientId === '') {
56
50
  return {
57
51
  rootClientId: clientId,
58
52
  insertionIndex: getBlockOrder(clientId).length
59
53
  };
60
54
  }
61
-
62
55
  return {
63
56
  rootClientId,
64
57
  insertionIndex: getBlockIndex(clientId) + 1
65
58
  };
66
59
  }, [firstRootId]);
67
60
  };
68
-
69
61
  var _default = useWidgetLibraryInsertionPoint;
70
62
  exports.default = _default;
71
63
  //# sourceMappingURL=use-widget-library-insertion-point.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/hooks/use-widget-library-insertion-point.js"],"names":["useWidgetLibraryInsertionPoint","firstRootId","select","getEntityRecord","coreStore","widgetAreasPost","KIND","POST_TYPE","blocks","clientId","getBlockRootClientId","getBlockSelectionEnd","getBlockOrder","getBlockIndex","blockEditorStore","insertionPoint","editWidgetsStore","__experimentalGetInsertionPoint","rootClientId","insertionIndex","length"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIA,MAAMA,8BAA8B,GAAG,MAAM;AAC5C,QAAMC,WAAW,GAAG,qBAAaC,MAAF,IAAc;AAC5C;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEE,eAAF,CAAlC;AACA,UAAMC,eAAe,GAAGF,eAAe,CACtCG,WADsC,EAEtCC,gBAFsC,EAGtC,oCAHsC,CAAvC;AAKA,WAAOF,eAAe,EAAEG,MAAjB,CAAyB,CAAzB,GAA8BC,QAArC;AACA,GATmB,EASjB,EATiB,CAApB;AAWA,SAAO,qBACJP,MAAF,IAAc;AACb,UAAM;AACLQ,MAAAA,oBADK;AAELC,MAAAA,oBAFK;AAGLC,MAAAA,aAHK;AAILC,MAAAA;AAJK,QAKFX,MAAM,CAAEY,kBAAF,CALV;;AAOA,UAAMC,cAAc,GACnBb,MAAM,CAAEc,YAAF,CAAN,CAA2BC,+BAA3B,EADD,CARa,CAWb;AACA;;;AACA,QAAKF,cAAc,CAACG,YAApB,EAAmC;AAClC,aAAOH,cAAP;AACA;;AAED,UAAMN,QAAQ,GAAGE,oBAAoB,MAAMV,WAA3C;AACA,UAAMiB,YAAY,GAAGR,oBAAoB,CAAED,QAAF,CAAzC,CAlBa,CAoBb;AACA;AACA;;AACA,QAAKA,QAAQ,IAAIS,YAAY,KAAK,EAAlC,EAAuC;AACtC,aAAO;AACNA,QAAAA,YAAY,EAAET,QADR;AAENU,QAAAA,cAAc,EAAEP,aAAa,CAAEH,QAAF,CAAb,CAA0BW;AAFpC,OAAP;AAIA;;AAED,WAAO;AACNF,MAAAA,YADM;AAENC,MAAAA,cAAc,EAAEN,aAAa,CAAEJ,QAAF,CAAb,GAA4B;AAFtC,KAAP;AAIA,GAnCK,EAoCN,CAAER,WAAF,CApCM,CAAP;AAsCA,CAlDD;;eAoDeD,8B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../store';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';\n\nconst useWidgetLibraryInsertionPoint = () => {\n\tconst firstRootId = useSelect( ( select ) => {\n\t\t// Default to the first widget area\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst widgetAreasPost = getEntityRecord(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tbuildWidgetAreasPostId()\n\t\t);\n\t\treturn widgetAreasPost?.blocks[ 0 ]?.clientId;\n\t}, [] );\n\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockSelectionEnd,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockIndex,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst insertionPoint =\n\t\t\t\tselect( editWidgetsStore ).__experimentalGetInsertionPoint();\n\n\t\t\t// \"Browse all\" in the quick inserter will set the rootClientId to the current block.\n\t\t\t// Otherwise, it will just be undefined, and we'll have to handle it differently below.\n\t\t\tif ( insertionPoint.rootClientId ) {\n\t\t\t\treturn insertionPoint;\n\t\t\t}\n\n\t\t\tconst clientId = getBlockSelectionEnd() || firstRootId;\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t// If the selected block is at the root level, it's a widget area and\n\t\t\t// blocks can't be inserted here. Return this block as the root and the\n\t\t\t// last child clientId indicating insertion at the end.\n\t\t\tif ( clientId && rootClientId === '' ) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: clientId,\n\t\t\t\t\tinsertionIndex: getBlockOrder( clientId ).length,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\trootClientId,\n\t\t\t\tinsertionIndex: getBlockIndex( clientId ) + 1,\n\t\t\t};\n\t\t},\n\t\t[ firstRootId ]\n\t);\n};\n\nexport default useWidgetLibraryInsertionPoint;\n"]}
1
+ {"version":3,"names":["_data","require","_blockEditor","_coreData","_store","_utils","useWidgetLibraryInsertionPoint","firstRootId","useSelect","select","getEntityRecord","coreStore","widgetAreasPost","KIND","POST_TYPE","buildWidgetAreasPostId","blocks","clientId","getBlockRootClientId","getBlockSelectionEnd","getBlockOrder","getBlockIndex","blockEditorStore","insertionPoint","editWidgetsStore","__experimentalGetInsertionPoint","rootClientId","insertionIndex","length","_default","exports","default"],"sources":["@wordpress/edit-widgets/src/hooks/use-widget-library-insertion-point.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../store';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';\n\nconst useWidgetLibraryInsertionPoint = () => {\n\tconst firstRootId = useSelect( ( select ) => {\n\t\t// Default to the first widget area\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst widgetAreasPost = getEntityRecord(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tbuildWidgetAreasPostId()\n\t\t);\n\t\treturn widgetAreasPost?.blocks[ 0 ]?.clientId;\n\t}, [] );\n\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockSelectionEnd,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockIndex,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst insertionPoint =\n\t\t\t\tselect( editWidgetsStore ).__experimentalGetInsertionPoint();\n\n\t\t\t// \"Browse all\" in the quick inserter will set the rootClientId to the current block.\n\t\t\t// Otherwise, it will just be undefined, and we'll have to handle it differently below.\n\t\t\tif ( insertionPoint.rootClientId ) {\n\t\t\t\treturn insertionPoint;\n\t\t\t}\n\n\t\t\tconst clientId = getBlockSelectionEnd() || firstRootId;\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t// If the selected block is at the root level, it's a widget area and\n\t\t\t// blocks can't be inserted here. Return this block as the root and the\n\t\t\t// last child clientId indicating insertion at the end.\n\t\t\tif ( clientId && rootClientId === '' ) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: clientId,\n\t\t\t\t\tinsertionIndex: getBlockOrder( clientId ).length,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\trootClientId,\n\t\t\t\tinsertionIndex: getBlockIndex( clientId ) + 1,\n\t\t\t};\n\t\t},\n\t\t[ firstRootId ]\n\t);\n};\n\nexport default useWidgetLibraryInsertionPoint;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAIA,MAAMK,8BAA8B,GAAGA,CAAA,KAAM;EAC5C,MAAMC,WAAW,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5C;IACA,MAAM;MAAEC;IAAgB,CAAC,GAAGD,MAAM,CAAEE,eAAU,CAAC;IAC/C,MAAMC,eAAe,GAAGF,eAAe,CACtCG,WAAI,EACJC,gBAAS,EACT,IAAAC,6BAAsB,EAAC,CACxB,CAAC;IACD,OAAOH,eAAe,EAAEI,MAAM,CAAE,CAAC,CAAE,EAAEC,QAAQ;EAC9C,CAAC,EAAE,EAAG,CAAC;EAEP,OAAO,IAAAT,eAAS,EACbC,MAAM,IAAM;IACb,MAAM;MACLS,oBAAoB;MACpBC,oBAAoB;MACpBC,aAAa;MACbC;IACD,CAAC,GAAGZ,MAAM,CAAEa,kBAAiB,CAAC;IAE9B,MAAMC,cAAc,GACnBd,MAAM,CAAEe,YAAiB,CAAC,CAACC,+BAA+B,CAAC,CAAC;;IAE7D;IACA;IACA,IAAKF,cAAc,CAACG,YAAY,EAAG;MAClC,OAAOH,cAAc;IACtB;IAEA,MAAMN,QAAQ,GAAGE,oBAAoB,CAAC,CAAC,IAAIZ,WAAW;IACtD,MAAMmB,YAAY,GAAGR,oBAAoB,CAAED,QAAS,CAAC;;IAErD;IACA;IACA;IACA,IAAKA,QAAQ,IAAIS,YAAY,KAAK,EAAE,EAAG;MACtC,OAAO;QACNA,YAAY,EAAET,QAAQ;QACtBU,cAAc,EAAEP,aAAa,CAAEH,QAAS,CAAC,CAACW;MAC3C,CAAC;IACF;IAEA,OAAO;MACNF,YAAY;MACZC,cAAc,EAAEN,aAAa,CAAEJ,QAAS,CAAC,GAAG;IAC7C,CAAC;EACF,CAAC,EACD,CAAEV,WAAW,CACd,CAAC;AACF,CAAC;AAAC,IAAAsB,QAAA,GAEavB,8BAA8B;AAAAwB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
package/build/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -14,37 +13,21 @@ Object.defineProperty(exports, "store", {
14
13
  return _store.store;
15
14
  }
16
15
  });
17
-
18
16
  var _element = require("@wordpress/element");
19
-
20
17
  var _blocks = require("@wordpress/blocks");
21
-
22
18
  var _data = require("@wordpress/data");
23
-
24
19
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
25
-
26
20
  var _blockLibrary = require("@wordpress/block-library");
27
-
28
21
  var _coreData = require("@wordpress/core-data");
29
-
30
22
  var _widgets = require("@wordpress/widgets");
31
-
32
23
  var _preferences = require("@wordpress/preferences");
33
-
34
24
  var _store = require("./store");
35
-
36
25
  require("./filters");
37
-
38
26
  var widgetArea = _interopRequireWildcard(require("./blocks/widget-area"));
39
-
40
27
  var _layout = _interopRequireDefault(require("./components/layout"));
41
-
42
28
  var _constants = require("./constants");
43
-
44
29
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
45
-
46
30
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
47
-
48
31
  /**
49
32
  * WordPress dependencies
50
33
  */
@@ -52,14 +35,15 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
52
35
  /**
53
36
  * Internal dependencies
54
37
  */
38
+
55
39
  const disabledBlocks = ['core/more', 'core/freeform', 'core/template-part', ...(_constants.ALLOW_REUSABLE_BLOCKS ? [] : ['core/block'])];
40
+
56
41
  /**
57
42
  * Initializes the block editor in the widgets screen.
58
43
  *
59
44
  * @param {string} id ID of the root element to render the screen in.
60
45
  * @param {Object} settings Block editor settings.
61
46
  */
62
-
63
47
  function initializeEditor(id, settings) {
64
48
  const target = document.getElementById(id);
65
49
  const root = (0, _element.createRoot)(target);
@@ -72,73 +56,61 @@ function initializeEditor(id, settings) {
72
56
  showBlockBreadcrumbs: true,
73
57
  themeStyles: true
74
58
  });
75
-
76
59
  (0, _data.dispatch)(_blocks.store).__experimentalReapplyBlockTypeFilters();
77
-
78
60
  (0, _blockLibrary.registerCoreBlocks)(coreBlocks);
79
61
  (0, _widgets.registerLegacyWidgetBlock)();
80
-
81
62
  if (process.env.IS_GUTENBERG_PLUGIN) {
82
63
  (0, _blockLibrary.__experimentalRegisterExperimentalCoreBlocks)({
83
64
  enableFSEBlocks: _constants.ENABLE_EXPERIMENTAL_FSE_BLOCKS
84
65
  });
85
66
  }
86
-
87
67
  (0, _widgets.registerLegacyWidgetVariations)(settings);
88
68
  registerBlock(widgetArea);
89
69
  (0, _widgets.registerWidgetGroupBlock)();
70
+ settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0, _coreData.__experimentalFetchLinkSuggestions)(search, searchOptions, settings);
90
71
 
91
- settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0, _coreData.__experimentalFetchLinkSuggestions)(search, searchOptions, settings); // As we are unregistering `core/freeform` to avoid the Classic block, we must
72
+ // As we are unregistering `core/freeform` to avoid the Classic block, we must
92
73
  // replace it with something as the default freeform content handler. Failure to
93
74
  // do this will result in errors in the default block parser.
94
75
  // see: https://github.com/WordPress/gutenberg/issues/33097
95
-
96
-
97
76
  (0, _blocks.setFreeformContentHandlerName)('core/html');
98
77
  root.render((0, _element.createElement)(_layout.default, {
99
78
  blockEditorSettings: settings
100
79
  }));
101
80
  return root;
102
81
  }
82
+
103
83
  /**
104
84
  * Compatibility export under the old `initialize` name.
105
85
  */
106
-
107
-
108
86
  const initialize = initializeEditor;
109
87
  exports.initialize = initialize;
110
-
111
88
  function reinitializeEditor() {
112
89
  (0, _deprecated.default)('wp.editWidgets.reinitializeEditor', {
113
90
  since: '6.2',
114
91
  version: '6.3'
115
92
  });
116
93
  }
94
+
117
95
  /**
118
96
  * Function to register an individual block.
119
97
  *
120
98
  * @param {Object} block The block to be registered.
121
- *
122
99
  */
123
-
124
-
125
100
  const registerBlock = block => {
126
101
  if (!block) {
127
102
  return;
128
103
  }
129
-
130
104
  const {
131
105
  metadata,
132
106
  settings,
133
107
  name
134
108
  } = block;
135
-
136
109
  if (metadata) {
137
110
  (0, _blocks.unstable__bootstrapServerSideBlockDefinitions)({
138
111
  [name]: metadata
139
112
  });
140
113
  }
141
-
142
114
  (0, _blocks.registerBlockType)(name, settings);
143
115
  };
144
116
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/index.js"],"names":["disabledBlocks","ALLOW_REUSABLE_BLOCKS","initializeEditor","id","settings","target","document","getElementById","root","coreBlocks","filter","block","includes","name","startsWith","preferencesStore","setDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","blocksStore","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","ENABLE_EXPERIMENTAL_FSE_BLOCKS","registerBlock","widgetArea","__experimentalFetchLinkSuggestions","search","searchOptions","render","initialize","reinitializeEditor","since","version","metadata"],"mappings":";;;;;;;;;;;;;;;;;AAWA;;AARA;;AAMA;;AACA;;AAEA;;AAKA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAjCA;AACA;AACA;;AAuBA;AACA;AACA;AAWA,MAAMA,cAAc,GAAG,CACtB,WADsB,EAEtB,eAFsB,EAGtB,oBAHsB,EAItB,IAAKC,mCAAwB,EAAxB,GAA6B,CAAE,YAAF,CAAlC,CAJsB,CAAvB;AAOA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,gBAAT,CAA2BC,EAA3B,EAA+BC,QAA/B,EAA0C;AAChD,QAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAT,CAAyBJ,EAAzB,CAAf;AACA,QAAMK,IAAI,GAAG,yBAAYH,MAAZ,CAAb;AAEA,QAAMI,UAAU,GAAG,iDAA8BC,MAA9B,CAAwCC,KAAF,IAAa;AACrE,WAAO,EACNX,cAAc,CAACY,QAAf,CAAyBD,KAAK,CAACE,IAA/B,KACAF,KAAK,CAACE,IAAN,CAAWC,UAAX,CAAuB,WAAvB,CADA,IAEAH,KAAK,CAACE,IAAN,CAAWC,UAAX,CAAuB,YAAvB,CAFA,IAGAH,KAAK,CAACE,IAAN,CAAWC,UAAX,CAAuB,WAAvB,CAHA,IAIAH,KAAK,CAACE,IAAN,CAAWC,UAAX,CAAuB,iBAAvB,CALM,CAAP;AAOA,GARkB,CAAnB;AAUA,sBAAUC,kBAAV,EAA6BC,WAA7B,CAA0C,mBAA1C,EAA+D;AAC9DC,IAAAA,YAAY,EAAE,KADgD;AAE9DC,IAAAA,YAAY,EAAE,IAFgD;AAG9DC,IAAAA,oBAAoB,EAAE,IAHwC;AAI9DC,IAAAA,WAAW,EAAE;AAJiD,GAA/D;;AAOA,sBAAUC,aAAV,EAAwBC,qCAAxB;;AACA,wCAAoBb,UAApB;AACA;;AACA,MAAKc,OAAO,CAACC,GAAR,CAAYC,mBAAjB,EAAuC;AACtC,oEAA8C;AAC7CC,MAAAA,eAAe,EAAEC;AAD4B,KAA9C;AAGA;;AACD,+CAAgCvB,QAAhC;AACAwB,EAAAA,aAAa,CAAEC,UAAF,CAAb;AACA;;AAEAzB,EAAAA,QAAQ,CAAC0B,kCAAT,GAA8C,CAAEC,MAAF,EAAUC,aAAV,KAC7C,kDAAsBD,MAAtB,EAA8BC,aAA9B,EAA6C5B,QAA7C,CADD,CAjCgD,CAoChD;AACA;AACA;AACA;;;AACA,6CAA+B,WAA/B;AAEAI,EAAAA,IAAI,CAACyB,MAAL,CAAa,4BAAC,eAAD;AAAQ,IAAA,mBAAmB,EAAG7B;AAA9B,IAAb;AAEA,SAAOI,IAAP;AACA;AAED;AACA;AACA;;;AACO,MAAM0B,UAAU,GAAGhC,gBAAnB;;;AAEA,SAASiC,kBAAT,GAA8B;AACpC,2BAAY,mCAAZ,EAAiD;AAChDC,IAAAA,KAAK,EAAE,KADyC;AAEhDC,IAAAA,OAAO,EAAE;AAFuC,GAAjD;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMT,aAAa,GAAKjB,KAAF,IAAa;AAClC,MAAK,CAAEA,KAAP,EAAe;AACd;AACA;;AACD,QAAM;AAAE2B,IAAAA,QAAF;AAAYlC,IAAAA,QAAZ;AAAsBS,IAAAA;AAAtB,MAA+BF,KAArC;;AACA,MAAK2B,QAAL,EAAgB;AACf,+DAA+C;AAAE,OAAEzB,IAAF,GAAUyB;AAAZ,KAA/C;AACA;;AACD,iCAAmBzB,IAAnB,EAAyBT,QAAzB;AACA,CATD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tregisterBlockType,\n\tunstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport './store';\nimport './filters';\nimport * as widgetArea from './blocks/widget-area';\n\nimport Layout from './components/layout';\nimport {\n\tALLOW_REUSABLE_BLOCKS,\n\tENABLE_EXPERIMENTAL_FSE_BLOCKS,\n} from './constants';\n\nconst disabledBlocks = [\n\t'core/more',\n\t'core/freeform',\n\t'core/template-part',\n\t...( ALLOW_REUSABLE_BLOCKS ? [] : [ 'core/block' ] ),\n];\n\n/**\n * Initializes the block editor in the widgets screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Block editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tdisabledBlocks.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' )\n\t\t);\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t\tshowBlockBreadcrumbs: true,\n\t\tthemeStyles: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( settings );\n\tregisterBlock( widgetArea );\n\tregisterWidgetGroupBlock();\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\n\troot.render( <Layout blockEditorSettings={ settings } /> );\n\n\treturn root;\n}\n\n/**\n * Compatibility export under the old `initialize` name.\n */\nexport const initialize = initializeEditor;\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editWidgets.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\n/**\n * Function to register an individual block.\n *\n * @param {Object} block The block to be registered.\n *\n */\nconst registerBlock = ( block ) => {\n\tif ( ! block ) {\n\t\treturn;\n\t}\n\tconst { metadata, settings, name } = block;\n\tif ( metadata ) {\n\t\tunstable__bootstrapServerSideBlockDefinitions( { [ name ]: metadata } );\n\t}\n\tregisterBlockType( name, settings );\n};\n\nexport { store } from './store';\n"]}
1
+ {"version":3,"names":["_element","require","_blocks","_data","_deprecated","_interopRequireDefault","_blockLibrary","_coreData","_widgets","_preferences","_store","widgetArea","_interopRequireWildcard","_layout","_constants","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","disabledBlocks","ALLOW_REUSABLE_BLOCKS","initializeEditor","id","settings","target","document","getElementById","root","createRoot","coreBlocks","__experimentalGetCoreBlocks","filter","block","includes","name","startsWith","dispatch","preferencesStore","setDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","blocksStore","__experimentalReapplyBlockTypeFilters","registerCoreBlocks","registerLegacyWidgetBlock","process","env","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","ENABLE_EXPERIMENTAL_FSE_BLOCKS","registerLegacyWidgetVariations","registerBlock","registerWidgetGroupBlock","__experimentalFetchLinkSuggestions","search","searchOptions","fetchLinkSuggestions","setFreeformContentHandlerName","render","createElement","blockEditorSettings","initialize","exports","reinitializeEditor","deprecated","since","version","metadata","unstable__bootstrapServerSideBlockDefinitions","registerBlockType"],"sources":["@wordpress/edit-widgets/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tregisterBlockType,\n\tunstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport './store';\nimport './filters';\nimport * as widgetArea from './blocks/widget-area';\n\nimport Layout from './components/layout';\nimport {\n\tALLOW_REUSABLE_BLOCKS,\n\tENABLE_EXPERIMENTAL_FSE_BLOCKS,\n} from './constants';\n\nconst disabledBlocks = [\n\t'core/more',\n\t'core/freeform',\n\t'core/template-part',\n\t...( ALLOW_REUSABLE_BLOCKS ? [] : [ 'core/block' ] ),\n];\n\n/**\n * Initializes the block editor in the widgets screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Block editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tdisabledBlocks.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' )\n\t\t);\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t\tshowBlockBreadcrumbs: true,\n\t\tthemeStyles: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( settings );\n\tregisterBlock( widgetArea );\n\tregisterWidgetGroupBlock();\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\n\troot.render( <Layout blockEditorSettings={ settings } /> );\n\n\treturn root;\n}\n\n/**\n * Compatibility export under the old `initialize` name.\n */\nexport const initialize = initializeEditor;\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editWidgets.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\n/**\n * Function to register an individual block.\n *\n * @param {Object} block The block to be registered.\n */\nconst registerBlock = ( block ) => {\n\tif ( ! block ) {\n\t\treturn;\n\t}\n\tconst { metadata, settings, name } = block;\n\tif ( metadata ) {\n\t\tunstable__bootstrapServerSideBlockDefinitions( { [ name ]: metadata } );\n\t}\n\tregisterBlockType( name, settings );\n};\n\nexport { store } from './store';\n"],"mappings":"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"}
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.unlock = exports.lock = void 0;
7
-
8
7
  var _privateApis = require("@wordpress/private-apis");
9
-
10
8
  /**
11
9
  * WordPress dependencies
12
10
  */
11
+
13
12
  const {
14
13
  lock,
15
14
  unlock
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/lock-unlock.js"],"names":["lock","unlock"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAM;AAAEA,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZ,mEACC,8GADD,EAEC,yBAFD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/edit-widgets'\n\t);\n"]}
1
+ {"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/edit-widgets/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/edit-widgets'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,8GAA8G,EAC9G,yBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA"}