@wordpress/block-editor 15.16.0 → 15.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/autocomplete/index.cjs +1 -2
  3. package/build/components/autocomplete/index.cjs.map +3 -3
  4. package/build/components/block-list/block-crash-warning.cjs +4 -2
  5. package/build/components/block-list/block-crash-warning.cjs.map +2 -2
  6. package/build/components/block-list/block-html.cjs +6 -2
  7. package/build/components/block-list/block-html.cjs.map +2 -2
  8. package/build/components/block-mover/button.cjs +4 -3
  9. package/build/components/block-mover/button.cjs.map +2 -2
  10. package/build/components/block-mover/index.cjs +1 -8
  11. package/build/components/block-mover/index.cjs.map +2 -2
  12. package/build/components/copy-handler/index.cjs.map +2 -2
  13. package/build/components/iframe/get-compatibility-styles.cjs +1 -1
  14. package/build/components/iframe/get-compatibility-styles.cjs.map +2 -2
  15. package/build/components/inserter/media-tab/hooks.cjs +1 -1
  16. package/build/components/inserter/media-tab/hooks.cjs.map +2 -2
  17. package/build/components/link-control/link-preview.cjs +3 -1
  18. package/build/components/link-control/link-preview.cjs.map +2 -2
  19. package/build/components/link-control/search-input.cjs +1 -1
  20. package/build/components/link-control/search-input.cjs.map +2 -2
  21. package/build/components/link-picker/link-preview.cjs +2 -1
  22. package/build/components/link-picker/link-preview.cjs.map +3 -3
  23. package/build/components/preset-input-control/index.cjs +7 -4
  24. package/build/components/preset-input-control/index.cjs.map +2 -2
  25. package/build/components/rich-text/event-listeners/index.cjs.map +2 -2
  26. package/build/components/rich-text/index.cjs +1 -1
  27. package/build/components/rich-text/index.cjs.map +2 -2
  28. package/build/components/rich-text/input-event.cjs +3 -3
  29. package/build/components/rich-text/input-event.cjs.map +2 -2
  30. package/build/components/spacing-sizes-control/utils.cjs +1 -1
  31. package/build/components/spacing-sizes-control/utils.cjs.map +2 -2
  32. package/build/components/use-on-block-drop/index.cjs +1 -1
  33. package/build/components/use-on-block-drop/index.cjs.map +2 -2
  34. package/build/components/use-paste-styles/index.cjs +2 -2
  35. package/build/components/use-paste-styles/index.cjs.map +2 -2
  36. package/build/components/writing-flow/use-selection-observer.cjs +23 -1
  37. package/build/components/writing-flow/use-selection-observer.cjs.map +2 -2
  38. package/build/hooks/block-style-variation.cjs +5 -6
  39. package/build/hooks/block-style-variation.cjs.map +3 -3
  40. package/build/hooks/index.cjs +2 -2
  41. package/build/hooks/index.cjs.map +2 -2
  42. package/build/hooks/style.cjs +54 -52
  43. package/build/hooks/style.cjs.map +2 -2
  44. package/build/private-apis.cjs +1 -1
  45. package/build/private-apis.cjs.map +1 -1
  46. package/build/store/actions.cjs +0 -8
  47. package/build/store/actions.cjs.map +2 -2
  48. package/build/store/reducer.cjs +52 -53
  49. package/build/store/reducer.cjs.map +2 -2
  50. package/build/store/selectors.cjs +12 -13
  51. package/build/store/selectors.cjs.map +2 -2
  52. package/build/store/utils.cjs +1 -1
  53. package/build/store/utils.cjs.map +2 -2
  54. package/build/utils/pasting.cjs +1 -1
  55. package/build/utils/pasting.cjs.map +2 -2
  56. package/build-module/components/autocomplete/index.mjs +1 -2
  57. package/build-module/components/autocomplete/index.mjs.map +2 -2
  58. package/build-module/components/block-list/block-crash-warning.mjs +4 -2
  59. package/build-module/components/block-list/block-crash-warning.mjs.map +2 -2
  60. package/build-module/components/block-list/block-html.mjs +7 -3
  61. package/build-module/components/block-list/block-html.mjs.map +2 -2
  62. package/build-module/components/block-mover/button.mjs +4 -3
  63. package/build-module/components/block-mover/button.mjs.map +2 -2
  64. package/build-module/components/block-mover/index.mjs +1 -8
  65. package/build-module/components/block-mover/index.mjs.map +2 -2
  66. package/build-module/components/copy-handler/index.mjs.map +2 -2
  67. package/build-module/components/iframe/get-compatibility-styles.mjs +1 -1
  68. package/build-module/components/iframe/get-compatibility-styles.mjs.map +2 -2
  69. package/build-module/components/inserter/media-tab/hooks.mjs +1 -1
  70. package/build-module/components/inserter/media-tab/hooks.mjs.map +2 -2
  71. package/build-module/components/link-control/link-preview.mjs +3 -1
  72. package/build-module/components/link-control/link-preview.mjs.map +2 -2
  73. package/build-module/components/link-control/search-input.mjs +1 -1
  74. package/build-module/components/link-control/search-input.mjs.map +2 -2
  75. package/build-module/components/link-picker/link-preview.mjs +2 -1
  76. package/build-module/components/link-picker/link-preview.mjs.map +2 -2
  77. package/build-module/components/preset-input-control/index.mjs +7 -4
  78. package/build-module/components/preset-input-control/index.mjs.map +2 -2
  79. package/build-module/components/rich-text/event-listeners/index.mjs.map +2 -2
  80. package/build-module/components/rich-text/index.mjs +2 -2
  81. package/build-module/components/rich-text/index.mjs.map +2 -2
  82. package/build-module/components/rich-text/input-event.mjs +2 -2
  83. package/build-module/components/rich-text/input-event.mjs.map +2 -2
  84. package/build-module/components/spacing-sizes-control/utils.mjs +1 -1
  85. package/build-module/components/spacing-sizes-control/utils.mjs.map +2 -2
  86. package/build-module/components/use-on-block-drop/index.mjs +1 -1
  87. package/build-module/components/use-on-block-drop/index.mjs.map +2 -2
  88. package/build-module/components/use-paste-styles/index.mjs +2 -2
  89. package/build-module/components/use-paste-styles/index.mjs.map +2 -2
  90. package/build-module/components/writing-flow/use-selection-observer.mjs +23 -1
  91. package/build-module/components/writing-flow/use-selection-observer.mjs.map +2 -2
  92. package/build-module/hooks/block-style-variation.mjs +4 -5
  93. package/build-module/hooks/block-style-variation.mjs.map +2 -2
  94. package/build-module/hooks/index.mjs +2 -2
  95. package/build-module/hooks/index.mjs.map +2 -2
  96. package/build-module/hooks/style.mjs +54 -52
  97. package/build-module/hooks/style.mjs.map +2 -2
  98. package/build-module/private-apis.mjs +2 -2
  99. package/build-module/private-apis.mjs.map +1 -1
  100. package/build-module/store/actions.mjs +0 -8
  101. package/build-module/store/actions.mjs.map +2 -2
  102. package/build-module/store/reducer.mjs +52 -53
  103. package/build-module/store/reducer.mjs.map +2 -2
  104. package/build-module/store/selectors.mjs +12 -13
  105. package/build-module/store/selectors.mjs.map +2 -2
  106. package/build-module/store/utils.mjs +1 -1
  107. package/build-module/store/utils.mjs.map +2 -2
  108. package/build-module/utils/pasting.mjs +1 -1
  109. package/build-module/utils/pasting.mjs.map +2 -2
  110. package/build-style/style-rtl.css +0 -7
  111. package/build-style/style.css +0 -7
  112. package/package.json +38 -39
  113. package/src/autocompleters/style.scss +0 -8
  114. package/src/components/autocomplete/index.js +1 -2
  115. package/src/components/block-draggable/test/helpers.native.js +1 -1
  116. package/src/components/block-list/block-crash-warning.js +3 -1
  117. package/src/components/block-list/block-crash-warning.native.js +3 -1
  118. package/src/components/block-list/block-html.js +13 -3
  119. package/src/components/block-mover/button.js +7 -4
  120. package/src/components/block-mover/index.js +1 -8
  121. package/src/components/copy-handler/index.js +1 -0
  122. package/src/components/iframe/get-compatibility-styles.js +1 -1
  123. package/src/components/inserter/media-tab/hooks.js +1 -1
  124. package/src/components/link-control/README.md +2 -2
  125. package/src/components/link-control/link-preview.js +3 -1
  126. package/src/components/link-control/search-input.js +1 -1
  127. package/src/components/link-picker/link-preview.js +2 -1
  128. package/src/components/preset-input-control/index.js +10 -4
  129. package/src/components/preset-input-control/test/index.js +70 -0
  130. package/src/components/rich-text/event-listeners/index.js +1 -0
  131. package/src/components/rich-text/index.js +1 -1
  132. package/src/components/rich-text/index.native.js +1 -1
  133. package/src/components/rich-text/input-event.js +1 -1
  134. package/src/components/rich-text/input-event.native.js +1 -1
  135. package/src/components/rich-text/native/index.native.js +18 -17
  136. package/src/components/spacing-sizes-control/utils.js +1 -1
  137. package/src/components/use-on-block-drop/index.js +1 -1
  138. package/src/components/use-paste-styles/index.js +2 -2
  139. package/src/components/writing-flow/use-selection-observer.js +39 -1
  140. package/src/hooks/block-style-variation.js +3 -4
  141. package/src/hooks/index.js +1 -1
  142. package/src/hooks/style.js +75 -61
  143. package/src/private-apis.js +2 -2
  144. package/src/store/actions.js +0 -8
  145. package/src/store/reducer.js +62 -67
  146. package/src/store/selectors.js +31 -21
  147. package/src/store/test/private-selectors.js +44 -41
  148. package/src/store/test/reducer.js +159 -88
  149. package/src/store/test/registry-selectors.js +1 -1
  150. package/src/store/test/selectors.js +265 -200
  151. package/src/store/utils.js +1 -1
  152. package/src/utils/pasting.js +1 -1
  153. package/build/autocompleters/link.cjs +0 -81
  154. package/build/autocompleters/link.cjs.map +0 -7
  155. package/build-module/autocompleters/link.mjs +0 -50
  156. package/build-module/autocompleters/link.mjs.map +0 -7
  157. package/src/autocompleters/link.js +0 -63
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/link-control/search-input.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { URLInput } from '../';\nimport LinkControlSearchResults from './search-results';\nimport { CREATE_TYPE } from './constants';\nimport useSearchHandler from './use-search-handler';\n\n// Must be a function as otherwise URLInput will default\n// to the fetchLinkSuggestions passed in block editor settings\n// which will cause an unintended http request.\nconst noopSearchHandler = () => Promise.resolve( [] );\n\nconst noop = () => {};\n\nconst LinkControlSearchInput = forwardRef(\n\t(\n\t\t{\n\t\t\tvalue,\n\t\t\tchildren,\n\t\t\tcurrentLink = {},\n\t\t\tclassName = null,\n\t\t\tplaceholder = null,\n\t\t\twithCreateSuggestion = false,\n\t\t\tonCreateSuggestion = noop,\n\t\t\tonChange = noop,\n\t\t\tonSelect = noop,\n\t\t\tshowSuggestions = true,\n\t\t\trenderSuggestions = ( props ) => (\n\t\t\t\t<LinkControlSearchResults { ...props } />\n\t\t\t),\n\t\t\tfetchSuggestions = null,\n\t\t\tallowDirectEntry = true,\n\t\t\tshowInitialSuggestions = false,\n\t\t\tsuggestionsQuery = {},\n\t\t\twithURLSuggestion = true,\n\t\t\tcreateSuggestionButtonText,\n\t\t\thideLabelFromVision = false,\n\t\t\tsuffix,\n\t\t\tisEntity = false,\n\t\t\tcustomValidity: customValidityProp,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst genericSearchHandler = useSearchHandler(\n\t\t\tsuggestionsQuery,\n\t\t\tallowDirectEntry,\n\t\t\twithCreateSuggestion,\n\t\t\twithURLSuggestion\n\t\t);\n\n\t\tconst searchHandler = showSuggestions\n\t\t\t? fetchSuggestions || genericSearchHandler\n\t\t\t: noopSearchHandler;\n\n\t\tconst [ focusedSuggestion, setFocusedSuggestion ] = useState();\n\n\t\t/**\n\t\t * Handles the user moving between different suggestions. Does not handle\n\t\t * choosing an individual item.\n\t\t *\n\t\t * @param {string} selection the url of the selected suggestion.\n\t\t * @param {Object} suggestion the suggestion object.\n\t\t */\n\t\tconst onInputChange = ( selection, suggestion ) => {\n\t\t\tonChange( selection );\n\t\t\tsetFocusedSuggestion( suggestion );\n\t\t};\n\n\t\tconst handleRenderSuggestions = ( props ) =>\n\t\t\trenderSuggestions( {\n\t\t\t\t...props,\n\t\t\t\twithCreateSuggestion,\n\t\t\t\tcreateSuggestionButtonText,\n\t\t\t\tsuggestionsQuery,\n\t\t\t\thandleSuggestionClick: ( suggestion ) => {\n\t\t\t\t\tif ( props.handleSuggestionClick ) {\n\t\t\t\t\t\tprops.handleSuggestionClick( suggestion );\n\t\t\t\t\t}\n\t\t\t\t\tonSuggestionSelected( suggestion );\n\t\t\t\t},\n\t\t\t} );\n\n\t\tconst onSuggestionSelected = async ( selectedSuggestion ) => {\n\t\t\tlet suggestion = selectedSuggestion;\n\t\t\tif ( CREATE_TYPE === selectedSuggestion.type ) {\n\t\t\t\t// Create a new page and call onSelect with the output from the onCreateSuggestion callback.\n\t\t\t\ttry {\n\t\t\t\t\tsuggestion = await onCreateSuggestion(\n\t\t\t\t\t\tselectedSuggestion.title\n\t\t\t\t\t);\n\t\t\t\t\tif ( suggestion?.url ) {\n\t\t\t\t\t\tonSelect( suggestion );\n\t\t\t\t\t}\n\t\t\t\t} catch ( e ) {}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tallowDirectEntry ||\n\t\t\t\t( suggestion && Object.keys( suggestion ).length >= 1 )\n\t\t\t) {\n\t\t\t\t// Strip out id, url, kind, and type from the current link to prevent\n\t\t\t\t// entity metadata from persisting when switching to a different link type.\n\t\t\t\t// For example, when changing from an entity link (kind: 'post-type', type: 'page')\n\t\t\t\t// to a custom URL (type: 'link', no kind), we need to ensure the old 'kind'\n\t\t\t\t// doesn't carry over. We do want to preserve other properites like title, though.\n\t\t\t\tconst { id, url, kind, type, ...restLinkProps } =\n\t\t\t\t\tcurrentLink ?? {};\n\t\t\t\tonSelect(\n\t\t\t\t\t// Some direct entries don't have types or IDs, and we still need to clear the previous ones.\n\t\t\t\t\t{ ...restLinkProps, ...suggestion },\n\t\t\t\t\tsuggestion\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst _placeholder = placeholder ?? __( 'Search or type URL' );\n\n\t\tconst label =\n\t\t\thideLabelFromVision && placeholder !== ''\n\t\t\t\t? _placeholder\n\t\t\t\t: __( 'Link' );\n\n\t\treturn (\n\t\t\t<div className=\"block-editor-link-control__search-input-container\">\n\t\t\t\t<URLInput\n\t\t\t\t\tdisableSuggestions={ currentLink?.url === value }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\tplaceholder={ _placeholder }\n\t\t\t\t\t__experimentalRenderSuggestions={\n\t\t\t\t\t\tshowSuggestions ? handleRenderSuggestions : null\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFetchLinkSuggestions={ searchHandler }\n\t\t\t\t\t__experimentalHandleURLSuggestions\n\t\t\t\t\t__experimentalShowInitialSuggestions={\n\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t}\n\t\t\t\t\tcustomValidity={ customValidityProp }\n\t\t\t\t\t// Validation is handled manually via onSubmit and handleSubmit. We may be able to rely\n\t\t\t\t\t// on browser validation when enhancements land to base level components:\n\t\t\t\t\t// https://github.com/WordPress/gutenberg/pull/75188#issuecomment-3861757260\n\t\t\t\t\trequired={ false }\n\t\t\t\t\tonSubmit={ ( suggestion, event ) => {\n\t\t\t\t\t\tconst hasSuggestion = suggestion || focusedSuggestion;\n\n\t\t\t\t\t\t// If there is no suggestion and the value (ie: any manually entered URL) is empty\n\t\t\t\t\t\t// then don't allow submission otherwise we get empty links.\n\t\t\t\t\t\tif ( ! hasSuggestion && ! value?.trim()?.length ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonSuggestionSelected(\n\t\t\t\t\t\t\t\thasSuggestion || { url: value }\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tinputRef={ ref }\n\t\t\t\t\tsuffix={ suffix }\n\t\t\t\t\tdisabled={ isEntity }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nexport default LinkControlSearchInput;\n\nexport const __experimentalLinkControlSearchInput = ( props ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalLinkControlSearchInput', {\n\t\tsince: '6.8',\n\t} );\n\n\treturn <LinkControlSearchInput { ...props } />;\n};\n"],
5
- "mappings": ";AAGA,SAAS,YAAY,gBAAgB;AACrC,SAAS,UAAU;AACnB,OAAO,gBAAgB;AAKvB,SAAS,gBAAgB;AACzB,OAAO,8BAA8B;AACrC,SAAS,mBAAmB;AAC5B,OAAO,sBAAsB;AAuBzB,cAgGD,YAhGC;AAlBJ,IAAM,oBAAoB,MAAM,QAAQ,QAAS,CAAC,CAAE;AAEpD,IAAM,OAAO,MAAM;AAAC;AAEpB,IAAM,yBAAyB;AAAA,EAC9B,CACC;AAAA,IACC;AAAA,IACA;AAAA,IACA,cAAc,CAAC;AAAA,IACf,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,uBAAuB;AAAA,IACvB,qBAAqB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UAEC,EAAE,GAAG,eAAe,GAAG,WAAW;AAAA,UAClC;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAEA,UAAM,eAAe,eAAe,GAAI,oBAAqB;AAE7D,UAAM,QACL,uBAAuB,gBAAgB,KACpC,eACA,GAAI,MAAO;AAEf,WACC,qBAAC,SAAI,WAAU,qDACd;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,oBAAqB,aAAa,QAAQ;AAAA,UAC1C;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,UAAW;AAAA,UACX,aAAc;AAAA,UACd,iCACC,kBAAkB,0BAA0B;AAAA,UAE7C,oCAAqC;AAAA,UACrC,oCAAkC;AAAA,UAClC,sCACC;AAAA,UAED,gBAAiB;AAAA,UAIjB,UAAW;AAAA,UACX,UAAW,CAAE,YAAY,UAAW;AACnC,kBAAM,gBAAgB,cAAc;AAIpC,gBAAK,CAAE,iBAAiB,CAAE,OAAO,KAAK,GAAG,QAAS;AACjD,oBAAM,eAAe;AAAA,YACtB,OAAO;AACN;AAAA,gBACC,iBAAiB,EAAE,KAAK,MAAM;AAAA,cAC/B;AAAA,YACD;AAAA,UACD;AAAA,UACA,UAAW;AAAA,UACX;AAAA,UACA,UAAW;AAAA;AAAA,MACZ;AAAA,MACE;AAAA,OACH;AAAA,EAEF;AACD;AAEA,IAAO,uBAAQ;AAER,IAAM,uCAAuC,CAAE,UAAW;AAChE,aAAY,uDAAuD;AAAA,IAClE,OAAO;AAAA,EACR,CAAE;AAEF,SAAO,oBAAC,0BAAyB,GAAG,OAAQ;AAC7C;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { URLInput } from '../';\nimport LinkControlSearchResults from './search-results';\nimport { CREATE_TYPE } from './constants';\nimport useSearchHandler from './use-search-handler';\n\n// Must be a function as otherwise URLInput will default\n// to the fetchLinkSuggestions passed in block editor settings\n// which will cause an unintended http request.\nconst noopSearchHandler = () => Promise.resolve( [] );\n\nconst noop = () => {};\n\nconst LinkControlSearchInput = forwardRef(\n\t(\n\t\t{\n\t\t\tvalue,\n\t\t\tchildren,\n\t\t\tcurrentLink = {},\n\t\t\tclassName = null,\n\t\t\tplaceholder = null,\n\t\t\twithCreateSuggestion = false,\n\t\t\tonCreateSuggestion = noop,\n\t\t\tonChange = noop,\n\t\t\tonSelect = noop,\n\t\t\tshowSuggestions = true,\n\t\t\trenderSuggestions = ( props ) => (\n\t\t\t\t<LinkControlSearchResults { ...props } />\n\t\t\t),\n\t\t\tfetchSuggestions = null,\n\t\t\tallowDirectEntry = true,\n\t\t\tshowInitialSuggestions = false,\n\t\t\tsuggestionsQuery = {},\n\t\t\twithURLSuggestion = true,\n\t\t\tcreateSuggestionButtonText,\n\t\t\thideLabelFromVision = false,\n\t\t\tsuffix,\n\t\t\tisEntity = false,\n\t\t\tcustomValidity: customValidityProp,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst genericSearchHandler = useSearchHandler(\n\t\t\tsuggestionsQuery,\n\t\t\tallowDirectEntry,\n\t\t\twithCreateSuggestion,\n\t\t\twithURLSuggestion\n\t\t);\n\n\t\tconst searchHandler = showSuggestions\n\t\t\t? fetchSuggestions || genericSearchHandler\n\t\t\t: noopSearchHandler;\n\n\t\tconst [ focusedSuggestion, setFocusedSuggestion ] = useState();\n\n\t\t/**\n\t\t * Handles the user moving between different suggestions. Does not handle\n\t\t * choosing an individual item.\n\t\t *\n\t\t * @param {string} selection the url of the selected suggestion.\n\t\t * @param {Object} suggestion the suggestion object.\n\t\t */\n\t\tconst onInputChange = ( selection, suggestion ) => {\n\t\t\tonChange( selection );\n\t\t\tsetFocusedSuggestion( suggestion );\n\t\t};\n\n\t\tconst handleRenderSuggestions = ( props ) =>\n\t\t\trenderSuggestions( {\n\t\t\t\t...props,\n\t\t\t\twithCreateSuggestion,\n\t\t\t\tcreateSuggestionButtonText,\n\t\t\t\tsuggestionsQuery,\n\t\t\t\thandleSuggestionClick: ( suggestion ) => {\n\t\t\t\t\tif ( props.handleSuggestionClick ) {\n\t\t\t\t\t\tprops.handleSuggestionClick( suggestion );\n\t\t\t\t\t}\n\t\t\t\t\tonSuggestionSelected( suggestion );\n\t\t\t\t},\n\t\t\t} );\n\n\t\tconst onSuggestionSelected = async ( selectedSuggestion ) => {\n\t\t\tlet suggestion = selectedSuggestion;\n\t\t\tif ( CREATE_TYPE === selectedSuggestion.type ) {\n\t\t\t\t// Create a new page and call onSelect with the output from the onCreateSuggestion callback.\n\t\t\t\ttry {\n\t\t\t\t\tsuggestion = await onCreateSuggestion(\n\t\t\t\t\t\tselectedSuggestion.title\n\t\t\t\t\t);\n\t\t\t\t\tif ( suggestion?.url ) {\n\t\t\t\t\t\tonSelect( suggestion );\n\t\t\t\t\t}\n\t\t\t\t} catch {}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tallowDirectEntry ||\n\t\t\t\t( suggestion && Object.keys( suggestion ).length >= 1 )\n\t\t\t) {\n\t\t\t\t// Strip out id, url, kind, and type from the current link to prevent\n\t\t\t\t// entity metadata from persisting when switching to a different link type.\n\t\t\t\t// For example, when changing from an entity link (kind: 'post-type', type: 'page')\n\t\t\t\t// to a custom URL (type: 'link', no kind), we need to ensure the old 'kind'\n\t\t\t\t// doesn't carry over. We do want to preserve other properites like title, though.\n\t\t\t\tconst { id, url, kind, type, ...restLinkProps } =\n\t\t\t\t\tcurrentLink ?? {};\n\t\t\t\tonSelect(\n\t\t\t\t\t// Some direct entries don't have types or IDs, and we still need to clear the previous ones.\n\t\t\t\t\t{ ...restLinkProps, ...suggestion },\n\t\t\t\t\tsuggestion\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst _placeholder = placeholder ?? __( 'Search or type URL' );\n\n\t\tconst label =\n\t\t\thideLabelFromVision && placeholder !== ''\n\t\t\t\t? _placeholder\n\t\t\t\t: __( 'Link' );\n\n\t\treturn (\n\t\t\t<div className=\"block-editor-link-control__search-input-container\">\n\t\t\t\t<URLInput\n\t\t\t\t\tdisableSuggestions={ currentLink?.url === value }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\tplaceholder={ _placeholder }\n\t\t\t\t\t__experimentalRenderSuggestions={\n\t\t\t\t\t\tshowSuggestions ? handleRenderSuggestions : null\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFetchLinkSuggestions={ searchHandler }\n\t\t\t\t\t__experimentalHandleURLSuggestions\n\t\t\t\t\t__experimentalShowInitialSuggestions={\n\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t}\n\t\t\t\t\tcustomValidity={ customValidityProp }\n\t\t\t\t\t// Validation is handled manually via onSubmit and handleSubmit. We may be able to rely\n\t\t\t\t\t// on browser validation when enhancements land to base level components:\n\t\t\t\t\t// https://github.com/WordPress/gutenberg/pull/75188#issuecomment-3861757260\n\t\t\t\t\trequired={ false }\n\t\t\t\t\tonSubmit={ ( suggestion, event ) => {\n\t\t\t\t\t\tconst hasSuggestion = suggestion || focusedSuggestion;\n\n\t\t\t\t\t\t// If there is no suggestion and the value (ie: any manually entered URL) is empty\n\t\t\t\t\t\t// then don't allow submission otherwise we get empty links.\n\t\t\t\t\t\tif ( ! hasSuggestion && ! value?.trim()?.length ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonSuggestionSelected(\n\t\t\t\t\t\t\t\thasSuggestion || { url: value }\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tinputRef={ ref }\n\t\t\t\t\tsuffix={ suffix }\n\t\t\t\t\tdisabled={ isEntity }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nexport default LinkControlSearchInput;\n\nexport const __experimentalLinkControlSearchInput = ( props ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalLinkControlSearchInput', {\n\t\tsince: '6.8',\n\t} );\n\n\treturn <LinkControlSearchInput { ...props } />;\n};\n"],
5
+ "mappings": ";AAGA,SAAS,YAAY,gBAAgB;AACrC,SAAS,UAAU;AACnB,OAAO,gBAAgB;AAKvB,SAAS,gBAAgB;AACzB,OAAO,8BAA8B;AACrC,SAAS,mBAAmB;AAC5B,OAAO,sBAAsB;AAuBzB,cAgGD,YAhGC;AAlBJ,IAAM,oBAAoB,MAAM,QAAQ,QAAS,CAAC,CAAE;AAEpD,IAAM,OAAO,MAAM;AAAC;AAEpB,IAAM,yBAAyB;AAAA,EAC9B,CACC;AAAA,IACC;AAAA,IACA;AAAA,IACA,cAAc,CAAC;AAAA,IACf,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,uBAAuB;AAAA,IACvB,qBAAqB;AAAA,IACrB,WAAW;AAAA,IACX,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB,oBAAoB,CAAE,UACrB,oBAAC,4BAA2B,GAAG,OAAQ;AAAA,IAExC,mBAAmB;AAAA,IACnB,mBAAmB;AAAA,IACnB,yBAAyB;AAAA,IACzB,mBAAmB,CAAC;AAAA,IACpB,oBAAoB;AAAA,IACpB;AAAA,IACA,sBAAsB;AAAA,IACtB;AAAA,IACA,WAAW;AAAA,IACX,gBAAgB;AAAA,EACjB,GACA,QACI;AACJ,UAAM,uBAAuB;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAEA,UAAM,gBAAgB,kBACnB,oBAAoB,uBACpB;AAEH,UAAM,CAAE,mBAAmB,oBAAqB,IAAI,SAAS;AAS7D,UAAM,gBAAgB,CAAE,WAAW,eAAgB;AAClD,eAAU,SAAU;AACpB,2BAAsB,UAAW;AAAA,IAClC;AAEA,UAAM,0BAA0B,CAAE,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eAAe;AAAA,YACtB,OAAO;AACN;AAAA,gBACC,iBAAiB,EAAE,KAAK,MAAM;AAAA,cAC/B;AAAA,YACD;AAAA,UACD;AAAA,UACA,UAAW;AAAA,UACX;AAAA,UACA,UAAW;AAAA;AAAA,MACZ;AAAA,MACE;AAAA,OACH;AAAA,EAEF;AACD;AAEA,IAAO,uBAAQ;AAER,IAAM,uCAAuC,CAAE,UAAW;AAChE,aAAY,uDAAuD;AAAA,IAClE,OAAO;AAAA,EACR,CAAE;AAEF,SAAO,oBAAC,0BAAyB,GAAG,OAAQ;AAC7C;",
6
6
  "names": []
