@wordpress/block-editor 15.13.2-next.v.202602241322.0 → 15.13.2

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 (175) hide show
  1. package/build/components/block-bindings/attribute-control.cjs +5 -2
  2. package/build/components/block-bindings/attribute-control.cjs.map +2 -2
  3. package/build/components/block-inspector/edit-contents.cjs +5 -4
  4. package/build/components/block-inspector/edit-contents.cjs.map +2 -2
  5. package/build/components/block-list/block-html.cjs +6 -2
  6. package/build/components/block-list/block-html.cjs.map +2 -2
  7. package/build/components/block-list/block.cjs +9 -1
  8. package/build/components/block-list/block.cjs.map +2 -2
  9. package/build/components/block-list/use-block-props/index.cjs +10 -1
  10. package/build/components/block-list/use-block-props/index.cjs.map +2 -2
  11. package/build/components/block-settings-menu-controls/index.cjs +1 -0
  12. package/build/components/block-settings-menu-controls/index.cjs.map +2 -2
  13. package/build/components/block-styles/index.cjs +7 -1
  14. package/build/components/block-styles/index.cjs.map +3 -3
  15. package/build/components/block-switcher/block-transformations-menu.cjs +2 -0
  16. package/build/components/block-switcher/block-transformations-menu.cjs.map +2 -2
  17. package/build/components/block-switcher/block-variation-transformations.cjs +2 -0
  18. package/build/components/block-switcher/block-variation-transformations.cjs.map +2 -2
  19. package/build/components/block-toolbar/block-toolbar-icon.cjs +1 -1
  20. package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
  21. package/build/components/block-toolbar/index.cjs +8 -4
  22. package/build/components/block-toolbar/index.cjs.map +2 -2
  23. package/build/components/block-tools/index.cjs +4 -3
  24. package/build/components/block-tools/index.cjs.map +2 -2
  25. package/build/components/block-variation-transforms/index.cjs +11 -5
  26. package/build/components/block-variation-transforms/index.cjs.map +2 -2
  27. package/build/components/block-visibility/modal.cjs +2 -2
  28. package/build/components/block-visibility/modal.cjs.map +1 -1
  29. package/build/components/block-visibility/use-block-visibility.cjs +4 -3
  30. package/build/components/block-visibility/use-block-visibility.cjs.map +2 -2
  31. package/build/components/block-visibility/viewport-visibility-info.cjs +6 -1
  32. package/build/components/block-visibility/viewport-visibility-info.cjs.map +2 -2
  33. package/build/components/dimensions-tool/scale-tool.cjs +2 -2
  34. package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
  35. package/build/components/iframe/index.cjs +1 -3
  36. package/build/components/iframe/index.cjs.map +2 -2
  37. package/build/components/iframe/use-scale-canvas.cjs +0 -1
  38. package/build/components/iframe/use-scale-canvas.cjs.map +2 -2
  39. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +8 -4
  40. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
  41. package/build/components/link-picker/link-preview.cjs +2 -1
  42. package/build/components/link-picker/link-preview.cjs.map +3 -3
  43. package/build/components/provider/index.cjs +23 -7
  44. package/build/components/provider/index.cjs.map +2 -2
  45. package/build/components/provider/use-media-upload-settings.cjs +1 -0
  46. package/build/components/provider/use-media-upload-settings.cjs.map +2 -2
  47. package/build/components/writing-flow/use-arrow-nav.cjs +1 -1
  48. package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
  49. package/build/hooks/auto-inspector-controls.cjs +26 -2
  50. package/build/hooks/auto-inspector-controls.cjs.map +3 -3
  51. package/build/hooks/cross-origin-isolation.cjs +9 -75
  52. package/build/hooks/cross-origin-isolation.cjs.map +2 -2
  53. package/build/hooks/custom-css.cjs +26 -0
  54. package/build/hooks/custom-css.cjs.map +3 -3
  55. package/build/private-apis.cjs +1 -0
  56. package/build/private-apis.cjs.map +2 -2
  57. package/build/store/actions.cjs +0 -8
  58. package/build/store/actions.cjs.map +2 -2
  59. package/build/store/private-keys.cjs +3 -0
  60. package/build/store/private-keys.cjs.map +2 -2
  61. package/build/store/private-selectors.cjs +4 -3
  62. package/build/store/private-selectors.cjs.map +2 -2
  63. package/build/store/reducer.cjs +78 -74
  64. package/build/store/reducer.cjs.map +2 -2
  65. package/build/store/selectors.cjs +16 -14
  66. package/build/store/selectors.cjs.map +2 -2
  67. package/build-module/components/block-bindings/attribute-control.mjs +5 -2
  68. package/build-module/components/block-bindings/attribute-control.mjs.map +2 -2
  69. package/build-module/components/block-inspector/edit-contents.mjs +5 -4
  70. package/build-module/components/block-inspector/edit-contents.mjs.map +2 -2
  71. package/build-module/components/block-list/block-html.mjs +7 -3
  72. package/build-module/components/block-list/block-html.mjs.map +2 -2
  73. package/build-module/components/block-list/block.mjs +10 -2
  74. package/build-module/components/block-list/block.mjs.map +2 -2
  75. package/build-module/components/block-list/use-block-props/index.mjs +11 -2
  76. package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
  77. package/build-module/components/block-settings-menu-controls/index.mjs +1 -0
  78. package/build-module/components/block-settings-menu-controls/index.mjs.map +2 -2
  79. package/build-module/components/block-styles/index.mjs +7 -1
  80. package/build-module/components/block-styles/index.mjs.map +2 -2
  81. package/build-module/components/block-switcher/block-transformations-menu.mjs +2 -0
  82. package/build-module/components/block-switcher/block-transformations-menu.mjs.map +2 -2
  83. package/build-module/components/block-switcher/block-variation-transformations.mjs +2 -0
  84. package/build-module/components/block-switcher/block-variation-transformations.mjs.map +2 -2
  85. package/build-module/components/block-toolbar/block-toolbar-icon.mjs +1 -1
  86. package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
  87. package/build-module/components/block-toolbar/index.mjs +8 -4
  88. package/build-module/components/block-toolbar/index.mjs.map +2 -2
  89. package/build-module/components/block-tools/index.mjs +4 -3
  90. package/build-module/components/block-tools/index.mjs.map +2 -2
  91. package/build-module/components/block-variation-transforms/index.mjs +11 -5
  92. package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
  93. package/build-module/components/block-visibility/modal.mjs +2 -2
  94. package/build-module/components/block-visibility/modal.mjs.map +1 -1
  95. package/build-module/components/block-visibility/use-block-visibility.mjs +4 -3
  96. package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
  97. package/build-module/components/block-visibility/viewport-visibility-info.mjs +6 -1
  98. package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
  99. package/build-module/components/dimensions-tool/scale-tool.mjs +2 -2
  100. package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
  101. package/build-module/components/iframe/index.mjs +2 -9
  102. package/build-module/components/iframe/index.mjs.map +2 -2
  103. package/build-module/components/iframe/use-scale-canvas.mjs +0 -1
  104. package/build-module/components/iframe/use-scale-canvas.mjs.map +2 -2
  105. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +8 -4
  106. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
  107. package/build-module/components/link-picker/link-preview.mjs +2 -1
  108. package/build-module/components/link-picker/link-preview.mjs.map +2 -2
  109. package/build-module/components/provider/index.mjs +23 -7
  110. package/build-module/components/provider/index.mjs.map +2 -2
  111. package/build-module/components/provider/use-media-upload-settings.mjs +1 -0
  112. package/build-module/components/provider/use-media-upload-settings.mjs.map +2 -2
  113. package/build-module/components/writing-flow/use-arrow-nav.mjs +1 -1
  114. package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
  115. package/build-module/hooks/auto-inspector-controls.mjs +28 -4
  116. package/build-module/hooks/auto-inspector-controls.mjs.map +2 -2
  117. package/build-module/hooks/cross-origin-isolation.mjs +9 -75
  118. package/build-module/hooks/cross-origin-isolation.mjs.map +2 -2
  119. package/build-module/hooks/custom-css.mjs +28 -2
  120. package/build-module/hooks/custom-css.mjs.map +2 -2
  121. package/build-module/private-apis.mjs +3 -1
  122. package/build-module/private-apis.mjs.map +2 -2
  123. package/build-module/store/actions.mjs +0 -8
  124. package/build-module/store/actions.mjs.map +2 -2
  125. package/build-module/store/private-keys.mjs +2 -0
  126. package/build-module/store/private-keys.mjs.map +2 -2
  127. package/build-module/store/private-selectors.mjs +4 -3
  128. package/build-module/store/private-selectors.mjs.map +2 -2
  129. package/build-module/store/reducer.mjs +78 -73
  130. package/build-module/store/reducer.mjs.map +2 -2
  131. package/build-module/store/selectors.mjs +16 -14
  132. package/build-module/store/selectors.mjs.map +2 -2
  133. package/build-style/content-rtl.css +25 -0
  134. package/build-style/content.css +25 -0
  135. package/build-style/style-rtl.css +3 -0
  136. package/build-style/style.css +3 -0
  137. package/package.json +39 -39
  138. package/src/components/block-bindings/attribute-control.js +8 -3
  139. package/src/components/block-inspector/edit-contents.js +5 -3
  140. package/src/components/block-list/block-html.js +13 -3
  141. package/src/components/block-list/block.js +10 -1
  142. package/src/components/block-list/content.scss +35 -0
  143. package/src/components/block-list/use-block-props/index.js +11 -1
  144. package/src/components/block-settings-menu-controls/index.js +1 -0
  145. package/src/components/block-styles/index.js +7 -1
  146. package/src/components/block-switcher/block-transformations-menu.js +2 -0
  147. package/src/components/block-switcher/block-variation-transformations.js +2 -0
  148. package/src/components/block-toolbar/block-toolbar-icon.js +6 -1
  149. package/src/components/block-toolbar/index.js +7 -2
  150. package/src/components/block-tools/index.js +11 -4
  151. package/src/components/block-tools/style.scss +5 -0
  152. package/src/components/block-variation-transforms/index.js +41 -36
  153. package/src/components/block-visibility/use-block-visibility.js +4 -2
  154. package/src/components/block-visibility/viewport-visibility-info.js +8 -1
  155. package/src/components/dimensions-tool/scale-tool.js +2 -2
  156. package/src/components/iframe/index.js +2 -12
  157. package/src/components/iframe/use-scale-canvas.js +0 -1
  158. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +9 -5
  159. package/src/components/link-picker/link-preview.js +2 -1
  160. package/src/components/provider/index.js +49 -6
  161. package/src/components/provider/use-media-upload-settings.js +1 -0
  162. package/src/components/writing-flow/use-arrow-nav.js +9 -2
  163. package/src/hooks/auto-inspector-controls.js +31 -4
  164. package/src/hooks/cross-origin-isolation.js +10 -109
  165. package/src/hooks/custom-css.js +36 -2
  166. package/src/hooks/test/cross-origin-isolation.js +15 -42
  167. package/src/private-apis.js +2 -0
  168. package/src/store/actions.js +0 -8
  169. package/src/store/private-keys.js +1 -0
  170. package/src/store/private-selectors.js +6 -3
  171. package/src/store/reducer.js +119 -97
  172. package/src/store/selectors.js +59 -22
  173. package/src/store/test/private-selectors.js +67 -34
  174. package/src/store/test/reducer.js +545 -57
  175. package/src/store/test/selectors.js +611 -53
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/link-picker/link-preview.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTruncate as Truncate,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tFlexItem,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { Icon, chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { Badge } = unlock( componentsPrivateApis );\n\n/**\n * Link preview component that displays the current link information.\n * This is a presentational component meant to be wrapped in a button.\n *\n * @param {Object} props - Component props\n * @param {string} props.title - Display title for the link\n * @param {string} props.url - Display URL for the link\n * @param {string} props.image - Optional image URL for the link preview\n * @param {Array<Object>} props.badges - Optional array of badge objects with label and intent\n */\nexport function LinkPreview( { title, url, image, badges } ) {\n\treturn (\n\t\t<HStack justify=\"space-between\" alignment=\"top\">\n\t\t\t<FlexItem className=\"link-preview-button__content\">\n\t\t\t\t<HStack alignment=\"top\">\n\t\t\t\t\t{ image && (\n\t\t\t\t\t\t<FlexItem className=\"link-preview-button__image-container\">\n\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\tclassName=\"link-preview-button__image\"\n\t\t\t\t\t\t\t\tsrc={ image }\n\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tclassName=\"link-preview-button__details\"\n\t\t\t\t\t\talignment=\"topLeft\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\t\tclassName=\"link-preview-button__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t{ url && (\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\t\t\tclassName=\"link-preview-button__hint\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ url }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ badges && badges.length > 0 && (\n\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\tclassName=\"link-preview-button__badges\"\n\t\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ badges.map( ( badge ) => (\n\t\t\t\t\t\t\t\t\t<Badge\n\t\t\t\t\t\t\t\t\t\tkey={ `${ badge.label }|${ badge.intent }` }\n\t\t\t\t\t\t\t\t\t\tintent={ badge.intent }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ badge.label }\n\t\t\t\t\t\t\t\t\t</Badge>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VStack>\n\t\t\t\t</HStack>\n\t\t\t</FlexItem>\n\t\t\t<Icon icon={ chevronDown } className=\"link-preview-button__icon\" />\n\t\t</HStack>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAMO;AACP,mBAAkC;AAKlC,yBAAuB;AAqBhB;AAnBP,IAAM,EAAE,MAAM,QAAI,2BAAQ,kBAAAA,WAAsB;AAYzC,SAAS,YAAa,EAAE,OAAO,KAAK,OAAO,OAAO,GAAI;AAC5D,SACC,6CAAC,kBAAAC,sBAAA,EAAO,SAAQ,iBAAgB,WAAU,OACzC;AAAA,gDAAC,8BAAS,WAAU,gCACnB,uDAAC,kBAAAA,sBAAA,EAAO,WAAU,OACf;AAAA,eACD,4CAAC,8BAAS,WAAU,wCACnB;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,KAAM;AAAA,UACN,KAAI;AAAA;AAAA,MACL,GACD;AAAA,MAGD;AAAA,QAAC,kBAAAC;AAAA,QAAA;AAAA,UACA,WAAU;AAAA,UACV,WAAU;AAAA,UAEV;AAAA;AAAA,cAAC,kBAAAC;AAAA,cAAA;AAAA,gBACA,eAAgB;AAAA,gBAChB,WAAU;AAAA,gBAER;AAAA;AAAA,YACH;AAAA,YACE,OACD;AAAA,cAAC,kBAAAA;AAAA,cAAA;AAAA,gBACA,eAAgB;AAAA,gBAChB,WAAU;AAAA,gBAER;AAAA;AAAA,YACH;AAAA,YAEC,UAAU,OAAO,SAAS,KAC3B;AAAA,cAAC,kBAAAF;AAAA,cAAA;AAAA,gBACA,WAAU;AAAA,gBACV,WAAU;AAAA,gBAER,iBAAO,IAAK,CAAE,UACf;AAAA,kBAAC;AAAA;AAAA,oBAEA,QAAS,MAAM;AAAA,oBAEb,gBAAM;AAAA;AAAA,kBAHF,GAAI,MAAM,KAAM,IAAK,MAAM,MAAO;AAAA,gBAIzC,CACC;AAAA;AAAA,YACH;AAAA;AAAA;AAAA,MAEF;AAAA,OACD,GACD;AAAA,IACA,4CAAC,qBAAK,MAAO,0BAAc,WAAU,6BAA4B;AAAA,KAClE;AAEF;",
6
- "names": ["componentsPrivateApis", "HStack", "VStack", "Truncate"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTruncate as Truncate,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tFlexItem,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { Icon, chevronDown } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { Badge } = unlock( componentsPrivateApis );\n\n/**\n * Link preview component that displays the current link information.\n * This is a presentational component meant to be wrapped in a button.\n *\n * @param {Object} props - Component props\n * @param {string} props.title - Display title for the link\n * @param {string} props.url - Display URL for the link\n * @param {string} props.image - Optional image URL for the link preview\n * @param {Array<Object>} props.badges - Optional array of badge objects with label and intent\n */\nexport function LinkPreview( { title, url, image, badges } ) {\n\treturn (\n\t\t<HStack justify=\"space-between\" alignment=\"top\">\n\t\t\t<FlexItem className=\"link-preview-button__content\">\n\t\t\t\t<HStack alignment=\"top\">\n\t\t\t\t\t{ image && (\n\t\t\t\t\t\t<FlexItem className=\"link-preview-button__image-container\">\n\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\tclassName=\"link-preview-button__image\"\n\t\t\t\t\t\t\t\tsrc={ image }\n\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tclassName=\"link-preview-button__details\"\n\t\t\t\t\t\talignment=\"topLeft\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\t\tclassName=\"link-preview-button__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ stripHTML( title ) }\n\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t{ url && (\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\t\t\tclassName=\"link-preview-button__hint\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ url }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ badges && badges.length > 0 && (\n\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\tclassName=\"link-preview-button__badges\"\n\t\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ badges.map( ( badge ) => (\n\t\t\t\t\t\t\t\t\t<Badge\n\t\t\t\t\t\t\t\t\t\tkey={ `${ badge.label }|${ badge.intent }` }\n\t\t\t\t\t\t\t\t\t\tintent={ badge.intent }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ badge.label }\n\t\t\t\t\t\t\t\t\t</Badge>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VStack>\n\t\t\t\t</HStack>\n\t\t\t</FlexItem>\n\t\t\t<Icon icon={ chevronDown } className=\"link-preview-button__icon\" />\n\t\t</HStack>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAMO;AACP,mBAAkC;AAClC,iBAAiD;AAKjD,yBAAuB;AAqBhB;AAnBP,IAAM,EAAE,MAAM,QAAI,2BAAQ,kBAAAA,WAAsB;AAYzC,SAAS,YAAa,EAAE,OAAO,KAAK,OAAO,OAAO,GAAI;AAC5D,SACC,6CAAC,kBAAAC,sBAAA,EAAO,SAAQ,iBAAgB,WAAU,OACzC;AAAA,gDAAC,8BAAS,WAAU,gCACnB,uDAAC,kBAAAA,sBAAA,EAAO,WAAU,OACf;AAAA,eACD,4CAAC,8BAAS,WAAU,wCACnB;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,KAAM;AAAA,UACN,KAAI;AAAA;AAAA,MACL,GACD;AAAA,MAGD;AAAA,QAAC,kBAAAC;AAAA,QAAA;AAAA,UACA,WAAU;AAAA,UACV,WAAU;AAAA,UAEV;AAAA;AAAA,cAAC,kBAAAC;AAAA,cAAA;AAAA,gBACA,eAAgB;AAAA,gBAChB,WAAU;AAAA,gBAER,yBAAAC,qBAAW,KAAM;AAAA;AAAA,YACpB;AAAA,YACE,OACD;AAAA,cAAC,kBAAAD;AAAA,cAAA;AAAA,gBACA,eAAgB;AAAA,gBAChB,WAAU;AAAA,gBAER;AAAA;AAAA,YACH;AAAA,YAEC,UAAU,OAAO,SAAS,KAC3B;AAAA,cAAC,kBAAAF;AAAA,cAAA;AAAA,gBACA,WAAU;AAAA,gBACV,WAAU;AAAA,gBAER,iBAAO,IAAK,CAAE,UACf;AAAA,kBAAC;AAAA;AAAA,oBAEA,QAAS,MAAM;AAAA,oBAEb,gBAAM;AAAA;AAAA,kBAHF,GAAI,MAAM,KAAM,IAAK,MAAM,MAAO;AAAA,gBAIzC,CACC;AAAA;AAAA,YACH;AAAA;AAAA;AAAA,MAEF;AAAA,OACD,GACD;AAAA,IACA,4CAAC,qBAAK,MAAO,0BAAc,WAAU,6BAA4B;AAAA,KAClE;AAEF;",
6
+ "names": ["componentsPrivateApis", "HStack", "VStack", "Truncate", "stripHTML"]
7
7
  }
@@ -46,6 +46,7 @@ var import_block_refs_provider = require("./block-refs-provider.cjs");
46
46
  var import_lock_unlock = require("../../lock-unlock.cjs");
47
47
  var import_keyboard_shortcuts = __toESM(require("../keyboard-shortcuts/index.cjs"));
48
48
  var import_use_media_upload_settings = __toESM(require("./use-media-upload-settings.cjs"));
49
+ var import_private_keys = require("../../store/private-keys.cjs");
49
50
  var import_selection_context = require("./selection-context.cjs");
50
51
  var import_jsx_runtime = require("react/jsx-runtime");
51
52
  var noop = () => {
@@ -78,7 +79,7 @@ function shouldEnableClientSideMediaProcessing() {
78
79
  isClientSideMediaEnabledCache = true;
79
80
  return true;
80
81
  }
81
- function mediaUpload(registry, {
82
+ function mediaUpload(registry, settings, {
82
83
  allowedTypes,
83
84
  additionalData = {},
84
85
  filesList,
@@ -90,9 +91,12 @@ function mediaUpload(registry, {
90
91
  void registry.dispatch(import_upload_media.store).addItems({
91
92
  files: Array.from(filesList),
92
93
  onChange: onFileChange,
93
- onSuccess,
94
+ onSuccess: (attachments) => {
95
+ settings?.[import_private_keys.mediaUploadOnSuccessKey]?.(attachments);
96
+ onSuccess?.(attachments);
97
+ },
94
98
  onBatchSuccess,
95
- onError: ({ message }) => onError(message),
99
+ onError: (error) => onError(typeof error === "string" ? error : error?.message ?? ""),
96
100
  additionalData,
97
101
  allowedTypes
98
102
  });
@@ -110,15 +114,27 @@ var ExperimentalBlockEditorProvider = (0, import_with_registry_provider.default)
110
114
  } = props;
111
115
  const mediaUploadSettings = (0, import_use_media_upload_settings.default)(_settings);
112
116
  const isClientSideMediaEnabled = shouldEnableClientSideMediaProcessing();
117
+ const isMediaUploadIntercepted = !!_settings?.mediaUpload?.__isMediaUploadInterceptor;
113
118
  const settings = (0, import_element.useMemo)(() => {
114
- if (isClientSideMediaEnabled && _settings?.mediaUpload) {
119
+ if (isClientSideMediaEnabled && _settings?.mediaUpload && !isMediaUploadIntercepted) {
120
+ const interceptor = mediaUpload.bind(
121
+ null,
122
+ registry,
123
+ _settings
124
+ );
125
+ interceptor.__isMediaUploadInterceptor = true;
115
126
  return {
116
127
  ..._settings,
117
- mediaUpload: mediaUpload.bind(null, registry)
128
+ mediaUpload: interceptor
118
129
  };
119
130
  }
120
131
  return _settings;
121
- }, [_settings, registry, isClientSideMediaEnabled]);
132
+ }, [
133
+ _settings,
134
+ registry,
135
+ isClientSideMediaEnabled,
136
+ isMediaUploadIntercepted
137
+ ]);
122
138
  const { __experimentalUpdateSettings } = (0, import_lock_unlock.unlock)(
123
139
  (0, import_data.useDispatch)(import_store.store)
124
140
  );
@@ -165,7 +181,7 @@ var ExperimentalBlockEditorProvider = (0, import_with_registry_provider.default)
165
181
  ),
166
182
  children
167
183
  ] });
168
- if (isClientSideMediaEnabled) {
184
+ if (isClientSideMediaEnabled && !isMediaUploadIntercepted) {
169
185
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
170
186
  import_upload_media.MediaUploadProvider,
171
187
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/provider/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect, useMemo, useRef } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport {\n\tMediaUploadProvider,\n\tstore as uploadStore,\n\tdetectClientSideMediaSupport,\n} from '@wordpress/upload-media';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport useBlockSync from './use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockRefsProvider } from './block-refs-provider';\nimport { unlock } from '../../lock-unlock';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport useMediaUploadSettings from './use-media-upload-settings';\nimport { SelectionContext } from './selection-context';\n\n/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */\n\nconst noop = () => {};\n\n/**\n * Flag to track if we've already logged the fallback message.\n */\nlet hasLoggedFallback = false;\n\n/**\n * Cached result of whether client-side media processing should be enabled.\n * This is computed once per session for efficiency and stability.\n */\nlet isClientSideMediaEnabledCache = null;\n\n/**\n * Checks if client-side media processing should be enabled.\n *\n * Returns true only if:\n * 1. The client-side media processing flag is enabled\n * 2. The browser supports WebAssembly, SharedArrayBuffer, cross-origin isolation, and CSP allows blob workers\n *\n * The result is cached for the session to ensure stability during React renders.\n *\n * @return {boolean} Whether client-side media processing should be enabled.\n */\nfunction shouldEnableClientSideMediaProcessing() {\n\t// Return cached result if available.\n\tif ( isClientSideMediaEnabledCache !== null ) {\n\t\treturn isClientSideMediaEnabledCache;\n\t}\n\n\t// Check if the client-side media processing flag is enabled first.\n\tif ( ! window.__clientSideMediaProcessing ) {\n\t\tisClientSideMediaEnabledCache = false;\n\t\treturn false;\n\t}\n\n\t// Safety check in case the import is unavailable.\n\tif ( typeof detectClientSideMediaSupport !== 'function' ) {\n\t\tisClientSideMediaEnabledCache = false;\n\t\treturn false;\n\t}\n\n\tconst detection = detectClientSideMediaSupport();\n\tif ( ! detection || ! detection.supported ) {\n\t\t// Only log once per session to avoid console spam.\n\t\tif ( ! hasLoggedFallback ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.info(\n\t\t\t\t`Client-side media processing unavailable: ${ detection.reason }. Using server-side processing.`\n\t\t\t);\n\t\t\thasLoggedFallback = true;\n\t\t}\n\t\tisClientSideMediaEnabledCache = false;\n\t\treturn false;\n\t}\n\n\tisClientSideMediaEnabledCache = true;\n\treturn true;\n}\n\n/**\n * Upload a media file when the file upload button is activated\n * or when adding a file to the editor via drag & drop.\n *\n * @param {WPDataRegistry} registry\n * @param {Object} $3 Parameters object passed to the function.\n * @param {Array} $3.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.\n * @param {Object} $3.additionalData Additional data to include in the request.\n * @param {Array<File>} $3.filesList List of files.\n * @param {Function} $3.onError Function called when an error happens.\n * @param {Function} $3.onFileChange Function called each time a file or a temporary representation of the file is available.\n * @param {Function} $3.onSuccess Function called once a file has completely finished uploading, including thumbnails.\n * @param {Function} $3.onBatchSuccess Function called once all files in a group have completely finished uploading, including thumbnails.\n */\nfunction mediaUpload(\n\tregistry,\n\t{\n\t\tallowedTypes,\n\t\tadditionalData = {},\n\t\tfilesList,\n\t\tonError = noop,\n\t\tonFileChange,\n\t\tonSuccess,\n\t\tonBatchSuccess,\n\t}\n) {\n\tvoid registry.dispatch( uploadStore ).addItems( {\n\t\tfiles: Array.from( filesList ),\n\t\tonChange: onFileChange,\n\t\tonSuccess,\n\t\tonBatchSuccess,\n\t\tonError: ( { message } ) => onError( message ),\n\t\tadditionalData,\n\t\tallowedTypes,\n\t} );\n}\n\n/**\n * Calls useBlockSync as a child of SelectionContext.Provider so that the\n * hook can read selection state from the context provided by this tree\n * rather than from a parent provider (which may not exist for the root).\n *\n * @param {Object} props Props forwarded to useBlockSync.\n */\nfunction BlockSyncEffect( props ) {\n\tuseBlockSync( props );\n\treturn null;\n}\n\nexport const ExperimentalBlockEditorProvider = withRegistryProvider(\n\t( props ) => {\n\t\tconst {\n\t\t\tsettings: _settings,\n\t\t\tregistry,\n\t\t\tstripExperimentalSettings = false,\n\t\t} = props;\n\n\t\tconst mediaUploadSettings = useMediaUploadSettings( _settings );\n\n\t\tconst isClientSideMediaEnabled =\n\t\t\tshouldEnableClientSideMediaProcessing();\n\n\t\tconst settings = useMemo( () => {\n\t\t\tif ( isClientSideMediaEnabled && _settings?.mediaUpload ) {\n\t\t\t\t// Create a new object so that the original props.settings.mediaUpload is not modified.\n\t\t\t\treturn {\n\t\t\t\t\t..._settings,\n\t\t\t\t\tmediaUpload: mediaUpload.bind( null, registry ),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn _settings;\n\t\t}, [ _settings, registry, isClientSideMediaEnabled ] );\n\n\t\tconst { __experimentalUpdateSettings } = unlock(\n\t\t\tuseDispatch( blockEditorStore )\n\t\t);\n\t\tuseEffect( () => {\n\t\t\t__experimentalUpdateSettings(\n\t\t\t\t{\n\t\t\t\t\t...settings,\n\t\t\t\t\t__internalIsInitialized: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstripExperimentalSettings,\n\t\t\t\t\treset: true,\n\t\t\t\t}\n\t\t\t);\n\t\t}, [\n\t\t\tsettings,\n\t\t\tstripExperimentalSettings,\n\t\t\t__experimentalUpdateSettings,\n\t\t] );\n\n\t\t// Store selection and onChangeSelection in refs and expose\n\t\t// stable getters/callers so that the context value is a\n\t\t// complete constant. This prevents re-rendering the entire\n\t\t// block tree (including async-rendered off-screen blocks)\n\t\t// when either value changes.\n\t\tconst selectionRef = useRef( props.selection );\n\t\tselectionRef.current = props.selection;\n\t\tconst onChangeSelectionRef = useRef( props.onChangeSelection ?? noop );\n\t\tonChangeSelectionRef.current = props.onChangeSelection ?? noop;\n\n\t\tconst selectionContextValue = useMemo(\n\t\t\t() => ( {\n\t\t\t\tgetSelection: () => selectionRef.current,\n\t\t\t\tonChangeSelection: ( ...args ) =>\n\t\t\t\t\tonChangeSelectionRef.current( ...args ),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\n\t\tconst children = (\n\t\t\t<SlotFillProvider passthrough>\n\t\t\t\t{ ! settings?.isPreviewMode && <KeyboardShortcuts.Register /> }\n\t\t\t\t<BlockRefsProvider>{ props.children }</BlockRefsProvider>\n\t\t\t</SlotFillProvider>\n\t\t);\n\n\t\tconst content = (\n\t\t\t<SelectionContext.Provider value={ selectionContextValue }>\n\t\t\t\t<BlockSyncEffect\n\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\tvalue={ props.value }\n\t\t\t\t\tonChange={ props.onChange }\n\t\t\t\t\tonInput={ props.onInput }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</SelectionContext.Provider>\n\t\t);\n\n\t\tif ( isClientSideMediaEnabled ) {\n\t\t\treturn (\n\t\t\t\t<MediaUploadProvider\n\t\t\t\t\tsettings={ mediaUploadSettings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t{ content }\n\t\t\t\t</MediaUploadProvider>\n\t\t\t);\n\t\t}\n\n\t\treturn content;\n\t}\n);\n\nexport const BlockEditorProvider = ( props ) => {\n\treturn (\n\t\t<ExperimentalBlockEditorProvider { ...props } stripExperimentalSettings>\n\t\t\t{ props.children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n};\n\nexport default BlockEditorProvider;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA4B;AAC5B,qBAA2C;AAC3C,wBAAiC;AACjC,0BAIO;AAKP,oCAAiC;AACjC,4BAAyB;AACzB,mBAA0C;AAC1C,iCAAkC;AAClC,yBAAuB;AACvB,gCAA8B;AAC9B,uCAAmC;AACnC,+BAAiC;AAiL9B;AA7KH,IAAM,OAAO,MAAM;AAAC;AAKpB,IAAI,oBAAoB;AAMxB,IAAI,gCAAgC;AAapC,SAAS,wCAAwC;AAEhD,MAAK,kCAAkC,MAAO;AAC7C,WAAO;AAAA,EACR;AAGA,MAAK,CAAE,OAAO,6BAA8B;AAC3C,oCAAgC;AAChC,WAAO;AAAA,EACR;AAGA,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\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect, useMemo, useRef } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport {\n\tMediaUploadProvider,\n\tstore as uploadStore,\n\tdetectClientSideMediaSupport,\n} from '@wordpress/upload-media';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport useBlockSync from './use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockRefsProvider } from './block-refs-provider';\nimport { unlock } from '../../lock-unlock';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport useMediaUploadSettings from './use-media-upload-settings';\nimport { mediaUploadOnSuccessKey } from '../../store/private-keys';\nimport { SelectionContext } from './selection-context';\n\n/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */\n\nconst noop = () => {};\n\n/**\n * Flag to track if we've already logged the fallback message.\n */\nlet hasLoggedFallback = false;\n\n/**\n * Cached result of whether client-side media processing should be enabled.\n * This is computed once per session for efficiency and stability.\n */\nlet isClientSideMediaEnabledCache = null;\n\n/**\n * Checks if client-side media processing should be enabled.\n *\n * Returns true only if:\n * 1. The client-side media processing flag is enabled\n * 2. The browser supports WebAssembly, SharedArrayBuffer, cross-origin isolation, and CSP allows blob workers\n *\n * The result is cached for the session to ensure stability during React renders.\n *\n * @return {boolean} Whether client-side media processing should be enabled.\n */\nfunction shouldEnableClientSideMediaProcessing() {\n\t// Return cached result if available.\n\tif ( isClientSideMediaEnabledCache !== null ) {\n\t\treturn isClientSideMediaEnabledCache;\n\t}\n\n\t// Check if the client-side media processing flag is enabled first.\n\tif ( ! window.__clientSideMediaProcessing ) {\n\t\tisClientSideMediaEnabledCache = false;\n\t\treturn false;\n\t}\n\n\t// Safety check in case the import is unavailable.\n\tif ( typeof detectClientSideMediaSupport !== 'function' ) {\n\t\tisClientSideMediaEnabledCache = false;\n\t\treturn false;\n\t}\n\n\tconst detection = detectClientSideMediaSupport();\n\tif ( ! detection || ! detection.supported ) {\n\t\t// Only log once per session to avoid console spam.\n\t\tif ( ! hasLoggedFallback ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.info(\n\t\t\t\t`Client-side media processing unavailable: ${ detection.reason }. Using server-side processing.`\n\t\t\t);\n\t\t\thasLoggedFallback = true;\n\t\t}\n\t\tisClientSideMediaEnabledCache = false;\n\t\treturn false;\n\t}\n\n\tisClientSideMediaEnabledCache = true;\n\treturn true;\n}\n\n/**\n * Upload a media file when the file upload button is activated\n * or when adding a file to the editor via drag & drop.\n *\n * @param {WPDataRegistry} registry\n * @param {Object} settings Block editor settings.\n * @param {Object} $3 Parameters object passed to the function.\n * @param {Array} $3.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.\n * @param {Object} $3.additionalData Additional data to include in the request.\n * @param {Array<File>} $3.filesList List of files.\n * @param {Function} $3.onError Function called when an error happens.\n * @param {Function} $3.onFileChange Function called each time a file or a temporary representation of the file is available.\n * @param {Function} $3.onSuccess Function called once a file has completely finished uploading, including thumbnails.\n * @param {Function} $3.onBatchSuccess Function called once all files in a group have completely finished uploading, including thumbnails.\n */\nfunction mediaUpload(\n\tregistry,\n\tsettings,\n\t{\n\t\tallowedTypes,\n\t\tadditionalData = {},\n\t\tfilesList,\n\t\tonError = noop,\n\t\tonFileChange,\n\t\tonSuccess,\n\t\tonBatchSuccess,\n\t}\n) {\n\tvoid registry.dispatch( uploadStore ).addItems( {\n\t\tfiles: Array.from( filesList ),\n\t\tonChange: onFileChange,\n\t\tonSuccess: ( attachments ) => {\n\t\t\tsettings?.[ mediaUploadOnSuccessKey ]?.( attachments );\n\t\t\tonSuccess?.( attachments );\n\t\t},\n\t\tonBatchSuccess,\n\t\tonError: ( error ) =>\n\t\t\tonError( typeof error === 'string' ? error : error?.message ?? '' ),\n\t\tadditionalData,\n\t\tallowedTypes,\n\t} );\n}\n\n/**\n * Calls useBlockSync as a child of SelectionContext.Provider so that the\n * hook can read selection state from the context provided by this tree\n * rather than from a parent provider (which may not exist for the root).\n *\n * @param {Object} props Props forwarded to useBlockSync.\n */\nfunction BlockSyncEffect( props ) {\n\tuseBlockSync( props );\n\treturn null;\n}\n\nexport const ExperimentalBlockEditorProvider = withRegistryProvider(\n\t( props ) => {\n\t\tconst {\n\t\t\tsettings: _settings,\n\t\t\tregistry,\n\t\t\tstripExperimentalSettings = false,\n\t\t} = props;\n\n\t\tconst mediaUploadSettings = useMediaUploadSettings( _settings );\n\n\t\tconst isClientSideMediaEnabled =\n\t\t\tshouldEnableClientSideMediaProcessing();\n\n\t\t// Nested providers (e.g. from useBlockPreview) inherit settings\n\t\t// where mediaUpload has already been replaced with the\n\t\t// interceptor. Detect this so we skip the replacement and\n\t\t// MediaUploadProvider for them \u2014 see the longer comment below.\n\t\tconst isMediaUploadIntercepted =\n\t\t\t!! _settings?.mediaUpload?.__isMediaUploadInterceptor;\n\n\t\tconst settings = useMemo( () => {\n\t\t\tif (\n\t\t\t\tisClientSideMediaEnabled &&\n\t\t\t\t_settings?.mediaUpload &&\n\t\t\t\t! isMediaUploadIntercepted\n\t\t\t) {\n\t\t\t\t// Create a new object so that the original props.settings.mediaUpload is not modified.\n\t\t\t\tconst interceptor = mediaUpload.bind(\n\t\t\t\t\tnull,\n\t\t\t\t\tregistry,\n\t\t\t\t\t_settings\n\t\t\t\t);\n\t\t\t\tinterceptor.__isMediaUploadInterceptor = true;\n\t\t\t\treturn {\n\t\t\t\t\t..._settings,\n\t\t\t\t\tmediaUpload: interceptor,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn _settings;\n\t\t}, [\n\t\t\t_settings,\n\t\t\tregistry,\n\t\t\tisClientSideMediaEnabled,\n\t\t\tisMediaUploadIntercepted,\n\t\t] );\n\n\t\tconst { __experimentalUpdateSettings } = unlock(\n\t\t\tuseDispatch( blockEditorStore )\n\t\t);\n\t\tuseEffect( () => {\n\t\t\t__experimentalUpdateSettings(\n\t\t\t\t{\n\t\t\t\t\t...settings,\n\t\t\t\t\t__internalIsInitialized: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstripExperimentalSettings,\n\t\t\t\t\treset: true,\n\t\t\t\t}\n\t\t\t);\n\t\t}, [\n\t\t\tsettings,\n\t\t\tstripExperimentalSettings,\n\t\t\t__experimentalUpdateSettings,\n\t\t] );\n\n\t\t// Store selection and onChangeSelection in refs and expose\n\t\t// stable getters/callers so that the context value is a\n\t\t// complete constant. This prevents re-rendering the entire\n\t\t// block tree (including async-rendered off-screen blocks)\n\t\t// when either value changes.\n\t\tconst selectionRef = useRef( props.selection );\n\t\tselectionRef.current = props.selection;\n\t\tconst onChangeSelectionRef = useRef( props.onChangeSelection ?? noop );\n\t\tonChangeSelectionRef.current = props.onChangeSelection ?? noop;\n\n\t\tconst selectionContextValue = useMemo(\n\t\t\t() => ( {\n\t\t\t\tgetSelection: () => selectionRef.current,\n\t\t\t\tonChangeSelection: ( ...args ) =>\n\t\t\t\t\tonChangeSelectionRef.current( ...args ),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\n\t\tconst children = (\n\t\t\t<SlotFillProvider passthrough>\n\t\t\t\t{ ! settings?.isPreviewMode && <KeyboardShortcuts.Register /> }\n\t\t\t\t<BlockRefsProvider>{ props.children }</BlockRefsProvider>\n\t\t\t</SlotFillProvider>\n\t\t);\n\n\t\tconst content = (\n\t\t\t<SelectionContext.Provider value={ selectionContextValue }>\n\t\t\t\t<BlockSyncEffect\n\t\t\t\t\tclientId={ props.clientId }\n\t\t\t\t\tvalue={ props.value }\n\t\t\t\t\tonChange={ props.onChange }\n\t\t\t\t\tonInput={ props.onInput }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</SelectionContext.Provider>\n\t\t);\n\n\t\t// MediaUploadProvider writes the mediaUpload function from\n\t\t// _settings into the shared upload-media store so the store can\n\t\t// hand files off to the server. useMediaUploadSettings extracts\n\t\t// mediaUpload from the original _settings prop \u2014 *before* the\n\t\t// interceptor replacement above \u2014 so the store receives the\n\t\t// real server-side upload function.\n\t\t//\n\t\t// Only the first (outermost) provider should do this.\n\t\t// Nested providers (e.g. from useBlockPreview in\n\t\t// core/post-template) inherit settings that already contain\n\t\t// the interceptor, so their MediaUploadProvider would\n\t\t// overwrite the store's server-side function with the\n\t\t// interceptor, causing uploads to loop instead of reaching\n\t\t// the server.\n\t\tif ( isClientSideMediaEnabled && ! isMediaUploadIntercepted ) {\n\t\t\treturn (\n\t\t\t\t<MediaUploadProvider\n\t\t\t\t\tsettings={ mediaUploadSettings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t{ content }\n\t\t\t\t</MediaUploadProvider>\n\t\t\t);\n\t\t}\n\n\t\treturn content;\n\t}\n);\n\nexport const BlockEditorProvider = ( props ) => {\n\treturn (\n\t\t<ExperimentalBlockEditorProvider { ...props } stripExperimentalSettings>\n\t\t\t{ props.children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n};\n\nexport default BlockEditorProvider;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA4B;AAC5B,qBAA2C;AAC3C,wBAAiC;AACjC,0BAIO;AAKP,oCAAiC;AACjC,4BAAyB;AACzB,mBAA0C;AAC1C,iCAAkC;AAClC,yBAAuB;AACvB,gCAA8B;AAC9B,uCAAmC;AACnC,0BAAwC;AACxC,+BAAiC;AA6M9B;AAzMH,IAAM,OAAO,MAAM;AAAC;AAKpB,IAAI,oBAAoB;AAMxB,IAAI,gCAAgC;AAapC,SAAS,wCAAwC;AAEhD,MAAK,kCAAkC,MAAO;AAC7C,WAAO;AAAA,EACR;AAGA,MAAK,CAAE,OAAO,6BAA8B;AAC3C,oCAAgC;AAChC,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,qDAAiC,YAAa;AACzD,oCAAgC;AAChC,WAAO;AAAA,EACR;AAEA,QAAM,gBAAY,kDAA6B;AAC/C,MAAK,CAAE,aAAa,CA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;AAEO,IAAM,sBAAsB,CAAE,UAAW;AAC/C,SACC,4CAAC,mCAAkC,GAAG,OAAQ,2BAAyB,MACpE,gBAAM,UACT;AAEF;AAEA,IAAO,mBAAQ;",
6
6
  "names": ["uploadStore", "useBlockSync", "withRegistryProvider", "useMediaUploadSettings", "blockEditorStore", "KeyboardShortcuts"]
7
7
  }
@@ -29,6 +29,7 @@ function useMediaUploadSettings(settings = {}) {
29
29
  () => ({
30
30
  mediaUpload: settings.mediaUpload,
31
31
  mediaSideload: settings.mediaSideload,
32
+ mediaFinalize: settings.mediaFinalize,
32
33
  maxUploadFileSize: settings.maxUploadFileSize,
33
34
  allowedMimeTypes: settings.allowedMimeTypes,
34
35
  allImageSizes: settings.allImageSizes,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/provider/use-media-upload-settings.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * React hook used to compute the media upload settings to use in the post editor.\n *\n * @param {Object} settings Media upload settings prop.\n *\n * @return {Object} Media upload settings.\n */\nfunction useMediaUploadSettings( settings = {} ) {\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tmediaUpload: settings.mediaUpload,\n\t\t\tmediaSideload: settings.mediaSideload,\n\t\t\tmaxUploadFileSize: settings.maxUploadFileSize,\n\t\t\tallowedMimeTypes: settings.allowedMimeTypes,\n\t\t\tallImageSizes: settings.allImageSizes,\n\t\t\tbigImageSizeThreshold: settings.bigImageSizeThreshold,\n\t\t} ),\n\t\t[ settings ]\n\t);\n}\n\nexport default useMediaUploadSettings;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAwB;AASxB,SAAS,uBAAwB,WAAW,CAAC,GAAI;AAChD,aAAO;AAAA,IACN,OAAQ;AAAA,MACP,aAAa,SAAS;AAAA,MACtB,eAAe,SAAS;AAAA,MACxB,mBAAmB,SAAS;AAAA,MAC5B,kBAAkB,SAAS;AAAA,MAC3B,eAAe,SAAS;AAAA,MACxB,uBAAuB,SAAS;AAAA,IACjC;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACD;AAEA,IAAO,oCAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * React hook used to compute the media upload settings to use in the post editor.\n *\n * @param {Object} settings Media upload settings prop.\n *\n * @return {Object} Media upload settings.\n */\nfunction useMediaUploadSettings( settings = {} ) {\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tmediaUpload: settings.mediaUpload,\n\t\t\tmediaSideload: settings.mediaSideload,\n\t\t\tmediaFinalize: settings.mediaFinalize,\n\t\t\tmaxUploadFileSize: settings.maxUploadFileSize,\n\t\t\tallowedMimeTypes: settings.allowedMimeTypes,\n\t\t\tallImageSizes: settings.allImageSizes,\n\t\t\tbigImageSizeThreshold: settings.bigImageSizeThreshold,\n\t\t} ),\n\t\t[ settings ]\n\t);\n}\n\nexport default useMediaUploadSettings;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAwB;AASxB,SAAS,uBAAwB,WAAW,CAAC,GAAI;AAChD,aAAO;AAAA,IACN,OAAQ;AAAA,MACP,aAAa,SAAS;AAAA,MACtB,eAAe,SAAS;AAAA,MACxB,eAAe,SAAS;AAAA,MACxB,mBAAmB,SAAS;AAAA,MAC5B,kBAAkB,SAAS;AAAA,MAC3B,eAAe,SAAS;AAAA,MACxB,uBAAuB,SAAS;AAAA,IACjC;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACD;AAEA,IAAO,oCAAQ;",
6
6
  "names": []
7
7
  }
@@ -79,7 +79,7 @@ function getClosestTabbable(target, isReverse, containerElement, onlyVertical) {
79
79
  targetRect = target.getBoundingClientRect();
80
80
  }
81
81
  function isTabCandidate(node) {
82
- if ((0, import_dom2.getBlockClientId)(node) && import_dom.focus.focusable.find(node).filter((element) => !(0, import_dom.isFormElement)(element)).length !== 0) {
82
+ if (node.contentEditable !== "true" && (0, import_dom2.getBlockClientId)(node) && import_dom.focus.focusable.find(node).filter((element) => !(0, import_dom.isFormElement)(element)).length !== 0) {
83
83
  return false;
84
84
  }
85
85
  if (!import_dom.focus.tabbable.isTabbableIndex(node)) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/writing-flow/use-arrow-nav.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tcomputeCaretRect,\n\tfocus,\n\tisHorizontalEdge,\n\tisVerticalEdge,\n\tplaceCaretAtHorizontalEdge,\n\tplaceCaretAtVerticalEdge,\n\tisRTL,\n\tisFormElement,\n} from '@wordpress/dom';\nimport { UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getBlockClientId } from '../../utils/dom';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Returns true if the element should consider edge navigation upon a keyboard\n * event of the given directional key code, or false otherwise.\n *\n * @param {Element} element HTML element to test.\n * @param {number} keyCode KeyboardEvent keyCode to test.\n * @param {boolean} hasModifier Whether a modifier is pressed.\n *\n * @return {boolean} Whether element should consider edge navigation.\n */\nexport function isNavigationCandidate( element, keyCode, hasModifier ) {\n\tconst isVertical = keyCode === UP || keyCode === DOWN;\n\tconst { tagName } = element;\n\tconst elementType = element.getAttribute( 'type' );\n\n\t// Native inputs should not navigate vertically, unless they are simple types that don't need up/down arrow keys.\n\tif ( isVertical && ! hasModifier ) {\n\t\tif ( tagName === 'INPUT' ) {\n\t\t\tconst verticalInputTypes = [\n\t\t\t\t'date',\n\t\t\t\t'datetime-local',\n\t\t\t\t'month',\n\t\t\t\t'number',\n\t\t\t\t'range',\n\t\t\t\t'time',\n\t\t\t\t'week',\n\t\t\t];\n\t\t\treturn ! verticalInputTypes.includes( elementType );\n\t\t}\n\t\treturn true;\n\t}\n\n\t// Native inputs should not navigate horizontally, unless they are simple types that don't need left/right arrow keys.\n\tif ( tagName === 'INPUT' ) {\n\t\tconst simpleInputTypes = [\n\t\t\t'button',\n\t\t\t'checkbox',\n\t\t\t'number',\n\t\t\t'color',\n\t\t\t'file',\n\t\t\t'image',\n\t\t\t'radio',\n\t\t\t'reset',\n\t\t\t'submit',\n\t\t];\n\t\treturn simpleInputTypes.includes( elementType );\n\t}\n\n\t// Native textareas should not navigate horizontally.\n\treturn tagName !== 'TEXTAREA';\n}\n\n/**\n * Returns the optimal tab target from the given focused element in the desired\n * direction. A preference is made toward text fields, falling back to the block\n * focus stop if no other candidates exist for the block.\n *\n * @param {Element} target Currently focused text field.\n * @param {boolean} isReverse True if considering as the first field.\n * @param {Element} containerElement Element containing all blocks.\n * @param {boolean} onlyVertical Whether to only consider tabbable elements\n * that are visually above or under the\n * target.\n *\n * @return {?Element} Optimal tab target, if one exists.\n */\nexport function getClosestTabbable(\n\ttarget,\n\tisReverse,\n\tcontainerElement,\n\tonlyVertical\n) {\n\t// Since the current focus target is not guaranteed to be a text field, find\n\t// all focusables. Tabbability is considered later.\n\tlet focusableNodes = focus.focusable.find( containerElement );\n\n\tif ( isReverse ) {\n\t\tfocusableNodes.reverse();\n\t}\n\n\t// Consider as candidates those focusables after the current target. It's\n\t// assumed this can only be reached if the target is focusable (on its\n\t// keydown event), so no need to verify it exists in the set.\n\tfocusableNodes = focusableNodes.slice(\n\t\tfocusableNodes.indexOf( target ) + 1\n\t);\n\n\tlet targetRect;\n\n\tif ( onlyVertical ) {\n\t\ttargetRect = target.getBoundingClientRect();\n\t}\n\n\tfunction isTabCandidate( node ) {\n\t\t// If it's a block and there are nested focusable nodes, skip because\n\t\t// there are better candidates.\n\t\tif (\n\t\t\tgetBlockClientId( node ) &&\n\t\t\tfocus.focusable\n\t\t\t\t.find( node )\n\t\t\t\t// Exclude form elements for now because primary+a cannot be\n\t\t\t\t// used to select the parent element.\n\t\t\t\t.filter( ( element ) => ! isFormElement( element ) ).length !==\n\t\t\t\t0\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Not a candidate if the node is not tabbable.\n\t\tif ( ! focus.tabbable.isTabbableIndex( node ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Skip focusable elements such as links within content editable nodes.\n\t\tif ( node.isContentEditable && node.contentEditable !== 'true' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( onlyVertical ) {\n\t\t\tconst nodeRect = node.getBoundingClientRect();\n\n\t\t\tif (\n\t\t\t\tnodeRect.left >= targetRect.right ||\n\t\t\t\tnodeRect.right <= targetRect.left\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\treturn focusableNodes.find( isTabCandidate );\n}\n\nexport default function useArrowNav() {\n\tconst {\n\t\tgetMultiSelectedBlocksStartClientId,\n\t\tgetMultiSelectedBlocksEndClientId,\n\t\tgetSettings,\n\t\thasMultiSelection,\n\t\t__unstableIsFullySelected,\n\t} = useSelect( blockEditorStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\treturn useRefEffect( ( node ) => {\n\t\t// Here a DOMRect is stored while moving the caret vertically so\n\t\t// vertical position of the start position can be restored. This is to\n\t\t// recreate browser behaviour across blocks.\n\t\tlet verticalRect;\n\n\t\tfunction onMouseDown() {\n\t\t\tverticalRect = null;\n\t\t}\n\n\t\tfunction isClosestTabbableABlock( target, isReverse ) {\n\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\ttarget,\n\t\t\t\tisReverse,\n\t\t\t\tnode\n\t\t\t);\n\t\t\treturn closestTabbable && getBlockClientId( closestTabbable );\n\t\t}\n\n\t\tfunction onKeyDown( event ) {\n\t\t\t// Abort if navigation has already been handled (e.g. RichText\n\t\t\t// inline boundaries).\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { keyCode, target, shiftKey, ctrlKey, altKey, metaKey } =\n\t\t\t\tevent;\n\t\t\tconst isUp = keyCode === UP;\n\t\t\tconst isDown = keyCode === DOWN;\n\t\t\tconst isLeft = keyCode === LEFT;\n\t\t\tconst isRight = keyCode === RIGHT;\n\t\t\tconst isReverse = isUp || isLeft;\n\t\t\tconst isHorizontal = isLeft || isRight;\n\t\t\tconst isVertical = isUp || isDown;\n\t\t\tconst isNav = isHorizontal || isVertical;\n\t\t\tconst hasModifier = shiftKey || ctrlKey || altKey || metaKey;\n\t\t\tconst isNavEdge = isVertical ? isVerticalEdge : isHorizontalEdge;\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tif ( ! isNav ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In preview mode, navigation is handled by useSelectableBlocksNav.\n\t\t\tif ( getSettings().isPreviewMode ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If there is a multi-selection, the arrow keys should collapse the\n\t\t\t// selection to the start or end of the selection.\n\t\t\tif ( hasMultiSelection() ) {\n\t\t\t\tif ( shiftKey ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Only handle if we have a full selection (not a native partial\n\t\t\t\t// selection).\n\t\t\t\tif ( ! __unstableIsFullySelected() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tif ( isReverse ) {\n\t\t\t\t\tselectBlock( getMultiSelectedBlocksStartClientId() );\n\t\t\t\t} else {\n\t\t\t\t\tselectBlock( getMultiSelectedBlocksEndClientId(), -1 );\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Abort if our current target is not a candidate for navigation\n\t\t\t// (e.g. preserve native input behaviors).\n\t\t\tif ( ! isNavigationCandidate( target, keyCode, hasModifier ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// When presing any key other than up or down, the initial vertical\n\t\t\t// position must ALWAYS be reset. The vertical position is saved so\n\t\t\t// it can be restored as well as possible on sebsequent vertical\n\t\t\t// arrow key presses. It may not always be possible to restore the\n\t\t\t// exact same position (such as at an empty line), so it wouldn't be\n\t\t\t// good to compute the position right before any vertical arrow key\n\t\t\t// press.\n\t\t\tif ( ! isVertical ) {\n\t\t\t\tverticalRect = null;\n\t\t\t} else if ( ! verticalRect ) {\n\t\t\t\tverticalRect = computeCaretRect( defaultView );\n\t\t\t}\n\n\t\t\t// In the case of RTL scripts, right means previous and left means\n\t\t\t// next, which is the exact reverse of LTR.\n\t\t\tconst isReverseDir = isRTL( target ) ? ! isReverse : isReverse;\n\t\t\tconst { keepCaretInsideBlock } = getSettings();\n\n\t\t\tif ( shiftKey ) {\n\t\t\t\tif (\n\t\t\t\t\tisClosestTabbableABlock( target, isReverse ) &&\n\t\t\t\t\tisNavEdge( target, isReverse )\n\t\t\t\t) {\n\t\t\t\t\tnode.contentEditable = true;\n\t\t\t\t\t// Firefox doesn't automatically move focus.\n\t\t\t\t\tnode.focus();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tisVertical &&\n\t\t\t\tisVerticalEdge( target, isReverse ) &&\n\t\t\t\t// When Alt is pressed, only intercept if the caret is also at\n\t\t\t\t// the horizontal edge.\n\t\t\t\t( altKey ? isHorizontalEdge( target, isReverseDir ) : true ) &&\n\t\t\t\t! keepCaretInsideBlock\n\t\t\t) {\n\t\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\t\ttarget,\n\t\t\t\t\tisReverse,\n\t\t\t\t\tnode,\n\t\t\t\t\ttrue\n\t\t\t\t);\n\n\t\t\t\tif ( closestTabbable ) {\n\t\t\t\t\tplaceCaretAtVerticalEdge(\n\t\t\t\t\t\tclosestTabbable,\n\t\t\t\t\t\t// When Alt is pressed, place the caret at the furthest\n\t\t\t\t\t\t// horizontal edge and the furthest vertical edge.\n\t\t\t\t\t\taltKey ? ! isReverse : isReverse,\n\t\t\t\t\t\taltKey ? undefined : verticalRect\n\t\t\t\t\t);\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tisHorizontal &&\n\t\t\t\tdefaultView.getSelection().isCollapsed &&\n\t\t\t\tisHorizontalEdge( target, isReverseDir ) &&\n\t\t\t\t! keepCaretInsideBlock\n\t\t\t) {\n\t\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\t\ttarget,\n\t\t\t\t\tisReverseDir,\n\t\t\t\t\tnode\n\t\t\t\t);\n\t\t\t\tplaceCaretAtHorizontalEdge( closestTabbable, isReverse );\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBASO;AACP,sBAAsC;AACtC,kBAAuC;AACvC,qBAA6B;AAK7B,IAAAA,cAAiC;AACjC,mBAA0C;AAYnC,SAAS,sBAAuB,SAAS,SAAS,aAAc;AACtE,QAAM,aAAa,YAAY,sBAAM,YAAY;AACjD,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,cAAc,QAAQ,aAAc,MAAO;AAGjD,MAAK,cAAc,CAAE,aAAc;AAClC,QAAK,YAAY,SAAU;AAC1B,YAAM,qBAAqB;AAAA,QAC1B;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD;AACA,aAAO,CAAE,mBAAmB,SAAU,WAAY;AAAA,IACnD;AACA,WAAO;AAAA,EACR;AAGA,MAAK,YAAY,SAAU;AAC1B,UAAM,mBAAmB;AAAA,M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,YAAY;AAE7C,UAAK,UAAW;AACf,YACC,wBAAyB,QAAQ,SAAU,KAC3C,UAAW,QAAQ,SAAU,GAC5B;AACD,eAAK,kBAAkB;AAEvB,eAAK,MAAM;AAAA,QACZ;AAAA,MACD,WACC,kBACA,2BAAgB,QAAQ,SAAU;AAAA;AAAA,OAGhC,aAAS,6BAAkB,QAAQ,YAAa,IAAI,SACtD,CAAE,sBACD;AACD,cAAM,kBAAkB;AAAA,UACvB;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACD;AAEA,YAAK,iBAAkB;AACtB;AAAA,YACC;AAAA;AAAA;AAAA,YAGA,SAAS,CAAE,YAAY;AAAA,YACvB,SAAS,SAAY;AAAA,UACtB;AACA,gBAAM,eAAe;AAAA,QACtB;AAAA,MACD,WACC,gBACA,YAAY,aAAa,EAAE,mBAC3B,6BAAkB,QAAQ,YAAa,KACvC,CAAE,sBACD;AACD,cAAM,kBAAkB;AAAA,UACvB;AAAA,UACA;AAAA,UACA;AAAA,QACD;AACA,mDAA4B,iBAAiB,SAAU;AACvD,cAAM,eAAe;AAAA,MACtB;AAAA,IACD;AAEA,SAAK,iBAAkB,aAAa,WAAY;AAChD,SAAK,iBAAkB,WAAW,SAAU;AAC5C,WAAO,MAAM;AACZ,WAAK,oBAAqB,aAAa,WAAY;AACnD,WAAK,oBAAqB,WAAW,SAAU;AAAA,IAChD;AAAA,EACD,GAAG,CAAC,CAAE;AACP;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tcomputeCaretRect,\n\tfocus,\n\tisHorizontalEdge,\n\tisVerticalEdge,\n\tplaceCaretAtHorizontalEdge,\n\tplaceCaretAtVerticalEdge,\n\tisRTL,\n\tisFormElement,\n} from '@wordpress/dom';\nimport { UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getBlockClientId } from '../../utils/dom';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Returns true if the element should consider edge navigation upon a keyboard\n * event of the given directional key code, or false otherwise.\n *\n * @param {Element} element HTML element to test.\n * @param {number} keyCode KeyboardEvent keyCode to test.\n * @param {boolean} hasModifier Whether a modifier is pressed.\n *\n * @return {boolean} Whether element should consider edge navigation.\n */\nexport function isNavigationCandidate( element, keyCode, hasModifier ) {\n\tconst isVertical = keyCode === UP || keyCode === DOWN;\n\tconst { tagName } = element;\n\tconst elementType = element.getAttribute( 'type' );\n\n\t// Native inputs should not navigate vertically, unless they are simple types that don't need up/down arrow keys.\n\tif ( isVertical && ! hasModifier ) {\n\t\tif ( tagName === 'INPUT' ) {\n\t\t\tconst verticalInputTypes = [\n\t\t\t\t'date',\n\t\t\t\t'datetime-local',\n\t\t\t\t'month',\n\t\t\t\t'number',\n\t\t\t\t'range',\n\t\t\t\t'time',\n\t\t\t\t'week',\n\t\t\t];\n\t\t\treturn ! verticalInputTypes.includes( elementType );\n\t\t}\n\t\treturn true;\n\t}\n\n\t// Native inputs should not navigate horizontally, unless they are simple types that don't need left/right arrow keys.\n\tif ( tagName === 'INPUT' ) {\n\t\tconst simpleInputTypes = [\n\t\t\t'button',\n\t\t\t'checkbox',\n\t\t\t'number',\n\t\t\t'color',\n\t\t\t'file',\n\t\t\t'image',\n\t\t\t'radio',\n\t\t\t'reset',\n\t\t\t'submit',\n\t\t];\n\t\treturn simpleInputTypes.includes( elementType );\n\t}\n\n\t// Native textareas should not navigate horizontally.\n\treturn tagName !== 'TEXTAREA';\n}\n\n/**\n * Returns the optimal tab target from the given focused element in the desired\n * direction. A preference is made toward text fields, falling back to the block\n * focus stop if no other candidates exist for the block.\n *\n * @param {Element} target Currently focused text field.\n * @param {boolean} isReverse True if considering as the first field.\n * @param {Element} containerElement Element containing all blocks.\n * @param {boolean} onlyVertical Whether to only consider tabbable elements\n * that are visually above or under the\n * target.\n *\n * @return {?Element} Optimal tab target, if one exists.\n */\nexport function getClosestTabbable(\n\ttarget,\n\tisReverse,\n\tcontainerElement,\n\tonlyVertical\n) {\n\t// Since the current focus target is not guaranteed to be a text field, find\n\t// all focusables. Tabbability is considered later.\n\tlet focusableNodes = focus.focusable.find( containerElement );\n\n\tif ( isReverse ) {\n\t\tfocusableNodes.reverse();\n\t}\n\n\t// Consider as candidates those focusables after the current target. It's\n\t// assumed this can only be reached if the target is focusable (on its\n\t// keydown event), so no need to verify it exists in the set.\n\tfocusableNodes = focusableNodes.slice(\n\t\tfocusableNodes.indexOf( target ) + 1\n\t);\n\n\tlet targetRect;\n\n\tif ( onlyVertical ) {\n\t\ttargetRect = target.getBoundingClientRect();\n\t}\n\n\tfunction isTabCandidate( node ) {\n\t\t// If it's a block wrapper (not itself a contenteditable editing surface)\n\t\t// and there are nested focusable nodes, skip because there are better\n\t\t// candidates. We must not skip contenteditable nodes that happen to\n\t\t// contain links or other focusable inline elements, since those are the\n\t\t// correct navigation targets.\n\t\t//\n\t\t// See https://github.com/WordPress/gutenberg/pull/77474\n\t\t// TODO: Consider fixing focus.tabbable\n\t\tif (\n\t\t\tnode.contentEditable !== 'true' &&\n\t\t\tgetBlockClientId( node ) &&\n\t\t\tfocus.focusable\n\t\t\t\t.find( node )\n\t\t\t\t// Exclude form elements for now because primary+a cannot be\n\t\t\t\t// used to select the parent element.\n\t\t\t\t.filter( ( element ) => ! isFormElement( element ) ).length !==\n\t\t\t\t0\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Not a candidate if the node is not tabbable.\n\t\tif ( ! focus.tabbable.isTabbableIndex( node ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Skip focusable elements such as links within content editable nodes.\n\t\tif ( node.isContentEditable && node.contentEditable !== 'true' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( onlyVertical ) {\n\t\t\tconst nodeRect = node.getBoundingClientRect();\n\n\t\t\tif (\n\t\t\t\tnodeRect.left >= targetRect.right ||\n\t\t\t\tnodeRect.right <= targetRect.left\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\treturn focusableNodes.find( isTabCandidate );\n}\n\nexport default function useArrowNav() {\n\tconst {\n\t\tgetMultiSelectedBlocksStartClientId,\n\t\tgetMultiSelectedBlocksEndClientId,\n\t\tgetSettings,\n\t\thasMultiSelection,\n\t\t__unstableIsFullySelected,\n\t} = useSelect( blockEditorStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\treturn useRefEffect( ( node ) => {\n\t\t// Here a DOMRect is stored while moving the caret vertically so\n\t\t// vertical position of the start position can be restored. This is to\n\t\t// recreate browser behaviour across blocks.\n\t\tlet verticalRect;\n\n\t\tfunction onMouseDown() {\n\t\t\tverticalRect = null;\n\t\t}\n\n\t\tfunction isClosestTabbableABlock( target, isReverse ) {\n\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\ttarget,\n\t\t\t\tisReverse,\n\t\t\t\tnode\n\t\t\t);\n\t\t\treturn closestTabbable && getBlockClientId( closestTabbable );\n\t\t}\n\n\t\tfunction onKeyDown( event ) {\n\t\t\t// Abort if navigation has already been handled (e.g. RichText\n\t\t\t// inline boundaries).\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { keyCode, target, shiftKey, ctrlKey, altKey, metaKey } =\n\t\t\t\tevent;\n\t\t\tconst isUp = keyCode === UP;\n\t\t\tconst isDown = keyCode === DOWN;\n\t\t\tconst isLeft = keyCode === LEFT;\n\t\t\tconst isRight = keyCode === RIGHT;\n\t\t\tconst isReverse = isUp || isLeft;\n\t\t\tconst isHorizontal = isLeft || isRight;\n\t\t\tconst isVertical = isUp || isDown;\n\t\t\tconst isNav = isHorizontal || isVertical;\n\t\t\tconst hasModifier = shiftKey || ctrlKey || altKey || metaKey;\n\t\t\tconst isNavEdge = isVertical ? isVerticalEdge : isHorizontalEdge;\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tif ( ! isNav ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In preview mode, navigation is handled by useSelectableBlocksNav.\n\t\t\tif ( getSettings().isPreviewMode ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If there is a multi-selection, the arrow keys should collapse the\n\t\t\t// selection to the start or end of the selection.\n\t\t\tif ( hasMultiSelection() ) {\n\t\t\t\tif ( shiftKey ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Only handle if we have a full selection (not a native partial\n\t\t\t\t// selection).\n\t\t\t\tif ( ! __unstableIsFullySelected() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tif ( isReverse ) {\n\t\t\t\t\tselectBlock( getMultiSelectedBlocksStartClientId() );\n\t\t\t\t} else {\n\t\t\t\t\tselectBlock( getMultiSelectedBlocksEndClientId(), -1 );\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Abort if our current target is not a candidate for navigation\n\t\t\t// (e.g. preserve native input behaviors).\n\t\t\tif ( ! isNavigationCandidate( target, keyCode, hasModifier ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// When presing any key other than up or down, the initial vertical\n\t\t\t// position must ALWAYS be reset. The vertical position is saved so\n\t\t\t// it can be restored as well as possible on sebsequent vertical\n\t\t\t// arrow key presses. It may not always be possible to restore the\n\t\t\t// exact same position (such as at an empty line), so it wouldn't be\n\t\t\t// good to compute the position right before any vertical arrow key\n\t\t\t// press.\n\t\t\tif ( ! isVertical ) {\n\t\t\t\tverticalRect = null;\n\t\t\t} else if ( ! verticalRect ) {\n\t\t\t\tverticalRect = computeCaretRect( defaultView );\n\t\t\t}\n\n\t\t\t// In the case of RTL scripts, right means previous and left means\n\t\t\t// next, which is the exact reverse of LTR.\n\t\t\tconst isReverseDir = isRTL( target ) ? ! isReverse : isReverse;\n\t\t\tconst { keepCaretInsideBlock } = getSettings();\n\n\t\t\tif ( shiftKey ) {\n\t\t\t\tif (\n\t\t\t\t\tisClosestTabbableABlock( target, isReverse ) &&\n\t\t\t\t\tisNavEdge( target, isReverse )\n\t\t\t\t) {\n\t\t\t\t\tnode.contentEditable = true;\n\t\t\t\t\t// Firefox doesn't automatically move focus.\n\t\t\t\t\tnode.focus();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tisVertical &&\n\t\t\t\tisVerticalEdge( target, isReverse ) &&\n\t\t\t\t// When Alt is pressed, only intercept if the caret is also at\n\t\t\t\t// the horizontal edge.\n\t\t\t\t( altKey ? isHorizontalEdge( target, isReverseDir ) : true ) &&\n\t\t\t\t! keepCaretInsideBlock\n\t\t\t) {\n\t\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\t\ttarget,\n\t\t\t\t\tisReverse,\n\t\t\t\t\tnode,\n\t\t\t\t\ttrue\n\t\t\t\t);\n\n\t\t\t\tif ( closestTabbable ) {\n\t\t\t\t\tplaceCaretAtVerticalEdge(\n\t\t\t\t\t\tclosestTabbable,\n\t\t\t\t\t\t// When Alt is pressed, place the caret at the furthest\n\t\t\t\t\t\t// horizontal edge and the furthest vertical edge.\n\t\t\t\t\t\taltKey ? ! isReverse : isReverse,\n\t\t\t\t\t\taltKey ? undefined : verticalRect\n\t\t\t\t\t);\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tisHorizontal &&\n\t\t\t\tdefaultView.getSelection().isCollapsed &&\n\t\t\t\tisHorizontalEdge( target, isReverseDir ) &&\n\t\t\t\t! keepCaretInsideBlock\n\t\t\t) {\n\t\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\t\ttarget,\n\t\t\t\t\tisReverseDir,\n\t\t\t\t\tnode\n\t\t\t\t);\n\t\t\t\tplaceCaretAtHorizontalEdge( closestTabbable, isReverse );\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBASO;AACP,sBAAsC;AACtC,kBAAuC;AACvC,qBAA6B;AAK7B,IAAAA,cAAiC;AACjC,mBAA0C;AAYnC,SAAS,sBAAuB,SAAS,SAAS,aAAc;AACtE,QAAM,aAAa,YAAY,sBAAM,YAAY;AACjD,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,cAAc,QAAQ,aAAc,MAAO;AAGjD,MAAK,cAAc,CAAE,aAAc;AAClC,QAAK,YAAY,SAAU;AAC1B,YAAM,qBAAqB;AAAA,QAC1B;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD;AACA,aAAO,CAAE,mBAAmB,SAAU,WAAY;AAAA,IACnD;AACA,WAAO;AAAA,EACR;AAGA,MAAK,YAAY,SAAU;AAC1B,UAAM,mBAAmB;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AACA,WAAO,iBAAiB,SAAU,WAAY;AAAA,EAC/C;AAGA,SAAO,YAAY;AACpB;AAgBO,SAAS,mBACf,QACA,WACA,kBACA,cACC;AAGD,MAAI,iBAAiB,iBAAM,UAAU,KAAM,gBAAiB;AAE5D,MAAK,WAAY;AAChB,mBAAe,QAAQ;AAAA,EACxB;AAKA,mBAAiB,eAAe;AAAA,IAC/B,eAAe,QAAS,MAAO,IAAI;AAAA,EACpC;AAEA,MAAI;AAEJ,MAAK,cAAe;AACnB,iBAAa,OAAO,sBAAsB;AAAA,EAC3C;A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;AAAA,UACtB;AACA,gBAAM,eAAe;AAAA,QACtB;AAAA,MACD,WACC,gBACA,YAAY,aAAa,EAAE,mBAC3B,6BAAkB,QAAQ,YAAa,KACvC,CAAE,sBACD;AACD,cAAM,kBAAkB;AAAA,UACvB;AAAA,UACA;AAAA,UACA;AAAA,QACD;AACA,mDAA4B,iBAAiB,SAAU;AACvD,cAAM,eAAe;AAAA,MACtB;AAAA,IACD;AAEA,SAAK,iBAAkB,aAAa,WAAY;AAChD,SAAK,iBAAkB,WAAW,SAAU;AAC5C,WAAO,MAAM;AACZ,WAAK,oBAAqB,aAAa,WAAY;AACnD,WAAK,oBAAqB,WAAW,SAAU;AAAA,IAChD;AAAA,EACD,GAAG,CAAC,CAAE;AACP;",
6
6
  "names": ["import_dom", "blockEditorStore"]
7
7
  }
@@ -42,6 +42,8 @@ var import_i18n = require("@wordpress/i18n");
42
42
  var import_inspector_controls = __toESM(require("../components/inspector-controls/index.cjs"));
43
43
  var import_block_editing_mode = require("../components/block-editing-mode/index.cjs");
44
44
  var import_store = require("../store/index.cjs");
45
+ var import_lock_unlock = require("../lock-unlock.cjs");
46
+ var import_block_context = __toESM(require("../components/block-context/index.cjs"));
45
47
  var import_generate_fields_from_attributes = require("./generate-fields-from-attributes.cjs");
46
48
  var import_jsx_runtime = require("react/jsx-runtime");
47
49
  function hasAutoGenerateControl(blockTypeAttributes) {
@@ -54,9 +56,31 @@ function hasAutoGenerateControl(blockTypeAttributes) {
54
56
  }
55
57
  function AutoRegisterControls({ name, clientId, setAttributes }) {
56
58
  const blockEditingMode = (0, import_block_editing_mode.useBlockEditingMode)();
59
+ const blockContext = (0, import_element.useContext)(import_block_context.default);
57
60
  const attributes = (0, import_data.useSelect)(
58
- (select) => select(import_store.store).getBlockAttributes(clientId),
59
- [clientId]
61
+ (select) => {
62
+ const _attributes = select(import_store.store).getBlockAttributes(clientId);
63
+ if (!_attributes?.metadata?.bindings) {
64
+ return _attributes;
65
+ }
66
+ const { getBlockBindingsSource } = (0, import_lock_unlock.unlock)(select(import_blocks.store));
67
+ return Object.entries(_attributes.metadata.bindings).reduce(
68
+ (acc, [attribute, binding]) => {
69
+ const source = getBlockBindingsSource(binding.source);
70
+ if (!source) {
71
+ return acc;
72
+ }
73
+ const values = source.getValues({
74
+ select,
75
+ context: blockContext,
76
+ bindings: { [attribute]: binding }
77
+ });
78
+ return { ...acc, ...values };
79
+ },
80
+ _attributes
81
+ );
82
+ },
83
+ [blockContext, clientId]
60
84
  );
61
85
  const blockType = (0, import_blocks.getBlockType)(name);
62
86
  const { fields, form } = (0, import_element.useMemo)(() => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/auto-inspector-controls.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { PanelBody } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { store as blockEditorStore } from '../store';\nimport { generateFieldsFromAttributes } from './generate-fields-from-attributes';\n\n/**\n * Checks if a block has any attributes marked for auto-generated inspector controls.\n *\n * @param {Object} blockTypeAttributes - The block type's attributes object.\n * @return {boolean} True if any attribute has autoGenerateControl marker.\n */\nfunction hasAutoGenerateControl( blockTypeAttributes ) {\n\tif ( ! blockTypeAttributes ) {\n\t\treturn false;\n\t}\n\treturn Object.values( blockTypeAttributes ).some(\n\t\t( attr ) => attr?.autoGenerateControl\n\t);\n}\n\n/**\n * Renders DataForm-based inspector controls for auto-registered PHP-only blocks.\n *\n * Fields are generated on-the-fly from attributes marked with `autoGenerateControl`\n * during PHP registration.\n *\n * @param {Object} props Component props.\n * @param {string} props.name Block name.\n * @param {string} props.clientId Block client ID.\n * @param {Function} props.setAttributes Function to update block attributes.\n */\nfunction AutoRegisterControls( { name, clientId, setAttributes } ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst attributes = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockAttributes( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tconst blockType = getBlockType( name );\n\n\t// Generate fields from user-defined attributes marked by PHP.\n\t// The autoGenerateControl marker excludes block support attributes\n\t// (which have their own UI) and internal state (role: 'local').\n\t// Memoized since blockType.attributes don't change after registration.\n\tconst { fields, form } = useMemo( () => {\n\t\tif ( ! blockType?.attributes ) {\n\t\t\treturn { fields: [], form: { fields: [] } };\n\t\t}\n\t\treturn generateFieldsFromAttributes( blockType.attributes );\n\t}, [ blockType?.attributes ] );\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tif ( ! fields || fields.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ attributes }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ setAttributes }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\tedit: AutoRegisterControls,\n\tattributeKeys: [],\n\thasSupport( name ) {\n\t\tconst blockType = getBlockType( name );\n\t\treturn hasAutoGenerateControl( blockType?.attributes );\n\t},\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAA6B;AAC7B,wBAA0B;AAC1B,kBAA0B;AAC1B,uBAAyB;AACzB,qBAAwB;AACxB,kBAAmB;AAKnB,gCAA8B;AAC9B,gCAAoC;AACpC,mBAA0C;AAC1C,6CAA6C;AA4DzC;AApDJ,SAAS,uBAAwB,qBAAsB;AACtD,MAAK,CAAE,qBAAsB;AAC5B,WAAO;AAAA,EACR;AACA,SAAO,OAAO,OAAQ,mBAAoB,EAAE;AAAA,IAC3C,CAAE,SAAU,MAAM;AAAA,EACnB;AACD;AAaA,SAAS,qBAAsB,EAAE,MAAM,UAAU,cAAc,GAAI;AAClE,QAAM,uBAAmB,+CAAoB;AAE7C,QAAM,iBAAa;AAAA,IAClB,CAAE,WAAY,OAAQ,aAAAA,KAAiB,EAAE,mBAAoB,QAAS;AAAA,IACtE,CAAE,QAAS;AAAA,EACZ;AAEA,QAAM,gBAAY,4BAAc,IAAK;AAMrC,QAAM,EAAE,QAAQ,KAAK,QAAI,wBAAS,MAAM;AACvC,QAAK,CAAE,WAAW,YAAa;AAC9B,aAAO,EAAE,QAAQ,CAAC,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,EAAE;AAAA,IAC3C;AACA,eAAO,qEAA8B,UAAU,UAAW;AAAA,EAC3D,GAAG,CAAE,WAAW,UAAW,CAAE;AAE7B,MAAK,qBAAqB,WAAY;AACrC,WAAO;AAAA,EACR;AAEA,MAAK,CAAE,UAAU,OAAO,WAAW,GAAI;AACtC,WAAO;AAAA,EACR;AAEA,SACC,4CAAC,0BAAAC,SAAA,EACA,sDAAC,+BAAU,WAAQ,gBAAI,UAAW,GACjC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA,UAAW;AAAA;AAAA,EACZ,GACD,GACD;AAEF;AAEA,IAAO,kCAAQ;AAAA,EACd,MAAM;AAAA,EACN,eAAe,CAAC;AAAA,EAChB,WAAY,MAAO;AAClB,UAAM,gBAAY,4BAAc,IAAK;AACrC,WAAO,uBAAwB,WAAW,UAAW;AAAA,EACtD;AACD;",
6
- "names": ["blockEditorStore", "InspectorControls"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { PanelBody } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\nimport BlockContext from '../components/block-context';\nimport { generateFieldsFromAttributes } from './generate-fields-from-attributes';\n\n/**\n * Checks if a block has any attributes marked for auto-generated inspector controls.\n *\n * @param {Object} blockTypeAttributes - The block type's attributes object.\n * @return {boolean} True if any attribute has autoGenerateControl marker.\n */\nfunction hasAutoGenerateControl( blockTypeAttributes ) {\n\tif ( ! blockTypeAttributes ) {\n\t\treturn false;\n\t}\n\treturn Object.values( blockTypeAttributes ).some(\n\t\t( attr ) => attr?.autoGenerateControl\n\t);\n}\n\n/**\n * Renders DataForm-based inspector controls for auto-registered PHP-only blocks.\n *\n * Fields are generated on-the-fly from attributes marked with `autoGenerateControl`\n * during PHP registration.\n *\n * @param {Object} props Component props.\n * @param {string} props.name Block name.\n * @param {string} props.clientId Block client ID.\n * @param {Function} props.setAttributes Function to update block attributes.\n */\nfunction AutoRegisterControls( { name, clientId, setAttributes } ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst blockContext = useContext( BlockContext );\n\n\tconst attributes = useSelect(\n\t\t( select ) => {\n\t\t\tconst _attributes =\n\t\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId );\n\t\t\tif ( ! _attributes?.metadata?.bindings ) {\n\t\t\t\treturn _attributes;\n\t\t\t}\n\n\t\t\tconst { getBlockBindingsSource } = unlock( select( blocksStore ) );\n\t\t\treturn Object.entries( _attributes.metadata.bindings ).reduce(\n\t\t\t\t( acc, [ attribute, binding ] ) => {\n\t\t\t\t\tconst source = getBlockBindingsSource( binding.source );\n\t\t\t\t\tif ( ! source ) {\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}\n\t\t\t\t\tconst values = source.getValues( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext: blockContext,\n\t\t\t\t\t\tbindings: { [ attribute ]: binding },\n\t\t\t\t\t} );\n\t\t\t\t\treturn { ...acc, ...values };\n\t\t\t\t},\n\t\t\t\t_attributes\n\t\t\t);\n\t\t},\n\t\t[ blockContext, clientId ]\n\t);\n\n\tconst blockType = getBlockType( name );\n\n\t// Generate fields from user-defined attributes marked by PHP.\n\t// The autoGenerateControl marker excludes block support attributes\n\t// (which have their own UI) and internal state (role: 'local').\n\t// Memoized since blockType.attributes don't change after registration.\n\tconst { fields, form } = useMemo( () => {\n\t\tif ( ! blockType?.attributes ) {\n\t\t\treturn { fields: [], form: { fields: [] } };\n\t\t}\n\t\treturn generateFieldsFromAttributes( blockType.attributes );\n\t}, [ blockType?.attributes ] );\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tif ( ! fields || fields.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ attributes }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ setAttributes }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\tedit: AutoRegisterControls,\n\tattributeKeys: [],\n\thasSupport( name ) {\n\t\tconst blockType = getBlockType( name );\n\t\treturn hasAutoGenerateControl( blockType?.attributes );\n\t},\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAmD;AACnD,wBAA0B;AAC1B,kBAA0B;AAC1B,uBAAyB;AACzB,qBAAoC;AACpC,kBAAmB;AAKnB,gCAA8B;AAC9B,gCAAoC;AACpC,mBAA0C;AAC1C,yBAAuB;AACvB,2BAAyB;AACzB,6CAA6C;AAqFzC;AA7EJ,SAAS,uBAAwB,qBAAsB;A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AACrC,WAAO;AAAA,EACR;AAEA,MAAK,CAAE,UAAU,OAAO,WAAW,GAAI;AACtC,WAAO;AAAA,EACR;AAEA,SACC,4CAAC,0BAAAC,SAAA,EACA,sDAAC,+BAAU,WAAQ,gBAAI,UAAW,GACjC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA,UAAW;AAAA;AAAA,EACZ,GACD,GACD;AAEF;AAEA,IAAO,kCAAQ;AAAA,EACd,MAAM;AAAA,EACN,eAAe,CAAC;AAAA,EAChB,WAAY,MAAO;AAClB,UAAM,gBAAY,4BAAc,IAAK;AACrC,WAAO,uBAAwB,WAAW,UAAW;AAAA,EACtD;AACD;",
6
+ "names": ["BlockContext", "blockEditorStore", "blocksStore", "InspectorControls"]
7
7
  }
@@ -1,22 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  // packages/block-editor/src/hooks/cross-origin-isolation.js
4
- var import_hooks = require("@wordpress/hooks");
5
- var import_compose = require("@wordpress/compose");
6
- var import_jsx_runtime = require("react/jsx-runtime");
7
- function addCrossOriginAttributes(el) {
4
+ function addCrossOriginAttribute(el) {
8
5
  if (!el.hasAttribute("crossorigin")) {
9
6
  el.setAttribute("crossorigin", "anonymous");
10
7
  }
11
- if (el.nodeName === "IFRAME" && !el.hasAttribute("credentialless")) {
12
- if (el.getAttribute("src")?.startsWith("blob:")) {
13
- return;
14
- }
15
- el.setAttribute("credentialless", "");
16
- const origSrc = el.getAttribute("src") || "";
17
- el.setAttribute("src", "");
18
- el.setAttribute("src", origSrc);
19
- }
20
8
  }
21
9
  if (window.crossOriginIsolated) {
22
10
  let startObservingBody = function() {
@@ -48,43 +36,15 @@ if (window.crossOriginIsolated) {
48
36
  if (!el.querySelectorAll) {
49
37
  return;
50
38
  }
51
- el.querySelectorAll(
52
- "img,source,script,video,link,iframe"
53
- ).forEach((v) => {
54
- addCrossOriginAttributes(v);
55
- });
56
- if (el.nodeName === "IFRAME") {
57
- const iframeNode = el;
58
- const isEmbedSandboxIframe = iframeNode.classList.contains(
59
- "components-sandbox"
60
- );
61
- if (!isEmbedSandboxIframe) {
62
- iframeNode.addEventListener("load", () => {
63
- try {
64
- if (iframeNode.contentDocument && iframeNode.contentDocument.body) {
65
- observer.observe(
66
- iframeNode.contentDocument,
67
- {
68
- childList: true,
69
- attributes: true,
70
- subtree: true
71
- }
72
- );
73
- }
74
- } catch (e) {
75
- }
76
- });
39
+ el.querySelectorAll("source,script,video,link").forEach(
40
+ (v) => {
41
+ addCrossOriginAttribute(v);
77
42
  }
78
- }
79
- if ([
80
- "IMG",
81
- "SOURCE",
82
- "SCRIPT",
83
- "VIDEO",
84
- "LINK",
85
- "IFRAME"
86
- ].includes(el.nodeName)) {
87
- addCrossOriginAttributes(el);
43
+ );
44
+ if (["SOURCE", "SCRIPT", "VIDEO", "LINK"].includes(
45
+ el.nodeName
46
+ )) {
47
+ addCrossOriginAttribute(el);
88
48
  }
89
49
  });
90
50
  });
@@ -93,30 +53,4 @@ if (window.crossOriginIsolated) {
93
53
  startObservingBody();
94
54
  }
95
55
  var startObservingBody2;
96
- if (window.crossOriginIsolated) {
97
- const supportsCredentialless = "credentialless" in window.HTMLIFrameElement.prototype;
98
- const disableEmbedPreviews = (0, import_compose.createHigherOrderComponent)(
99
- (BlockEdit) => function DisableEmbedPreviews(props) {
100
- if ("core/embed" !== props.name) {
101
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockEdit, { ...props });
102
- }
103
- const previewable = supportsCredentialless && !["facebook", "smugmug"].includes(
104
- props.attributes.providerNameSlug
105
- );
106
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
107
- BlockEdit,
108
- {
109
- ...props,
110
- attributes: { ...props.attributes, previewable }
111
- }
112
- );
113
- },
114
- "withDisabledEmbedPreview"
115
- );
116
- (0, import_hooks.addFilter)(
117
- "editor.BlockEdit",
118
- "media-experiments/disable-embed-previews",
119
- disableEmbedPreviews
120
- );
121
- }
122
56
  //# sourceMappingURL=cross-origin-isolation.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/cross-origin-isolation.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Adds crossorigin and credentialless attributes to elements as needed.\n *\n * @param {Element} el The element to modify.\n */\nfunction addCrossOriginAttributes( el ) {\n\t// Add the crossorigin attribute if missing.\n\tif ( ! el.hasAttribute( 'crossorigin' ) ) {\n\t\tel.setAttribute( 'crossorigin', 'anonymous' );\n\t}\n\n\t// For iframes, add the credentialless attribute.\n\tif ( el.nodeName === 'IFRAME' && ! el.hasAttribute( 'credentialless' ) ) {\n\t\t// Do not modify the iframed editor canvas.\n\t\tif ( el.getAttribute( 'src' )?.startsWith( 'blob:' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tel.setAttribute( 'credentialless', '' );\n\n\t\t// Reload the iframe to ensure the new attribute is taken into account.\n\t\tconst origSrc = el.getAttribute( 'src' ) || '';\n\t\tel.setAttribute( 'src', '' );\n\t\tel.setAttribute( 'src', origSrc );\n\t}\n}\n\n// Only add the mutation observer if the site is cross-origin isolated.\nif ( window.crossOriginIsolated ) {\n\t/*\n\t * Detects dynamically added DOM nodes that are missing the `crossorigin` attribute.\n\t */\n\tconst observer = new window.MutationObserver( ( mutations ) => {\n\t\tmutations.forEach( ( mutation ) => {\n\t\t\t[ mutation.addedNodes, mutation.target ].forEach( ( value ) => {\n\t\t\t\tconst nodes =\n\t\t\t\t\tvalue instanceof window.NodeList ? value : [ value ];\n\t\t\t\tnodes.forEach( ( node ) => {\n\t\t\t\t\tconst el = node;\n\n\t\t\t\t\tif ( ! el.querySelectorAll ) {\n\t\t\t\t\t\t// Most likely a text node.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tel.querySelectorAll(\n\t\t\t\t\t\t'img,source,script,video,link,iframe'\n\t\t\t\t\t).forEach( ( v ) => {\n\t\t\t\t\t\taddCrossOriginAttributes( v );\n\t\t\t\t\t} );\n\n\t\t\t\t\tif ( el.nodeName === 'IFRAME' ) {\n\t\t\t\t\t\tconst iframeNode = el;\n\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * Sandboxed iframes should not get modified. For example embedding a tweet served in a sandboxed\n\t\t\t\t\t\t * iframe, the tweet itself would not be modified.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tconst isEmbedSandboxIframe =\n\t\t\t\t\t\t\tiframeNode.classList.contains(\n\t\t\t\t\t\t\t\t'components-sandbox'\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( ! isEmbedSandboxIframe ) {\n\t\t\t\t\t\t\tiframeNode.addEventListener( 'load', () => {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tiframeNode.contentDocument &&\n\t\t\t\t\t\t\t\t\t\tiframeNode.contentDocument.body\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tobserver.observe(\n\t\t\t\t\t\t\t\t\t\t\tiframeNode.contentDocument,\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tchildList: true,\n\t\t\t\t\t\t\t\t\t\t\t\tattributes: true,\n\t\t\t\t\t\t\t\t\t\t\t\tsubtree: true,\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch ( e ) {\n\t\t\t\t\t\t\t\t\t// Iframe may be cross-origin or otherwise inaccessible.\n\t\t\t\t\t\t\t\t\t// Silently ignore these cases.\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}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t'IMG',\n\t\t\t\t\t\t\t'SOURCE',\n\t\t\t\t\t\t\t'SCRIPT',\n\t\t\t\t\t\t\t'VIDEO',\n\t\t\t\t\t\t\t'LINK',\n\t\t\t\t\t\t\t'IFRAME',\n\t\t\t\t\t\t].includes( el.nodeName )\n\t\t\t\t\t) {\n\t\t\t\t\t\taddCrossOriginAttributes( el );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\t} );\n\n\t/**\n\t * Start observing the document body, waiting for it to be available if needed.\n\t */\n\tfunction startObservingBody() {\n\t\tif ( document.body ) {\n\t\t\tobserver.observe( document.body, {\n\t\t\t\tchildList: true,\n\t\t\t\tattributes: true,\n\t\t\t\tsubtree: true,\n\t\t\t} );\n\t\t} else if ( document.readyState === 'loading' ) {\n\t\t\t// Wait for DOM to be ready.\n\t\t\tdocument.addEventListener( 'DOMContentLoaded', () => {\n\t\t\t\tif ( document.body ) {\n\t\t\t\t\tobserver.observe( document.body, {\n\t\t\t\t\t\tchildList: true,\n\t\t\t\t\t\tattributes: true,\n\t\t\t\t\t\tsubtree: true,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\tstartObservingBody();\n}\n\n// Only apply the embed preview filter when cross-origin isolated.\nif ( window.crossOriginIsolated ) {\n\tconst supportsCredentialless =\n\t\t'credentialless' in window.HTMLIFrameElement.prototype;\n\n\tconst disableEmbedPreviews = createHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\tfunction DisableEmbedPreviews( props ) {\n\t\t\t\tif ( 'core/embed' !== props.name ) {\n\t\t\t\t\treturn <BlockEdit { ...props } />;\n\t\t\t\t}\n\n\t\t\t\t// List of embeds that do not support a preview is from packages/block-library/src/embed/variations.js.\n\t\t\t\tconst previewable =\n\t\t\t\t\tsupportsCredentialless &&\n\t\t\t\t\t! [ 'facebook', 'smugmug' ].includes(\n\t\t\t\t\t\tprops.attributes.providerNameSlug\n\t\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\tattributes={ { ...props.attributes, previewable } }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withDisabledEmbedPreview'\n\t);\n\n\taddFilter(\n\t\t'editor.BlockEdit',\n\t\t'media-experiments/disable-embed-previews',\n\t\tdisableEmbedPreviews\n\t);\n}\n"],
5
- "mappings": ";;;AAGA,mBAA0B;AAC1B,qBAA2C;AA8I/B;AAvIZ,SAAS,yBAA0B,IAAK;AAEvC,MAAK,CAAE,GAAG,aAAc,aAAc,GAAI;AACzC,OAAG,aAAc,eAAe,WAAY;AAAA,EAC7C;AAGA,MAAK,GAAG,aAAa,YAAY,CAAE,GAAG,aAAc,gBAAiB,GAAI;AAExE,QAAK,GAAG,aAAc,KAAM,GAAG,WAAY,OAAQ,GAAI;AACtD;AAAA,IACD;AAEA,OAAG,aAAc,kBAAkB,EAAG;AAGtC,UAAM,UAAU,GAAG,aAAc,KAAM,KAAK;AAC5C,OAAG,aAAc,OAAO,EAAG;AAC3B,OAAG,aAAc,OAAO,OAAQ;AAAA,EACjC;AACD;AAGA,IAAK,OAAO,qBAAsB;AA+EjC,MAAS,qBAAT,WAA8B;AAC7B,QAAK,SAAS,MAAO;AACpB,eAAS,QAAS,SAAS,MAAM;AAAA,QAChC,WAAW;AAAA,QACX,YAAY;AAAA,QACZ,SAAS;AAAA,MACV,CAAE;AAAA,IACH,WAAY,SAAS,eAAe,WAAY;AAE/C,eAAS,iBAAkB,oBAAoB,MAAM;AACpD,YAAK,SAAS,MAAO;AACpB,mBAAS,QAAS,SAAS,MAAM;AAAA,YAChC,WAAW;AAAA,YACX,YAAY;AAAA,YACZ,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AAAA,MACD,CAAE;AAAA,IACH;AAAA,EACD;AAnBS,EAAAA,sBAAA;AA3ET,QAAM,WAAW,IAAI,OAAO,iBAAkB,CAAE,cAAe;AAC9D,cAAU,QAAS,CAA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;AAGA,YAAM,cACL,0BACA,CAAE,CAAE,YAAY,SAAU,EAAE;AAAA,QAC3B,MAAM,WAAW;AAAA,MAClB;AAED,aACC;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACL,YAAa,EAAE,GAAG,MAAM,YAAY,YAAY;AAAA;AAAA,MACjD;AAAA,IAEF;AAAA,IACD;AAAA,EACD;AAEA;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["/**\n * Adds crossorigin=\"anonymous\" to an element if missing.\n *\n * @param {Element} el The element to modify.\n */\nfunction addCrossOriginAttribute( el ) {\n\tif ( ! el.hasAttribute( 'crossorigin' ) ) {\n\t\tel.setAttribute( 'crossorigin', 'anonymous' );\n\t}\n}\n\n// Only add the mutation observer if the site is cross-origin isolated.\nif ( window.crossOriginIsolated ) {\n\t/*\n\t * Detects dynamically added DOM nodes that are missing the `crossorigin` attribute.\n\t */\n\tconst observer = new window.MutationObserver( ( mutations ) => {\n\t\tmutations.forEach( ( mutation ) => {\n\t\t\t[ mutation.addedNodes, mutation.target ].forEach( ( value ) => {\n\t\t\t\tconst nodes =\n\t\t\t\t\tvalue instanceof window.NodeList ? value : [ value ];\n\t\t\t\tnodes.forEach( ( node ) => {\n\t\t\t\t\tconst el = node;\n\n\t\t\t\t\tif ( ! el.querySelectorAll ) {\n\t\t\t\t\t\t// Most likely a text node.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tel.querySelectorAll( 'source,script,video,link' ).forEach(\n\t\t\t\t\t\t( v ) => {\n\t\t\t\t\t\t\taddCrossOriginAttribute( v );\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t[ 'SOURCE', 'SCRIPT', 'VIDEO', 'LINK' ].includes(\n\t\t\t\t\t\t\tel.nodeName\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\taddCrossOriginAttribute( el );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\t} );\n\n\t/**\n\t * Start observing the document body, waiting for it to be available if needed.\n\t */\n\tfunction startObservingBody() {\n\t\tif ( document.body ) {\n\t\t\tobserver.observe( document.body, {\n\t\t\t\tchildList: true,\n\t\t\t\tattributes: true,\n\t\t\t\tsubtree: true,\n\t\t\t} );\n\t\t} else if ( document.readyState === 'loading' ) {\n\t\t\t// Wait for DOM to be ready.\n\t\t\tdocument.addEventListener( 'DOMContentLoaded', () => {\n\t\t\t\tif ( document.body ) {\n\t\t\t\t\tobserver.observe( document.body, {\n\t\t\t\t\t\tchildList: true,\n\t\t\t\t\t\tattributes: true,\n\t\t\t\t\t\tsubtree: true,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\tstartObservingBody();\n}\n"],
5
+ "mappings": ";;;AAKA,SAAS,wBAAyB,IAAK;AACtC,MAAK,CAAE,GAAG,aAAc,aAAc,GAAI;AACzC,OAAG,aAAc,eAAe,WAAY;AAAA,EAC7C;AACD;AAGA,IAAK,OAAO,qBAAsB;AAsCjC,MAAS,qBAAT,WAA8B;AAC7B,QAAK,SAAS,MAAO;AACpB,eAAS,QAAS,SAAS,MAAM;AAAA,QAChC,WAAW;AAAA,QACX,YAAY;AAAA,QACZ,SAAS;AAAA,MACV,CAAE;AAAA,IACH,WAAY,SAAS,eAAe,WAAY;AAE/C,eAAS,iBAAkB,oBAAoB,MAAM;AACpD,YAAK,SAAS,MAAO;AACpB,mBAAS,QAAS,SAAS,MAAM;AAAA,YAChC,WAAW;AAAA,YACX,YAAY;AAAA,YACZ,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AAAA,MACD,CAAE;AAAA,IACH;AAAA,EACD;AAnBS,EAAAA,sBAAA;AAlCT,QAAM,WAAW,IAAI,OAAO,iBAAkB,CAAE,cAAe;AAC9D,cAAU,QAAS,CAAE,aAAc;AAClC,OAAE,SAAS,YAAY,SAAS,MAAO,EAAE,QAAS,CAAE,UAAW;AAC9D,cAAM,QACL,iBAAiB,OAAO,WAAW,QAAQ,CAAE,KAAM;AACpD,cAAM,QAAS,CAAE,SAAU;AAC1B,gBAAM,KAAK;AAEX,cAAK,CAAE,GAAG,kBAAmB;AAE5B;AAAA,UACD;AAEA,aAAG,iBAAkB,0BAA2B,EAAE;AAAA,YACjD,CAAE,MAAO;AACR,sCAAyB,CAAE;AAAA,YAC5B;AAAA,UACD;AAEA,cACC,CAAE,UAAU,UAAU,SAAS,MAAO,EAAE;AAAA,YACvC,GAAG;AAAA,UACJ,GACC;AACD,oCAAyB,EAAG;AAAA,UAC7B;AAAA,QACD,CAAE;AAAA,MACH,CAAE;AAAA,IACH,CAAE;AAAA,EACH,CAAE;AA0BF,qBAAmB;AACpB;AAtBU,IAAAA;",
6
6
  "names": ["startObservingBody"]
7
7
  }
@@ -39,6 +39,8 @@ var import_compose = require("@wordpress/compose");
39
39
  var import_blocks = require("@wordpress/blocks");
40
40
  var import_i18n = require("@wordpress/i18n");
41
41
  var import_global_styles_engine = require("@wordpress/global-styles-engine");
42
+ var import_block_editing_mode = require("../components/block-editing-mode/index.cjs");
43
+ var import_notices = require("@wordpress/notices");
42
44
  var import_inspector_controls = __toESM(require("../components/inspector-controls/index.cjs"));
43
45
  var import_advanced_panel = __toESM(require("../components/global-styles/advanced-panel.cjs"));
44
46
  var import_utils = require("./utils.cjs");
@@ -47,6 +49,10 @@ var import_jsx_runtime = require("react/jsx-runtime");
47
49
  var CUSTOM_CSS_INSTANCE_REFERENCE = {};
48
50
  var EMPTY_STYLE = {};
49
51
  function CustomCSSControl({ blockName, setAttributes, style }) {
52
+ const blockEditingMode = (0, import_block_editing_mode.useBlockEditingMode)();
53
+ if (blockEditingMode !== "default") {
54
+ return null;
55
+ }
50
56
  const blockType = (0, import_blocks.getBlockType)(blockName);
51
57
  function onChange(newStyle) {
52
58
  const css = newStyle?.css?.trim() ? newStyle.css : void 0;
@@ -71,6 +77,7 @@ function CustomCSSControl({ blockName, setAttributes, style }) {
71
77
  }
72
78
  ) });
73
79
  }
80
+ var CUSTOM_CSS_WARNING_NOTICE_ID = "custom-css-edit-warning";
74
81
  function CustomCSSEdit({ clientId, name, setAttributes }) {
75
82
  const { style, canEditCSS } = (0, import_data.useSelect)(
76
83
  (select) => {
@@ -97,6 +104,25 @@ function CustomCSSEdit({ clientId, name, setAttributes }) {
97
104
  function useBlockProps({ style }) {
98
105
  const customCSS = style?.css;
99
106
  const isValidCSS = typeof customCSS === "string" && customCSS.trim().length > 0 && (0, import_advanced_panel.validateCSS)(customCSS);
107
+ const canEditCSS = (0, import_data.useSelect)(
108
+ (select) => select(import_store.store).getSettings().canEditCSS,
109
+ []
110
+ );
111
+ const { createWarningNotice } = (0, import_data.useDispatch)(import_notices.store);
112
+ const hasCustomCSS = !!customCSS?.trim();
113
+ (0, import_element.useEffect)(() => {
114
+ if (!canEditCSS && hasCustomCSS) {
115
+ createWarningNotice(
116
+ (0, import_i18n.__)(
117
+ "This post contains blocks with custom CSS. You do not have permission to edit CSS. If you save this post, the custom CSS will be removed."
118
+ ),
119
+ {
120
+ id: CUSTOM_CSS_WARNING_NOTICE_ID,
121
+ isDismissible: true
122
+ }
123
+ );
124
+ }
125
+ }, [canEditCSS, hasCustomCSS, createWarningNotice]);
100
126
  const customCSSIdentifier = (0, import_compose.useInstanceId)(
101
127
  CUSTOM_CSS_INSTANCE_REFERENCE,
102
128
  "wp-custom-css"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/custom-css.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { getBlockType, hasBlockSupport } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { processCSSNesting } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport AdvancedPanel, {\n\tvalidateCSS,\n} from '../components/global-styles/advanced-panel';\nimport { cleanEmptyObject, useStyleOverride } from './utils';\nimport { store as blockEditorStore } from '../store';\n\n// Stable reference for useInstanceId.\nconst CUSTOM_CSS_INSTANCE_REFERENCE = {};\n\n// Stable empty object reference for useSelect.\nconst EMPTY_STYLE = {};\n\n/**\n * Inspector control for custom CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.blockName Block name.\n * @param {Function} props.setAttributes Function to set block attributes.\n * @param {Object} props.style Block style attribute.\n */\nfunction CustomCSSControl( { blockName, setAttributes, style } ) {\n\tconst blockType = getBlockType( blockName );\n\n\tfunction onChange( newStyle ) {\n\t\t// Normalize whitespace-only CSS to undefined so it gets cleaned up.\n\t\tconst css = newStyle?.css?.trim() ? newStyle.css : undefined;\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( { ...newStyle, css } ),\n\t\t} );\n\t}\n\n\tconst cssHelpText = sprintf(\n\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Quote'.\n\t\t__(\n\t\t\t'Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value, e.g. color: red;.'\n\t\t),\n\t\tblockType?.title\n\t);\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<AdvancedPanel\n\t\t\t\tvalue={ style }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tinheritedValue={ style }\n\t\t\t\thelp={ cssHelpText }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nfunction CustomCSSEdit( { clientId, name, setAttributes } ) {\n\tconst { style, canEditCSS } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tstyle: getBlockAttributes( clientId )?.style || EMPTY_STYLE,\n\t\t\t\tcanEditCSS: getSettings().canEditCSS,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Don't render the panel if user lacks edit_css capability.\n\tif ( ! canEditCSS ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<CustomCSSControl\n\t\t\tblockName={ name }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tstyle={ style }\n\t\t/>\n\t);\n}\n\n/**\n * Hook to handle custom CSS for a block in the editor.\n * Generates a unique class and applies scoped CSS via style override.\n *\n * @param {Object} props Block props.\n * @param {Object} props.style Block style attribute.\n * @return {Object} Block props including className for custom CSS scoping.\n */\nfunction useBlockProps( { style } ) {\n\tconst customCSS = style?.css;\n\n\t// Validate CSS is non-empty and passes validation checks.\n\tconst isValidCSS =\n\t\ttypeof customCSS === 'string' &&\n\t\tcustomCSS.trim().length > 0 &&\n\t\tvalidateCSS( customCSS );\n\n\tconst customCSSIdentifier = useInstanceId(\n\t\tCUSTOM_CSS_INSTANCE_REFERENCE,\n\t\t'wp-custom-css'\n\t);\n\n\tconst customCSSSelector = `.${ customCSSIdentifier }`;\n\n\t// Transform the custom CSS using the same logic as global styles.\n\t// Only process if CSS is valid (doesn't contain HTML markup).\n\tconst transformedCSS = useMemo( () => {\n\t\tif ( ! isValidCSS ) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn processCSSNesting( customCSS, customCSSSelector );\n\t}, [ customCSS, customCSSSelector, isValidCSS ] );\n\n\t// Inject the CSS via style override.\n\tuseStyleOverride( { css: transformedCSS } );\n\n\t// Only add the class if there's valid custom CSS.\n\tif ( ! isValidCSS ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\tclassName: `has-custom-css ${ customCSSIdentifier }`,\n\t};\n}\n\n/**\n * Adds a marker class to blocks with custom CSS for server-side rendering.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type definition.\n * @param {Object} attributes Block's attributes.\n * @return {Object} Filtered props applied to save element.\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, 'customCSS', true ) ) {\n\t\treturn props;\n\t}\n\n\tif ( ! attributes?.style?.css?.trim() ) {\n\t\treturn props;\n\t}\n\n\t// Add a class to indicate this block has custom CSS.\n\t// The actual CSS is rendered server-side using the render_block filter.\n\tconst className = props.className\n\t\t? `${ props.className } has-custom-css`\n\t\t: 'has-custom-css';\n\n\treturn {\n\t\t...props,\n\t\tclassName,\n\t};\n}\n\nexport default {\n\tedit: CustomCSSEdit,\n\tuseBlockProps,\n\taddSaveProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'customCSS', true );\n\t},\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAwB;AACxB,kBAA0B;AAC1B,qBAA8B;AAC9B,oBAA8C;AAC9C,kBAA4B;AAC5B,kCAAkC;AAKlC,gCAA8B;AAC9B,4BAEO;AACP,mBAAmD;AACnD,mBAA0C;AAqCvC;AAlCH,IAAM,gCAAgC,CAAC;AAGvC,IAAM,cAAc,CAAC;AAUrB,SAAS,iBAAkB,EAAE,WAAW,eAAe,MAAM,GAAI;AAChE,QAAM,gBAAY,4BAAc,SAAU;AAE1C,WAAS,SAAU,UAAW;AAE7B,UAAM,MAAM,UAAU,KAAK,KAAK,IAAI,SAAS,MAAM;AACnD,kBAAe;AAAA,MACd,WAAO,+BAAkB,EAAE,GAAG,UAAU,IAAI,CAAE;AAAA,IAC/C,CAAE;AAAA,EACH;AAEA,QAAM,kBAAc;AAAA;AAAA,QAEnB;AAAA,MACC;AAAA,IACD;AAAA,IACA,WAAW;AAAA,EACZ;AAEA,SACC,4CAAC,0BAAAA,SAAA,EAAkB,OAAM,YACxB;AAAA,IAAC,sBAAAC;AAAA,IAAA;AAAA,MACA,OAAQ;AAAA,MACR;AAAA,MACA,gBAAiB;AAAA,MACjB,MAAO;AAAA;AAAA,EACR,GACD;AAEF;AAEA,SAAS,cAAe,EAAE,UAAU,MAAM,cAAc,GAAI;AAC3D,QAAM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AACD;AAEA,IAAO,qBAAQ;AAAA,EACd,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA,eAAe,CAAE,OAAQ;AAAA,EACzB,WAAY,MAAO;AAClB,eAAO,+BAAiB,MAAM,aAAa,IAAK;AAAA,EACjD;AACD;",
6
- "names": ["InspectorControls", "AdvancedPanel", "blockEditorStore"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { getBlockType, hasBlockSupport } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { processCSSNesting } from '@wordpress/global-styles-engine';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport AdvancedPanel, {\n\tvalidateCSS,\n} from '../components/global-styles/advanced-panel';\nimport { cleanEmptyObject, useStyleOverride } from './utils';\nimport { store as blockEditorStore } from '../store';\n\n// Stable reference for useInstanceId.\nconst CUSTOM_CSS_INSTANCE_REFERENCE = {};\n\n// Stable empty object reference for useSelect.\nconst EMPTY_STYLE = {};\n\n/**\n * Inspector control for custom CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.blockName Block name.\n * @param {Function} props.setAttributes Function to set block attributes.\n * @param {Object} props.style Block style attribute.\n */\nfunction CustomCSSControl( { blockName, setAttributes, style } ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\tconst blockType = getBlockType( blockName );\n\n\tfunction onChange( newStyle ) {\n\t\t// Normalize whitespace-only CSS to undefined so it gets cleaned up.\n\t\tconst css = newStyle?.css?.trim() ? newStyle.css : undefined;\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( { ...newStyle, css } ),\n\t\t} );\n\t}\n\n\tconst cssHelpText = sprintf(\n\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Quote'.\n\t\t__(\n\t\t\t'Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value, e.g. color: red;.'\n\t\t),\n\t\tblockType?.title\n\t);\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<AdvancedPanel\n\t\t\t\tvalue={ style }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tinheritedValue={ style }\n\t\t\t\thelp={ cssHelpText }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nconst CUSTOM_CSS_WARNING_NOTICE_ID = 'custom-css-edit-warning';\n\nfunction CustomCSSEdit( { clientId, name, setAttributes } ) {\n\tconst { style, canEditCSS } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tstyle: getBlockAttributes( clientId )?.style || EMPTY_STYLE,\n\t\t\t\tcanEditCSS: getSettings().canEditCSS,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Don't render the panel if user lacks edit_css capability.\n\tif ( ! canEditCSS ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<CustomCSSControl\n\t\t\tblockName={ name }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tstyle={ style }\n\t\t/>\n\t);\n}\n\n/**\n * Hook to handle custom CSS for a block in the editor.\n * Generates a unique class and applies scoped CSS via style override.\n *\n * @param {Object} props Block props.\n * @param {Object} props.style Block style attribute.\n * @return {Object} Block props including className for custom CSS scoping.\n */\nfunction useBlockProps( { style } ) {\n\tconst customCSS = style?.css;\n\n\t// Validate CSS is non-empty and passes validation checks.\n\tconst isValidCSS =\n\t\ttypeof customCSS === 'string' &&\n\t\tcustomCSS.trim().length > 0 &&\n\t\tvalidateCSS( customCSS );\n\n\tconst canEditCSS = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings().canEditCSS,\n\t\t[]\n\t);\n\n\tconst { createWarningNotice } = useDispatch( noticesStore );\n\n\t// Show a warning notice when the user lacks edit_css and a block has\n\t// custom CSS. The fixed notice ID ensures only one notice is shown\n\t// regardless of how many blocks have CSS.\n\tconst hasCustomCSS = !! customCSS?.trim();\n\tuseEffect( () => {\n\t\tif ( ! canEditCSS && hasCustomCSS ) {\n\t\t\tcreateWarningNotice(\n\t\t\t\t__(\n\t\t\t\t\t'This post contains blocks with custom CSS. You do not have permission to edit CSS. If you save this post, the custom CSS will be removed.'\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tid: CUSTOM_CSS_WARNING_NOTICE_ID,\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [ canEditCSS, hasCustomCSS, createWarningNotice ] );\n\n\tconst customCSSIdentifier = useInstanceId(\n\t\tCUSTOM_CSS_INSTANCE_REFERENCE,\n\t\t'wp-custom-css'\n\t);\n\n\tconst customCSSSelector = `.${ customCSSIdentifier }`;\n\n\t// Transform the custom CSS using the same logic as global styles.\n\t// Only process if CSS is valid (doesn't contain HTML markup).\n\tconst transformedCSS = useMemo( () => {\n\t\tif ( ! isValidCSS ) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn processCSSNesting( customCSS, customCSSSelector );\n\t}, [ customCSS, customCSSSelector, isValidCSS ] );\n\n\t// Inject the CSS via style override.\n\tuseStyleOverride( { css: transformedCSS } );\n\n\t// Only add the class if there's valid custom CSS.\n\tif ( ! isValidCSS ) {\n\t\treturn {};\n\t}\n\n\treturn {\n\t\tclassName: `has-custom-css ${ customCSSIdentifier }`,\n\t};\n}\n\n/**\n * Adds a marker class to blocks with custom CSS for server-side rendering.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type definition.\n * @param {Object} attributes Block's attributes.\n * @return {Object} Filtered props applied to save element.\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, 'customCSS', true ) ) {\n\t\treturn props;\n\t}\n\n\tif ( ! attributes?.style?.css?.trim() ) {\n\t\treturn props;\n\t}\n\n\t// Add a class to indicate this block has custom CSS.\n\t// The actual CSS is rendered server-side using the render_block filter.\n\tconst className = props.className\n\t\t? `${ props.className } has-custom-css`\n\t\t: 'has-custom-css';\n\n\treturn {\n\t\t...props,\n\t\tclassName,\n\t};\n}\n\nexport default {\n\tedit: CustomCSSEdit,\n\tuseBlockProps,\n\taddSaveProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'customCSS', true );\n\t},\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAmC;AACnC,kBAAuC;AACvC,qBAA8B;AAC9B,oBAA8C;AAC9C,kBAA4B;AAC5B,kCAAkC;AAClC,gCAAoC;AACpC,qBAAsC;AAKtC,gCAA8B;AAC9B,4BAEO;AACP,mBAAmD;AACnD,mBAA0C;AA0CvC;AAvCH,IAAM,gCAAgC,CAAC;AAGvC,IAAM,cAAc,CAAC;AAUrB,SAAS,iBAAkB,EAAE,WAAW,eAAe,MAAM,GAAI;AAChE,QAAM,uBAAmB,+CAAoB;AAE7C,MAAK,qBAAqB,WAAY;AACrC,WAAO;AAAA,EACR;AACA,QAAM,gBAAY,4BAAc,SAAU;AAE1C,WAAS,SAAU,UAAW;AAE7B,UAAM,MAAM,UAAU,KAAK,KAAK,IAAI,SAAS,MAAM;AACnD,kBAAe;AAAA,MACd,WAAO,+BAAkB,EAAE,GAAG,UAAU,IAAI,CAAE;AAAA,IAC/C,CAAE;AAAA,EACH;AAEA,QAAM,kBAAc;AAAA;AAAA,QAEnB;AAAA,MACC;AAAA,IACD;AAAA,IACA,WAAW;AAAA,EACZ;AAEA,SACC,4CAAC,0BAAAA,SAAA,EAAkB,OAAM,YACxB;AAAA,IAAC,sBAAAC;AAAA,IAAA;AAAA,MACA,OAAQ;AAAA,MACR;AA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QAAK,CAAE,YAAa;AACnB,aAAO;AAAA,IACR;AACA,eAAO,+CAAmB,WAAW,iBAAkB;AAAA,EACxD,GAAG,CAAE,WAAW,mBAAmB,UAAW,CAAE;AAGhD,qCAAkB,EAAE,KAAK,eAAe,CAAE;AAG1C,MAAK,CAAE,YAAa;AACnB,WAAO,CAAC;AAAA,EACT;AAEA,SAAO;AAAA,IACN,WAAW,kBAAmB,mBAAoB;AAAA,EACnD;AACD;AAUA,SAAS,aAAc,OAAO,WAAW,YAAa;AACrD,MAAK,KAAE,+BAAiB,WAAW,aAAa,IAAK,GAAI;AACxD,WAAO;AAAA,EACR;AAEA,MAAK,CAAE,YAAY,OAAO,KAAK,KAAK,GAAI;AACvC,WAAO;AAAA,EACR;AAIA,QAAM,YAAY,MAAM,YACrB,GAAI,MAAM,SAAU,oBACpB;AAEH,SAAO;AAAA,IACN,GAAG;AAAA,IACH;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;AAAA,EACd,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA,eAAe,CAAE,OAAQ;AAAA,EACzB,WAAY,MAAO;AAClB,eAAO,+BAAiB,MAAM,aAAa,IAAK;AAAA,EACjD;AACD;",
6
+ "names": ["InspectorControls", "AdvancedPanel", "blockEditorStore", "noticesStore"]
7
7
  }
@@ -127,6 +127,7 @@ var privateApis = {};
127
127
  deviceTypeKey: import_private_keys.deviceTypeKey,
128
128
  isIsolatedEditorKey: import_private_keys.isIsolatedEditorKey,
129
129
  isNavigationOverlayContextKey: import_private_keys.isNavigationOverlayContextKey,
130
+ mediaUploadOnSuccessKey: import_private_keys.mediaUploadOnSuccessKey,
130
131
  useBlockElement: import_use_block_refs.useBlockElement,
131
132
  useBlockElementRef: import_use_block_refs.useBlockElementRef,
132
133
  LinkPicker: import_link_picker.LinkPicker,