7
7
  }
@@ -7,6 +7,7 @@ import {
7
7
  privateApis as componentsPrivateApis
8
8
  } from "@wordpress/components";
9
9
  import { Icon, chevronDown } from "@wordpress/icons";
10
+ import { __unstableStripHTML as stripHTML } from "@wordpress/dom";
10
11
  import { unlock } from "../../lock-unlock.mjs";
11
12
  import { jsx, jsxs } from "react/jsx-runtime";
12
13
  var { Badge } = unlock(componentsPrivateApis);
@@ -32,7 +33,7 @@ function LinkPreview({ title, url, image, badges }) {
32
33
  {
33
34
  numberOfLines: 1,
34
35
  className: "link-preview-button__title",
35
- children: title
36
+ children: stripHTML(title)
36
37
  }
37
38
  ),
38
39
  url && /* @__PURE__ */ jsx(
@@ -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": ";AAGA;AAAA,EACC,0BAA0B;AAAA,EAC1B,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,MAAM,mBAAmB;AAKlC,SAAS,cAAc;AAqBhB,cAQF,YARE;AAnBP,IAAM,EAAE,MAAM,IAAI,OAAQ,qBAAsB;AAYzC,SAAS,YAAa,EAAE,OAAO,KAAK,OAAO,OAAO,GAAI;AAC5D,SACC,qBAAC,UAAO,SAAQ,iBAAgB,WAAU,OACzC;AAAA,wBAAC,YAAS,WAAU,gCACnB,+BAAC,UAAO,WAAU,OACf;AAAA,eACD,oBAAC,YAAS,WAAU,wCACnB;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,KAAM;AAAA,UACN,KAAI;AAAA;AAAA,MACL,GACD;AAAA,MAGD;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,WAAU;AAAA,UAEV;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,eAAgB;AAAA,gBAChB,WAAU;AAAA,gBAER;AAAA;AAAA,YACH;AAAA,YACE,OACD;AAAA,cAAC;AAAA;AAAA,gBACA,eAAgB;AAAA,gBAChB,WAAU;AAAA,gBAER;AAAA;AAAA,YACH;AAAA,YAEC,UAAU,OAAO,SAAS,KAC3B;AAAA,cAAC;AAAA;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,oBAAC,QAAK,MAAO,aAAc,WAAU,6BAA4B;AAAA,KAClE;AAEF;",
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": ";AAGA;AAAA,EACC,0BAA0B;AAAA,EAC1B,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,MAAM,mBAAmB;AAClC,SAAS,uBAAuB,iBAAiB;AAKjD,SAAS,cAAc;AAqBhB,cAQF,YARE;AAnBP,IAAM,EAAE,MAAM,IAAI,OAAQ,qBAAsB;AAYzC,SAAS,YAAa,EAAE,OAAO,KAAK,OAAO,OAAO,GAAI;AAC5D,SACC,qBAAC,UAAO,SAAQ,iBAAgB,WAAU,OACzC;AAAA,wBAAC,YAAS,WAAU,gCACnB,+BAAC,UAAO,WAAU,OACf;AAAA,eACD,oBAAC,YAAS,WAAU,wCACnB;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,KAAM;AAAA,UACN,KAAI;AAAA;AAAA,MACL,GACD;AAAA,MAGD;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,WAAU;AAAA,UAEV;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,eAAgB;AAAA,gBAChB,WAAU;AAAA,gBAER,oBAAW,KAAM;AAAA;AAAA,YACpB;AAAA,YACE,OACD;AAAA,cAAC;AAAA;AAAA,gBACA,eAAgB;AAAA,gBAChB,WAAU;AAAA,gBAER;AAAA;AAAA,YACH;AAAA,YAEC,UAAU,OAAO,SAAS,KAC3B;AAAA,cAAC;AAAA;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,oBAAC,QAAK,MAAO,aAAc,WAAU,6BAA4B;AAAA,KAClE;AAEF;",
6
6
  "names": []
7
7
  }
@@ -96,11 +96,14 @@ function PresetInputControl({
96
96
  const step = unitConfig?.step ?? customValueSettings[computedUnit]?.steps ?? 0.1;
97
97
  const max = unitConfig?.max ?? customValueSettings[computedUnit]?.max ?? 10;
98
98
  const handleCustomValueChange = (newValue) => {
99
- const isNumeric = !isNaN(parseFloat(newValue));
100
- const newCustomValue = isNumeric ? newValue : void 0;
101
- if (newCustomValue !== void 0) {
102
- onChange(newCustomValue);
99
+ if (newValue === void 0 || newValue === "") {
100
+ onChange(void 0);
101
+ return;
103
102
  }
103
+ if (isNaN(parseFloat(newValue))) {
104
+ return;
105
+ }
106
+ onChange(newValue);
104
107
  };
105
108
  const handleCustomValueSliderChange = (next) => {
106
109
  onChange([next, computedUnit].join(""));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preset-input-control/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCustomSelectControl,\n\tIcon,\n\tRangeControl,\n\t__experimentalHStack as HStack,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { usePrevious } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { settings } from '@wordpress/icons';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tCUSTOM_VALUE_SETTINGS,\n\tICON_SIZE,\n\tRANGE_CONTROL_MAX_SIZE,\n} from './constants';\nimport {\n\tgetCustomValueFromPreset,\n\tgetPresetValueFromCustomValue,\n\tgetSliderValueFromPreset,\n\tisValuePreset,\n} from './utils';\nimport CustomValueControls from './custom-value-controls';\n\n/**\n * PresetInputControl component for selecting preset values or entering custom values.\n *\n * Displays preset values as either a slider (for <= 8 presets) or a select dropdown.\n * Allows toggling to custom value mode with a UnitControl and RangeControl.\n * Handles unit tracking and conversion between preset and custom values.\n *\n * @param {Object} props Component props.\n * @param {boolean} props.allowNegativeOnDrag Whether to allow negative values during drag operations.\n * @param {string} props.ariaLabel Accessible label for the control.\n * @param {string} props.className Optional CSS class name.\n * @param {Object} props.customValueSettings Optional custom value settings for max/steps per unit.\n * @param {boolean} props.disableCustomValues Whether to disable custom value input.\n * @param {Object} props.icon Icon to display alongside the control.\n * @param {boolean} props.isMixed Whether the current value is mixed (multiple values).\n * @param {number} props.minimumCustomValue Minimum allowed custom value.\n * @param {Function} props.onChange Callback when value changes.\n * @param {Function} props.onMouseOut Callback for mouse out events.\n * @param {Function} props.onMouseOver Callback for mouse over events.\n * @param {Function} props.onUnitChange Callback when unit changes.\n * @param {Array} props.presets Array of preset objects with name, slug, and size.\n * @param {string} props.presetType Type of preset (e.g., 'spacing', 'border-radius').\n * @param {string} props.selectedUnit Currently selected unit (e.g., 'px', 'em').\n * @param {boolean} props.showTooltip Whether to show tooltip on custom UnitControl.\n * @param {Array} props.units Array of available unit objects (can include max and step).\n * @param {string} props.value Current value (preset or custom).\n *\n * @return {Element} The PresetInputControl component.\n */\nexport default function PresetInputControl( {\n\tallowNegativeOnDrag = false,\n\tariaLabel,\n\tclassName: classNameProp,\n\tcustomValueSettings = CUSTOM_VALUE_SETTINGS,\n\tdisableCustomValues,\n\ticon,\n\tisMixed,\n\tvalue: valueProp,\n\tminimumCustomValue,\n\tonChange,\n\tonMouseOut,\n\tonMouseOver,\n\tonUnitChange,\n\tpresets = [],\n\tpresetType,\n\tselectedUnit,\n\tshowTooltip,\n\tunits,\n} ) {\n\tconst value = useMemo(\n\t\t() => getPresetValueFromCustomValue( valueProp, presets, presetType ),\n\t\t[ valueProp, presets, presetType ]\n\t);\n\n\tconst className = classNameProp ?? 'preset-input-control';\n\n\tconst marks = presets\n\t\t.slice( 1, presets.length - 1 )\n\t\t.map( ( _newValue, index ) => ( {\n\t\t\tvalue: index + 1,\n\t\t\tlabel: undefined,\n\t\t} ) );\n\tconst hasPresets = marks.length > 0;\n\tconst showRangeControl = presets.length <= RANGE_CONTROL_MAX_SIZE;\n\n\tconst allPlaceholder = isMixed ? __( 'Mixed' ) : null;\n\n\tconst [ minValue, setMinValue ] = useState( minimumCustomValue );\n\tconst [ showCustomValueControl, setShowCustomValueControl ] = useState(\n\t\t! disableCustomValues &&\n\t\t\tvalue !== undefined &&\n\t\t\t! isValuePreset( value, presetType )\n\t);\n\n\tlet currentValue = null;\n\n\tconst previousValue = usePrevious( value );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t!! value &&\n\t\t\tpreviousValue !== value &&\n\t\t\t! isValuePreset( value, presetType ) &&\n\t\t\tshowCustomValueControl !== true\n\t\t) {\n\t\t\tsetShowCustomValueControl( true );\n\t\t}\n\t}, [ value, previousValue, presetType, showCustomValueControl ] );\n\n\tconst showCustomValueInSelectList =\n\t\t! showRangeControl &&\n\t\t! showCustomValueControl &&\n\t\tvalue !== undefined &&\n\t\t( ! isValuePreset( value, presetType ) ||\n\t\t\t( isValuePreset( value, presetType ) && isMixed ) );\n\n\tlet selectListOptions = presets;\n\tif ( showCustomValueInSelectList ) {\n\t\tselectListOptions = [\n\t\t\t...presets,\n\t\t\t{\n\t\t\t\tname: ! isMixed\n\t\t\t\t\t? // translators: %s: A custom measurement, e.g. a number followed by a unit like 12px.\n\t\t\t\t\t sprintf( __( 'Custom (%s)' ), value )\n\t\t\t\t\t: __( 'Mixed' ),\n\t\t\t\tslug: 'custom',\n\t\t\t\tsize: value,\n\t\t\t},\n\t\t];\n\t\tcurrentValue = selectListOptions.length - 1;\n\t} else if ( ! isMixed ) {\n\t\tcurrentValue = ! showCustomValueControl\n\t\t\t? getSliderValueFromPreset( value, presets, presetType )\n\t\t\t: getCustomValueFromPreset( value, presets, presetType );\n\t}\n\n\tconst options = selectListOptions.map( ( size, index ) => ( {\n\t\tkey: index,\n\t\tname: size.name,\n\t} ) );\n\n\tconst resolvedPresetValue = isValuePreset( value, presetType )\n\t\t? getCustomValueFromPreset( value, presets, presetType )\n\t\t: value;\n\n\tconst [ parsedQuantity, parsedUnit ] =\n\t\tparseQuantityAndUnitFromRawValue( resolvedPresetValue );\n\n\tconst computedUnit = parsedUnit || selectedUnit || 'px';\n\n\t// Get step and max from units prop, falling back to customValueSettings\n\tconst unitConfig = units?.find( ( item ) => item.value === computedUnit );\n\tconst step =\n\t\tunitConfig?.step ?? customValueSettings[ computedUnit ]?.steps ?? 0.1;\n\tconst max =\n\t\tunitConfig?.max ?? customValueSettings[ computedUnit ]?.max ?? 10;\n\n\tconst handleCustomValueChange = ( newValue ) => {\n\t\tconst isNumeric = ! isNaN( parseFloat( newValue ) );\n\t\tconst newCustomValue = isNumeric ? newValue : undefined;\n\n\t\tif ( newCustomValue !== undefined ) {\n\t\t\tonChange( newCustomValue );\n\t\t}\n\t};\n\tconst handleCustomValueSliderChange = ( next ) => {\n\t\tonChange( [ next, computedUnit ].join( '' ) );\n\t};\n\tconst customTooltipContent = ( newValue ) =>\n\t\tvalue === undefined ? undefined : presets[ newValue ]?.name;\n\n\tconst getNewPresetValue = ( next, controlType ) => {\n\t\tconst newValue = parseInt( next, 10 );\n\n\t\tif ( controlType === 'selectList' ) {\n\t\t\tif ( newValue === 0 && presets[ 0 ]?.slug === '0' ) {\n\t\t\t\treturn '0';\n\t\t\t}\n\t\t\tif ( newValue === 0 ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t} else if ( newValue === 0 ) {\n\t\t\treturn '0';\n\t\t}\n\t\treturn `var:preset|${ presetType }|${ presets[ next ]?.slug }`;\n\t};\n\n\treturn (\n\t\t<HStack\n\t\t\tclassName={ `preset-input-control__wrapper ${ className }__wrapper` }\n\t\t>\n\t\t\t{ icon && (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"preset-input-control__icon\"\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tsize={ ICON_SIZE }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ( ! hasPresets || showCustomValueControl ) && (\n\t\t\t\t<CustomValueControls\n\t\t\t\t\tallowNegativeOnDrag={ allowNegativeOnDrag }\n\t\t\t\t\tariaLabel={ ariaLabel }\n\t\t\t\t\tallPlaceholder={ allPlaceholder }\n\t\t\t\t\tminValue={ minValue }\n\t\t\t\t\tparsedQuantity={ parsedQuantity }\n\t\t\t\t\tcomputedUnit={ computedUnit }\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tisMixed={ isMixed }\n\t\t\t\t\tstep={ step }\n\t\t\t\t\tmax={ max }\n\t\t\t\t\tshowTooltip={ showTooltip }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tminimumCustomValue={ minimumCustomValue }\n\t\t\t\t\tonCustomValueChange={ handleCustomValueChange }\n\t\t\t\t\tonCustomValueSliderChange={ handleCustomValueSliderChange }\n\t\t\t\t\tonUnitChange={ onUnitChange }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\tsetMinValue={ setMinValue }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPresets && showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<RangeControl\n\t\t\t\t\taria-valuenow={ currentValue }\n\t\t\t\t\taria-valuetext={ presets[ currentValue ]?.name }\n\t\t\t\t\tclassName=\"preset-input-control__preset-range\"\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tinitialPosition={ 0 }\n\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\tmax={ presets.length - 1 }\n\t\t\t\t\tmarks={ marks }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\t\tonChange( getNewPresetValue( newValue ) )\n\t\t\t\t\t}\n\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t// If mouse down is near start of range set initial value to 0, which\n\t\t\t\t\t\t// prevents the user have to drag right then left to get 0 setting.\n\t\t\t\t\t\tconst nearStart = event?.nativeEvent?.offsetX < 35;\n\t\t\t\t\t\tif ( nearStart && value === undefined ) {\n\t\t\t\t\t\t\tonChange( '0' );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\trenderTooltipContent={ customTooltipContent }\n\t\t\t\t\tstep={ 1 }\n\t\t\t\t\tvalue={ currentValue }\n\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPresets && ! showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<CustomSelectControl\n\t\t\t\t\tclassName=\"preset-input-control__custom-select-control\"\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t\tonChange={ ( selection ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tshowCustomValueInSelectList &&\n\t\t\t\t\t\t\tselection.selectedItem.key === options.length - 1\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tsetShowCustomValueControl( true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tgetNewPresetValue(\n\t\t\t\t\t\t\t\t\tselection.selectedItem.key,\n\t\t\t\t\t\t\t\t\t'selectList'\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\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tvalue={\n\t\t\t\t\t\t// passing empty string as a fallback to continue using the\n\t\t\t\t\t\t// component in controlled mode\n\t\t\t\t\t\toptions.find(\n\t\t\t\t\t\t\t( option ) => option.key === currentValue\n\t\t\t\t\t\t) || ''\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPresets && ! disableCustomValues && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"preset-input-control__custom-toggle\"\n\t\t\t\t\ticon={ settings }\n\t\t\t\t\ticonSize={ ICON_SIZE }\n\t\t\t\t\tisPressed={ showCustomValueControl }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tshowCustomValueControl\n\t\t\t\t\t\t\t? __( 'Use preset' )\n\t\t\t\t\t\t\t: __( 'Set custom value' )\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowCustomValueControl( ! showCustomValueControl );\n\t\t\t\t\t} }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n"],
5
- "mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,kDAAkD;AAAA,OAC5C;AACP,SAAS,mBAAmB;AAC5B,SAAS,IAAI,eAAe;AAC5B,SAAS,gBAAgB;AACzB,SAAS,UAAU,WAAW,eAAe;AAK7C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,yBAAyB;AA0K9B,SAIE,KAJF;AA3Ia,SAAR,mBAAqC;AAAA,EAC3C,sBAAsB;AAAA,EACtB;AAAA,EACA,WAAW;AAAA,EACX,sBAAsB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,QAAQ;AAAA,IACb,MAAM,8BAA+B,WAAW,SAAS,UAAW;AAAA,IACpE,CAAE,WAAW,SAAS,UAAW;AAAA,EAClC;AAEA,QAAM,YAAY,iBAAiB;AAEnC,QAAM,QAAQ,QACZ,MAAO,GAAG,QAAQ,SAAS,CAAE,EAC7B,IAAK,CAAE,WAAW,WAAa;AAAA,IAC/B,OAAO,QAAQ;AAAA,IACf,OAAO;A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YACL;AAAA;AAAA;AAAA,cAGC,QAAQ;AAAA,gBACP,CAAE,WAAY,OAAO,QAAQ;AAAA,cAC9B,KAAK;AAAA;AAAA;AAAA,QAEP;AAAA,QAEC,cAAc,CAAE,uBACjB;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,MAAO;AAAA,YACP,UAAW;AAAA,YACX,WAAY;AAAA,YACZ,OACC,yBACG,GAAI,YAAa,IACjB,GAAI,kBAAmB;AAAA,YAE3B,SAAU,MAAM;AACf,wCAA2B,CAAE,sBAAuB;AAAA,YACrD;AAAA,YACA,MAAK;AAAA;AAAA,QACN;AAAA;AAAA;AAAA,EAEF;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCustomSelectControl,\n\tIcon,\n\tRangeControl,\n\t__experimentalHStack as HStack,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { usePrevious } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { settings } from '@wordpress/icons';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tCUSTOM_VALUE_SETTINGS,\n\tICON_SIZE,\n\tRANGE_CONTROL_MAX_SIZE,\n} from './constants';\nimport {\n\tgetCustomValueFromPreset,\n\tgetPresetValueFromCustomValue,\n\tgetSliderValueFromPreset,\n\tisValuePreset,\n} from './utils';\nimport CustomValueControls from './custom-value-controls';\n\n/**\n * PresetInputControl component for selecting preset values or entering custom values.\n *\n * Displays preset values as either a slider (for <= 8 presets) or a select dropdown.\n * Allows toggling to custom value mode with a UnitControl and RangeControl.\n * Handles unit tracking and conversion between preset and custom values.\n *\n * @param {Object} props Component props.\n * @param {boolean} props.allowNegativeOnDrag Whether to allow negative values during drag operations.\n * @param {string} props.ariaLabel Accessible label for the control.\n * @param {string} props.className Optional CSS class name.\n * @param {Object} props.customValueSettings Optional custom value settings for max/steps per unit.\n * @param {boolean} props.disableCustomValues Whether to disable custom value input.\n * @param {Object} props.icon Icon to display alongside the control.\n * @param {boolean} props.isMixed Whether the current value is mixed (multiple values).\n * @param {number} props.minimumCustomValue Minimum allowed custom value.\n * @param {Function} props.onChange Callback when value changes.\n * @param {Function} props.onMouseOut Callback for mouse out events.\n * @param {Function} props.onMouseOver Callback for mouse over events.\n * @param {Function} props.onUnitChange Callback when unit changes.\n * @param {Array} props.presets Array of preset objects with name, slug, and size.\n * @param {string} props.presetType Type of preset (e.g., 'spacing', 'border-radius').\n * @param {string} props.selectedUnit Currently selected unit (e.g., 'px', 'em').\n * @param {boolean} props.showTooltip Whether to show tooltip on custom UnitControl.\n * @param {Array} props.units Array of available unit objects (can include max and step).\n * @param {string} props.value Current value (preset or custom).\n *\n * @return {Element} The PresetInputControl component.\n */\nexport default function PresetInputControl( {\n\tallowNegativeOnDrag = false,\n\tariaLabel,\n\tclassName: classNameProp,\n\tcustomValueSettings = CUSTOM_VALUE_SETTINGS,\n\tdisableCustomValues,\n\ticon,\n\tisMixed,\n\tvalue: valueProp,\n\tminimumCustomValue,\n\tonChange,\n\tonMouseOut,\n\tonMouseOver,\n\tonUnitChange,\n\tpresets = [],\n\tpresetType,\n\tselectedUnit,\n\tshowTooltip,\n\tunits,\n} ) {\n\tconst value = useMemo(\n\t\t() => getPresetValueFromCustomValue( valueProp, presets, presetType ),\n\t\t[ valueProp, presets, presetType ]\n\t);\n\n\tconst className = classNameProp ?? 'preset-input-control';\n\n\tconst marks = presets\n\t\t.slice( 1, presets.length - 1 )\n\t\t.map( ( _newValue, index ) => ( {\n\t\t\tvalue: index + 1,\n\t\t\tlabel: undefined,\n\t\t} ) );\n\tconst hasPresets = marks.length > 0;\n\tconst showRangeControl = presets.length <= RANGE_CONTROL_MAX_SIZE;\n\n\tconst allPlaceholder = isMixed ? __( 'Mixed' ) : null;\n\n\tconst [ minValue, setMinValue ] = useState( minimumCustomValue );\n\tconst [ showCustomValueControl, setShowCustomValueControl ] = useState(\n\t\t! disableCustomValues &&\n\t\t\tvalue !== undefined &&\n\t\t\t! isValuePreset( value, presetType )\n\t);\n\n\tlet currentValue = null;\n\n\tconst previousValue = usePrevious( value );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t!! value &&\n\t\t\tpreviousValue !== value &&\n\t\t\t! isValuePreset( value, presetType ) &&\n\t\t\tshowCustomValueControl !== true\n\t\t) {\n\t\t\tsetShowCustomValueControl( true );\n\t\t}\n\t}, [ value, previousValue, presetType, showCustomValueControl ] );\n\n\tconst showCustomValueInSelectList =\n\t\t! showRangeControl &&\n\t\t! showCustomValueControl &&\n\t\tvalue !== undefined &&\n\t\t( ! isValuePreset( value, presetType ) ||\n\t\t\t( isValuePreset( value, presetType ) && isMixed ) );\n\n\tlet selectListOptions = presets;\n\tif ( showCustomValueInSelectList ) {\n\t\tselectListOptions = [\n\t\t\t...presets,\n\t\t\t{\n\t\t\t\tname: ! isMixed\n\t\t\t\t\t? // translators: %s: A custom measurement, e.g. a number followed by a unit like 12px.\n\t\t\t\t\t sprintf( __( 'Custom (%s)' ), value )\n\t\t\t\t\t: __( 'Mixed' ),\n\t\t\t\tslug: 'custom',\n\t\t\t\tsize: value,\n\t\t\t},\n\t\t];\n\t\tcurrentValue = selectListOptions.length - 1;\n\t} else if ( ! isMixed ) {\n\t\tcurrentValue = ! showCustomValueControl\n\t\t\t? getSliderValueFromPreset( value, presets, presetType )\n\t\t\t: getCustomValueFromPreset( value, presets, presetType );\n\t}\n\n\tconst options = selectListOptions.map( ( size, index ) => ( {\n\t\tkey: index,\n\t\tname: size.name,\n\t} ) );\n\n\tconst resolvedPresetValue = isValuePreset( value, presetType )\n\t\t? getCustomValueFromPreset( value, presets, presetType )\n\t\t: value;\n\n\tconst [ parsedQuantity, parsedUnit ] =\n\t\tparseQuantityAndUnitFromRawValue( resolvedPresetValue );\n\n\tconst computedUnit = parsedUnit || selectedUnit || 'px';\n\n\t// Get step and max from units prop, falling back to customValueSettings\n\tconst unitConfig = units?.find( ( item ) => item.value === computedUnit );\n\tconst step =\n\t\tunitConfig?.step ?? customValueSettings[ computedUnit ]?.steps ?? 0.1;\n\tconst max =\n\t\tunitConfig?.max ?? customValueSettings[ computedUnit ]?.max ?? 10;\n\n\tconst handleCustomValueChange = ( newValue ) => {\n\t\t// Treat empty or undefined as an explicit clear and propagate undefined.\n\t\tif ( newValue === undefined || newValue === '' ) {\n\t\t\tonChange( undefined );\n\t\t\treturn;\n\t\t}\n\n\t\t// Ignore non-numeric intermediate input (e.g. just a unit).\n\t\tif ( isNaN( parseFloat( newValue ) ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonChange( newValue );\n\t};\n\tconst handleCustomValueSliderChange = ( next ) => {\n\t\tonChange( [ next, computedUnit ].join( '' ) );\n\t};\n\tconst customTooltipContent = ( newValue ) =>\n\t\tvalue === undefined ? undefined : presets[ newValue ]?.name;\n\n\tconst getNewPresetValue = ( next, controlType ) => {\n\t\tconst newValue = parseInt( next, 10 );\n\n\t\tif ( controlType === 'selectList' ) {\n\t\t\tif ( newValue === 0 && presets[ 0 ]?.slug === '0' ) {\n\t\t\t\treturn '0';\n\t\t\t}\n\t\t\tif ( newValue === 0 ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t} else if ( newValue === 0 ) {\n\t\t\treturn '0';\n\t\t}\n\t\treturn `var:preset|${ presetType }|${ presets[ next ]?.slug }`;\n\t};\n\n\treturn (\n\t\t<HStack\n\t\t\tclassName={ `preset-input-control__wrapper ${ className }__wrapper` }\n\t\t>\n\t\t\t{ icon && (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"preset-input-control__icon\"\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tsize={ ICON_SIZE }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ( ! hasPresets || showCustomValueControl ) && (\n\t\t\t\t<CustomValueControls\n\t\t\t\t\tallowNegativeOnDrag={ allowNegativeOnDrag }\n\t\t\t\t\tariaLabel={ ariaLabel }\n\t\t\t\t\tallPlaceholder={ allPlaceholder }\n\t\t\t\t\tminValue={ minValue }\n\t\t\t\t\tparsedQuantity={ parsedQuantity }\n\t\t\t\t\tcomputedUnit={ computedUnit }\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tisMixed={ isMixed }\n\t\t\t\t\tstep={ step }\n\t\t\t\t\tmax={ max }\n\t\t\t\t\tshowTooltip={ showTooltip }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tminimumCustomValue={ minimumCustomValue }\n\t\t\t\t\tonCustomValueChange={ handleCustomValueChange }\n\t\t\t\t\tonCustomValueSliderChange={ handleCustomValueSliderChange }\n\t\t\t\t\tonUnitChange={ onUnitChange }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\tsetMinValue={ setMinValue }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPresets && showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<RangeControl\n\t\t\t\t\taria-valuenow={ currentValue }\n\t\t\t\t\taria-valuetext={ presets[ currentValue ]?.name }\n\t\t\t\t\tclassName=\"preset-input-control__preset-range\"\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tinitialPosition={ 0 }\n\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\tmax={ presets.length - 1 }\n\t\t\t\t\tmarks={ marks }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\t\tonChange( getNewPresetValue( newValue ) )\n\t\t\t\t\t}\n\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t// If mouse down is near start of range set initial value to 0, which\n\t\t\t\t\t\t// prevents the user have to drag right then left to get 0 setting.\n\t\t\t\t\t\tconst nearStart = event?.nativeEvent?.offsetX < 35;\n\t\t\t\t\t\tif ( nearStart && value === undefined ) {\n\t\t\t\t\t\t\tonChange( '0' );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\trenderTooltipContent={ customTooltipContent }\n\t\t\t\t\tstep={ 1 }\n\t\t\t\t\tvalue={ currentValue }\n\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPresets && ! showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<CustomSelectControl\n\t\t\t\t\tclassName=\"preset-input-control__custom-select-control\"\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t\tonChange={ ( selection ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tshowCustomValueInSelectList &&\n\t\t\t\t\t\t\tselection.selectedItem.key === options.length - 1\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tsetShowCustomValueControl( true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tgetNewPresetValue(\n\t\t\t\t\t\t\t\t\tselection.selectedItem.key,\n\t\t\t\t\t\t\t\t\t'selectList'\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\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tvalue={\n\t\t\t\t\t\t// passing empty string as a fallback to continue using the\n\t\t\t\t\t\t// component in controlled mode\n\t\t\t\t\t\toptions.find(\n\t\t\t\t\t\t\t( option ) => option.key === currentValue\n\t\t\t\t\t\t) || ''\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPresets && ! disableCustomValues && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"preset-input-control__custom-toggle\"\n\t\t\t\t\ticon={ settings }\n\t\t\t\t\ticonSize={ ICON_SIZE }\n\t\t\t\t\tisPressed={ showCustomValueControl }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tshowCustomValueControl\n\t\t\t\t\t\t\t? __( 'Use preset' )\n\t\t\t\t\t\t\t: __( 'Set custom value' )\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowCustomValueControl( ! showCustomValueControl );\n\t\t\t\t\t} }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n"],
5
+ "mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,kDAAkD;AAAA,OAC5C;AACP,SAAS,mBAAmB;AAC5B,SAAS,IAAI,eAAe;AAC5B,SAAS,gBAAgB;AACzB,SAAS,UAAU,WAAW,eAAe;AAK7C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,yBAAyB;AAgL9B,SAIE,KAJF;AAjJa,SAAR,mBAAqC;AAAA,EAC3C,sBAAsB;AAAA,EACtB;AAAA,EACA,WAAW;AAAA,EACX,sBAAsB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,QAAQ;AAAA,IACb,MAAM,8BAA+B,WAAW,SAAS,UAAW;AAAA,IACpE,CAAE,WAAW,SAAS,UAAW;AAAA,EAClC;AAEA,QA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kBACC;AAAA,oBACC,UAAU,aAAa;AAAA,oBACvB;AAAA,kBACD;AAAA,gBACD;AAAA,cACD;AAAA,YACD;AAAA,YACA,SAAU;AAAA,YACV;AAAA,YACA;AAAA,YACA;AAAA,YACA,MAAK;AAAA,YACL;AAAA;AAAA;AAAA,cAGC,QAAQ;AAAA,gBACP,CAAE,WAAY,OAAO,QAAQ;AAAA,cAC9B,KAAK;AAAA;AAAA;AAAA,QAEP;AAAA,QAEC,cAAc,CAAE,uBACjB;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,MAAO;AAAA,YACP,UAAW;AAAA,YACX,WAAY;AAAA,YACZ,OACC,yBACG,GAAI,YAAa,IACjB,GAAI,kBAAmB;AAAA,YAE3B,SAAU,MAAM;AACf,wCAA2B,CAAE,sBAAuB;AAAA,YACrD;AAAA,YACA,MAAK;AAAA;AAAA,QACN;AAAA;AAAA;AAAA,EAEF;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/rich-text/event-listeners/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo, useRef, useInsertionEffect } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport beforeInputRules from './before-input-rules';\nimport inputRules from './input-rules';\nimport insertReplacementText from './insert-replacement-text';\nimport removeBrowserShortcuts from './remove-browser-shortcuts';\nimport shortcuts from './shortcuts';\nimport inputEvents from './input-events';\nimport undoAutomaticChange from './undo-automatic-change';\nimport pasteHandler from './paste-handler';\nimport _delete from './delete';\nimport enter from './enter';\nimport firefoxCompat from './firefox-compat';\n\nconst allEventListeners = [\n\tbeforeInputRules,\n\tinputRules,\n\tinsertReplacementText,\n\tremoveBrowserShortcuts,\n\tshortcuts,\n\tinputEvents,\n\tundoAutomaticChange,\n\tpasteHandler,\n\t_delete,\n\tenter,\n\tfirefoxCompat,\n];\n\nexport function useEventListeners( props ) {\n\tconst propsRef = useRef( props );\n\tuseInsertionEffect( () => {\n\t\tpropsRef.current = props;\n\t} );\n\tconst refEffects = useMemo(\n\t\t() => allEventListeners.map( ( refEffect ) => refEffect( propsRef ) ),\n\t\t[ propsRef ]\n\t);\n\n\treturn useRefEffect(\n\t\t( element ) => {\n\t\t\tif ( ! props.isSelected ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst cleanups = refEffects.map( ( effect ) => effect( element ) );\n\t\t\treturn () => {\n\t\t\t\tcleanups.forEach( ( cleanup ) => cleanup() );\n\t\t\t};\n\t\t},\n\t\t[ refEffects, props.isSelected ]\n\t);\n}\n"],
5
- "mappings": ";AAGA,SAAS,SAAS,QAAQ,0BAA0B;AACpD,SAAS,oBAAoB;AAK7B,OAAO,sBAAsB;AAC7B,OAAO,gBAAgB;AACvB,OAAO,2BAA2B;AAClC,OAAO,4BAA4B;AACnC,OAAO,eAAe;AACtB,OAAO,iBAAiB;AACxB,OAAO,yBAAyB;AAChC,OAAO,kBAAkB;AACzB,OAAO,aAAa;AACpB,OAAO,WAAW;AAClB,OAAO,mBAAmB;AAE1B,IAAM,oBAAoB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,SAAS,kBAAmB,OAAQ;AAC1C,QAAM,WAAW,OAAQ,KAAM;AAC/B,qBAAoB,MAAM;AACzB,aAAS,UAAU;AAAA,EACpB,CAAE;AACF,QAAM,aAAa;AAAA,IAClB,MAAM,kBAAkB,IAAK,CAAE,cAAe,UAAW,QAAS,CAAE;AAAA,IACpE,CAAE,QAAS;AAAA,EACZ;AAEA,SAAO;AAAA,IACN,CAAE,YAAa;AACd,UAAK,CAAE,MAAM,YAAa;AACzB;AAAA,MACD;AACA,YAAM,WAAW,WAAW,IAAK,CAAE,WAAY,OAAQ,OAAQ,CAAE;AACjE,aAAO,MAAM;AACZ,iBAAS,QAAS,CAAE,YAAa,QAAQ,CAAE;AAAA,MAC5C;AAAA,IACD;AAAA,IACA,CAAE,YAAY,MAAM,UAAW;AAAA,EAChC;AACD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo, useRef, useInsertionEffect } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport beforeInputRules from './before-input-rules';\nimport inputRules from './input-rules';\nimport insertReplacementText from './insert-replacement-text';\nimport removeBrowserShortcuts from './remove-browser-shortcuts';\nimport shortcuts from './shortcuts';\nimport inputEvents from './input-events';\nimport undoAutomaticChange from './undo-automatic-change';\nimport pasteHandler from './paste-handler';\nimport _delete from './delete';\nimport enter from './enter';\nimport firefoxCompat from './firefox-compat';\n\nconst allEventListeners = [\n\tbeforeInputRules,\n\tinputRules,\n\tinsertReplacementText,\n\tremoveBrowserShortcuts,\n\tshortcuts,\n\tinputEvents,\n\tundoAutomaticChange,\n\tpasteHandler,\n\t_delete,\n\tenter,\n\tfirefoxCompat,\n];\n\nexport function useEventListeners( props ) {\n\tconst propsRef = useRef( props );\n\tuseInsertionEffect( () => {\n\t\t// eslint-disable-next-line react-compiler/react-compiler -- false positive, see https://github.com/facebook/react/issues/29196\n\t\tpropsRef.current = props;\n\t} );\n\tconst refEffects = useMemo(\n\t\t() => allEventListeners.map( ( refEffect ) => refEffect( propsRef ) ),\n\t\t[ propsRef ]\n\t);\n\n\treturn useRefEffect(\n\t\t( element ) => {\n\t\t\tif ( ! props.isSelected ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst cleanups = refEffects.map( ( effect ) => effect( element ) );\n\t\t\treturn () => {\n\t\t\t\tcleanups.forEach( ( cleanup ) => cleanup() );\n\t\t\t};\n\t\t},\n\t\t[ refEffects, props.isSelected ]\n\t);\n}\n"],
5
+ "mappings": ";AAGA,SAAS,SAAS,QAAQ,0BAA0B;AACpD,SAAS,oBAAoB;AAK7B,OAAO,sBAAsB;AAC7B,OAAO,gBAAgB;AACvB,OAAO,2BAA2B;AAClC,OAAO,4BAA4B;AACnC,OAAO,eAAe;AACtB,OAAO,iBAAiB;AACxB,OAAO,yBAAyB;AAChC,OAAO,kBAAkB;AACzB,OAAO,aAAa;AACpB,OAAO,WAAW;AAClB,OAAO,mBAAmB;AAE1B,IAAM,oBAAoB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,SAAS,kBAAmB,OAAQ;AAC1C,QAAM,WAAW,OAAQ,KAAM;AAC/B,qBAAoB,MAAM;AAEzB,aAAS,UAAU;AAAA,EACpB,CAAE;AACF,QAAM,aAAa;AAAA,IAClB,MAAM,kBAAkB,IAAK,CAAE,cAAe,UAAW,QAAS,CAAE;AAAA,IACpE,CAAE,QAAS;AAAA,EACZ;AAEA,SAAO;AAAA,IACN,CAAE,YAAa;AACd,UAAK,CAAE,MAAM,YAAa;AACzB;AAAA,MACD;AACA,YAAM,WAAW,WAAW,IAAK,CAAE,WAAY,OAAQ,OAAQ,CAAE;AACjE,aAAO,MAAM;AACZ,iBAAS,QAAS,CAAE,YAAa,QAAQ,CAAE;AAAA,MAC5C;AAAA,IACD;AAAA,IACA,CAAE,YAAY,MAAM,UAAW;AAAA,EAChC;AACD;",
6
6
  "names": []
7
7
  }
@@ -32,7 +32,7 @@ import BlockContext from "../block-context/index.mjs";
32
32
  import { unlock } from "../../lock-unlock.mjs";
33
33
  import { RichTextShortcut } from "./shortcut.mjs";
34
34
  import { RichTextToolbarButton } from "./toolbar-button.mjs";
35
- import { __unstableRichTextInputEvent } from "./input-event.mjs";
35
+ import { RichTextInputEvent } from "./input-event.mjs";
36
36
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
37
37
  var { useRichText } = unlock(richTextPrivateApis);
38
38
  var keyboardShortcutContext = createContext();
@@ -432,7 +432,7 @@ export {
432
432
  RichTextShortcut,
433
433
  RichTextToolbarButton,
434
434
  RichTextWrapper,
435
- __unstableRichTextInputEvent,
435
+ RichTextInputEvent as __unstableRichTextInputEvent,
436
436
  rich_text_default as default,
437
437
  inputEventContext,
438
438
  keyboardShortcutContext
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/rich-text/index.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport fastDeepEqual from 'fast-deep-equal/es6/index.js';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseState,\n\tuseCallback,\n\tuseMemo,\n\tforwardRef,\n\tcreateContext,\n\tuseContext,\n} from '@wordpress/element';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { useMergeRefs, useInstanceId } from '@wordpress/compose';\nimport { privateApis as richTextPrivateApis } from '@wordpress/rich-text';\nimport { Popover } from '@wordpress/components';\nimport { getBlockBindingsSource } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditorAutocompleteProps } from '../autocomplete';\nimport { useBlockEditContext } from '../block-edit';\nimport { blockBindingsKey, isPreviewModeKey } from '../block-edit/context';\nimport FormatToolbarContainer from './format-toolbar-container';\nimport { store as blockEditorStore } from '../../store';\nimport { useMarkPersistent } from './use-mark-persistent';\nimport { useEventListeners } from './event-listeners';\nimport FormatEdit from './format-edit';\nimport { getAllowedFormats } from './utils';\nimport { Content, valueToHTMLString } from './content';\nimport { withDeprecations } from './with-deprecations';\nimport BlockContext from '../block-context';\nimport { unlock } from '../../lock-unlock';\n\nconst { useRichText } = unlock( richTextPrivateApis );\n\nexport const keyboardShortcutContext = createContext();\nkeyboardShortcutContext.displayName = 'keyboardShortcutContext';\n\nexport const inputEventContext = createContext();\ninputEventContext.displayName = 'inputEventContext';\n\nconst instanceIdKey = Symbol( 'instanceId' );\n\n/**\n * Removes props used for the native version of RichText so that they are not\n * passed to the DOM element and log warnings.\n *\n * @param {Object} props Props to filter.\n *\n * @return {Object} Filtered props.\n */\nfunction removeNativeProps( props ) {\n\tconst {\n\t\t__unstableMobileNoFocusOnMount,\n\t\tdeleteEnter,\n\t\tplaceholderTextColor,\n\t\ttextAlign,\n\t\tselectionColor,\n\t\ttagsToEliminate,\n\t\tdisableEditingMenu,\n\t\tfontSize,\n\t\tfontFamily,\n\t\tfontWeight,\n\t\tfontStyle,\n\t\tminWidth,\n\t\tmaxWidth,\n\t\tdisableSuggestions,\n\t\tdisableAutocorrection,\n\t\t...restProps\n\t} = props;\n\treturn restProps;\n}\n\nexport function RichTextWrapper(\n\t{\n\t\tchildren,\n\t\ttagName = 'div',\n\t\tvalue: adjustedValue = '',\n\t\tonChange: adjustedOnChange,\n\t\tisSelected: originalIsSelected,\n\t\tmultiline,\n\t\tinlineToolbar,\n\t\twrapperClassName,\n\t\tautocompleters,\n\t\tonReplace,\n\t\tplaceholder,\n\t\tallowedFormats,\n\t\twithoutInteractiveFormatting,\n\t\tonRemove,\n\t\tonMerge,\n\t\tonSplit,\n\t\t__unstableOnSplitAtEnd: onSplitAtEnd,\n\t\t__unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd,\n\t\tidentifier,\n\t\tpreserveWhiteSpace,\n\t\t__unstablePastePlainText: pastePlainText,\n\t\t__unstableEmbedURLOnPaste,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tdisableLineBreaks,\n\t\t__unstableAllowPrefixTransformations,\n\t\treadOnly,\n\t\t...props\n\t},\n\tforwardedRef\n) {\n\tprops = removeNativeProps( props );\n\n\tif ( onSplit ) {\n\t\tdeprecated( 'wp.blockEditor.RichText onSplit prop', {\n\t\t\tsince: '6.4',\n\t\t\talternative: 'block.json support key: \"splitting\"',\n\t\t} );\n\t}\n\n\tconst instanceId = useInstanceId( RichTextWrapper );\n\tconst anchorRef = useRef();\n\tconst [ anchorElement, setAnchorElement ] = useState( null );\n\tconst context = useBlockEditContext();\n\tconst { clientId, isSelected: isBlockSelected, name: blockName } = context;\n\tconst blockBindings = context[ blockBindingsKey ];\n\tconst blockContext = useContext( BlockContext );\n\tconst registry = useRegistry();\n\tconst selector = ( select ) => {\n\t\t// Avoid subscribing to the block editor store if the block is not\n\t\t// selected.\n\t\tif ( ! isBlockSelected ) {\n\t\t\treturn { isSelected: false };\n\t\t}\n\n\t\tconst { getSelectionStart, getSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionStart = getSelectionStart();\n\t\tconst selectionEnd = getSelectionEnd();\n\n\t\tlet isSelected;\n\n\t\tif ( originalIsSelected === undefined ) {\n\t\t\tisSelected =\n\t\t\t\tselectionStart.clientId === clientId &&\n\t\t\t\tselectionEnd.clientId === clientId &&\n\t\t\t\t( identifier\n\t\t\t\t\t? selectionStart.attributeKey === identifier\n\t\t\t\t\t: selectionStart[ instanceIdKey ] === instanceId );\n\t\t} else if ( originalIsSelected ) {\n\t\t\tisSelected = selectionStart.clientId === clientId;\n\t\t}\n\n\t\treturn {\n\t\t\tselectionStart: isSelected ? selectionStart.offset : undefined,\n\t\t\tselectionEnd: isSelected ? selectionEnd.offset : undefined,\n\t\t\tisSelected,\n\t\t};\n\t};\n\tconst { selectionStart, selectionEnd, isSelected } = useSelect( selector, [\n\t\tclientId,\n\t\tidentifier,\n\t\tinstanceId,\n\t\toriginalIsSelected,\n\t\tisBlockSelected,\n\t] );\n\n\tconst { disableBoundBlock, bindingsPlaceholder, bindingsLabel } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! blockBindings?.[ identifier ] ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst { __experimentalBlockBindingsSupportedAttributes } =\n\t\t\t\tselect( blockEditorStore ).getSettings();\n\n\t\t\tconst bindableAttributes =\n\t\t\t\t__experimentalBlockBindingsSupportedAttributes?.[ blockName ];\n\n\t\t\tif ( ! bindableAttributes ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst relatedBinding = blockBindings[ identifier ];\n\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\trelatedBinding.source\n\t\t\t);\n\t\t\tconst blockBindingsContext = {};\n\t\t\tif ( blockBindingsSource?.usesContext?.length ) {\n\t\t\t\tfor ( const key of blockBindingsSource.usesContext ) {\n\t\t\t\t\tblockBindingsContext[ key ] = blockContext[ key ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst _disableBoundBlock =\n\t\t\t\t! blockBindingsSource?.canUserEditValue?.( {\n\t\t\t\t\tselect,\n\t\t\t\t\tcontext: blockBindingsContext,\n\t\t\t\t\targs: relatedBinding.args,\n\t\t\t\t} );\n\n\t\t\t// Don't modify placeholders if value is not empty.\n\t\t\tif ( adjustedValue.length > 0 ) {\n\t\t\t\treturn {\n\t\t\t\t\tdisableBoundBlock: _disableBoundBlock,\n\t\t\t\t\t// Null values will make them fall back to the default behavior.\n\t\t\t\t\tbindingsPlaceholder: null,\n\t\t\t\t\tbindingsLabel: null,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { getBlockAttributes } = select( blockEditorStore );\n\t\t\tconst blockAttributes = getBlockAttributes( clientId );\n\t\t\tlet clientSideFieldLabel = null;\n\t\t\tif ( blockBindingsSource?.getFieldsList ) {\n\t\t\t\tconst fieldsItems = blockBindingsSource.getFieldsList( {\n\t\t\t\t\tselect,\n\t\t\t\t\tcontext: blockBindingsContext,\n\t\t\t\t} );\n\t\t\t\tclientSideFieldLabel = fieldsItems?.find( ( item ) =>\n\t\t\t\t\tfastDeepEqual( item.args, relatedBinding?.args )\n\t\t\t\t)?.label;\n\t\t\t}\n\n\t\t\tconst bindingKey =\n\t\t\t\tclientSideFieldLabel ?? blockBindingsSource?.label;\n\n\t\t\tconst _bindingsPlaceholder = _disableBoundBlock\n\t\t\t\t? bindingKey\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: connected field label or source label */\n\t\t\t\t\t\t__( 'Add %s' ),\n\t\t\t\t\t\tbindingKey\n\t\t\t\t );\n\t\t\tconst _bindingsLabel = _disableBoundBlock\n\t\t\t\t? relatedBinding?.args?.key || blockBindingsSource?.label\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: source label or key */\n\t\t\t\t\t\t__( 'Empty %s; start writing to edit its value' ),\n\t\t\t\t\t\trelatedBinding?.args?.key || blockBindingsSource?.label\n\t\t\t\t );\n\n\t\t\treturn {\n\t\t\t\tdisableBoundBlock: _disableBoundBlock,\n\t\t\t\tbindingsPlaceholder:\n\t\t\t\t\tblockAttributes?.placeholder || _bindingsPlaceholder,\n\t\t\t\tbindingsLabel: _bindingsLabel,\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tblockBindings,\n\t\t\tidentifier,\n\t\t\tblockName,\n\t\t\tadjustedValue,\n\t\t\tclientId,\n\t\t\tblockContext,\n\t\t]\n\t);\n\tconst isInsidePatternOverrides = !! blockContext?.[ 'pattern/overrides' ];\n\tconst hasOverrideEnabled =\n\t\tblockBindings?.__default?.source === 'core/pattern-overrides';\n\n\tconst shouldDisableForPattern =\n\t\tisInsidePatternOverrides && ! hasOverrideEnabled;\n\n\tconst shouldDisableEditing =\n\t\treadOnly || disableBoundBlock || shouldDisableForPattern;\n\n\tconst { getSelectionStart, getSelectionEnd, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { selectionChange } = useDispatch( blockEditorStore );\n\tconst adjustedAllowedFormats = getAllowedFormats( {\n\t\tallowedFormats,\n\t\tdisableFormats,\n\t} );\n\tconst hasFormats =\n\t\t! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;\n\n\tconst onSelectionChange = useCallback(\n\t\t( start, end ) => {\n\t\t\tconst selection = {};\n\t\t\tconst unset = start === undefined && end === undefined;\n\n\t\t\tconst baseSelection = {\n\t\t\t\tclientId,\n\t\t\t\t[ identifier ? 'attributeKey' : instanceIdKey ]: identifier\n\t\t\t\t\t? identifier\n\t\t\t\t\t: instanceId,\n\t\t\t};\n\n\t\t\tif ( typeof start === 'number' || unset ) {\n\t\t\t\t// If we are only setting the start (or the end below), which\n\t\t\t\t// means a partial selection, and we're not updating a selection\n\t\t\t\t// with the same client ID, abort. This means the selected block\n\t\t\t\t// is a parent block.\n\t\t\t\tif (\n\t\t\t\t\tend === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionEnd().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.start = {\n\t\t\t\t\t...baseSelection,\n\t\t\t\t\toffset: start,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( typeof end === 'number' || unset ) {\n\t\t\t\tif (\n\t\t\t\t\tstart === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionStart().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.end = {\n\t\t\t\t\t...baseSelection,\n\t\t\t\t\toffset: end,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tselectionChange( selection );\n\t\t},\n\t\t[\n\t\t\tclientId,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetSelectionEnd,\n\t\t\tgetSelectionStart,\n\t\t\tidentifier,\n\t\t\tinstanceId,\n\t\t\tselectionChange,\n\t\t]\n\t);\n\n\tconst {\n\t\tvalue,\n\t\tgetValue,\n\t\tonChange,\n\t\tref: richTextRef,\n\t\tformatTypes,\n\t} = useRichText( {\n\t\tvalue: adjustedValue,\n\t\tonChange: adjustedOnChange,\n\t\tselectionStart,\n\t\tselectionEnd,\n\t\tonSelectionChange,\n\t\tplaceholder: bindingsPlaceholder || placeholder,\n\t\t__unstableIsSelected: isSelected,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tpreserveWhiteSpace,\n\t\t__unstableDependencies: [ tagName ],\n\t\tallowedFormats: adjustedAllowedFormats,\n\t\twithoutInteractiveFormatting,\n\t\t__unstableFormatTypeHandlerContext: useMemo(\n\t\t\t() => ( {\n\t\t\t\trichTextIdentifier: identifier,\n\t\t\t\tblockClientId: clientId,\n\t\t\t} ),\n\t\t\t[ identifier, clientId ]\n\t\t),\n\t} );\n\tconst autocompleteProps = useBlockEditorAutocompleteProps( {\n\t\tonReplace,\n\t\tcompleters: autocompleters,\n\t\trecord: value,\n\t\tonChange,\n\t} );\n\n\tuseMarkPersistent( { html: adjustedValue, value } );\n\n\tconst keyboardShortcuts = useRef( new Set() );\n\tconst inputEvents = useRef( new Set() );\n\n\tfunction onFocus() {\n\t\tanchorRef.current?.focus();\n\t}\n\n\tconst TagName = tagName;\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<keyboardShortcutContext.Provider value={ keyboardShortcuts }>\n\t\t\t\t\t<inputEventContext.Provider value={ inputEvents }>\n\t\t\t\t\t\t<Popover.__unstableSlotNameProvider value=\"__unstable-block-tools-after\">\n\t\t\t\t\t\t\t{ children &&\n\t\t\t\t\t\t\t\tchildren( { value, onChange, onFocus } ) }\n\n\t\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\t\tforwardedRef={ anchorRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover.__unstableSlotNameProvider>\n\t\t\t\t\t</inputEventContext.Provider>\n\t\t\t\t</keyboardShortcutContext.Provider>\n\t\t\t) }\n\t\t\t{ isSelected && hasFormats && (\n\t\t\t\t<FormatToolbarContainer\n\t\t\t\t\tinline={ inlineToolbar }\n\t\t\t\t\teditableContentElement={ anchorElement }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<TagName\n\t\t\t\t// Overridable props.\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline={ ! disableLineBreaks }\n\t\t\t\taria-readonly={ shouldDisableEditing }\n\t\t\t\t{ ...props }\n\t\t\t\t// Unset draggable (coming from block props) for contentEditable\n\t\t\t\t// elements because it will interfere with multi block selection\n\t\t\t\t// when the contentEditable and draggable elements are the same\n\t\t\t\t// element.\n\t\t\t\tdraggable={ undefined }\n\t\t\t\taria-label={\n\t\t\t\t\tbindingsLabel || props[ 'aria-label' ] || placeholder\n\t\t\t\t}\n\t\t\t\t{ ...autocompleteProps }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\t// Rich text ref must be first because its focus listener\n\t\t\t\t\t// must be set up before any other ref calls .focus() on\n\t\t\t\t\t// mount.\n\t\t\t\t\trichTextRef,\n\t\t\t\t\tforwardedRef,\n\t\t\t\t\tautocompleteProps.ref,\n\t\t\t\t\tprops.ref,\n\t\t\t\t\tuseEventListeners( {\n\t\t\t\t\t\tregistry,\n\t\t\t\t\t\tgetValue,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\t__unstableAllowPrefixTransformations,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tselectionChange,\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tdisableFormats,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\ttagName,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\t\t\tpastePlainText,\n\t\t\t\t\t\tonMerge,\n\t\t\t\t\t\tonRemove,\n\t\t\t\t\t\tdisableLineBreaks,\n\t\t\t\t\t\tonSplitAtEnd,\n\t\t\t\t\t\tonSplitAtDoubleLineEnd,\n\t\t\t\t\t\tkeyboardShortcuts,\n\t\t\t\t\t\tinputEvents,\n\t\t\t\t\t} ),\n\t\t\t\t\tanchorRef,\n\t\t\t\t\tsetAnchorElement,\n\t\t\t\t] ) }\n\t\t\t\tcontentEditable={ ! shouldDisableEditing }\n\t\t\t\tsuppressContentEditableWarning\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-rich-text__editable',\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'rich-text'\n\t\t\t\t) }\n\t\t\t\t// Setting tabIndex to 0 is unnecessary, the element is already\n\t\t\t\t// focusable because it's contentEditable. This also fixes a\n\t\t\t\t// Safari bug where it's not possible to Shift+Click multi\n\t\t\t\t// select blocks when Shift Clicking into an element with\n\t\t\t\t// tabIndex because Safari will focus the element. However,\n\t\t\t\t// Safari will correctly ignore nested contentEditable elements.\n\t\t\t\ttabIndex={\n\t\t\t\t\tprops.tabIndex === 0 && ! shouldDisableEditing\n\t\t\t\t\t\t? null\n\t\t\t\t\t\t: props.tabIndex\n\t\t\t\t}\n\t\t\t\tdata-wp-block-attribute-key={ identifier }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\n// This is the private API for the RichText component.\n// It allows access to all props, not just the public ones.\nexport const PrivateRichText = withDeprecations(\n\tforwardRef( RichTextWrapper )\n);\n\nPrivateRichText.Content = Content;\nPrivateRichText.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\n};\n\n// This is the public API for the RichText component.\n// We wrap the PrivateRichText component to hide some props from the public API.\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md\n */\nconst PublicForwardedRichTextContainer = forwardRef( ( props, ref ) => {\n\tconst context = useBlockEditContext();\n\tconst isPreviewMode = context[ isPreviewModeKey ];\n\n\tif ( isPreviewMode ) {\n\t\t// Remove all non-content props.\n\t\tconst {\n\t\t\tchildren,\n\t\t\ttagName: Tag = 'div',\n\t\t\tvalue,\n\t\t\tonChange,\n\t\t\tisSelected,\n\t\t\tmultiline,\n\t\t\tinlineToolbar,\n\t\t\twrapperClassName,\n\t\t\tautocompleters,\n\t\t\tonReplace,\n\t\t\tplaceholder,\n\t\t\tallowedFormats,\n\t\t\twithoutInteractiveFormatting,\n\t\t\tonRemove,\n\t\t\tonMerge,\n\t\t\tonSplit,\n\t\t\t__unstableOnSplitAtEnd,\n\t\t\t__unstableOnSplitAtDoubleLineEnd,\n\t\t\tidentifier,\n\t\t\tpreserveWhiteSpace,\n\t\t\t__unstablePastePlainText,\n\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t__unstableDisableFormats,\n\t\t\tdisableLineBreaks,\n\t\t\t__unstableAllowPrefixTransformations,\n\t\t\treadOnly,\n\t\t\t...contentProps\n\t\t} = removeNativeProps( props );\n\t\treturn (\n\t\t\t<Tag\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...contentProps }\n\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t__html: valueToHTMLString( value, multiline ) || '<br>',\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn <PrivateRichText ref={ ref } { ...props } readOnly={ false } />;\n} );\n\nPublicForwardedRichTextContainer.Content = Content;\nPublicForwardedRichTextContainer.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\n};\n\nexport default PublicForwardedRichTextContainer;\nexport { RichTextShortcut } from './shortcut';\nexport { RichTextToolbarButton } from './toolbar-button';\nexport { __unstableRichTextInputEvent } from './input-event';\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AACjB,OAAO,mBAAmB;AAK1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,aAAa,aAAa,iBAAiB;AACpD,SAAS,cAAc,qBAAqB;AAC5C,SAAS,eAAe,2BAA2B;AACnD,SAAS,eAAe;AACxB,SAAS,8BAA8B;AACvC,OAAO,gBAAgB;AACvB,SAAS,IAAI,eAAe;AAK5B,SAAS,uCAAuC;AAChD,SAAS,2BAA2B;AACpC,SAAS,kBAAkB,wBAAwB;AACnD,OAAO,4BAA4B;AACnC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAClC,OAAO,g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;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACJ,IAAI,kBAAmB,KAAM;AAC7B,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACE,GAAG;AAAA,QACL,yBAA0B;AAAA,UACzB,QAAQ,kBAAmB,OAAO,SAAU,KAAK;AAAA,QAClD;AAAA;AAAA,IACD;AAAA,EAEF;AAEA,SAAO,oBAAC,mBAAgB,KAAc,GAAG,OAAQ,UAAW,OAAQ;AACrE,CAAE;AAEF,iCAAiC,UAAU;AAC3C,iCAAiC,UAAU,CAAE,UAAW;AACvD,SAAO,CAAE,SAAS,MAAM,WAAW;AACpC;AAEA,IAAO,oBAAQ;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport fastDeepEqual from 'fast-deep-equal/es6/index.js';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseState,\n\tuseCallback,\n\tuseMemo,\n\tforwardRef,\n\tcreateContext,\n\tuseContext,\n} from '@wordpress/element';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { useMergeRefs, useInstanceId } from '@wordpress/compose';\nimport { privateApis as richTextPrivateApis } from '@wordpress/rich-text';\nimport { Popover } from '@wordpress/components';\nimport { getBlockBindingsSource } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditorAutocompleteProps } from '../autocomplete';\nimport { useBlockEditContext } from '../block-edit';\nimport { blockBindingsKey, isPreviewModeKey } from '../block-edit/context';\nimport FormatToolbarContainer from './format-toolbar-container';\nimport { store as blockEditorStore } from '../../store';\nimport { useMarkPersistent } from './use-mark-persistent';\nimport { useEventListeners } from './event-listeners';\nimport FormatEdit from './format-edit';\nimport { getAllowedFormats } from './utils';\nimport { Content, valueToHTMLString } from './content';\nimport { withDeprecations } from './with-deprecations';\nimport BlockContext from '../block-context';\nimport { unlock } from '../../lock-unlock';\n\nconst { useRichText } = unlock( richTextPrivateApis );\n\nexport const keyboardShortcutContext = createContext();\nkeyboardShortcutContext.displayName = 'keyboardShortcutContext';\n\nexport const inputEventContext = createContext();\ninputEventContext.displayName = 'inputEventContext';\n\nconst instanceIdKey = Symbol( 'instanceId' );\n\n/**\n * Removes props used for the native version of RichText so that they are not\n * passed to the DOM element and log warnings.\n *\n * @param {Object} props Props to filter.\n *\n * @return {Object} Filtered props.\n */\nfunction removeNativeProps( props ) {\n\tconst {\n\t\t__unstableMobileNoFocusOnMount,\n\t\tdeleteEnter,\n\t\tplaceholderTextColor,\n\t\ttextAlign,\n\t\tselectionColor,\n\t\ttagsToEliminate,\n\t\tdisableEditingMenu,\n\t\tfontSize,\n\t\tfontFamily,\n\t\tfontWeight,\n\t\tfontStyle,\n\t\tminWidth,\n\t\tmaxWidth,\n\t\tdisableSuggestions,\n\t\tdisableAutocorrection,\n\t\t...restProps\n\t} = props;\n\treturn restProps;\n}\n\nexport function RichTextWrapper(\n\t{\n\t\tchildren,\n\t\ttagName = 'div',\n\t\tvalue: adjustedValue = '',\n\t\tonChange: adjustedOnChange,\n\t\tisSelected: originalIsSelected,\n\t\tmultiline,\n\t\tinlineToolbar,\n\t\twrapperClassName,\n\t\tautocompleters,\n\t\tonReplace,\n\t\tplaceholder,\n\t\tallowedFormats,\n\t\twithoutInteractiveFormatting,\n\t\tonRemove,\n\t\tonMerge,\n\t\tonSplit,\n\t\t__unstableOnSplitAtEnd: onSplitAtEnd,\n\t\t__unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd,\n\t\tidentifier,\n\t\tpreserveWhiteSpace,\n\t\t__unstablePastePlainText: pastePlainText,\n\t\t__unstableEmbedURLOnPaste,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tdisableLineBreaks,\n\t\t__unstableAllowPrefixTransformations,\n\t\treadOnly,\n\t\t...props\n\t},\n\tforwardedRef\n) {\n\tprops = removeNativeProps( props );\n\n\tif ( onSplit ) {\n\t\tdeprecated( 'wp.blockEditor.RichText onSplit prop', {\n\t\t\tsince: '6.4',\n\t\t\talternative: 'block.json support key: \"splitting\"',\n\t\t} );\n\t}\n\n\tconst instanceId = useInstanceId( RichTextWrapper );\n\tconst anchorRef = useRef();\n\tconst [ anchorElement, setAnchorElement ] = useState( null );\n\tconst context = useBlockEditContext();\n\tconst { clientId, isSelected: isBlockSelected, name: blockName } = context;\n\tconst blockBindings = context[ blockBindingsKey ];\n\tconst blockContext = useContext( BlockContext );\n\tconst registry = useRegistry();\n\tconst selector = ( select ) => {\n\t\t// Avoid subscribing to the block editor store if the block is not\n\t\t// selected.\n\t\tif ( ! isBlockSelected ) {\n\t\t\treturn { isSelected: false };\n\t\t}\n\n\t\tconst { getSelectionStart, getSelectionEnd } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionStart = getSelectionStart();\n\t\tconst selectionEnd = getSelectionEnd();\n\n\t\tlet isSelected;\n\n\t\tif ( originalIsSelected === undefined ) {\n\t\t\tisSelected =\n\t\t\t\tselectionStart.clientId === clientId &&\n\t\t\t\tselectionEnd.clientId === clientId &&\n\t\t\t\t( identifier\n\t\t\t\t\t? selectionStart.attributeKey === identifier\n\t\t\t\t\t: selectionStart[ instanceIdKey ] === instanceId );\n\t\t} else if ( originalIsSelected ) {\n\t\t\tisSelected = selectionStart.clientId === clientId;\n\t\t}\n\n\t\treturn {\n\t\t\tselectionStart: isSelected ? selectionStart.offset : undefined,\n\t\t\tselectionEnd: isSelected ? selectionEnd.offset : undefined,\n\t\t\tisSelected,\n\t\t};\n\t};\n\tconst { selectionStart, selectionEnd, isSelected } = useSelect( selector, [\n\t\tclientId,\n\t\tidentifier,\n\t\tinstanceId,\n\t\toriginalIsSelected,\n\t\tisBlockSelected,\n\t] );\n\n\tconst { disableBoundBlock, bindingsPlaceholder, bindingsLabel } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! blockBindings?.[ identifier ] ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst { __experimentalBlockBindingsSupportedAttributes } =\n\t\t\t\tselect( blockEditorStore ).getSettings();\n\n\t\t\tconst bindableAttributes =\n\t\t\t\t__experimentalBlockBindingsSupportedAttributes?.[ blockName ];\n\n\t\t\tif ( ! bindableAttributes ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst relatedBinding = blockBindings[ identifier ];\n\t\t\tconst blockBindingsSource = getBlockBindingsSource(\n\t\t\t\trelatedBinding.source\n\t\t\t);\n\t\t\tconst blockBindingsContext = {};\n\t\t\tif ( blockBindingsSource?.usesContext?.length ) {\n\t\t\t\tfor ( const key of blockBindingsSource.usesContext ) {\n\t\t\t\t\tblockBindingsContext[ key ] = blockContext[ key ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst _disableBoundBlock =\n\t\t\t\t! blockBindingsSource?.canUserEditValue?.( {\n\t\t\t\t\tselect,\n\t\t\t\t\tcontext: blockBindingsContext,\n\t\t\t\t\targs: relatedBinding.args,\n\t\t\t\t} );\n\n\t\t\t// Don't modify placeholders if value is not empty.\n\t\t\tif ( adjustedValue.length > 0 ) {\n\t\t\t\treturn {\n\t\t\t\t\tdisableBoundBlock: _disableBoundBlock,\n\t\t\t\t\t// Null values will make them fall back to the default behavior.\n\t\t\t\t\tbindingsPlaceholder: null,\n\t\t\t\t\tbindingsLabel: null,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { getBlockAttributes } = select( blockEditorStore );\n\t\t\tconst blockAttributes = getBlockAttributes( clientId );\n\t\t\tlet clientSideFieldLabel = null;\n\t\t\tif ( blockBindingsSource?.getFieldsList ) {\n\t\t\t\tconst fieldsItems = blockBindingsSource.getFieldsList( {\n\t\t\t\t\tselect,\n\t\t\t\t\tcontext: blockBindingsContext,\n\t\t\t\t} );\n\t\t\t\tclientSideFieldLabel = fieldsItems?.find( ( item ) =>\n\t\t\t\t\tfastDeepEqual( item.args, relatedBinding?.args )\n\t\t\t\t)?.label;\n\t\t\t}\n\n\t\t\tconst bindingKey =\n\t\t\t\tclientSideFieldLabel ?? blockBindingsSource?.label;\n\n\t\t\tconst _bindingsPlaceholder = _disableBoundBlock\n\t\t\t\t? bindingKey\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: connected field label or source label */\n\t\t\t\t\t\t__( 'Add %s' ),\n\t\t\t\t\t\tbindingKey\n\t\t\t\t );\n\t\t\tconst _bindingsLabel = _disableBoundBlock\n\t\t\t\t? relatedBinding?.args?.key || blockBindingsSource?.label\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: source label or key */\n\t\t\t\t\t\t__( 'Empty %s; start writing to edit its value' ),\n\t\t\t\t\t\trelatedBinding?.args?.key || blockBindingsSource?.label\n\t\t\t\t );\n\n\t\t\treturn {\n\t\t\t\tdisableBoundBlock: _disableBoundBlock,\n\t\t\t\tbindingsPlaceholder:\n\t\t\t\t\tblockAttributes?.placeholder || _bindingsPlaceholder,\n\t\t\t\tbindingsLabel: _bindingsLabel,\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tblockBindings,\n\t\t\tidentifier,\n\t\t\tblockName,\n\t\t\tadjustedValue,\n\t\t\tclientId,\n\t\t\tblockContext,\n\t\t]\n\t);\n\tconst isInsidePatternOverrides = !! blockContext?.[ 'pattern/overrides' ];\n\tconst hasOverrideEnabled =\n\t\tblockBindings?.__default?.source === 'core/pattern-overrides';\n\n\tconst shouldDisableForPattern =\n\t\tisInsidePatternOverrides && ! hasOverrideEnabled;\n\n\tconst shouldDisableEditing =\n\t\treadOnly || disableBoundBlock || shouldDisableForPattern;\n\n\tconst { getSelectionStart, getSelectionEnd, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { selectionChange } = useDispatch( blockEditorStore );\n\tconst adjustedAllowedFormats = getAllowedFormats( {\n\t\tallowedFormats,\n\t\tdisableFormats,\n\t} );\n\tconst hasFormats =\n\t\t! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;\n\n\tconst onSelectionChange = useCallback(\n\t\t( start, end ) => {\n\t\t\tconst selection = {};\n\t\t\tconst unset = start === undefined && end === undefined;\n\n\t\t\tconst baseSelection = {\n\t\t\t\tclientId,\n\t\t\t\t[ identifier ? 'attributeKey' : instanceIdKey ]: identifier\n\t\t\t\t\t? identifier\n\t\t\t\t\t: instanceId,\n\t\t\t};\n\n\t\t\tif ( typeof start === 'number' || unset ) {\n\t\t\t\t// If we are only setting the start (or the end below), which\n\t\t\t\t// means a partial selection, and we're not updating a selection\n\t\t\t\t// with the same client ID, abort. This means the selected block\n\t\t\t\t// is a parent block.\n\t\t\t\tif (\n\t\t\t\t\tend === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionEnd().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.start = {\n\t\t\t\t\t...baseSelection,\n\t\t\t\t\toffset: start,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( typeof end === 'number' || unset ) {\n\t\t\t\tif (\n\t\t\t\t\tstart === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionStart().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.end = {\n\t\t\t\t\t...baseSelection,\n\t\t\t\t\toffset: end,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tselectionChange( selection );\n\t\t},\n\t\t[\n\t\t\tclientId,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetSelectionEnd,\n\t\t\tgetSelectionStart,\n\t\t\tidentifier,\n\t\t\tinstanceId,\n\t\t\tselectionChange,\n\t\t]\n\t);\n\n\tconst {\n\t\tvalue,\n\t\tgetValue,\n\t\tonChange,\n\t\tref: richTextRef,\n\t\tformatTypes,\n\t} = useRichText( {\n\t\tvalue: adjustedValue,\n\t\tonChange: adjustedOnChange,\n\t\tselectionStart,\n\t\tselectionEnd,\n\t\tonSelectionChange,\n\t\tplaceholder: bindingsPlaceholder || placeholder,\n\t\t__unstableIsSelected: isSelected,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tpreserveWhiteSpace,\n\t\t__unstableDependencies: [ tagName ],\n\t\tallowedFormats: adjustedAllowedFormats,\n\t\twithoutInteractiveFormatting,\n\t\t__unstableFormatTypeHandlerContext: useMemo(\n\t\t\t() => ( {\n\t\t\t\trichTextIdentifier: identifier,\n\t\t\t\tblockClientId: clientId,\n\t\t\t} ),\n\t\t\t[ identifier, clientId ]\n\t\t),\n\t} );\n\tconst autocompleteProps = useBlockEditorAutocompleteProps( {\n\t\tonReplace,\n\t\tcompleters: autocompleters,\n\t\trecord: value,\n\t\tonChange,\n\t} );\n\n\tuseMarkPersistent( { html: adjustedValue, value } );\n\n\tconst keyboardShortcuts = useRef( new Set() );\n\tconst inputEvents = useRef( new Set() );\n\n\tfunction onFocus() {\n\t\tanchorRef.current?.focus();\n\t}\n\n\tconst TagName = tagName;\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<keyboardShortcutContext.Provider value={ keyboardShortcuts }>\n\t\t\t\t\t<inputEventContext.Provider value={ inputEvents }>\n\t\t\t\t\t\t<Popover.__unstableSlotNameProvider value=\"__unstable-block-tools-after\">\n\t\t\t\t\t\t\t{ children &&\n\t\t\t\t\t\t\t\tchildren( { value, onChange, onFocus } ) }\n\n\t\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\t\tforwardedRef={ anchorRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover.__unstableSlotNameProvider>\n\t\t\t\t\t</inputEventContext.Provider>\n\t\t\t\t</keyboardShortcutContext.Provider>\n\t\t\t) }\n\t\t\t{ isSelected && hasFormats && (\n\t\t\t\t<FormatToolbarContainer\n\t\t\t\t\tinline={ inlineToolbar }\n\t\t\t\t\teditableContentElement={ anchorElement }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<TagName\n\t\t\t\t// Overridable props.\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline={ ! disableLineBreaks }\n\t\t\t\taria-readonly={ shouldDisableEditing }\n\t\t\t\t{ ...props }\n\t\t\t\t// Unset draggable (coming from block props) for contentEditable\n\t\t\t\t// elements because it will interfere with multi block selection\n\t\t\t\t// when the contentEditable and draggable elements are the same\n\t\t\t\t// element.\n\t\t\t\tdraggable={ undefined }\n\t\t\t\taria-label={\n\t\t\t\t\tbindingsLabel || props[ 'aria-label' ] || placeholder\n\t\t\t\t}\n\t\t\t\t{ ...autocompleteProps }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\t// Rich text ref must be first because its focus listener\n\t\t\t\t\t// must be set up before any other ref calls .focus() on\n\t\t\t\t\t// mount.\n\t\t\t\t\trichTextRef,\n\t\t\t\t\tforwardedRef,\n\t\t\t\t\tautocompleteProps.ref,\n\t\t\t\t\tprops.ref,\n\t\t\t\t\tuseEventListeners( {\n\t\t\t\t\t\tregistry,\n\t\t\t\t\t\tgetValue,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\t__unstableAllowPrefixTransformations,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tselectionChange,\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tdisableFormats,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\ttagName,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\t\t\tpastePlainText,\n\t\t\t\t\t\tonMerge,\n\t\t\t\t\t\tonRemove,\n\t\t\t\t\t\tdisableLineBreaks,\n\t\t\t\t\t\tonSplitAtEnd,\n\t\t\t\t\t\tonSplitAtDoubleLineEnd,\n\t\t\t\t\t\tkeyboardShortcuts,\n\t\t\t\t\t\tinputEvents,\n\t\t\t\t\t} ),\n\t\t\t\t\tanchorRef,\n\t\t\t\t\tsetAnchorElement,\n\t\t\t\t] ) }\n\t\t\t\tcontentEditable={ ! shouldDisableEditing }\n\t\t\t\tsuppressContentEditableWarning\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-rich-text__editable',\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'rich-text'\n\t\t\t\t) }\n\t\t\t\t// Setting tabIndex to 0 is unnecessary, the element is already\n\t\t\t\t// focusable because it's contentEditable. This also fixes a\n\t\t\t\t// Safari bug where it's not possible to Shift+Click multi\n\t\t\t\t// select blocks when Shift Clicking into an element with\n\t\t\t\t// tabIndex because Safari will focus the element. However,\n\t\t\t\t// Safari will correctly ignore nested contentEditable elements.\n\t\t\t\ttabIndex={\n\t\t\t\t\tprops.tabIndex === 0 && ! shouldDisableEditing\n\t\t\t\t\t\t? null\n\t\t\t\t\t\t: props.tabIndex\n\t\t\t\t}\n\t\t\t\tdata-wp-block-attribute-key={ identifier }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\n// This is the private API for the RichText component.\n// It allows access to all props, not just the public ones.\nexport const PrivateRichText = withDeprecations(\n\tforwardRef( RichTextWrapper )\n);\n\nPrivateRichText.Content = Content;\nPrivateRichText.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\n};\n\n// This is the public API for the RichText component.\n// We wrap the PrivateRichText component to hide some props from the public API.\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md\n */\nconst PublicForwardedRichTextContainer = forwardRef( ( props, ref ) => {\n\tconst context = useBlockEditContext();\n\tconst isPreviewMode = context[ isPreviewModeKey ];\n\n\tif ( isPreviewMode ) {\n\t\t// Remove all non-content props.\n\t\tconst {\n\t\t\tchildren,\n\t\t\ttagName: Tag = 'div',\n\t\t\tvalue,\n\t\t\tonChange,\n\t\t\tisSelected,\n\t\t\tmultiline,\n\t\t\tinlineToolbar,\n\t\t\twrapperClassName,\n\t\t\tautocompleters,\n\t\t\tonReplace,\n\t\t\tplaceholder,\n\t\t\tallowedFormats,\n\t\t\twithoutInteractiveFormatting,\n\t\t\tonRemove,\n\t\t\tonMerge,\n\t\t\tonSplit,\n\t\t\t__unstableOnSplitAtEnd,\n\t\t\t__unstableOnSplitAtDoubleLineEnd,\n\t\t\tidentifier,\n\t\t\tpreserveWhiteSpace,\n\t\t\t__unstablePastePlainText,\n\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t__unstableDisableFormats,\n\t\t\tdisableLineBreaks,\n\t\t\t__unstableAllowPrefixTransformations,\n\t\t\treadOnly,\n\t\t\t...contentProps\n\t\t} = removeNativeProps( props );\n\t\treturn (\n\t\t\t<Tag\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...contentProps }\n\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t__html: valueToHTMLString( value, multiline ) || '<br>',\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn <PrivateRichText ref={ ref } { ...props } readOnly={ false } />;\n} );\n\nPublicForwardedRichTextContainer.Content = Content;\nPublicForwardedRichTextContainer.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\n};\n\nexport default PublicForwardedRichTextContainer;\nexport { RichTextShortcut } from './shortcut';\nexport { RichTextToolbarButton } from './toolbar-button';\nexport { RichTextInputEvent as __unstableRichTextInputEvent } from './input-event';\n"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AACjB,OAAO,mBAAmB;AAK1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,aAAa,aAAa,iBAAiB;AACpD,SAAS,cAAc,qBAAqB;AAC5C,SAAS,eA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M,UAAU,oBAAoB;AACpC,QAAM,gBAAgB,QAAS,gBAAiB;AAEhD,MAAK,eAAgB;AAEpB,UAAM;AAAA,MACL;AAAA,MACA,SAAS,MAAM;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACJ,IAAI,kBAAmB,KAAM;AAC7B,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACE,GAAG;AAAA,QACL,yBAA0B;AAAA,UACzB,QAAQ,kBAAmB,OAAO,SAAU,KAAK;AAAA,QAClD;AAAA;AAAA,IACD;AAAA,EAEF;AAEA,SAAO,oBAAC,mBAAgB,KAAc,GAAG,OAAQ,UAAW,OAAQ;AACrE,CAAE;AAEF,iCAAiC,UAAU;AAC3C,iCAAiC,UAAU,CAAE,UAAW;AACvD,SAAO,CAAE,SAAS,MAAM,WAAW;AACpC;AAEA,IAAO,oBAAQ;",
6
6
  "names": ["getSelectionStart", "getSelectionEnd", "selectionStart", "selectionEnd", "isSelected"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  // packages/block-editor/src/components/rich-text/input-event.js
2
2
  import { useEffect, useContext, useRef } from "@wordpress/element";
3
3
  import { inputEventContext } from "./index.mjs";
4
- function __unstableRichTextInputEvent({ inputType, onInput }) {
4
+ function RichTextInputEvent({ inputType, onInput }) {
5
5
  const callbacks = useContext(inputEventContext);
6
6
  const onInputRef = useRef();
7
7
  onInputRef.current = onInput;
@@ -20,6 +20,6 @@ function __unstableRichTextInputEvent({ inputType, onInput }) {
20
20
  return null;
21
21
  }
22
22
  export {
23
- __unstableRichTextInputEvent
23
+ RichTextInputEvent
24
24
  };
25
25
  //# sourceMappingURL=input-event.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/rich-text/input-event.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useContext, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { inputEventContext } from './';\n\nexport function __unstableRichTextInputEvent( { inputType, onInput } ) {\n\tconst callbacks = useContext( inputEventContext );\n\tconst onInputRef = useRef();\n\tonInputRef.current = onInput;\n\n\tuseEffect( () => {\n\t\tfunction callback( event ) {\n\t\t\tif ( event.inputType === inputType ) {\n\t\t\t\tonInputRef.current();\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tcallbacks.current.add( callback );\n\t\treturn () => {\n\t\t\tcallbacks.current.delete( callback );\n\t\t};\n\t}, [ inputType ] );\n\n\treturn null;\n}\n"],
5
- "mappings": ";AAGA,SAAS,WAAW,YAAY,cAAc;AAK9C,SAAS,yBAAyB;AAE3B,SAAS,6BAA8B,EAAE,WAAW,QAAQ,GAAI;AACtE,QAAM,YAAY,WAAY,iBAAkB;AAChD,QAAM,aAAa,OAAO;AAC1B,aAAW,UAAU;AAErB,YAAW,MAAM;AAChB,aAAS,SAAU,OAAQ;AAC1B,UAAK,MAAM,cAAc,WAAY;AACpC,mBAAW,QAAQ;AACnB,cAAM,eAAe;AAAA,MACtB;AAAA,IACD;AAEA,cAAU,QAAQ,IAAK,QAAS;AAChC,WAAO,MAAM;AACZ,gBAAU,QAAQ,OAAQ,QAAS;AAAA,IACpC;AAAA,EACD,GAAG,CAAE,SAAU,CAAE;AAEjB,SAAO;AACR;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useContext, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { inputEventContext } from './';\n\nexport function RichTextInputEvent( { inputType, onInput } ) {\n\tconst callbacks = useContext( inputEventContext );\n\tconst onInputRef = useRef();\n\tonInputRef.current = onInput;\n\n\tuseEffect( () => {\n\t\tfunction callback( event ) {\n\t\t\tif ( event.inputType === inputType ) {\n\t\t\t\tonInputRef.current();\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tcallbacks.current.add( callback );\n\t\treturn () => {\n\t\t\tcallbacks.current.delete( callback );\n\t\t};\n\t}, [ inputType ] );\n\n\treturn null;\n}\n"],
5
+ "mappings": ";AAGA,SAAS,WAAW,YAAY,cAAc;AAK9C,SAAS,yBAAyB;AAE3B,SAAS,mBAAoB,EAAE,WAAW,QAAQ,GAAI;AAC5D,QAAM,YAAY,WAAY,iBAAkB;AAChD,QAAM,aAAa,OAAO;AAC1B,aAAW,UAAU;AAErB,YAAW,MAAM;AAChB,aAAS,SAAU,OAAQ;AAC1B,UAAK,MAAM,cAAc,WAAY;AACpC,mBAAW,QAAQ;AACnB,cAAM,eAAe;AAAA,MACtB;AAAA,IACD;AAEA,cAAU,QAAQ,IAAK,QAAS;AAChC,WAAO,MAAM;AACZ,gBAAU,QAAQ,OAAQ,QAAS;AAAA,IACpC;AAAA,EACD,GAAG,CAAE,SAAU,CAAE;AAEjB,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -10,7 +10,7 @@ import {
10
10
  sidesVertical
11
11
  } from "@wordpress/icons";
12
12
  var RANGE_CONTROL_MAX_SIZE = 8;
13
- var ALL_SIDES = ["top", "right", "bottom", "left"];
13
+ var ALL_SIDES = ["top", "bottom", "left", "right"];
14
14
  var DEFAULT_VALUES = {
15
15
  top: void 0,
16
16
  right: void 0,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/spacing-sizes-control/utils.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tsidesAll,\n\tsidesBottom,\n\tsidesHorizontal,\n\tsidesLeft,\n\tsidesRight,\n\tsidesTop,\n\tsidesVertical,\n} from '@wordpress/icons';\n\nexport const RANGE_CONTROL_MAX_SIZE = 8;\n\nexport const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ];\n\nexport const DEFAULT_VALUES = {\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nexport const ICONS = {\n\tcustom: sidesAll,\n\taxial: sidesAll,\n\thorizontal: sidesHorizontal,\n\tvertical: sidesVertical,\n\ttop: sidesTop,\n\tright: sidesRight,\n\tbottom: sidesBottom,\n\tleft: sidesLeft,\n};\n\nexport const LABELS = {\n\tdefault: __( 'Spacing control' ),\n\ttop: __( 'Top' ),\n\tbottom: __( 'Bottom' ),\n\tleft: __( 'Left' ),\n\tright: __( 'Right' ),\n\tmixed: __( 'Mixed' ),\n\tvertical: __( 'Vertical' ),\n\thorizontal: __( 'Horizontal' ),\n\taxial: __( 'Horizontal & vertical' ),\n\tcustom: __( 'Custom' ),\n};\n\nexport const VIEWS = {\n\taxial: 'axial',\n\ttop: 'top',\n\tright: 'right',\n\tbottom: 'bottom',\n\tleft: 'left',\n\tcustom: 'custom',\n};\n\n/**\n * Checks is given value is a spacing preset.\n *\n * @param {string} value Value to check\n *\n * @return {boolean} Return true if value is string in format var:preset|spacing|.\n */\nexport function isValueSpacingPreset( value ) {\n\tif ( ! value?.includes ) {\n\t\treturn false;\n\t}\n\treturn value === '0' || value.includes( 'var:preset|spacing|' );\n}\n\n/**\n * Converts a spacing preset into a custom value.\n *\n * @param {string} value Value to convert\n * @param {Array} spacingSizes Array of the current spacing preset objects\n *\n * @return {string} Mapping of the spacing preset to its equivalent custom value.\n */\nexport function getCustomValueFromPreset( value, spacingSizes ) {\n\tif ( ! isValueSpacingPreset( value ) ) {\n\t\treturn value;\n\t}\n\n\tconst slug = getSpacingPresetSlug( value );\n\tconst spacingSize = spacingSizes.find(\n\t\t( size ) => String( size.slug ) === slug\n\t);\n\n\treturn spacingSize?.size;\n}\n\n/**\n * Converts a custom value to preset value if one can be found.\n *\n * Returns value as-is if no match is found.\n *\n * @param {string} value Value to convert\n * @param {Array} spacingSizes Array of the current spacing preset objects\n *\n * @return {string} The preset value if it can be found.\n */\nexport function getPresetValueFromCustomValue( value, spacingSizes ) {\n\t// Return value as-is if it is undefined or is already a preset, or '0';\n\tif ( ! value || isValueSpacingPreset( value ) || value === '0' ) {\n\t\treturn value;\n\t}\n\n\tconst spacingMatch = spacingSizes.find(\n\t\t( size ) => String( size.size ) === String( value )\n\t);\n\n\tif ( spacingMatch?.slug ) {\n\t\treturn `var:preset|spacing|${ spacingMatch.slug }`;\n\t}\n\n\treturn value;\n}\n\n/**\n * Converts a spacing preset into a custom value.\n *\n * @param {string} value Value to convert.\n *\n * @return {string | undefined} CSS var string for given spacing preset value.\n */\nexport function getSpacingPresetCssVar( value ) {\n\tif ( ! value ) {\n\t\treturn;\n\t}\n\n\tconst slug = value.match( /var:preset\\|spacing\\|(.+)/ );\n\n\tif ( ! slug ) {\n\t\treturn value;\n\t}\n\n\treturn `var(--wp--preset--spacing--${ slug[ 1 ] })`;\n}\n\n/**\n * Returns the slug section of the given spacing preset string.\n *\n * @param {string} value Value to extract slug from.\n *\n * @return {string|undefined} The int value of the slug from given spacing preset.\n */\nexport function getSpacingPresetSlug( value ) {\n\tif ( ! value ) {\n\t\treturn;\n\t}\n\n\tif ( value === '0' || value === 'default' ) {\n\t\treturn value;\n\t}\n\n\tconst slug = value.match( /var:preset\\|spacing\\|(.+)/ );\n\n\treturn slug ? slug[ 1 ] : undefined;\n}\n\n/**\n * Converts spacing preset value into a Range component value .\n *\n * @param {string} presetValue Value to convert to Range value.\n * @param {Array} spacingSizes Array of current spacing preset value objects.\n *\n * @return {number} The int value for use in Range control.\n */\nexport function getSliderValueFromPreset( presetValue, spacingSizes ) {\n\tif ( presetValue === undefined ) {\n\t\treturn 0;\n\t}\n\tconst slug =\n\t\tparseFloat( presetValue, 10 ) === 0\n\t\t\t? '0'\n\t\t\t: getSpacingPresetSlug( presetValue );\n\tconst sliderValue = spacingSizes.findIndex( ( spacingSize ) => {\n\t\treturn String( spacingSize.slug ) === slug;\n\t} );\n\n\t// Returning NaN rather than undefined as undefined makes range control thumb sit in center\n\treturn sliderValue !== -1 ? sliderValue : NaN;\n}\n\n/**\n * Determines whether a particular axis has support. If no axis is\n * specified, this function checks if either axis is supported.\n *\n * @param {Array} sides Supported sides.\n * @param {string} axis Which axis to check.\n *\n * @return {boolean} Whether there is support for the specified axis or both axes.\n */\nexport function hasAxisSupport( sides, axis ) {\n\tif ( ! sides || ! sides.length ) {\n\t\treturn false;\n\t}\n\n\tconst hasHorizontalSupport =\n\t\tsides.includes( 'horizontal' ) ||\n\t\t( sides.includes( 'left' ) && sides.includes( 'right' ) );\n\n\tconst hasVerticalSupport =\n\t\tsides.includes( 'vertical' ) ||\n\t\t( sides.includes( 'top' ) && sides.includes( 'bottom' ) );\n\n\tif ( axis === 'horizontal' ) {\n\t\treturn hasHorizontalSupport;\n\t}\n\n\tif ( axis === 'vertical' ) {\n\t\treturn hasVerticalSupport;\n\t}\n\n\treturn hasHorizontalSupport || hasVerticalSupport;\n}\n\n/**\n * Checks if the supported sides are balanced for each axis.\n * - Horizontal - both left and right sides are supported.\n * - Vertical - both top and bottom are supported.\n *\n * @param {Array} sides The supported sides which may be axes as well.\n *\n * @return {boolean} Whether or not the supported sides are balanced.\n */\nexport function hasBalancedSidesSupport( sides = [] ) {\n\tconst counts = { top: 0, right: 0, bottom: 0, left: 0 };\n\tsides.forEach( ( side ) => ( counts[ side ] += 1 ) );\n\n\treturn (\n\t\t( counts.top + counts.bottom ) % 2 === 0 &&\n\t\t( counts.left + counts.right ) % 2 === 0\n\t);\n}\n\n/**\n * Determines which view the SpacingSizesControl should default to on its\n * first render; Axial, Custom, or Single side.\n *\n * @param {Object} values Current side values.\n * @param {Array} sides Supported sides.\n *\n * @return {string} View to display.\n */\nexport function getInitialView( values = {}, sides ) {\n\tconst { top, right, bottom, left } = values;\n\tconst sideValues = [ top, right, bottom, left ].filter( Boolean );\n\n\t// Axial ( Horizontal & vertical ).\n\t// - Has axial side support\n\t// - Has axial side values which match\n\t// - Has no values and the supported sides are balanced\n\tconst hasMatchingAxialValues =\n\t\ttop === bottom && left === right && ( !! top || !! left );\n\tconst hasNoValuesAndBalancedSides =\n\t\t! sideValues.length && hasBalancedSidesSupport( sides );\n\tconst hasOnlyAxialSides =\n\t\tsides?.includes( 'horizontal' ) &&\n\t\tsides?.includes( 'vertical' ) &&\n\t\tsides?.length === 2;\n\n\tif (\n\t\thasAxisSupport( sides ) &&\n\t\t( hasMatchingAxialValues || hasNoValuesAndBalancedSides )\n\t) {\n\t\treturn VIEWS.axial;\n\t}\n\n\t// Only axial sides are supported and single value defined.\n\t// - Ensure the side returned is the first side that has a value.\n\tif ( hasOnlyAxialSides && sideValues.length === 1 ) {\n\t\tlet side;\n\n\t\tObject.entries( values ).some( ( [ key, value ] ) => {\n\t\t\tside = key;\n\t\t\treturn value !== undefined;\n\t\t} );\n\n\t\treturn side;\n\t}\n\n\t// Only single side supported and no value defined.\n\tif ( sides?.length === 1 && ! sideValues.length ) {\n\t\treturn sides[ 0 ];\n\t}\n\n\t// Default to the Custom (separated sides) view.\n\treturn VIEWS.custom;\n}\n"],
5
- "mappings": ";AAGA,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEA,IAAM,yBAAyB;AAE/B,IAAM,YAAY,CAAE,OAAO,SAAS,UAAU,MAAO;AAErD,IAAM,iBAAiB;AAAA,EAC7B,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACP;AAEO,IAAM,QAAQ;AAAA,EACpB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACP;AAEO,IAAM,SAAS;AAAA,EACrB,SAAS,G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CAAC,GAAG,OAAQ;AACpD,QAAM,EAAE,KAAK,OAAO,QAAQ,KAAK,IAAI;AACrC,QAAM,aAAa,CAAE,KAAK,OAAO,QAAQ,IAAK,EAAE,OAAQ,OAAQ;AAMhE,QAAM,yBACL,QAAQ,UAAU,SAAS,UAAW,CAAC,CAAE,OAAO,CAAC,CAAE;AACpD,QAAM,8BACL,CAAE,WAAW,UAAU,wBAAyB,KAAM;AACvD,QAAM,oBACL,OAAO,SAAU,YAAa,KAC9B,OAAO,SAAU,UAAW,KAC5B,OAAO,WAAW;AAEnB,MACC,eAAgB,KAAM,MACpB,0BAA0B,8BAC3B;AACD,WAAO,MAAM;AAAA,EACd;AAIA,MAAK,qBAAqB,WAAW,WAAW,GAAI;AACnD,QAAI;AAEJ,WAAO,QAAS,MAAO,EAAE,KAAM,CAAE,CAAE,KAAK,KAAM,MAAO;AACpD,aAAO;AACP,aAAO,UAAU;AAAA,IAClB,CAAE;AAEF,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,WAAW,KAAK,CAAE,WAAW,QAAS;AACjD,WAAO,MAAO,CAAE;AAAA,EACjB;AAGA,SAAO,MAAM;AACd;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tsidesAll,\n\tsidesBottom,\n\tsidesHorizontal,\n\tsidesLeft,\n\tsidesRight,\n\tsidesTop,\n\tsidesVertical,\n} from '@wordpress/icons';\n\nexport const RANGE_CONTROL_MAX_SIZE = 8;\n\nexport const ALL_SIDES = [ 'top', 'bottom', 'left', 'right' ];\n\nexport const DEFAULT_VALUES = {\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\nexport const ICONS = {\n\tcustom: sidesAll,\n\taxial: sidesAll,\n\thorizontal: sidesHorizontal,\n\tvertical: sidesVertical,\n\ttop: sidesTop,\n\tright: sidesRight,\n\tbottom: sidesBottom,\n\tleft: sidesLeft,\n};\n\nexport const LABELS = {\n\tdefault: __( 'Spacing control' ),\n\ttop: __( 'Top' ),\n\tbottom: __( 'Bottom' ),\n\tleft: __( 'Left' ),\n\tright: __( 'Right' ),\n\tmixed: __( 'Mixed' ),\n\tvertical: __( 'Vertical' ),\n\thorizontal: __( 'Horizontal' ),\n\taxial: __( 'Horizontal & vertical' ),\n\tcustom: __( 'Custom' ),\n};\n\nexport const VIEWS = {\n\taxial: 'axial',\n\ttop: 'top',\n\tright: 'right',\n\tbottom: 'bottom',\n\tleft: 'left',\n\tcustom: 'custom',\n};\n\n/**\n * Checks is given value is a spacing preset.\n *\n * @param {string} value Value to check\n *\n * @return {boolean} Return true if value is string in format var:preset|spacing|.\n */\nexport function isValueSpacingPreset( value ) {\n\tif ( ! value?.includes ) {\n\t\treturn false;\n\t}\n\treturn value === '0' || value.includes( 'var:preset|spacing|' );\n}\n\n/**\n * Converts a spacing preset into a custom value.\n *\n * @param {string} value Value to convert\n * @param {Array} spacingSizes Array of the current spacing preset objects\n *\n * @return {string} Mapping of the spacing preset to its equivalent custom value.\n */\nexport function getCustomValueFromPreset( value, spacingSizes ) {\n\tif ( ! isValueSpacingPreset( value ) ) {\n\t\treturn value;\n\t}\n\n\tconst slug = getSpacingPresetSlug( value );\n\tconst spacingSize = spacingSizes.find(\n\t\t( size ) => String( size.slug ) === slug\n\t);\n\n\treturn spacingSize?.size;\n}\n\n/**\n * Converts a custom value to preset value if one can be found.\n *\n * Returns value as-is if no match is found.\n *\n * @param {string} value Value to convert\n * @param {Array} spacingSizes Array of the current spacing preset objects\n *\n * @return {string} The preset value if it can be found.\n */\nexport function getPresetValueFromCustomValue( value, spacingSizes ) {\n\t// Return value as-is if it is undefined or is already a preset, or '0';\n\tif ( ! value || isValueSpacingPreset( value ) || value === '0' ) {\n\t\treturn value;\n\t}\n\n\tconst spacingMatch = spacingSizes.find(\n\t\t( size ) => String( size.size ) === String( value )\n\t);\n\n\tif ( spacingMatch?.slug ) {\n\t\treturn `var:preset|spacing|${ spacingMatch.slug }`;\n\t}\n\n\treturn value;\n}\n\n/**\n * Converts a spacing preset into a custom value.\n *\n * @param {string} value Value to convert.\n *\n * @return {string | undefined} CSS var string for given spacing preset value.\n */\nexport function getSpacingPresetCssVar( value ) {\n\tif ( ! value ) {\n\t\treturn;\n\t}\n\n\tconst slug = value.match( /var:preset\\|spacing\\|(.+)/ );\n\n\tif ( ! slug ) {\n\t\treturn value;\n\t}\n\n\treturn `var(--wp--preset--spacing--${ slug[ 1 ] })`;\n}\n\n/**\n * Returns the slug section of the given spacing preset string.\n *\n * @param {string} value Value to extract slug from.\n *\n * @return {string|undefined} The int value of the slug from given spacing preset.\n */\nexport function getSpacingPresetSlug( value ) {\n\tif ( ! value ) {\n\t\treturn;\n\t}\n\n\tif ( value === '0' || value === 'default' ) {\n\t\treturn value;\n\t}\n\n\tconst slug = value.match( /var:preset\\|spacing\\|(.+)/ );\n\n\treturn slug ? slug[ 1 ] : undefined;\n}\n\n/**\n * Converts spacing preset value into a Range component value .\n *\n * @param {string} presetValue Value to convert to Range value.\n * @param {Array} spacingSizes Array of current spacing preset value objects.\n *\n * @return {number} The int value for use in Range control.\n */\nexport function getSliderValueFromPreset( presetValue, spacingSizes ) {\n\tif ( presetValue === undefined ) {\n\t\treturn 0;\n\t}\n\tconst slug =\n\t\tparseFloat( presetValue, 10 ) === 0\n\t\t\t? '0'\n\t\t\t: getSpacingPresetSlug( presetValue );\n\tconst sliderValue = spacingSizes.findIndex( ( spacingSize ) => {\n\t\treturn String( spacingSize.slug ) === slug;\n\t} );\n\n\t// Returning NaN rather than undefined as undefined makes range control thumb sit in center\n\treturn sliderValue !== -1 ? sliderValue : NaN;\n}\n\n/**\n * Determines whether a particular axis has support. If no axis is\n * specified, this function checks if either axis is supported.\n *\n * @param {Array} sides Supported sides.\n * @param {string} axis Which axis to check.\n *\n * @return {boolean} Whether there is support for the specified axis or both axes.\n */\nexport function hasAxisSupport( sides, axis ) {\n\tif ( ! sides || ! sides.length ) {\n\t\treturn false;\n\t}\n\n\tconst hasHorizontalSupport =\n\t\tsides.includes( 'horizontal' ) ||\n\t\t( sides.includes( 'left' ) && sides.includes( 'right' ) );\n\n\tconst hasVerticalSupport =\n\t\tsides.includes( 'vertical' ) ||\n\t\t( sides.includes( 'top' ) && sides.includes( 'bottom' ) );\n\n\tif ( axis === 'horizontal' ) {\n\t\treturn hasHorizontalSupport;\n\t}\n\n\tif ( axis === 'vertical' ) {\n\t\treturn hasVerticalSupport;\n\t}\n\n\treturn hasHorizontalSupport || hasVerticalSupport;\n}\n\n/**\n * Checks if the supported sides are balanced for each axis.\n * - Horizontal - both left and right sides are supported.\n * - Vertical - both top and bottom are supported.\n *\n * @param {Array} sides The supported sides which may be axes as well.\n *\n * @return {boolean} Whether or not the supported sides are balanced.\n */\nexport function hasBalancedSidesSupport( sides = [] ) {\n\tconst counts = { top: 0, right: 0, bottom: 0, left: 0 };\n\tsides.forEach( ( side ) => ( counts[ side ] += 1 ) );\n\n\treturn (\n\t\t( counts.top + counts.bottom ) % 2 === 0 &&\n\t\t( counts.left + counts.right ) % 2 === 0\n\t);\n}\n\n/**\n * Determines which view the SpacingSizesControl should default to on its\n * first render; Axial, Custom, or Single side.\n *\n * @param {Object} values Current side values.\n * @param {Array} sides Supported sides.\n *\n * @return {string} View to display.\n */\nexport function getInitialView( values = {}, sides ) {\n\tconst { top, right, bottom, left } = values;\n\tconst sideValues = [ top, right, bottom, left ].filter( Boolean );\n\n\t// Axial ( Horizontal & vertical ).\n\t// - Has axial side support\n\t// - Has axial side values which match\n\t// - Has no values and the supported sides are balanced\n\tconst hasMatchingAxialValues =\n\t\ttop === bottom && left === right && ( !! top || !! left );\n\tconst hasNoValuesAndBalancedSides =\n\t\t! sideValues.length && hasBalancedSidesSupport( sides );\n\tconst hasOnlyAxialSides =\n\t\tsides?.includes( 'horizontal' ) &&\n\t\tsides?.includes( 'vertical' ) &&\n\t\tsides?.length === 2;\n\n\tif (\n\t\thasAxisSupport( sides ) &&\n\t\t( hasMatchingAxialValues || hasNoValuesAndBalancedSides )\n\t) {\n\t\treturn VIEWS.axial;\n\t}\n\n\t// Only axial sides are supported and single value defined.\n\t// - Ensure the side returned is the first side that has a value.\n\tif ( hasOnlyAxialSides && sideValues.length === 1 ) {\n\t\tlet side;\n\n\t\tObject.entries( values ).some( ( [ key, value ] ) => {\n\t\t\tside = key;\n\t\t\treturn value !== undefined;\n\t\t} );\n\n\t\treturn side;\n\t}\n\n\t// Only single side supported and no value defined.\n\tif ( sides?.length === 1 && ! sideValues.length ) {\n\t\treturn sides[ 0 ];\n\t}\n\n\t// Default to the Custom (separated sides) view.\n\treturn VIEWS.custom;\n}\n"],
5
+ "mappings": ";AAGA,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEA,IAAM,yBAAyB;AAE/B,IAAM,YAAY,CAAE,OAAO,UAAU,QAAQ,OAAQ;AAErD,IAAM,iBAAiB;AAAA,EAC7B,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACP;AAEO,IAAM,QAAQ;AAAA,EACpB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACP;AAEO,IAAM,SAAS;AAAA,EACrB,SAAS,GAAI,iBAAkB;AAAA,EAC/B,KAAK,GAAI,KAAM;AAAA,EACf,QAAQ,GAAI,QAAS;AAAA,EACrB,MAAM,GAAI,MAAO;AAAA,EACjB,OAAO,GAAI,OAAQ;AAAA,EACnB,OAAO,GAAI,OAAQ;AAAA,EACnB,UAAU,GAAI,UAAW;AAAA,EACzB,YAAY,GAAI,YAAa;AAAA,EAC7B,OAAO,GAAI,uBAAwB;AAAA,EACnC,QAAQ,GAAI,QAAS;AACtB;AAEO,IAAM,QAAQ;AAAA,EACpB,OAAO;AAAA,E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;AAEnB,MACC,eAAgB,KAAM,MACpB,0BAA0B,8BAC3B;AACD,WAAO,MAAM;AAAA,EACd;AAIA,MAAK,qBAAqB,WAAW,WAAW,GAAI;AACnD,QAAI;AAEJ,WAAO,QAAS,MAAO,EAAE,KAAM,CAAE,CAAE,KAAK,KAAM,MAAO;AACpD,aAAO;AACP,aAAO,UAAU;AAAA,IAClB,CAAE;AAEF,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,WAAW,KAAK,CAAE,WAAW,QAAS;AACjD,WAAO,MAAO,CAAE;AAAA,EACjB;AAGA,SAAO,MAAM;AACd;",
6
6
  "names": []
7
7
  }
@@ -27,7 +27,7 @@ function parseDropEvent(event) {
27
27
  result,
28
28
  JSON.parse(event.dataTransfer.getData("wp-blocks"))
29
29
  );
30
- } catch (err) {
30
+ } catch {
31
31
  return result;
32
32
  }
33
33
  return result;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/use-on-block-drop/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport {\n\tcloneBlock,\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tpasteHandler,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {React.SyntheticEvent} SyntheticEvent */\n/** @typedef {import('./types').WPDropOperation} WPDropOperation */\n\n/**\n * Retrieve the data for a block drop event.\n *\n * @param {SyntheticEvent} event The drop event.\n *\n * @return {Object} An object with block drag and drop data.\n */\nexport function parseDropEvent( event ) {\n\tlet result = {\n\t\tsrcRootClientId: null,\n\t\tsrcClientIds: null,\n\t\tsrcIndex: null,\n\t\ttype: null,\n\t\tblocks: null,\n\t};\n\n\tif ( ! event.dataTransfer ) {\n\t\treturn result;\n\t}\n\n\ttry {\n\t\tresult = Object.assign(\n\t\t\tresult,\n\t\t\tJSON.parse( event.dataTransfer.getData( 'wp-blocks' ) )\n\t\t);\n\t} catch ( err ) {\n\t\treturn result;\n\t}\n\n\treturn result;\n}\n\n/**\n * A function that returns an event handler function for block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Function} getBlockIndex A function that gets the index of a block.\n * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks.\n * @param {Function} moveBlocks A function that moves blocks.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n * @param {Function} clearSelectedBlock A function that clears block selection.\n * @param {string} operation The type of operation to perform on drop. Could be `insert` or `replace` or `group`.\n * @param {Function} getBlock A function that returns a block given its client id.\n * @return {Function} The event handler for a block drop event.\n */\nexport function onBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\tgetBlockIndex,\n\tgetClientIdsOfDescendants,\n\tmoveBlocks,\n\tinsertOrReplaceBlocks,\n\tclearSelectedBlock,\n\toperation,\n\tgetBlock\n) {\n\treturn ( event ) => {\n\t\tconst {\n\t\t\tsrcRootClientId: sourceRootClientId,\n\t\t\tsrcClientIds: sourceClientIds,\n\t\t\ttype: dropType,\n\t\t\tblocks,\n\t\t} = parseDropEvent( event );\n\n\t\t// If the user is inserting a block.\n\t\tif ( dropType === 'inserter' ) {\n\t\t\tclearSelectedBlock();\n\t\t\tconst blocksToInsert = blocks.map( ( block ) =>\n\t\t\t\tcloneBlock( block )\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocksToInsert, true, null );\n\t\t}\n\n\t\t// If the user is moving a block.\n\t\tif ( dropType === 'block' ) {\n\t\t\tconst sourceBlockIndex = getBlockIndex( sourceClientIds[ 0 ] );\n\n\t\t\t// If the user is dropping to the same position, return early.\n\t\t\tif (\n\t\t\t\tsourceRootClientId === targetRootClientId &&\n\t\t\t\tsourceBlockIndex === targetBlockIndex\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is attempting to drop a block within its own\n\t\t\t// nested blocks, return early as this would create infinite\n\t\t\t// recursion.\n\t\t\tif (\n\t\t\t\tsourceClientIds.includes( targetRootClientId ) ||\n\t\t\t\tgetClientIdsOfDescendants( sourceClientIds ).some(\n\t\t\t\t\t( id ) => id === targetRootClientId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is dropping a block over another block, replace both blocks\n\t\t\t// with a group block containing them\n\t\t\tif ( operation === 'group' ) {\n\t\t\t\tconst blocksToInsert = sourceClientIds.map( ( clientId ) =>\n\t\t\t\t\tgetBlock( clientId )\n\t\t\t\t);\n\t\t\t\tinsertOrReplaceBlocks(\n\t\t\t\t\tblocksToInsert,\n\t\t\t\t\ttrue,\n\t\t\t\t\tnull,\n\t\t\t\t\tsourceClientIds\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isAtSameLevel = sourceRootClientId === targetRootClientId;\n\t\t\tconst draggedBlockCount = sourceClientIds.length;\n\n\t\t\t// If the block is kept at the same level and moved downwards,\n\t\t\t// subtract to take into account that the blocks being dragged\n\t\t\t// were removed from the block list above the insertion point.\n\t\t\tconst insertIndex =\n\t\t\t\tisAtSameLevel && sourceBlockIndex < targetBlockIndex\n\t\t\t\t\t? targetBlockIndex - draggedBlockCount\n\t\t\t\t\t: targetBlockIndex;\n\n\t\t\tmoveBlocks( sourceClientIds, sourceRootClientId, insertIndex );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related file drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {Function} getSettings A function that gets the block editor settings.\n * @param {Function} updateBlockAttributes A function that updates a block's attributes.\n * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related file drop event.\n */\nexport function onFilesDrop(\n\ttargetRootClientId,\n\tgetSettings,\n\tupdateBlockAttributes,\n\tcanInsertBlockType,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( files ) => {\n\t\tif ( ! getSettings().mediaUpload ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transformation = findTransform(\n\t\t\tgetBlockTransforms( 'from' ),\n\t\t\t( transform ) =>\n\t\t\t\ttransform.type === 'files' &&\n\t\t\t\tcanInsertBlockType( transform.blockName, targetRootClientId ) &&\n\t\t\t\ttransform.isMatch( files )\n\t\t);\n\n\t\tif ( transformation ) {\n\t\t\tconst blocks = transformation.transform(\n\t\t\t\tfiles,\n\t\t\t\tupdateBlockAttributes\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related HTML drop events.\n *\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related HTML drop event.\n */\nexport function onHTMLDrop( insertOrReplaceBlocks ) {\n\treturn ( HTML ) => {\n\t\tconst blocks = pasteHandler( { HTML, mode: 'BLOCKS' } );\n\n\t\tif ( blocks.length ) {\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A React hook for handling block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Object} options The optional options.\n * @param {WPDropOperation} [options.operation] The type of operation to perform on drop. Could be `insert` or `replace` for now.\n *\n * @return {Function} A function to be passed to the onDrop handler.\n */\nexport default function useOnBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\toptions = {}\n) {\n\tconst { operation = 'insert', nearestSide = 'right' } = options;\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tgetSettings,\n\t\tgetBlock,\n\t} = useSelect( blockEditorStore );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst {\n\t\tinsertBlocks,\n\t\tmoveBlocksToPosition,\n\t\tupdateBlockAttributes,\n\t\tclearSelectedBlock,\n\t\treplaceBlocks,\n\t\tremoveBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst insertOrReplaceBlocks = useCallback(\n\t\t(\n\t\t\tblocks,\n\t\t\tupdateSelection = true,\n\t\t\tinitialPosition = 0,\n\t\t\tclientIdsToReplace = []\n\t\t) => {\n\t\t\tif ( ! Array.isArray( blocks ) ) {\n\t\t\t\tblocks = [ blocks ];\n\t\t\t}\n\t\t\tconst clientIds = getBlockOrder( targetRootClientId );\n\t\t\tconst clientId = clientIds[ targetBlockIndex ];\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\treplaceBlocks( clientId, blocks, undefined, initialPosition );\n\t\t\t} else if ( operation === 'group' ) {\n\t\t\t\tconst targetBlock = getBlock( clientId );\n\t\t\t\tif ( nearestSide === 'left' ) {\n\t\t\t\t\tblocks.push( targetBlock );\n\t\t\t\t} else {\n\t\t\t\t\tblocks.unshift( targetBlock );\n\t\t\t\t}\n\n\t\t\t\tconst groupInnerBlocks = blocks.map( ( block ) => {\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tconst areAllImages = blocks.every( ( block ) => {\n\t\t\t\t\treturn block.name === 'core/image';\n\t\t\t\t} );\n\n\t\t\t\tconst galleryBlock = canInsertBlockType(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\ttargetRootClientId\n\t\t\t\t);\n\n\t\t\t\tconst wrappedBlocks = createBlock(\n\t\t\t\t\tareAllImages && galleryBlock\n\t\t\t\t\t\t? 'core/gallery'\n\t\t\t\t\t\t: getGroupingBlockName(),\n\t\t\t\t\t{\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\ttype: 'flex',\n\t\t\t\t\t\t\tflexWrap:\n\t\t\t\t\t\t\t\tareAllImages && galleryBlock ? null : 'nowrap',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tgroupInnerBlocks\n\t\t\t\t);\n\t\t\t\t// Need to make sure both the target block and the block being dragged are replaced\n\t\t\t\t// otherwise the dragged block will be duplicated.\n\t\t\t\treplaceBlocks(\n\t\t\t\t\t[ clientId, ...clientIdsToReplace ],\n\t\t\t\t\twrappedBlocks,\n\t\t\t\t\tundefined,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tinsertBlocks(\n\t\t\t\t\tblocks,\n\t\t\t\t\ttargetBlockIndex,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tupdateSelection,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetBlockOrder,\n\t\t\ttargetRootClientId,\n\t\t\ttargetBlockIndex,\n\t\t\toperation,\n\t\t\treplaceBlocks,\n\t\t\tgetBlock,\n\t\t\tnearestSide,\n\t\t\tcanInsertBlockType,\n\t\t\tgetGroupingBlockName,\n\t\t\tinsertBlocks,\n\t\t]\n\t);\n\n\tconst moveBlocks = useCallback(\n\t\t( sourceClientIds, sourceRootClientId, insertIndex ) => {\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\tconst sourceBlocks = getBlocksByClientId( sourceClientIds );\n\t\t\t\tconst targetBlockClientIds =\n\t\t\t\t\tgetBlockOrder( targetRootClientId );\n\t\t\t\tconst targetBlockClientId =\n\t\t\t\t\ttargetBlockClientIds[ targetBlockIndex ];\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t// Remove the source blocks.\n\t\t\t\t\tremoveBlocks( sourceClientIds, false );\n\t\t\t\t\t// Replace the target block with the source blocks.\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\ttargetBlockClientId,\n\t\t\t\t\t\tsourceBlocks,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t0\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\tsourceClientIds,\n\t\t\t\t\tsourceRootClientId,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tinsertIndex\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\toperation,\n\t\t\tgetBlockOrder,\n\t\t\tgetBlocksByClientId,\n\t\t\tmoveBlocksToPosition,\n\t\t\tregistry,\n\t\t\tremoveBlocks,\n\t\t\treplaceBlocks,\n\t\t\ttargetBlockIndex,\n\t\t\ttargetRootClientId,\n\t\t]\n\t);\n\n\tconst _onDrop = onBlockDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tmoveBlocks,\n\t\tinsertOrReplaceBlocks,\n\t\tclearSelectedBlock,\n\t\toperation,\n\t\tgetBlock\n\t);\n\tconst _onFilesDrop = onFilesDrop(\n\t\ttargetRootClientId,\n\t\tgetSettings,\n\t\tupdateBlockAttributes,\n\t\tcanInsertBlockType,\n\t\tinsertOrReplaceBlocks\n\t);\n\tconst _onHTMLDrop = onHTMLDrop( insertOrReplaceBlocks );\n\n\treturn ( event ) => {\n\t\tconst files = getFilesFromDataTransfer( event.dataTransfer );\n\t\tconst html = event.dataTransfer.getData( 'text/html' );\n\n\t\t/**\n\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t */\n\t\tif ( html ) {\n\t\t\t_onHTMLDrop( html );\n\t\t} else if ( files.length ) {\n\t\t\t_onFilesDrop( files );\n\t\t} else {\n\t\t\t_onDrop( event );\n\t\t}\n\t};\n}\n"],
5
- "mappings": ";AAGA,SAAS,mBAAmB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AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,QAAM,aAAa;AAAA,IAClB,CAAE,iBAAiB,oBAAoB,gBAAiB;AACvD,UAAK,cAAc,WAAY;AAC9B,cAAM,eAAe,oBAAqB,eAAgB;AAC1D,cAAM,uBACL,cAAe,kBAAmB;AACnC,cAAM,sBACL,qBAAsB,gBAAiB;AAExC,iBAAS,MAAO,MAAM;AAErB,uBAAc,iBAAiB,KAAM;AAErC;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACD;AAAA,QACD,CAAE;AAAA,MACH,OAAO;AACN;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,QAAM,UAAU;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,QAAM,eAAe;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,QAAM,cAAc,WAAY,qBAAsB;AAEtD,SAAO,CAAE,UAAW;AACnB,UAAM,QAAQ,yBAA0B,MAAM,YAAa;AAC3D,UAAM,OAAO,MAAM,aAAa,QAAS,WAAY;AAMrD,QAAK,MAAO;AACX,kBAAa,IAAK;AAAA,IACnB,WAAY,MAAM,QAAS;AAC1B,mBAAc,KAAM;AAAA,IACrB,OAAO;AACN,cAAS,KAAM;AAAA,IAChB;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport {\n\tcloneBlock,\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tpasteHandler,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {React.SyntheticEvent} SyntheticEvent */\n/** @typedef {import('./types').WPDropOperation} WPDropOperation */\n\n/**\n * Retrieve the data for a block drop event.\n *\n * @param {SyntheticEvent} event The drop event.\n *\n * @return {Object} An object with block drag and drop data.\n */\nexport function parseDropEvent( event ) {\n\tlet result = {\n\t\tsrcRootClientId: null,\n\t\tsrcClientIds: null,\n\t\tsrcIndex: null,\n\t\ttype: null,\n\t\tblocks: null,\n\t};\n\n\tif ( ! event.dataTransfer ) {\n\t\treturn result;\n\t}\n\n\ttry {\n\t\tresult = Object.assign(\n\t\t\tresult,\n\t\t\tJSON.parse( event.dataTransfer.getData( 'wp-blocks' ) )\n\t\t);\n\t} catch {\n\t\treturn result;\n\t}\n\n\treturn result;\n}\n\n/**\n * A function that returns an event handler function for block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Function} getBlockIndex A function that gets the index of a block.\n * @param {Function} getClientIdsOfDescendants A function that gets the client ids of descendant blocks.\n * @param {Function} moveBlocks A function that moves blocks.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n * @param {Function} clearSelectedBlock A function that clears block selection.\n * @param {string} operation The type of operation to perform on drop. Could be `insert` or `replace` or `group`.\n * @param {Function} getBlock A function that returns a block given its client id.\n * @return {Function} The event handler for a block drop event.\n */\nexport function onBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\tgetBlockIndex,\n\tgetClientIdsOfDescendants,\n\tmoveBlocks,\n\tinsertOrReplaceBlocks,\n\tclearSelectedBlock,\n\toperation,\n\tgetBlock\n) {\n\treturn ( event ) => {\n\t\tconst {\n\t\t\tsrcRootClientId: sourceRootClientId,\n\t\t\tsrcClientIds: sourceClientIds,\n\t\t\ttype: dropType,\n\t\t\tblocks,\n\t\t} = parseDropEvent( event );\n\n\t\t// If the user is inserting a block.\n\t\tif ( dropType === 'inserter' ) {\n\t\t\tclearSelectedBlock();\n\t\t\tconst blocksToInsert = blocks.map( ( block ) =>\n\t\t\t\tcloneBlock( block )\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocksToInsert, true, null );\n\t\t}\n\n\t\t// If the user is moving a block.\n\t\tif ( dropType === 'block' ) {\n\t\t\tconst sourceBlockIndex = getBlockIndex( sourceClientIds[ 0 ] );\n\n\t\t\t// If the user is dropping to the same position, return early.\n\t\t\tif (\n\t\t\t\tsourceRootClientId === targetRootClientId &&\n\t\t\t\tsourceBlockIndex === targetBlockIndex\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is attempting to drop a block within its own\n\t\t\t// nested blocks, return early as this would create infinite\n\t\t\t// recursion.\n\t\t\tif (\n\t\t\t\tsourceClientIds.includes( targetRootClientId ) ||\n\t\t\t\tgetClientIdsOfDescendants( sourceClientIds ).some(\n\t\t\t\t\t( id ) => id === targetRootClientId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If the user is dropping a block over another block, replace both blocks\n\t\t\t// with a group block containing them\n\t\t\tif ( operation === 'group' ) {\n\t\t\t\tconst blocksToInsert = sourceClientIds.map( ( clientId ) =>\n\t\t\t\t\tgetBlock( clientId )\n\t\t\t\t);\n\t\t\t\tinsertOrReplaceBlocks(\n\t\t\t\t\tblocksToInsert,\n\t\t\t\t\ttrue,\n\t\t\t\t\tnull,\n\t\t\t\t\tsourceClientIds\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isAtSameLevel = sourceRootClientId === targetRootClientId;\n\t\t\tconst draggedBlockCount = sourceClientIds.length;\n\n\t\t\t// If the block is kept at the same level and moved downwards,\n\t\t\t// subtract to take into account that the blocks being dragged\n\t\t\t// were removed from the block list above the insertion point.\n\t\t\tconst insertIndex =\n\t\t\t\tisAtSameLevel && sourceBlockIndex < targetBlockIndex\n\t\t\t\t\t? targetBlockIndex - draggedBlockCount\n\t\t\t\t\t: targetBlockIndex;\n\n\t\t\tmoveBlocks( sourceClientIds, sourceRootClientId, insertIndex );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related file drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {Function} getSettings A function that gets the block editor settings.\n * @param {Function} updateBlockAttributes A function that updates a block's attributes.\n * @param {Function} canInsertBlockType A function that returns checks whether a block type can be inserted.\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related file drop event.\n */\nexport function onFilesDrop(\n\ttargetRootClientId,\n\tgetSettings,\n\tupdateBlockAttributes,\n\tcanInsertBlockType,\n\tinsertOrReplaceBlocks\n) {\n\treturn ( files ) => {\n\t\tif ( ! getSettings().mediaUpload ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transformation = findTransform(\n\t\t\tgetBlockTransforms( 'from' ),\n\t\t\t( transform ) =>\n\t\t\t\ttransform.type === 'files' &&\n\t\t\t\tcanInsertBlockType( transform.blockName, targetRootClientId ) &&\n\t\t\t\ttransform.isMatch( files )\n\t\t);\n\n\t\tif ( transformation ) {\n\t\t\tconst blocks = transformation.transform(\n\t\t\t\tfiles,\n\t\t\t\tupdateBlockAttributes\n\t\t\t);\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A function that returns an event handler function for block-related HTML drop events.\n *\n * @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.\n *\n * @return {Function} The event handler for a block-related HTML drop event.\n */\nexport function onHTMLDrop( insertOrReplaceBlocks ) {\n\treturn ( HTML ) => {\n\t\tconst blocks = pasteHandler( { HTML, mode: 'BLOCKS' } );\n\n\t\tif ( blocks.length ) {\n\t\t\tinsertOrReplaceBlocks( blocks );\n\t\t}\n\t};\n}\n\n/**\n * A React hook for handling block drop events.\n *\n * @param {string} targetRootClientId The root client id where the block(s) will be inserted.\n * @param {number} targetBlockIndex The index where the block(s) will be inserted.\n * @param {Object} options The optional options.\n * @param {WPDropOperation} [options.operation] The type of operation to perform on drop. Could be `insert` or `replace` for now.\n *\n * @return {Function} A function to be passed to the onDrop handler.\n */\nexport default function useOnBlockDrop(\n\ttargetRootClientId,\n\ttargetBlockIndex,\n\toptions = {}\n) {\n\tconst { operation = 'insert', nearestSide = 'right' } = options;\n\tconst {\n\t\tcanInsertBlockType,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tgetBlockOrder,\n\t\tgetBlocksByClientId,\n\t\tgetSettings,\n\t\tgetBlock,\n\t} = useSelect( blockEditorStore );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst {\n\t\tinsertBlocks,\n\t\tmoveBlocksToPosition,\n\t\tupdateBlockAttributes,\n\t\tclearSelectedBlock,\n\t\treplaceBlocks,\n\t\tremoveBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst insertOrReplaceBlocks = useCallback(\n\t\t(\n\t\t\tblocks,\n\t\t\tupdateSelection = true,\n\t\t\tinitialPosition = 0,\n\t\t\tclientIdsToReplace = []\n\t\t) => {\n\t\t\tif ( ! Array.isArray( blocks ) ) {\n\t\t\t\tblocks = [ blocks ];\n\t\t\t}\n\t\t\tconst clientIds = getBlockOrder( targetRootClientId );\n\t\t\tconst clientId = clientIds[ targetBlockIndex ];\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\treplaceBlocks( clientId, blocks, undefined, initialPosition );\n\t\t\t} else if ( operation === 'group' ) {\n\t\t\t\tconst targetBlock = getBlock( clientId );\n\t\t\t\tif ( nearestSide === 'left' ) {\n\t\t\t\t\tblocks.push( targetBlock );\n\t\t\t\t} else {\n\t\t\t\t\tblocks.unshift( targetBlock );\n\t\t\t\t}\n\n\t\t\t\tconst groupInnerBlocks = blocks.map( ( block ) => {\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tconst areAllImages = blocks.every( ( block ) => {\n\t\t\t\t\treturn block.name === 'core/image';\n\t\t\t\t} );\n\n\t\t\t\tconst galleryBlock = canInsertBlockType(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\ttargetRootClientId\n\t\t\t\t);\n\n\t\t\t\tconst wrappedBlocks = createBlock(\n\t\t\t\t\tareAllImages && galleryBlock\n\t\t\t\t\t\t? 'core/gallery'\n\t\t\t\t\t\t: getGroupingBlockName(),\n\t\t\t\t\t{\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\ttype: 'flex',\n\t\t\t\t\t\t\tflexWrap:\n\t\t\t\t\t\t\t\tareAllImages && galleryBlock ? null : 'nowrap',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tgroupInnerBlocks\n\t\t\t\t);\n\t\t\t\t// Need to make sure both the target block and the block being dragged are replaced\n\t\t\t\t// otherwise the dragged block will be duplicated.\n\t\t\t\treplaceBlocks(\n\t\t\t\t\t[ clientId, ...clientIdsToReplace ],\n\t\t\t\t\twrappedBlocks,\n\t\t\t\t\tundefined,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tinsertBlocks(\n\t\t\t\t\tblocks,\n\t\t\t\t\ttargetBlockIndex,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tupdateSelection,\n\t\t\t\t\tinitialPosition\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tgetBlockOrder,\n\t\t\ttargetRootClientId,\n\t\t\ttargetBlockIndex,\n\t\t\toperation,\n\t\t\treplaceBlocks,\n\t\t\tgetBlock,\n\t\t\tnearestSide,\n\t\t\tcanInsertBlockType,\n\t\t\tgetGroupingBlockName,\n\t\t\tinsertBlocks,\n\t\t]\n\t);\n\n\tconst moveBlocks = useCallback(\n\t\t( sourceClientIds, sourceRootClientId, insertIndex ) => {\n\t\t\tif ( operation === 'replace' ) {\n\t\t\t\tconst sourceBlocks = getBlocksByClientId( sourceClientIds );\n\t\t\t\tconst targetBlockClientIds =\n\t\t\t\t\tgetBlockOrder( targetRootClientId );\n\t\t\t\tconst targetBlockClientId =\n\t\t\t\t\ttargetBlockClientIds[ targetBlockIndex ];\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t// Remove the source blocks.\n\t\t\t\t\tremoveBlocks( sourceClientIds, false );\n\t\t\t\t\t// Replace the target block with the source blocks.\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\ttargetBlockClientId,\n\t\t\t\t\t\tsourceBlocks,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t0\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\tsourceClientIds,\n\t\t\t\t\tsourceRootClientId,\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\tinsertIndex\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\toperation,\n\t\t\tgetBlockOrder,\n\t\t\tgetBlocksByClientId,\n\t\t\tmoveBlocksToPosition,\n\t\t\tregistry,\n\t\t\tremoveBlocks,\n\t\t\treplaceBlocks,\n\t\t\ttargetBlockIndex,\n\t\t\ttargetRootClientId,\n\t\t]\n\t);\n\n\tconst _onDrop = onBlockDrop(\n\t\ttargetRootClientId,\n\t\ttargetBlockIndex,\n\t\tgetBlockIndex,\n\t\tgetClientIdsOfDescendants,\n\t\tmoveBlocks,\n\t\tinsertOrReplaceBlocks,\n\t\tclearSelectedBlock,\n\t\toperation,\n\t\tgetBlock\n\t);\n\tconst _onFilesDrop = onFilesDrop(\n\t\ttargetRootClientId,\n\t\tgetSettings,\n\t\tupdateBlockAttributes,\n\t\tcanInsertBlockType,\n\t\tinsertOrReplaceBlocks\n\t);\n\tconst _onHTMLDrop = onHTMLDrop( insertOrReplaceBlocks );\n\n\treturn ( event ) => {\n\t\tconst files = getFilesFromDataTransfer( event.dataTransfer );\n\t\tconst html = event.dataTransfer.getData( 'text/html' );\n\n\t\t/**\n\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t */\n\t\tif ( html ) {\n\t\t\t_onHTMLDrop( html );\n\t\t} else if ( files.length ) {\n\t\t\t_onFilesDrop( files );\n\t\t} else {\n\t\t\t_onDrop( event );\n\t\t}\n\t};\n}\n"],
5
+ "mappings": ";AAGA,SAAS,mBAAmB;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,aAAa,WAAW,mBAAmB;AACpD,SAAS,gCAAgC;AAKzC,SAAS,SAAS,wBAAwB;AAYnC,SAAS,eAAgB,OAAQ;AACvC,MAAI,SAAS;AAAA,IACZ,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd,UAAU;AAAA,IACV,MAAM;AAAA,IACN,QAAQ;AAAA,EACT;AAEA,MAAK,CAAE,MAAM,cAAe;AAC3B,WAAO;AAAA,EACR;AAEA,MAAI;AACH,aAAS,OAAO;AAAA,MACf;AAAA,MACA,KAAK,MAAO,MAAM,aAAa,QAAS,WAAY,CAAE;AAAA,IACvD;AAAA,EACD,QAAQ;AACP,WAAO;AAAA,EACR;AAEA,SAAO;AACR;AAgBO,SAAS,YACf,oBACA,kBACA,eACA,2BACA,YACA,uBACA,oBACA,WACA,UACC;AACD,SAAO,CAAE,UAAW;AACnB,UAAM;AAAA,MACL,iBAAiB;AAAA,MACjB,cAAc;AAAA,MACd,MAAM;AAAA,MACN;AAAA,IACD,IAAI,eAAgB,KAAM;AAG1B,QAAK,aAA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Ae;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,QAAM,cAAc,WAAY,qBAAsB;AAEtD,SAAO,CAAE,UAAW;AACnB,UAAM,QAAQ,yBAA0B,MAAM,YAAa;AAC3D,UAAM,OAAO,MAAM,aAAa,QAAS,WAAY;AAMrD,QAAK,MAAO;AACX,kBAAa,IAAK;AAAA,IACnB,WAAY,MAAM,QAAS;AAC1B,mBAAc,KAAM;AAAA,IACrB,OAAO;AACN,cAAS,KAAM;AAAA,IAChB;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -28,7 +28,7 @@ function hasSerializedBlocks(text) {
28
28
  return false;
29
29
  }
30
30
  return true;
31
- } catch (err) {
31
+ } catch {
32
32
  return false;
33
33
  }
34
34
  }
@@ -87,7 +87,7 @@ function usePasteStyles() {
87
87
  return;
88
88
  }
89
89
  html = await window.navigator.clipboard.readText();
90
- } catch (error) {
90
+ } catch {
91
91
  createErrorNotice(
92
92
  __(
93
93
  "Unable to paste styles. Please allow browser clipboard permissions before continuing."