@wordpress/block-editor 12.11.0 → 12.12.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 (215) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-controls/hook.js +4 -1
  3. package/build/components/block-controls/hook.js.map +1 -1
  4. package/build/components/block-list/block-outline.native.js +1 -1
  5. package/build/components/block-list/block-outline.native.js.map +1 -1
  6. package/build/components/block-list/block.js +2 -0
  7. package/build/components/block-list/block.js.map +1 -1
  8. package/build/components/block-preview/index.js +4 -1
  9. package/build/components/block-preview/index.js.map +1 -1
  10. package/build/components/block-styles/index.js +1 -2
  11. package/build/components/block-styles/index.js.map +1 -1
  12. package/build/components/block-switcher/pattern-transformations-menu.js +2 -4
  13. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  14. package/build/components/block-tools/block-contextual-toolbar.js +1 -0
  15. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  16. package/build/components/dimensions-tool/index.js +22 -22
  17. package/build/components/dimensions-tool/index.js.map +1 -1
  18. package/build/components/dimensions-tool/scale-tool.js +1 -1
  19. package/build/components/dimensions-tool/scale-tool.js.map +1 -1
  20. package/build/components/height-control/index.js +90 -2
  21. package/build/components/height-control/index.js.map +1 -1
  22. package/build/components/iframe/index.js +9 -1
  23. package/build/components/iframe/index.js.map +1 -1
  24. package/build/components/image-editor/aspect-ratio-dropdown.js +0 -6
  25. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  26. package/build/components/index.native.js +8 -0
  27. package/build/components/index.native.js.map +1 -1
  28. package/build/components/link-control/link-preview.js +5 -2
  29. package/build/components/link-control/link-preview.js.map +1 -1
  30. package/build/components/link-control/use-internal-value.js +14 -8
  31. package/build/components/link-control/use-internal-value.js.map +1 -1
  32. package/build/components/list-view/index.js +6 -5
  33. package/build/components/list-view/index.js.map +1 -1
  34. package/build/components/media-replace-flow/index.js +2 -4
  35. package/build/components/media-replace-flow/index.js.map +1 -1
  36. package/build/components/provider/use-block-sync.js +2 -2
  37. package/build/components/provider/use-block-sync.js.map +1 -1
  38. package/build/components/rich-text/index.native.js +14 -3
  39. package/build/components/rich-text/index.native.js.map +1 -1
  40. package/build/components/rich-text/use-delete.js +1 -1
  41. package/build/components/rich-text/use-delete.js.map +1 -1
  42. package/build/components/rich-text/use-paste-handler.js +25 -22
  43. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  44. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +88 -0
  45. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  46. package/build/components/tool-selector/index.js +1 -2
  47. package/build/components/tool-selector/index.js.map +1 -1
  48. package/build/components/use-block-commands/index.js +90 -46
  49. package/build/components/use-block-commands/index.js.map +1 -1
  50. package/build/components/use-setting/index.js +4 -2
  51. package/build/components/use-setting/index.js.map +1 -1
  52. package/build/components/writing-flow/use-arrow-nav.js +4 -0
  53. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  54. package/build/hooks/block-rename-ui.js +5 -5
  55. package/build/hooks/block-rename-ui.js.map +1 -1
  56. package/build/hooks/{metadata-name.js → block-renaming.js} +3 -7
  57. package/build/hooks/block-renaming.js.map +1 -0
  58. package/build/hooks/custom-class-name.js +28 -21
  59. package/build/hooks/custom-class-name.js.map +1 -1
  60. package/build/hooks/duotone.js +28 -1
  61. package/build/hooks/duotone.js.map +1 -1
  62. package/build/hooks/index.js +1 -1
  63. package/build/hooks/index.js.map +1 -1
  64. package/build/hooks/layout.js +6 -6
  65. package/build/hooks/layout.js.map +1 -1
  66. package/build/hooks/metadata.js +6 -27
  67. package/build/hooks/metadata.js.map +1 -1
  68. package/build/hooks/utils.js +1 -1
  69. package/build/hooks/utils.js.map +1 -1
  70. package/build/layouts/grid.js +25 -3
  71. package/build/layouts/grid.js.map +1 -1
  72. package/build/layouts/utils.js +1 -1
  73. package/build/layouts/utils.js.map +1 -1
  74. package/build/lock-unlock.js +1 -1
  75. package/build/lock-unlock.js.map +1 -1
  76. package/build/store/actions.js +13 -5
  77. package/build/store/actions.js.map +1 -1
  78. package/build/utils/parse-css-unit-to-px.js +20 -0
  79. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  80. package/build/utils/pasting.js +1 -1
  81. package/build/utils/pasting.js.map +1 -1
  82. package/build-module/components/block-controls/hook.js +4 -1
  83. package/build-module/components/block-controls/hook.js.map +1 -1
  84. package/build-module/components/block-list/block-outline.native.js +1 -1
  85. package/build-module/components/block-list/block-outline.native.js.map +1 -1
  86. package/build-module/components/block-list/block.js +2 -0
  87. package/build-module/components/block-list/block.js.map +1 -1
  88. package/build-module/components/block-preview/index.js +4 -1
  89. package/build-module/components/block-preview/index.js.map +1 -1
  90. package/build-module/components/block-styles/index.js +1 -2
  91. package/build-module/components/block-styles/index.js.map +1 -1
  92. package/build-module/components/block-switcher/pattern-transformations-menu.js +2 -4
  93. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  94. package/build-module/components/block-tools/block-contextual-toolbar.js +1 -0
  95. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  96. package/build-module/components/dimensions-tool/index.js +22 -22
  97. package/build-module/components/dimensions-tool/index.js.map +1 -1
  98. package/build-module/components/dimensions-tool/scale-tool.js +1 -1
  99. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -1
  100. package/build-module/components/height-control/index.js +90 -2
  101. package/build-module/components/height-control/index.js.map +1 -1
  102. package/build-module/components/iframe/index.js +9 -1
  103. package/build-module/components/iframe/index.js.map +1 -1
  104. package/build-module/components/image-editor/aspect-ratio-dropdown.js +0 -6
  105. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  106. package/build-module/components/index.native.js +1 -0
  107. package/build-module/components/index.native.js.map +1 -1
  108. package/build-module/components/link-control/link-preview.js +6 -3
  109. package/build-module/components/link-control/link-preview.js.map +1 -1
  110. package/build-module/components/link-control/use-internal-value.js +14 -9
  111. package/build-module/components/link-control/use-internal-value.js.map +1 -1
  112. package/build-module/components/list-view/index.js +7 -6
  113. package/build-module/components/list-view/index.js.map +1 -1
  114. package/build-module/components/media-replace-flow/index.js +3 -5
  115. package/build-module/components/media-replace-flow/index.js.map +1 -1
  116. package/build-module/components/provider/use-block-sync.js +2 -2
  117. package/build-module/components/provider/use-block-sync.js.map +1 -1
  118. package/build-module/components/rich-text/index.native.js +15 -4
  119. package/build-module/components/rich-text/index.native.js.map +1 -1
  120. package/build-module/components/rich-text/use-delete.js +1 -1
  121. package/build-module/components/rich-text/use-delete.js.map +1 -1
  122. package/build-module/components/rich-text/use-paste-handler.js +25 -22
  123. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  124. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +88 -0
  125. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  126. package/build-module/components/tool-selector/index.js +1 -2
  127. package/build-module/components/tool-selector/index.js.map +1 -1
  128. package/build-module/components/use-block-commands/index.js +90 -46
  129. package/build-module/components/use-block-commands/index.js.map +1 -1
  130. package/build-module/components/use-setting/index.js +4 -2
  131. package/build-module/components/use-setting/index.js.map +1 -1
  132. package/build-module/components/writing-flow/use-arrow-nav.js +4 -0
  133. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  134. package/build-module/hooks/block-rename-ui.js +6 -6
  135. package/build-module/hooks/block-rename-ui.js.map +1 -1
  136. package/build-module/hooks/{metadata-name.js → block-renaming.js} +3 -6
  137. package/build-module/hooks/block-renaming.js.map +1 -0
  138. package/build-module/hooks/custom-class-name.js +28 -21
  139. package/build-module/hooks/custom-class-name.js.map +1 -1
  140. package/build-module/hooks/duotone.js +28 -1
  141. package/build-module/hooks/duotone.js.map +1 -1
  142. package/build-module/hooks/index.js +1 -1
  143. package/build-module/hooks/index.js.map +1 -1
  144. package/build-module/hooks/layout.js +6 -6
  145. package/build-module/hooks/layout.js.map +1 -1
  146. package/build-module/hooks/metadata.js +6 -25
  147. package/build-module/hooks/metadata.js.map +1 -1
  148. package/build-module/hooks/utils.js +1 -1
  149. package/build-module/hooks/utils.js.map +1 -1
  150. package/build-module/layouts/grid.js +25 -3
  151. package/build-module/layouts/grid.js.map +1 -1
  152. package/build-module/layouts/utils.js +1 -1
  153. package/build-module/layouts/utils.js.map +1 -1
  154. package/build-module/lock-unlock.js +1 -1
  155. package/build-module/lock-unlock.js.map +1 -1
  156. package/build-module/store/actions.js +14 -6
  157. package/build-module/store/actions.js.map +1 -1
  158. package/build-module/utils/parse-css-unit-to-px.js +20 -0
  159. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  160. package/build-module/utils/pasting.js +1 -1
  161. package/build-module/utils/pasting.js.map +1 -1
  162. package/build-style/style-rtl.css +11 -6
  163. package/build-style/style.css +11 -6
  164. package/package.json +31 -31
  165. package/src/components/block-controls/hook.js +6 -3
  166. package/src/components/block-list/block-outline.native.js +1 -1
  167. package/src/components/block-list/block.js +2 -0
  168. package/src/components/block-preview/index.js +7 -1
  169. package/src/components/block-styles/index.js +1 -4
  170. package/src/components/block-switcher/pattern-transformations-menu.js +1 -4
  171. package/src/components/block-switcher/style.scss +6 -0
  172. package/src/components/block-tools/block-contextual-toolbar.js +1 -0
  173. package/src/components/block-tools/style.scss +0 -1
  174. package/src/components/color-palette/test/__snapshots__/control.js.snap +3 -1
  175. package/src/components/colors-gradients/style.scss +4 -2
  176. package/src/components/dimensions-tool/index.js +25 -25
  177. package/src/components/dimensions-tool/scale-tool.js +1 -1
  178. package/src/components/height-control/index.js +50 -2
  179. package/src/components/iframe/index.js +8 -1
  180. package/src/components/image-editor/aspect-ratio-dropdown.js +0 -8
  181. package/src/components/index.native.js +1 -0
  182. package/src/components/link-control/README.md +43 -0
  183. package/src/components/link-control/link-preview.js +11 -5
  184. package/src/components/link-control/style.scss +3 -3
  185. package/src/components/link-control/test/index.js +19 -0
  186. package/src/components/link-control/use-internal-value.js +14 -10
  187. package/src/components/list-view/index.js +13 -3
  188. package/src/components/media-replace-flow/index.js +9 -14
  189. package/src/components/provider/test/use-block-sync.js +1 -1
  190. package/src/components/provider/use-block-sync.js +2 -2
  191. package/src/components/rich-text/index.native.js +19 -3
  192. package/src/components/rich-text/use-delete.js +1 -1
  193. package/src/components/rich-text/use-paste-handler.js +27 -24
  194. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +22 -0
  195. package/src/components/tool-selector/index.js +1 -1
  196. package/src/components/use-block-commands/index.js +91 -46
  197. package/src/components/use-setting/index.js +6 -1
  198. package/src/components/writing-flow/use-arrow-nav.js +4 -0
  199. package/src/hooks/block-rename-ui.js +5 -14
  200. package/src/hooks/{metadata-name.js → block-renaming.js} +4 -7
  201. package/src/hooks/custom-class-name.js +36 -31
  202. package/src/hooks/duotone.js +33 -0
  203. package/src/hooks/index.js +1 -1
  204. package/src/hooks/layout.js +6 -6
  205. package/src/hooks/metadata.js +6 -38
  206. package/src/hooks/utils.js +2 -0
  207. package/src/layouts/grid.js +50 -2
  208. package/src/layouts/utils.js +2 -1
  209. package/src/lock-unlock.js +1 -1
  210. package/src/store/actions.js +25 -8
  211. package/src/utils/parse-css-unit-to-px.js +20 -0
  212. package/src/utils/pasting.js +1 -4
  213. package/src/utils/test/pasting.js +12 -19
  214. package/build/hooks/metadata-name.js.map +0 -1
  215. package/build-module/hooks/metadata-name.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_data","_blocks","_compose","_richText","_url","_autocomplete","_blockEdit","_removeBrowserShortcuts","_filePasteHandler","_formatToolbarContainer","_store","_utils","_embedHandlerPicker","_content","_shortcut","_toolbarButton","_inputEvent","classes","RichTextWrapper","children","tagName","start","reversed","value","originalValue","onChange","originalOnChange","isSelected","originalIsSelected","multiline","inlineToolbar","wrapperClassName","autocompleters","onReplace","placeholder","allowedFormats","withoutInteractiveFormatting","onRemove","onMerge","onSplit","__unstableOnSplitAtEnd","onSplitAtEnd","__unstableOnSplitMiddle","onSplitMiddle","identifier","preserveWhiteSpace","__unstablePastePlainText","pastePlainText","__unstableEmbedURLOnPaste","__unstableDisableFormats","disableFormats","disableLineBreaks","unstableOnFocus","__unstableAllowPrefixTransformations","__unstableMultilineRootTag","__unstableMobileNoFocusOnMount","deleteEnter","placeholderTextColor","textAlign","selectionColor","tagsToEliminate","disableEditingMenu","fontSize","fontFamily","fontWeight","fontStyle","minWidth","maxWidth","onBlur","setRef","disableSuggestions","disableAutocorrection","containerWidth","onEnter","onCustomEnter","props","forwardedRef","instanceId","useInstanceId","fallbackRef","useRef","clientId","blockIsSelected","useBlockEditContext","embedHandlerPickerRef","selector","select","getSelectionStart","getSelectionEnd","getSettings","didAutomaticChange","getBlock","isMultiSelecting","hasMultiSelection","blockEditorStore","selectionStart","selectionEnd","__experimentalUndo","undo","undefined","attributeKey","extraProps","Platform","OS","block","shouldBlurOnUnmount","isUnmodifiedDefaultBlock","offset","disabled","useSelect","__unstableMarkLastChangeAsPersistent","enterFormattedText","exitFormattedText","selectionChange","__unstableMarkAutomaticChange","useDispatch","multilineTag","getMultilineTag","adjustedAllowedFormats","getAllowedFormats","hasFormats","length","adjustedValue","adjustedOnChange","Array","isArray","childrenSource","toHTML","newValue","fromDOM","__unstableCreateElement","document","childNodes","onSelectionChange","useCallback","selectionChangeStart","selectionChangeEnd","onDelete","isReverse","isEmpty","splitValue","record","pastedBlocks","blocks","before","after","split","hasPastedBlocks","lastPastedBlockIndex","isAfterOriginal","push","toHTMLString","indexToSelect","initialPosition","shiftKey","canSplit","transforms","getBlockTransforms","filter","type","transformation","findTransform","item","regExp","test","text","transform","content","splitStart","end","splitEnd","canSplitAtEnd","insert","onPaste","html","plainText","isInternal","files","activeFormats","pastedValue","create","multilineWrapperTags","addActiveFormats","pasteHandler","HTML","filePasteHandler","mode","window","console","log","isPastedURL","isURL","trim","presentEmbedHandlerPicker","current","presentPicker","createEmbed","createLink","createLinkInParagraph","valueToInsert","canPasteEmbed","name","inputRule","valueToFormat","startPosition","characterBefore","slice","trimmedTextBefore","prefixTransforms","prefix","mergedRef","useMergeRefs","_react","createElement","__experimentalRichText","ref","__unstableIsSelected","__unstableInputRule","__unstableMultilineTag","__unstableOnEnterFormattedText","__unstableOnExitFormattedText","__unstableOnCreateUndoLevel","__unstableDidAutomaticChange","__unstableUndo","id","style","nestedIsSelected","onFocus","editableProps","editableTagName","TagName","Fragment","default","inline","anchorRef","RemoveBrowserShortcuts","completers","contentRef","listBoxId","activeId","onKeyDown","className","classnames","event","ForwardedRichTextContainer","forwardRef","Content","defaultProps","format","_default","exports"],"sources":["@wordpress/block-editor/src/components/rich-text/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Platform, useRef, useCallback, forwardRef } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tpasteHandler,\n\tchildren as childrenSource,\n\tgetBlockTransforms,\n\tfindTransform,\n\tisUnmodifiedDefaultBlock,\n} from '@wordpress/blocks';\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\nimport {\n\t__experimentalRichText as RichText,\n\t__unstableCreateElement,\n\tisEmpty,\n\tinsert,\n\tcreate,\n\tsplit,\n\ttoHTMLString,\n\tslice,\n} from '@wordpress/rich-text';\nimport { isURL } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport Autocomplete from '../autocomplete';\nimport { useBlockEditContext } from '../block-edit';\nimport { RemoveBrowserShortcuts } from './remove-browser-shortcuts';\nimport { filePasteHandler } from './file-paste-handler';\nimport FormatToolbarContainer from './format-toolbar-container';\nimport { store as blockEditorStore } from '../../store';\nimport {\n\taddActiveFormats,\n\tgetMultilineTag,\n\tgetAllowedFormats,\n\tcreateLinkInParagraph,\n} from './utils';\nimport EmbedHandlerPicker from './embed-handler-picker';\nimport { Content } from './content';\n\nconst classes = 'block-editor-rich-text__editable';\n\nfunction RichTextWrapper(\n\t{\n\t\tchildren,\n\t\ttagName,\n\t\tstart,\n\t\treversed,\n\t\tvalue: originalValue,\n\t\tonChange: originalOnChange,\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__unstableOnSplitMiddle: onSplitMiddle,\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\tunstableOnFocus,\n\t\t__unstableAllowPrefixTransformations,\n\t\t__unstableMultilineRootTag,\n\t\t// Native props.\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\tonBlur,\n\t\tsetRef,\n\t\tdisableSuggestions,\n\t\tdisableAutocorrection,\n\t\tcontainerWidth,\n\t\tonEnter: onCustomEnter,\n\t\t...props\n\t},\n\tforwardedRef\n) {\n\tconst instanceId = useInstanceId( RichTextWrapper );\n\n\tidentifier = identifier || instanceId;\n\n\tconst fallbackRef = useRef();\n\tconst { clientId, isSelected: blockIsSelected } = useBlockEditContext();\n\tconst embedHandlerPickerRef = useRef();\n\tconst selector = ( select ) => {\n\t\tconst {\n\t\t\tgetSelectionStart,\n\t\t\tgetSelectionEnd,\n\t\t\tgetSettings,\n\t\t\tdidAutomaticChange,\n\t\t\tgetBlock,\n\t\t\tisMultiSelecting,\n\t\t\thasMultiSelection,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectionStart = getSelectionStart();\n\t\tconst selectionEnd = getSelectionEnd();\n\t\tconst { __experimentalUndo: undo } = getSettings();\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\tselectionStart.attributeKey === identifier;\n\t\t} else if ( originalIsSelected ) {\n\t\t\tisSelected = selectionStart.clientId === clientId;\n\t\t}\n\n\t\tlet extraProps = {};\n\t\tif ( Platform.OS === 'native' ) {\n\t\t\t// If the block of this RichText is unmodified then it's a candidate for replacing when adding a new block.\n\t\t\t// In order to fix https://github.com/wordpress-mobile/gutenberg-mobile/issues/1126, let's blur on unmount in that case.\n\t\t\t// This apparently assumes functionality the BlockHlder actually.\n\t\t\tconst block = clientId && getBlock( clientId );\n\t\t\tconst shouldBlurOnUnmount =\n\t\t\t\tblock && isSelected && isUnmodifiedDefaultBlock( block );\n\t\t\textraProps = {\n\t\t\t\tshouldBlurOnUnmount,\n\t\t\t};\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\tdidAutomaticChange: didAutomaticChange(),\n\t\t\tdisabled: isMultiSelecting() || hasMultiSelection(),\n\t\t\tundo,\n\t\t\t...extraProps,\n\t\t};\n\t};\n\t// This selector must run on every render so the right selection state is\n\t// retrieved from the store on merge.\n\t// To do: fix this somehow.\n\tconst {\n\t\tselectionStart,\n\t\tselectionEnd,\n\t\tisSelected,\n\t\tdidAutomaticChange,\n\t\tdisabled,\n\t\tundo,\n\t\tshouldBlurOnUnmount,\n\t} = useSelect( selector );\n\tconst {\n\t\t__unstableMarkLastChangeAsPersistent,\n\t\tenterFormattedText,\n\t\texitFormattedText,\n\t\tselectionChange,\n\t\t__unstableMarkAutomaticChange,\n\t} = useDispatch( blockEditorStore );\n\tconst multilineTag = getMultilineTag( multiline );\n\tconst adjustedAllowedFormats = getAllowedFormats( {\n\t\tallowedFormats,\n\t\tdisableFormats,\n\t} );\n\tconst hasFormats =\n\t\t! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;\n\tlet adjustedValue = originalValue;\n\tlet adjustedOnChange = originalOnChange;\n\n\t// Handle deprecated format.\n\tif ( Array.isArray( originalValue ) ) {\n\t\tadjustedValue = childrenSource.toHTML( originalValue );\n\t\tadjustedOnChange = ( newValue ) =>\n\t\t\toriginalOnChange(\n\t\t\t\tchildrenSource.fromDOM(\n\t\t\t\t\t__unstableCreateElement( document, newValue ).childNodes\n\t\t\t\t)\n\t\t\t);\n\t}\n\n\tconst onSelectionChange = useCallback(\n\t\t( selectionChangeStart, selectionChangeEnd ) => {\n\t\t\tselectionChange(\n\t\t\t\tclientId,\n\t\t\t\tidentifier,\n\t\t\t\tselectionChangeStart,\n\t\t\t\tselectionChangeEnd\n\t\t\t);\n\t\t},\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ clientId, identifier ]\n\t);\n\n\tconst onDelete = useCallback(\n\t\t( { value, isReverse } ) => {\n\t\t\tif ( onMerge ) {\n\t\t\t\tonMerge( ! isReverse );\n\t\t\t}\n\n\t\t\t// Only handle remove on Backspace. This serves dual-purpose of being\n\t\t\t// an intentional user interaction distinguishing between Backspace and\n\t\t\t// Delete to remove the empty field, but also to avoid merge & remove\n\t\t\t// causing destruction of two fields (merge, then removed merged).\n\t\t\tif ( onRemove && isEmpty( value ) && isReverse ) {\n\t\t\t\tonRemove( ! isReverse );\n\t\t\t}\n\t\t},\n\t\t[ onMerge, onRemove ]\n\t);\n\n\t/**\n\t * Signals to the RichText owner that the block can be replaced with two\n\t * blocks as a result of splitting the block by pressing enter, or with\n\t * blocks as a result of splitting the block by pasting block content in the\n\t * instance.\n\t *\n\t * @param {Object} record The rich text value to split.\n\t * @param {Array} pastedBlocks The pasted blocks to insert, if any.\n\t */\n\tconst splitValue = useCallback(\n\t\t( record, pastedBlocks = [] ) => {\n\t\t\tif ( ! onReplace || ! onSplit ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst blocks = [];\n\t\t\tconst [ before, after ] = split( record );\n\t\t\tconst hasPastedBlocks = pastedBlocks.length > 0;\n\t\t\tlet lastPastedBlockIndex = -1;\n\n\t\t\t// Consider the after value to be the original it is not empty and\n\t\t\t// the before value *is* empty.\n\t\t\tconst isAfterOriginal = isEmpty( before ) && ! isEmpty( after );\n\n\t\t\t// Create a block with the content before the caret if there's no pasted\n\t\t\t// blocks, or if there are pasted blocks and the value is not empty.\n\t\t\t// We do not want a leading empty block on paste, but we do if split\n\t\t\t// with e.g. the enter key.\n\t\t\tif ( ! hasPastedBlocks || ! isEmpty( before ) ) {\n\t\t\t\tblocks.push(\n\t\t\t\t\tonSplit(\n\t\t\t\t\t\ttoHTMLString( {\n\t\t\t\t\t\t\tvalue: before,\n\t\t\t\t\t\t\tmultilineTag,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t\t! isAfterOriginal\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tlastPastedBlockIndex += 1;\n\t\t\t}\n\n\t\t\tif ( hasPastedBlocks ) {\n\t\t\t\tblocks.push( ...pastedBlocks );\n\t\t\t\tlastPastedBlockIndex += pastedBlocks.length;\n\t\t\t} else if ( onSplitMiddle ) {\n\t\t\t\tblocks.push( onSplitMiddle() );\n\t\t\t}\n\n\t\t\t// If there's pasted blocks, append a block with non empty content\n\t\t\t// after the caret. Otherwise, do append an empty block if there\n\t\t\t// is no `onSplitMiddle` prop, but if there is and the content is\n\t\t\t// empty, the middle block is enough to set focus in.\n\t\t\tif (\n\t\t\t\thasPastedBlocks\n\t\t\t\t\t? ! isEmpty( after )\n\t\t\t\t\t: ! onSplitMiddle || ! isEmpty( after )\n\t\t\t) {\n\t\t\t\tblocks.push(\n\t\t\t\t\tonSplit(\n\t\t\t\t\t\ttoHTMLString( {\n\t\t\t\t\t\t\tvalue: after,\n\t\t\t\t\t\t\tmultilineTag,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t\tisAfterOriginal\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// If there are pasted blocks, set the selection to the last one.\n\t\t\t// Otherwise, set the selection to the second block.\n\t\t\tconst indexToSelect = hasPastedBlocks ? lastPastedBlockIndex : 1;\n\n\t\t\t// If there are pasted blocks, move the caret to the end of the selected block\n\t\t\t// Otherwise, retain the default value.\n\t\t\tconst initialPosition = hasPastedBlocks ? -1 : 0;\n\n\t\t\tonReplace( blocks, indexToSelect, initialPosition );\n\t\t},\n\t\t[ onReplace, onSplit, multilineTag, onSplitMiddle ]\n\t);\n\n\tconst onEnter = useCallback(\n\t\t( { value, onChange, shiftKey } ) => {\n\t\t\tconst canSplit = onReplace && onSplit;\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst transforms = getBlockTransforms( 'from' ).filter(\n\t\t\t\t\t( { type } ) => type === 'enter'\n\t\t\t\t);\n\t\t\t\tconst transformation = findTransform( transforms, ( item ) => {\n\t\t\t\t\treturn item.regExp.test( value.text );\n\t\t\t\t} );\n\n\t\t\t\tif ( transformation ) {\n\t\t\t\t\tonReplace( [\n\t\t\t\t\t\ttransformation.transform( { content: value.text } ),\n\t\t\t\t\t] );\n\t\t\t\t\t__unstableMarkAutomaticChange();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( onCustomEnter ) {\n\t\t\t\tonCustomEnter();\n\t\t\t}\n\n\t\t\tconst { text, start: splitStart, end: splitEnd } = value;\n\t\t\tconst canSplitAtEnd =\n\t\t\t\tonSplitAtEnd &&\n\t\t\t\tsplitStart === splitEnd &&\n\t\t\t\tsplitEnd === text.length;\n\n\t\t\tif ( shiftKey || ( ! canSplit && ! canSplitAtEnd ) ) {\n\t\t\t\tif ( ! disableLineBreaks ) {\n\t\t\t\t\tonChange( insert( value, '\\n' ) );\n\t\t\t\t}\n\t\t\t} else if ( ! canSplit && canSplitAtEnd ) {\n\t\t\t\tonSplitAtEnd();\n\t\t\t} else if ( canSplit ) {\n\t\t\t\tsplitValue( value );\n\t\t\t}\n\t\t},\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[\n\t\t\tonReplace,\n\t\t\tonSplit,\n\t\t\t__unstableMarkAutomaticChange,\n\t\t\tmultiline,\n\t\t\tsplitValue,\n\t\t\tonSplitAtEnd,\n\t\t]\n\t);\n\n\tconst onPaste = useCallback(\n\t\t( {\n\t\t\tvalue,\n\t\t\tonChange,\n\t\t\thtml,\n\t\t\tplainText,\n\t\t\tisInternal,\n\t\t\tfiles,\n\t\t\tactiveFormats,\n\t\t} ) => {\n\t\t\t// If the data comes from a rich text instance, we can directly use it\n\t\t\t// without filtering the data. The filters are only meant for externally\n\t\t\t// pasted content and remove inline styles.\n\t\t\tif ( isInternal ) {\n\t\t\t\tconst pastedValue = create( {\n\t\t\t\t\thtml,\n\t\t\t\t\tmultilineTag,\n\t\t\t\t\tmultilineWrapperTags:\n\t\t\t\t\t\tmultilineTag === 'li' ? [ 'ul', 'ol' ] : undefined,\n\t\t\t\t\tpreserveWhiteSpace,\n\t\t\t\t} );\n\t\t\t\taddActiveFormats( pastedValue, activeFormats );\n\t\t\t\tonChange( insert( value, pastedValue ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( pastePlainText ) {\n\t\t\t\tonChange( insert( value, create( { text: plainText } ) ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Only process file if no HTML is present.\n\t\t\t// Note: a pasted file may have the URL as plain text.\n\t\t\tif ( files && files.length && ! html ) {\n\t\t\t\tconst content = pasteHandler( {\n\t\t\t\t\tHTML: filePasteHandler( files ),\n\t\t\t\t\tmode: 'BLOCKS',\n\t\t\t\t\ttagName,\n\t\t\t\t\tpreserveWhiteSpace,\n\t\t\t\t} );\n\n\t\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\twindow.console.log( 'Received items:\\n\\n', files );\n\n\t\t\t\tif ( onReplace && isEmpty( value ) ) {\n\t\t\t\t\tonReplace( content );\n\t\t\t\t} else {\n\t\t\t\t\tsplitValue( value, content );\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet mode = onReplace && onSplit ? 'AUTO' : 'INLINE';\n\n\t\t\tconst isPastedURL = isURL( plainText.trim() );\n\t\t\tconst presentEmbedHandlerPicker = () =>\n\t\t\t\tembedHandlerPickerRef.current?.presentPicker( {\n\t\t\t\t\tcreateEmbed: () =>\n\t\t\t\t\t\tonReplace( content, content.length - 1, -1 ),\n\t\t\t\t\tcreateLink: () =>\n\t\t\t\t\t\tcreateLinkInParagraph( plainText.trim(), onReplace ),\n\t\t\t\t} );\n\n\t\t\tif (\n\t\t\t\t__unstableEmbedURLOnPaste &&\n\t\t\t\tisEmpty( value ) &&\n\t\t\t\tisPastedURL\n\t\t\t) {\n\t\t\t\tmode = 'BLOCKS';\n\t\t\t}\n\n\t\t\tconst content = pasteHandler( {\n\t\t\t\tHTML: html,\n\t\t\t\tplainText,\n\t\t\t\tmode,\n\t\t\t\ttagName,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\n\t\t\tif ( typeof content === 'string' ) {\n\t\t\t\tconst valueToInsert = create( { html: content } );\n\t\t\t\taddActiveFormats( valueToInsert, activeFormats );\n\t\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t\t} else if ( content.length > 0 ) {\n\t\t\t\t// When an URL is pasted in an empty paragraph then the EmbedHandlerPicker should showcase options allowing the transformation of that URL\n\t\t\t\t// into either an Embed block or a link within the target paragraph. If the paragraph is non-empty, the URL is pasted as text.\n\t\t\t\tconst canPasteEmbed =\n\t\t\t\t\tisPastedURL &&\n\t\t\t\t\tcontent.length === 1 &&\n\t\t\t\t\tcontent[ 0 ].name === 'core/embed';\n\t\t\t\tif ( onReplace && isEmpty( value ) ) {\n\t\t\t\t\tif ( canPasteEmbed ) {\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tinsert( value, create( { text: plainText } ) )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( __unstableEmbedURLOnPaste ) {\n\t\t\t\t\t\t\tpresentEmbedHandlerPicker();\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tonReplace( content, content.length - 1, -1 );\n\t\t\t\t} else {\n\t\t\t\t\tif ( canPasteEmbed ) {\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tinsert( value, create( { text: plainText } ) )\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tsplitValue( value, content );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\ttagName,\n\t\t\tonReplace,\n\t\t\tonSplit,\n\t\t\tsplitValue,\n\t\t\t__unstableEmbedURLOnPaste,\n\t\t\tmultilineTag,\n\t\t\tpreserveWhiteSpace,\n\t\t\tpastePlainText,\n\t\t]\n\t);\n\n\tconst inputRule = useCallback(\n\t\t( value, valueToFormat ) => {\n\t\t\tif ( ! onReplace ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { start: startPosition, text } = value;\n\t\t\tconst characterBefore = text.slice(\n\t\t\t\tstartPosition - 1,\n\t\t\t\tstartPosition\n\t\t\t);\n\n\t\t\t// The character right before the caret must be a plain space.\n\t\t\tif ( characterBefore !== ' ' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst trimmedTextBefore = text.slice( 0, startPosition ).trim();\n\t\t\tconst prefixTransforms = getBlockTransforms( 'from' ).filter(\n\t\t\t\t( { type } ) => type === 'prefix'\n\t\t\t);\n\t\t\tconst transformation = findTransform(\n\t\t\t\tprefixTransforms,\n\t\t\t\t( { prefix } ) => {\n\t\t\t\t\treturn trimmedTextBefore === prefix;\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( ! transformation ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst content = valueToFormat(\n\t\t\t\tslice( value, startPosition, text.length )\n\t\t\t);\n\t\t\tconst block = transformation.transform( content );\n\n\t\t\tonReplace( [ block ] );\n\t\t\t__unstableMarkAutomaticChange();\n\t\t},\n\t\t[ onReplace, __unstableMarkAutomaticChange ]\n\t);\n\n\tconst mergedRef = useMergeRefs( [ forwardedRef, fallbackRef ] );\n\n\treturn (\n\t\t<RichText\n\t\t\tclientId={ clientId }\n\t\t\tidentifier={ identifier }\n\t\t\tref={ mergedRef }\n\t\t\tvalue={ adjustedValue }\n\t\t\tonChange={ adjustedOnChange }\n\t\t\tselectionStart={ selectionStart }\n\t\t\tselectionEnd={ selectionEnd }\n\t\t\tonSelectionChange={ onSelectionChange }\n\t\t\ttagName={ tagName }\n\t\t\tstart={ start }\n\t\t\treversed={ reversed }\n\t\t\tplaceholder={ placeholder }\n\t\t\tallowedFormats={ adjustedAllowedFormats }\n\t\t\twithoutInteractiveFormatting={ withoutInteractiveFormatting }\n\t\t\tonEnter={ onEnter }\n\t\t\tonDelete={ onDelete }\n\t\t\tonPaste={ onPaste }\n\t\t\t__unstableIsSelected={ isSelected }\n\t\t\t__unstableInputRule={ inputRule }\n\t\t\t__unstableMultilineTag={ multilineTag }\n\t\t\t__unstableOnEnterFormattedText={ enterFormattedText }\n\t\t\t__unstableOnExitFormattedText={ exitFormattedText }\n\t\t\t__unstableOnCreateUndoLevel={ __unstableMarkLastChangeAsPersistent }\n\t\t\t__unstableMarkAutomaticChange={ __unstableMarkAutomaticChange }\n\t\t\t__unstableDidAutomaticChange={ didAutomaticChange }\n\t\t\t__unstableUndo={ undo }\n\t\t\t__unstableDisableFormats={ disableFormats }\n\t\t\tpreserveWhiteSpace={ preserveWhiteSpace }\n\t\t\tdisabled={ disabled }\n\t\t\tunstableOnFocus={ unstableOnFocus }\n\t\t\t__unstableAllowPrefixTransformations={\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t}\n\t\t\t__unstableMultilineRootTag={ __unstableMultilineRootTag }\n\t\t\t// Native props.\n\t\t\tblockIsSelected={\n\t\t\t\toriginalIsSelected !== undefined\n\t\t\t\t\t? originalIsSelected\n\t\t\t\t\t: blockIsSelected\n\t\t\t}\n\t\t\tshouldBlurOnUnmount={ shouldBlurOnUnmount }\n\t\t\t__unstableMobileNoFocusOnMount={ __unstableMobileNoFocusOnMount }\n\t\t\tdeleteEnter={ deleteEnter }\n\t\t\tplaceholderTextColor={ placeholderTextColor }\n\t\t\ttextAlign={ textAlign }\n\t\t\tselectionColor={ selectionColor }\n\t\t\ttagsToEliminate={ tagsToEliminate }\n\t\t\tdisableEditingMenu={ disableEditingMenu }\n\t\t\tfontSize={ fontSize }\n\t\t\tfontFamily={ fontFamily }\n\t\t\tfontWeight={ fontWeight }\n\t\t\tfontStyle={ fontStyle }\n\t\t\tminWidth={ minWidth }\n\t\t\tmaxWidth={ maxWidth }\n\t\t\tonBlur={ onBlur }\n\t\t\tsetRef={ setRef }\n\t\t\tdisableSuggestions={ disableSuggestions }\n\t\t\tdisableAutocorrection={ disableAutocorrection }\n\t\t\tcontainerWidth={ containerWidth }\n\t\t\t// Props to be set on the editable container are destructured on the\n\t\t\t// element itself for web (see below), but passed through rich text\n\t\t\t// for native.\n\t\t\tid={ props.id }\n\t\t\tstyle={ props.style }\n\t\t>\n\t\t\t{ ( {\n\t\t\t\tisSelected: nestedIsSelected,\n\t\t\t\tvalue,\n\t\t\t\tonChange,\n\t\t\t\tonFocus,\n\t\t\t\teditableProps,\n\t\t\t\teditableTagName: TagName,\n\t\t\t} ) => (\n\t\t\t\t<>\n\t\t\t\t\t{ children && children( { value, onChange, onFocus } ) }\n\t\t\t\t\t{ nestedIsSelected && hasFormats && (\n\t\t\t\t\t\t<FormatToolbarContainer\n\t\t\t\t\t\t\tinline={ inlineToolbar }\n\t\t\t\t\t\t\tanchorRef={ fallbackRef.current }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ nestedIsSelected && <RemoveBrowserShortcuts /> }\n\t\t\t\t\t<Autocomplete\n\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\tcompleters={ autocompleters }\n\t\t\t\t\t\trecord={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tisSelected={ nestedIsSelected }\n\t\t\t\t\t\tcontentRef={ fallbackRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { listBoxId, activeId, onKeyDown } ) => (\n\t\t\t\t\t\t\t<TagName\n\t\t\t\t\t\t\t\t{ ...editableProps }\n\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tprops.style\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t...props.style,\n\t\t\t\t\t\t\t\t\t\t\t\t...editableProps.style,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: editableProps.style\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\tclasses,\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\teditableProps.className\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\taria-autocomplete={\n\t\t\t\t\t\t\t\t\tlistBoxId ? 'list' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-owns={ listBoxId }\n\t\t\t\t\t\t\t\taria-activedescendant={ activeId }\n\t\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\tonKeyDown( event );\n\t\t\t\t\t\t\t\t\teditableProps.onKeyDown( event );\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</Autocomplete>\n\t\t\t\t\t<EmbedHandlerPicker ref={ embedHandlerPickerRef } />\n\t\t\t\t</>\n\t\t\t) }\n\t\t</RichText>\n\t);\n}\n\nconst ForwardedRichTextContainer = forwardRef( RichTextWrapper );\n\nForwardedRichTextContainer.Content = Content;\n\nForwardedRichTextContainer.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\n};\n\nForwardedRichTextContainer.Content.defaultProps = {\n\tformat: 'string',\n\tvalue: '',\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md\n */\nexport default ForwardedRichTextContainer;\nexport { RichTextShortcut } from './shortcut';\nexport { RichTextToolbarButton } from './toolbar-button';\nexport { __unstableRichTextInputEvent } from './input-event';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAOA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAUA,IAAAM,IAAA,GAAAN,OAAA;AAKA,IAAAO,aAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,uBAAA,GAAAT,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AAMA,IAAAc,mBAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,QAAA,GAAAf,OAAA;AAwnBA,IAAAgB,SAAA,GAAAhB,OAAA;AACA,IAAAiB,cAAA,GAAAjB,OAAA;AACA,IAAAkB,WAAA,GAAAlB,OAAA;AAxqBA;AACA;AACA;;AAGA;AACA;AACA;;AAuBA;AACA;AACA;;AAgBA,MAAMmB,OAAO,GAAG,kCAAkC;AAElD,SAASC,eAAeA,CACvB;EACCC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC,QAAQ;EACRC,KAAK,EAAEC,aA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jDC,MAAM,EAAE,QAAQ;EAChBjO,KAAK,EAAE;AACR,CAAC;;AAED;AACA;AACA;AAFA,IAAAkO,QAAA,GAGeL,0BAA0B;AAAAM,OAAA,CAAAlB,OAAA,GAAAiB,QAAA"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_data","_blocks","_compose","_richText","_url","_autocomplete","_blockEdit","_removeBrowserShortcuts","_filePasteHandler","_formatToolbarContainer","_store","_utils","_embedHandlerPicker","_content","_shortcut","_toolbarButton","_inputEvent","classes","RichTextWrapper","children","tagName","start","reversed","value","originalValue","onChange","originalOnChange","isSelected","originalIsSelected","multiline","inlineToolbar","wrapperClassName","autocompleters","onReplace","placeholder","allowedFormats","withoutInteractiveFormatting","onRemove","onMerge","onSplit","__unstableOnSplitAtEnd","onSplitAtEnd","__unstableOnSplitMiddle","onSplitMiddle","__unstableOnSplitAtDoubleLineEnd","onSplitAtDoubleLineEnd","identifier","preserveWhiteSpace","__unstablePastePlainText","pastePlainText","__unstableEmbedURLOnPaste","__unstableDisableFormats","disableFormats","disableLineBreaks","unstableOnFocus","__unstableAllowPrefixTransformations","__unstableMultilineRootTag","__unstableMobileNoFocusOnMount","deleteEnter","placeholderTextColor","textAlign","selectionColor","tagsToEliminate","disableEditingMenu","fontSize","fontFamily","fontWeight","fontStyle","minWidth","maxWidth","onBlur","setRef","disableSuggestions","disableAutocorrection","containerWidth","onEnter","onCustomEnter","props","forwardedRef","instanceId","useInstanceId","fallbackRef","useRef","clientId","blockIsSelected","useBlockEditContext","embedHandlerPickerRef","selector","select","getSelectionStart","getSelectionEnd","getSettings","didAutomaticChange","getBlock","isMultiSelecting","hasMultiSelection","blockEditorStore","selectionStart","selectionEnd","__experimentalUndo","undo","undefined","attributeKey","extraProps","Platform","OS","block","shouldBlurOnUnmount","isUnmodifiedDefaultBlock","offset","disabled","useSelect","__unstableMarkLastChangeAsPersistent","enterFormattedText","exitFormattedText","selectionChange","__unstableMarkAutomaticChange","useDispatch","multilineTag","getMultilineTag","adjustedAllowedFormats","getAllowedFormats","hasFormats","length","adjustedValue","adjustedOnChange","Array","isArray","childrenSource","toHTML","newValue","fromDOM","__unstableCreateElement","document","childNodes","onSelectionChange","useCallback","selectionChangeStart","selectionChangeEnd","onDelete","isReverse","isEmpty","splitValue","record","pastedBlocks","blocks","before","after","split","hasPastedBlocks","lastPastedBlockIndex","isAfterOriginal","push","toHTMLString","indexToSelect","initialPosition","shiftKey","canSplit","transforms","getBlockTransforms","filter","type","transformation","findTransform","item","regExp","test","text","transform","content","splitStart","end","splitEnd","canSplitAtEnd","insert","slice","remove","onPaste","html","plainText","isInternal","files","activeFormats","pastedValue","create","multilineWrapperTags","addActiveFormats","pasteHandler","HTML","filePasteHandler","mode","window","console","log","isPastedURL","isURL","trim","presentEmbedHandlerPicker","current","presentPicker","createEmbed","createLink","createLinkInParagraph","valueToInsert","canPasteEmbed","name","inputRule","valueToFormat","startPosition","characterBefore","trimmedTextBefore","prefixTransforms","prefix","mergedRef","useMergeRefs","_react","createElement","__experimentalRichText","ref","__unstableIsSelected","__unstableInputRule","__unstableMultilineTag","__unstableOnEnterFormattedText","__unstableOnExitFormattedText","__unstableOnCreateUndoLevel","__unstableDidAutomaticChange","__unstableUndo","id","style","nestedIsSelected","onFocus","editableProps","editableTagName","TagName","Fragment","default","inline","anchorRef","RemoveBrowserShortcuts","completers","contentRef","listBoxId","activeId","onKeyDown","className","classnames","event","ForwardedRichTextContainer","forwardRef","Content","defaultProps","format","_default","exports"],"sources":["@wordpress/block-editor/src/components/rich-text/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Platform, useRef, useCallback, forwardRef } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tpasteHandler,\n\tchildren as childrenSource,\n\tgetBlockTransforms,\n\tfindTransform,\n\tisUnmodifiedDefaultBlock,\n} from '@wordpress/blocks';\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\nimport {\n\t__experimentalRichText as RichText,\n\t__unstableCreateElement,\n\tisEmpty,\n\tinsert,\n\tremove,\n\tcreate,\n\tsplit,\n\ttoHTMLString,\n\tslice,\n} from '@wordpress/rich-text';\nimport { isURL } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport Autocomplete from '../autocomplete';\nimport { useBlockEditContext } from '../block-edit';\nimport { RemoveBrowserShortcuts } from './remove-browser-shortcuts';\nimport { filePasteHandler } from './file-paste-handler';\nimport FormatToolbarContainer from './format-toolbar-container';\nimport { store as blockEditorStore } from '../../store';\nimport {\n\taddActiveFormats,\n\tgetMultilineTag,\n\tgetAllowedFormats,\n\tcreateLinkInParagraph,\n} from './utils';\nimport EmbedHandlerPicker from './embed-handler-picker';\nimport { Content } from './content';\n\nconst classes = 'block-editor-rich-text__editable';\n\nfunction RichTextWrapper(\n\t{\n\t\tchildren,\n\t\ttagName,\n\t\tstart,\n\t\treversed,\n\t\tvalue: originalValue,\n\t\tonChange: originalOnChange,\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__unstableOnSplitMiddle: onSplitMiddle,\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\tunstableOnFocus,\n\t\t__unstableAllowPrefixTransformations,\n\t\t__unstableMultilineRootTag,\n\t\t// Native props.\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\tonBlur,\n\t\tsetRef,\n\t\tdisableSuggestions,\n\t\tdisableAutocorrection,\n\t\tcontainerWidth,\n\t\tonEnter: onCustomEnter,\n\t\t...props\n\t},\n\tforwardedRef\n) {\n\tconst instanceId = useInstanceId( RichTextWrapper );\n\n\tidentifier = identifier || instanceId;\n\n\tconst fallbackRef = useRef();\n\tconst { clientId, isSelected: blockIsSelected } = useBlockEditContext();\n\tconst embedHandlerPickerRef = useRef();\n\tconst selector = ( select ) => {\n\t\tconst {\n\t\t\tgetSelectionStart,\n\t\t\tgetSelectionEnd,\n\t\t\tgetSettings,\n\t\t\tdidAutomaticChange,\n\t\t\tgetBlock,\n\t\t\tisMultiSelecting,\n\t\t\thasMultiSelection,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectionStart = getSelectionStart();\n\t\tconst selectionEnd = getSelectionEnd();\n\t\tconst { __experimentalUndo: undo } = getSettings();\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\tselectionStart.attributeKey === identifier;\n\t\t} else if ( originalIsSelected ) {\n\t\t\tisSelected = selectionStart.clientId === clientId;\n\t\t}\n\n\t\tlet extraProps = {};\n\t\tif ( Platform.OS === 'native' ) {\n\t\t\t// If the block of this RichText is unmodified then it's a candidate for replacing when adding a new block.\n\t\t\t// In order to fix https://github.com/wordpress-mobile/gutenberg-mobile/issues/1126, let's blur on unmount in that case.\n\t\t\t// This apparently assumes functionality the BlockHlder actually.\n\t\t\tconst block = clientId && getBlock( clientId );\n\t\t\tconst shouldBlurOnUnmount =\n\t\t\t\tblock && isSelected && isUnmodifiedDefaultBlock( block );\n\t\t\textraProps = {\n\t\t\t\tshouldBlurOnUnmount,\n\t\t\t};\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\tdidAutomaticChange: didAutomaticChange(),\n\t\t\tdisabled: isMultiSelecting() || hasMultiSelection(),\n\t\t\tundo,\n\t\t\t...extraProps,\n\t\t};\n\t};\n\t// This selector must run on every render so the right selection state is\n\t// retrieved from the store on merge.\n\t// To do: fix this somehow.\n\tconst {\n\t\tselectionStart,\n\t\tselectionEnd,\n\t\tisSelected,\n\t\tdidAutomaticChange,\n\t\tdisabled,\n\t\tundo,\n\t\tshouldBlurOnUnmount,\n\t} = useSelect( selector );\n\tconst {\n\t\t__unstableMarkLastChangeAsPersistent,\n\t\tenterFormattedText,\n\t\texitFormattedText,\n\t\tselectionChange,\n\t\t__unstableMarkAutomaticChange,\n\t} = useDispatch( blockEditorStore );\n\tconst multilineTag = getMultilineTag( multiline );\n\tconst adjustedAllowedFormats = getAllowedFormats( {\n\t\tallowedFormats,\n\t\tdisableFormats,\n\t} );\n\tconst hasFormats =\n\t\t! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;\n\tlet adjustedValue = originalValue;\n\tlet adjustedOnChange = originalOnChange;\n\n\t// Handle deprecated format.\n\tif ( Array.isArray( originalValue ) ) {\n\t\tadjustedValue = childrenSource.toHTML( originalValue );\n\t\tadjustedOnChange = ( newValue ) =>\n\t\t\toriginalOnChange(\n\t\t\t\tchildrenSource.fromDOM(\n\t\t\t\t\t__unstableCreateElement( document, newValue ).childNodes\n\t\t\t\t)\n\t\t\t);\n\t}\n\n\tconst onSelectionChange = useCallback(\n\t\t( selectionChangeStart, selectionChangeEnd ) => {\n\t\t\tselectionChange(\n\t\t\t\tclientId,\n\t\t\t\tidentifier,\n\t\t\t\tselectionChangeStart,\n\t\t\t\tselectionChangeEnd\n\t\t\t);\n\t\t},\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ clientId, identifier ]\n\t);\n\n\tconst onDelete = useCallback(\n\t\t( { value, isReverse } ) => {\n\t\t\tif ( onMerge ) {\n\t\t\t\tonMerge( ! isReverse );\n\t\t\t}\n\n\t\t\t// Only handle remove on Backspace. This serves dual-purpose of being\n\t\t\t// an intentional user interaction distinguishing between Backspace and\n\t\t\t// Delete to remove the empty field, but also to avoid merge & remove\n\t\t\t// causing destruction of two fields (merge, then removed merged).\n\t\t\tif ( onRemove && isEmpty( value ) && isReverse ) {\n\t\t\t\tonRemove( ! isReverse );\n\t\t\t}\n\t\t},\n\t\t[ onMerge, onRemove ]\n\t);\n\n\t/**\n\t * Signals to the RichText owner that the block can be replaced with two\n\t * blocks as a result of splitting the block by pressing enter, or with\n\t * blocks as a result of splitting the block by pasting block content in the\n\t * instance.\n\t *\n\t * @param {Object} record The rich text value to split.\n\t * @param {Array} pastedBlocks The pasted blocks to insert, if any.\n\t */\n\tconst splitValue = useCallback(\n\t\t( record, pastedBlocks = [] ) => {\n\t\t\tif ( ! onReplace || ! onSplit ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst blocks = [];\n\t\t\tconst [ before, after ] = split( record );\n\t\t\tconst hasPastedBlocks = pastedBlocks.length > 0;\n\t\t\tlet lastPastedBlockIndex = -1;\n\n\t\t\t// Consider the after value to be the original it is not empty and\n\t\t\t// the before value *is* empty.\n\t\t\tconst isAfterOriginal = isEmpty( before ) && ! isEmpty( after );\n\n\t\t\t// Create a block with the content before the caret if there's no pasted\n\t\t\t// blocks, or if there are pasted blocks and the value is not empty.\n\t\t\t// We do not want a leading empty block on paste, but we do if split\n\t\t\t// with e.g. the enter key.\n\t\t\tif ( ! hasPastedBlocks || ! isEmpty( before ) ) {\n\t\t\t\tblocks.push(\n\t\t\t\t\tonSplit(\n\t\t\t\t\t\ttoHTMLString( {\n\t\t\t\t\t\t\tvalue: before,\n\t\t\t\t\t\t\tmultilineTag,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t\t! isAfterOriginal\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tlastPastedBlockIndex += 1;\n\t\t\t}\n\n\t\t\tif ( hasPastedBlocks ) {\n\t\t\t\tblocks.push( ...pastedBlocks );\n\t\t\t\tlastPastedBlockIndex += pastedBlocks.length;\n\t\t\t} else if ( onSplitMiddle ) {\n\t\t\t\tblocks.push( onSplitMiddle() );\n\t\t\t}\n\n\t\t\t// If there's pasted blocks, append a block with non empty content\n\t\t\t// after the caret. Otherwise, do append an empty block if there\n\t\t\t// is no `onSplitMiddle` prop, but if there is and the content is\n\t\t\t// empty, the middle block is enough to set focus in.\n\t\t\tif (\n\t\t\t\thasPastedBlocks\n\t\t\t\t\t? ! isEmpty( after )\n\t\t\t\t\t: ! onSplitMiddle || ! isEmpty( after )\n\t\t\t) {\n\t\t\t\tblocks.push(\n\t\t\t\t\tonSplit(\n\t\t\t\t\t\ttoHTMLString( {\n\t\t\t\t\t\t\tvalue: after,\n\t\t\t\t\t\t\tmultilineTag,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t\tisAfterOriginal\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// If there are pasted blocks, set the selection to the last one.\n\t\t\t// Otherwise, set the selection to the second block.\n\t\t\tconst indexToSelect = hasPastedBlocks ? lastPastedBlockIndex : 1;\n\n\t\t\t// If there are pasted blocks, move the caret to the end of the selected block\n\t\t\t// Otherwise, retain the default value.\n\t\t\tconst initialPosition = hasPastedBlocks ? -1 : 0;\n\n\t\t\tonReplace( blocks, indexToSelect, initialPosition );\n\t\t},\n\t\t[ onReplace, onSplit, multilineTag, onSplitMiddle ]\n\t);\n\n\tconst onEnter = useCallback(\n\t\t( { value, onChange, shiftKey } ) => {\n\t\t\tconst canSplit = onReplace && onSplit;\n\n\t\t\tif ( onReplace ) {\n\t\t\t\tconst transforms = getBlockTransforms( 'from' ).filter(\n\t\t\t\t\t( { type } ) => type === 'enter'\n\t\t\t\t);\n\t\t\t\tconst transformation = findTransform( transforms, ( item ) => {\n\t\t\t\t\treturn item.regExp.test( value.text );\n\t\t\t\t} );\n\n\t\t\t\tif ( transformation ) {\n\t\t\t\t\tonReplace( [\n\t\t\t\t\t\ttransformation.transform( { content: value.text } ),\n\t\t\t\t\t] );\n\t\t\t\t\t__unstableMarkAutomaticChange();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( onCustomEnter ) {\n\t\t\t\tonCustomEnter();\n\t\t\t}\n\n\t\t\tconst { text, start: splitStart, end: splitEnd } = value;\n\t\t\tconst canSplitAtEnd =\n\t\t\t\tonSplitAtEnd &&\n\t\t\t\tsplitStart === splitEnd &&\n\t\t\t\tsplitEnd === text.length;\n\n\t\t\tif ( shiftKey ) {\n\t\t\t\tif ( ! disableLineBreaks ) {\n\t\t\t\t\tonChange( insert( value, '\\n' ) );\n\t\t\t\t}\n\t\t\t} else if ( canSplit ) {\n\t\t\t\tsplitValue( value );\n\t\t\t} else if ( canSplitAtEnd ) {\n\t\t\t\tonSplitAtEnd();\n\t\t\t} else if (\n\t\t\t\t// For some blocks it's desirable to split at the end of the\n\t\t\t\t// block when there are two line breaks at the end of the\n\t\t\t\t// block, so triple Enter exits the block.\n\t\t\t\tonSplitAtDoubleLineEnd &&\n\t\t\t\tsplitStart === splitEnd &&\n\t\t\t\tsplitEnd === text.length &&\n\t\t\t\ttext.slice( -2 ) === '\\n\\n'\n\t\t\t) {\n\t\t\t\tvalue.start = value.end - 2;\n\t\t\t\tonChange( remove( value ) );\n\t\t\t\tonSplitAtDoubleLineEnd();\n\t\t\t} else if ( ! disableLineBreaks ) {\n\t\t\t\tonChange( insert( value, '\\n' ) );\n\t\t\t}\n\t\t},\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[\n\t\t\tonReplace,\n\t\t\tonSplit,\n\t\t\t__unstableMarkAutomaticChange,\n\t\t\tmultiline,\n\t\t\tsplitValue,\n\t\t\tonSplitAtEnd,\n\t\t]\n\t);\n\n\tconst onPaste = useCallback(\n\t\t( {\n\t\t\tvalue,\n\t\t\tonChange,\n\t\t\thtml,\n\t\t\tplainText,\n\t\t\tisInternal,\n\t\t\tfiles,\n\t\t\tactiveFormats,\n\t\t} ) => {\n\t\t\t// If the data comes from a rich text instance, we can directly use it\n\t\t\t// without filtering the data. The filters are only meant for externally\n\t\t\t// pasted content and remove inline styles.\n\t\t\tif ( isInternal ) {\n\t\t\t\tconst pastedValue = create( {\n\t\t\t\t\thtml,\n\t\t\t\t\tmultilineTag,\n\t\t\t\t\tmultilineWrapperTags:\n\t\t\t\t\t\tmultilineTag === 'li' ? [ 'ul', 'ol' ] : undefined,\n\t\t\t\t\tpreserveWhiteSpace,\n\t\t\t\t} );\n\t\t\t\taddActiveFormats( pastedValue, activeFormats );\n\t\t\t\tonChange( insert( value, pastedValue ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( pastePlainText ) {\n\t\t\t\tonChange( insert( value, create( { text: plainText } ) ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Only process file if no HTML is present.\n\t\t\t// Note: a pasted file may have the URL as plain text.\n\t\t\tif ( files && files.length && ! html ) {\n\t\t\t\tconst content = pasteHandler( {\n\t\t\t\t\tHTML: filePasteHandler( files ),\n\t\t\t\t\tmode: 'BLOCKS',\n\t\t\t\t\ttagName,\n\t\t\t\t\tpreserveWhiteSpace,\n\t\t\t\t} );\n\n\t\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\twindow.console.log( 'Received items:\\n\\n', files );\n\n\t\t\t\tif ( onReplace && isEmpty( value ) ) {\n\t\t\t\t\tonReplace( content );\n\t\t\t\t} else {\n\t\t\t\t\tsplitValue( value, content );\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet mode = onReplace && onSplit ? 'AUTO' : 'INLINE';\n\n\t\t\tconst isPastedURL = isURL( plainText.trim() );\n\t\t\tconst presentEmbedHandlerPicker = () =>\n\t\t\t\tembedHandlerPickerRef.current?.presentPicker( {\n\t\t\t\t\tcreateEmbed: () =>\n\t\t\t\t\t\tonReplace( content, content.length - 1, -1 ),\n\t\t\t\t\tcreateLink: () =>\n\t\t\t\t\t\tcreateLinkInParagraph( plainText.trim(), onReplace ),\n\t\t\t\t} );\n\n\t\t\tif (\n\t\t\t\t__unstableEmbedURLOnPaste &&\n\t\t\t\tisEmpty( value ) &&\n\t\t\t\tisPastedURL\n\t\t\t) {\n\t\t\t\tmode = 'BLOCKS';\n\t\t\t}\n\n\t\t\tconst content = pasteHandler( {\n\t\t\t\tHTML: html,\n\t\t\t\tplainText,\n\t\t\t\tmode,\n\t\t\t\ttagName,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\n\t\t\tif ( typeof content === 'string' ) {\n\t\t\t\tconst valueToInsert = create( { html: content } );\n\t\t\t\taddActiveFormats( valueToInsert, activeFormats );\n\t\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t\t} else if ( content.length > 0 ) {\n\t\t\t\t// When an URL is pasted in an empty paragraph then the EmbedHandlerPicker should showcase options allowing the transformation of that URL\n\t\t\t\t// into either an Embed block or a link within the target paragraph. If the paragraph is non-empty, the URL is pasted as text.\n\t\t\t\tconst canPasteEmbed =\n\t\t\t\t\tisPastedURL &&\n\t\t\t\t\tcontent.length === 1 &&\n\t\t\t\t\tcontent[ 0 ].name === 'core/embed';\n\t\t\t\tif ( onReplace && isEmpty( value ) ) {\n\t\t\t\t\tif ( canPasteEmbed ) {\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tinsert( value, create( { text: plainText } ) )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( __unstableEmbedURLOnPaste ) {\n\t\t\t\t\t\t\tpresentEmbedHandlerPicker();\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tonReplace( content, content.length - 1, -1 );\n\t\t\t\t} else {\n\t\t\t\t\tif ( canPasteEmbed ) {\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tinsert( value, create( { text: plainText } ) )\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tsplitValue( value, content );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\ttagName,\n\t\t\tonReplace,\n\t\t\tonSplit,\n\t\t\tsplitValue,\n\t\t\t__unstableEmbedURLOnPaste,\n\t\t\tmultilineTag,\n\t\t\tpreserveWhiteSpace,\n\t\t\tpastePlainText,\n\t\t]\n\t);\n\n\tconst inputRule = useCallback(\n\t\t( value, valueToFormat ) => {\n\t\t\tif ( ! onReplace ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { start: startPosition, text } = value;\n\t\t\tconst characterBefore = text.slice(\n\t\t\t\tstartPosition - 1,\n\t\t\t\tstartPosition\n\t\t\t);\n\n\t\t\t// The character right before the caret must be a plain space.\n\t\t\tif ( characterBefore !== ' ' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst trimmedTextBefore = text.slice( 0, startPosition ).trim();\n\t\t\tconst prefixTransforms = getBlockTransforms( 'from' ).filter(\n\t\t\t\t( { type } ) => type === 'prefix'\n\t\t\t);\n\t\t\tconst transformation = findTransform(\n\t\t\t\tprefixTransforms,\n\t\t\t\t( { prefix } ) => {\n\t\t\t\t\treturn trimmedTextBefore === prefix;\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( ! transformation ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst content = valueToFormat(\n\t\t\t\tslice( value, startPosition, text.length )\n\t\t\t);\n\t\t\tconst block = transformation.transform( content );\n\n\t\t\tonReplace( [ block ] );\n\t\t\t__unstableMarkAutomaticChange();\n\t\t},\n\t\t[ onReplace, __unstableMarkAutomaticChange ]\n\t);\n\n\tconst mergedRef = useMergeRefs( [ forwardedRef, fallbackRef ] );\n\n\treturn (\n\t\t<RichText\n\t\t\tclientId={ clientId }\n\t\t\tidentifier={ identifier }\n\t\t\tref={ mergedRef }\n\t\t\tvalue={ adjustedValue }\n\t\t\tonChange={ adjustedOnChange }\n\t\t\tselectionStart={ selectionStart }\n\t\t\tselectionEnd={ selectionEnd }\n\t\t\tonSelectionChange={ onSelectionChange }\n\t\t\ttagName={ tagName }\n\t\t\tstart={ start }\n\t\t\treversed={ reversed }\n\t\t\tplaceholder={ placeholder }\n\t\t\tallowedFormats={ adjustedAllowedFormats }\n\t\t\twithoutInteractiveFormatting={ withoutInteractiveFormatting }\n\t\t\tonEnter={ onEnter }\n\t\t\tonDelete={ onDelete }\n\t\t\tonPaste={ onPaste }\n\t\t\t__unstableIsSelected={ isSelected }\n\t\t\t__unstableInputRule={ inputRule }\n\t\t\t__unstableMultilineTag={ multilineTag }\n\t\t\t__unstableOnEnterFormattedText={ enterFormattedText }\n\t\t\t__unstableOnExitFormattedText={ exitFormattedText }\n\t\t\t__unstableOnCreateUndoLevel={ __unstableMarkLastChangeAsPersistent }\n\t\t\t__unstableMarkAutomaticChange={ __unstableMarkAutomaticChange }\n\t\t\t__unstableDidAutomaticChange={ didAutomaticChange }\n\t\t\t__unstableUndo={ undo }\n\t\t\t__unstableDisableFormats={ disableFormats }\n\t\t\tpreserveWhiteSpace={ preserveWhiteSpace }\n\t\t\tdisabled={ disabled }\n\t\t\tunstableOnFocus={ unstableOnFocus }\n\t\t\t__unstableAllowPrefixTransformations={\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t}\n\t\t\t__unstableMultilineRootTag={ __unstableMultilineRootTag }\n\t\t\t// Native props.\n\t\t\tblockIsSelected={\n\t\t\t\toriginalIsSelected !== undefined\n\t\t\t\t\t? originalIsSelected\n\t\t\t\t\t: blockIsSelected\n\t\t\t}\n\t\t\tshouldBlurOnUnmount={ shouldBlurOnUnmount }\n\t\t\t__unstableMobileNoFocusOnMount={ __unstableMobileNoFocusOnMount }\n\t\t\tdeleteEnter={ deleteEnter }\n\t\t\tplaceholderTextColor={ placeholderTextColor }\n\t\t\ttextAlign={ textAlign }\n\t\t\tselectionColor={ selectionColor }\n\t\t\ttagsToEliminate={ tagsToEliminate }\n\t\t\tdisableEditingMenu={ disableEditingMenu }\n\t\t\tfontSize={ fontSize }\n\t\t\tfontFamily={ fontFamily }\n\t\t\tfontWeight={ fontWeight }\n\t\t\tfontStyle={ fontStyle }\n\t\t\tminWidth={ minWidth }\n\t\t\tmaxWidth={ maxWidth }\n\t\t\tonBlur={ onBlur }\n\t\t\tsetRef={ setRef }\n\t\t\tdisableSuggestions={ disableSuggestions }\n\t\t\tdisableAutocorrection={ disableAutocorrection }\n\t\t\tcontainerWidth={ containerWidth }\n\t\t\t// Props to be set on the editable container are destructured on the\n\t\t\t// element itself for web (see below), but passed through rich text\n\t\t\t// for native.\n\t\t\tid={ props.id }\n\t\t\tstyle={ props.style }\n\t\t>\n\t\t\t{ ( {\n\t\t\t\tisSelected: nestedIsSelected,\n\t\t\t\tvalue,\n\t\t\t\tonChange,\n\t\t\t\tonFocus,\n\t\t\t\teditableProps,\n\t\t\t\teditableTagName: TagName,\n\t\t\t} ) => (\n\t\t\t\t<>\n\t\t\t\t\t{ children && children( { value, onChange, onFocus } ) }\n\t\t\t\t\t{ nestedIsSelected && hasFormats && (\n\t\t\t\t\t\t<FormatToolbarContainer\n\t\t\t\t\t\t\tinline={ inlineToolbar }\n\t\t\t\t\t\t\tanchorRef={ fallbackRef.current }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ nestedIsSelected && <RemoveBrowserShortcuts /> }\n\t\t\t\t\t<Autocomplete\n\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\tcompleters={ autocompleters }\n\t\t\t\t\t\trecord={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tisSelected={ nestedIsSelected }\n\t\t\t\t\t\tcontentRef={ fallbackRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { listBoxId, activeId, onKeyDown } ) => (\n\t\t\t\t\t\t\t<TagName\n\t\t\t\t\t\t\t\t{ ...editableProps }\n\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tprops.style\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t...props.style,\n\t\t\t\t\t\t\t\t\t\t\t\t...editableProps.style,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: editableProps.style\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\tclasses,\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\teditableProps.className\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\taria-autocomplete={\n\t\t\t\t\t\t\t\t\tlistBoxId ? 'list' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-owns={ listBoxId }\n\t\t\t\t\t\t\t\taria-activedescendant={ activeId }\n\t\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\tonKeyDown( event );\n\t\t\t\t\t\t\t\t\teditableProps.onKeyDown( event );\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</Autocomplete>\n\t\t\t\t\t<EmbedHandlerPicker ref={ embedHandlerPickerRef } />\n\t\t\t\t</>\n\t\t\t) }\n\t\t</RichText>\n\t);\n}\n\nconst ForwardedRichTextContainer = forwardRef( RichTextWrapper );\n\nForwardedRichTextContainer.Content = Content;\n\nForwardedRichTextContainer.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\n};\n\nForwardedRichTextContainer.Content.defaultProps = {\n\tformat: 'string',\n\tvalue: '',\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md\n */\nexport default ForwardedRichTextContainer;\nexport { RichTextShortcut } from './shortcut';\nexport { RichTextToolbarButton } from './toolbar-button';\nexport { __unstableRichTextInputEvent } from './input-event';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAOA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAWA,IAAAM,IAAA,GAAAN,OAAA;AAKA,IAAAO,aAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,uBAAA,GAAAT,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AAMA,IAAAc,mBAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,QAAA,GAAAf,OAAA;AAuoBA,IAAAgB,SAAA,GAAAhB,OAAA;AACA,IAAAiB,cAAA,GAAAjB,OAAA;AACA,IAAAkB,WAAA,GAAAlB,OAAA;AAxrBA;AACA;AACA;;AAGA;AACA;AACA;;AAwBA;AACA;AACA;;AAgBA,MAAMmB,OAAO,GAAG,kCAAkC;AAElD,SAASC,eAAeA,CACvB;EACCC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC,QAAQ;EACRC,KAAK,EAAEC,aAAa;EACpBC,QAAQ,EAAEC,gBAAgB;EAC1BC,UAAU,EAAEC,kBAAkB;EAC9BC,SAAS;EACTC,aAAa;EACbC,gBAAgB;EAChBC,cAAc;EACdC,SAAS;EACTC,WAAW;EACXC,cAAc;EACdC,4BAA4B;EAC5BC,QAAQ;EACRC,OAAO;EACPC,OAAO;EACPC,sBAAsB,EAAE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EtO,eAAgB,CAAC;AAEhEqO,0BAA0B,CAACE,OAAO,GAAGA,gBAAO;AAE5CF,0BAA0B,CAAC1G,OAAO,GAAKtH,KAAK,IAAM;EACjD,OAAO,CAAEA,KAAK,IAAIA,KAAK,CAACoG,MAAM,KAAK,CAAC;AACrC,CAAC;AAED4H,0BAA0B,CAACE,OAAO,CAACC,YAAY,GAAG;EACjDC,MAAM,EAAE,QAAQ;EAChBpO,KAAK,EAAE;AACR,CAAC;;AAED;AACA;AACA;AAFA,IAAAqO,QAAA,GAGeL,0BAA0B;AAAAM,OAAA,CAAAlB,OAAA,GAAAiB,QAAA"}
@@ -49,7 +49,7 @@ function useDelete(props) {
49
49
  // an intentional user interaction distinguishing between Backspace and
50
50
  // Delete to remove the empty field, but also to avoid merge & remove
51
51
  // causing destruction of two fields (merge, then removed merged).
52
- if (onRemove && (0, _richText.isEmpty)(value) && isReverse) {
52
+ else if (onRemove && (0, _richText.isEmpty)(value) && isReverse) {
53
53
  onRemove(!isReverse);
54
54
  }
55
55
  event.preventDefault();
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_compose","_keycodes","_richText","useDelete","props","propsRef","useRef","current","useRefEffect","element","onKeyDown","event","keyCode","defaultPrevented","value","onMerge","onRemove","DELETE","BACKSPACE","start","end","text","isReverse","hasActiveFormats","activeFormats","length","isCollapsed","isEmpty","preventDefault","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/rich-text/use-delete.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport { DELETE, BACKSPACE } from '@wordpress/keycodes';\nimport { isCollapsed, isEmpty } from '@wordpress/rich-text';\n\nexport function useDelete( props ) {\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tconst { keyCode } = event;\n\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { value, onMerge, onRemove } = propsRef.current;\n\n\t\t\tif ( keyCode === DELETE || keyCode === BACKSPACE ) {\n\t\t\t\tconst { start, end, text } = value;\n\t\t\t\tconst isReverse = keyCode === BACKSPACE;\n\t\t\t\tconst hasActiveFormats =\n\t\t\t\t\tvalue.activeFormats && !! value.activeFormats.length;\n\n\t\t\t\t// Only process delete if the key press occurs at an uncollapsed edge.\n\t\t\t\tif (\n\t\t\t\t\t! isCollapsed( value ) ||\n\t\t\t\t\thasActiveFormats ||\n\t\t\t\t\t( isReverse && start !== 0 ) ||\n\t\t\t\t\t( ! isReverse && end !== text.length )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( onMerge ) {\n\t\t\t\t\tonMerge( ! isReverse );\n\t\t\t\t}\n\n\t\t\t\t// Only handle remove on Backspace. This serves dual-purpose of being\n\t\t\t\t// an intentional user interaction distinguishing between Backspace and\n\t\t\t\t// Delete to remove the empty field, but also to avoid merge & remove\n\t\t\t\t// causing destruction of two fields (merge, then removed merged).\n\t\t\t\tif ( onRemove && isEmpty( value ) && isReverse ) {\n\t\t\t\t\tonRemove( ! isReverse );\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\telement.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\telement.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMO,SAASI,SAASA,CAAEC,KAAK,EAAG;EAClC,MAAMC,QAAQ,GAAG,IAAAC,eAAM,EAAEF,KAAM,CAAC;EAChCC,QAAQ,CAACE,OAAO,GAAGH,KAAK;EACxB,OAAO,IAAAI,qBAAY,EAAIC,OAAO,IAAM;IACnC,SAASC,SAASA,CAAEC,KAAK,EAAG;MAC3B,MAAM;QAAEC;MAAQ,CAAC,GAAGD,KAAK;MAEzB,IAAKA,KAAK,CAACE,gBAAgB,EAAG;QAC7B;MACD;MAEA,MAAM;QAAEC,KAAK;QAAEC,OAAO;QAAEC;MAAS,CAAC,GAAGX,QAAQ,CAACE,OAAO;MAErD,IAAKK,OAAO,KAAKK,gBAAM,IAAIL,OAAO,KAAKM,mBAAS,EAAG;QAClD,MAAM;UAAEC,KAAK;UAAEC,GAAG;UAAEC;QAAK,CAAC,GAAGP,KAAK;QAClC,MAAMQ,SAAS,GAAGV,OAAO,KAAKM,mBAAS;QACvC,MAAMK,gBAAgB,GACrBT,KAAK,CAACU,aAAa,IAAI,CAAC,CAAEV,KAAK,CAACU,aAAa,CAACC,MAAM;;QAErD;QACA,IACC,CAAE,IAAAC,qBAAW,EAAEZ,KAAM,CAAC,IACtBS,gBAAgB,IACdD,SAAS,IAAIH,KAAK,KAAK,CAAG,IAC1B,CAAEG,SAAS,IAAIF,GAAG,KAAKC,IAAI,CAACI,MAAQ,EACrC;UACD;QACD;QAEA,IAAKV,OAAO,EAAG;UACdA,OAAO,CAAE,CAAEO,SAAU,CAAC;QACvB;;QAEA;QACA;QACA;QACA;QACA,IAAKN,QAAQ,IAAI,IAAAW,iBAAO,EAAEb,KAAM,CAAC,IAAIQ,SAAS,EAAG;UAChDN,QAAQ,CAAE,CAAEM,SAAU,CAAC;QACxB;QAEAX,KAAK,CAACiB,cAAc,CAAC,CAAC;MACvB;IACD;IAEAnB,OAAO,CAACoB,gBAAgB,CAAE,SAAS,EAAEnB,SAAU,CAAC;IAChD,OAAO,MAAM;MACZD,OAAO,CAACqB,mBAAmB,CAAE,SAAS,EAAEpB,SAAU,CAAC;IACpD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
1
+ {"version":3,"names":["_element","require","_compose","_keycodes","_richText","useDelete","props","propsRef","useRef","current","useRefEffect","element","onKeyDown","event","keyCode","defaultPrevented","value","onMerge","onRemove","DELETE","BACKSPACE","start","end","text","isReverse","hasActiveFormats","activeFormats","length","isCollapsed","isEmpty","preventDefault","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/rich-text/use-delete.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport { DELETE, BACKSPACE } from '@wordpress/keycodes';\nimport { isCollapsed, isEmpty } from '@wordpress/rich-text';\n\nexport function useDelete( props ) {\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tconst { keyCode } = event;\n\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { value, onMerge, onRemove } = propsRef.current;\n\n\t\t\tif ( keyCode === DELETE || keyCode === BACKSPACE ) {\n\t\t\t\tconst { start, end, text } = value;\n\t\t\t\tconst isReverse = keyCode === BACKSPACE;\n\t\t\t\tconst hasActiveFormats =\n\t\t\t\t\tvalue.activeFormats && !! value.activeFormats.length;\n\n\t\t\t\t// Only process delete if the key press occurs at an uncollapsed edge.\n\t\t\t\tif (\n\t\t\t\t\t! isCollapsed( value ) ||\n\t\t\t\t\thasActiveFormats ||\n\t\t\t\t\t( isReverse && start !== 0 ) ||\n\t\t\t\t\t( ! isReverse && end !== text.length )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( onMerge ) {\n\t\t\t\t\tonMerge( ! isReverse );\n\t\t\t\t}\n\n\t\t\t\t// Only handle remove on Backspace. This serves dual-purpose of being\n\t\t\t\t// an intentional user interaction distinguishing between Backspace and\n\t\t\t\t// Delete to remove the empty field, but also to avoid merge & remove\n\t\t\t\t// causing destruction of two fields (merge, then removed merged).\n\t\t\t\telse if ( onRemove && isEmpty( value ) && isReverse ) {\n\t\t\t\t\tonRemove( ! isReverse );\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\telement.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\telement.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMO,SAASI,SAASA,CAAEC,KAAK,EAAG;EAClC,MAAMC,QAAQ,GAAG,IAAAC,eAAM,EAAEF,KAAM,CAAC;EAChCC,QAAQ,CAACE,OAAO,GAAGH,KAAK;EACxB,OAAO,IAAAI,qBAAY,EAAIC,OAAO,IAAM;IACnC,SAASC,SAASA,CAAEC,KAAK,EAAG;MAC3B,MAAM;QAAEC;MAAQ,CAAC,GAAGD,KAAK;MAEzB,IAAKA,KAAK,CAACE,gBAAgB,EAAG;QAC7B;MACD;MAEA,MAAM;QAAEC,KAAK;QAAEC,OAAO;QAAEC;MAAS,CAAC,GAAGX,QAAQ,CAACE,OAAO;MAErD,IAAKK,OAAO,KAAKK,gBAAM,IAAIL,OAAO,KAAKM,mBAAS,EAAG;QAClD,MAAM;UAAEC,KAAK;UAAEC,GAAG;UAAEC;QAAK,CAAC,GAAGP,KAAK;QAClC,MAAMQ,SAAS,GAAGV,OAAO,KAAKM,mBAAS;QACvC,MAAMK,gBAAgB,GACrBT,KAAK,CAACU,aAAa,IAAI,CAAC,CAAEV,KAAK,CAACU,aAAa,CAACC,MAAM;;QAErD;QACA,IACC,CAAE,IAAAC,qBAAW,EAAEZ,KAAM,CAAC,IACtBS,gBAAgB,IACdD,SAAS,IAAIH,KAAK,KAAK,CAAG,IAC1B,CAAEG,SAAS,IAAIF,GAAG,KAAKC,IAAI,CAACI,MAAQ,EACrC;UACD;QACD;QAEA,IAAKV,OAAO,EAAG;UACdA,OAAO,CAAE,CAAEO,SAAU,CAAC;QACvB;;QAEA;QACA;QACA;QACA;QAAA,KACK,IAAKN,QAAQ,IAAI,IAAAW,iBAAO,EAAEb,KAAM,CAAC,IAAIQ,SAAS,EAAG;UACrDN,QAAQ,CAAE,CAAEM,SAAU,CAAC;QACxB;QAEAX,KAAK,CAACiB,cAAc,CAAC,CAAC;MACvB;IACD;IAEAnB,OAAO,CAACoB,gBAAgB,CAAE,SAAS,EAAEnB,SAAU,CAAC;IAChD,OAAO,MAAM;MACZD,OAAO,CAACqB,mBAAmB,CAAE,SAAS,EAAEpB,SAAU,CAAC;IACpD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
@@ -57,22 +57,6 @@ function usePasteHandler(props) {
57
57
  onChange((0, _richText.insert)(value, plainText));
58
58
  return;
59
59
  }
60
- const transformed = formatTypes.reduce((accumlator, {
61
- __unstablePasteRule
62
- }) => {
63
- // Only allow one transform.
64
- if (__unstablePasteRule && accumlator === value) {
65
- accumlator = __unstablePasteRule(value, {
66
- html,
67
- plainText
68
- });
69
- }
70
- return accumlator;
71
- }, value);
72
- if (transformed !== value) {
73
- onChange(transformed);
74
- return;
75
- }
76
60
  const isInternal = event.clipboardData.getData('rich-text') === 'true';
77
61
 
78
62
  // If the data comes from a rich text instance, we can directly use it
@@ -121,7 +105,10 @@ function usePasteHandler(props) {
121
105
  return;
122
106
  }
123
107
  let mode = onReplace && onSplit ? 'AUTO' : 'INLINE';
124
- if (__unstableEmbedURLOnPaste && (0, _richText.isEmpty)(value) && (0, _url.isURL)(plainText.trim())) {
108
+ const trimmedPlainText = plainText.trim();
109
+ if (__unstableEmbedURLOnPaste && (0, _richText.isEmpty)(value) && (0, _url.isURL)(trimmedPlainText) &&
110
+ // For the link pasting feature, allow only http(s) protocols.
111
+ /^https?:/.test(trimmedPlainText)) {
125
112
  mode = 'BLOCKS';
126
113
  }
127
114
  const content = (0, _blocks.pasteHandler)({
@@ -132,11 +119,27 @@ function usePasteHandler(props) {
132
119
  preserveWhiteSpace
133
120
  });
134
121
  if (typeof content === 'string') {
135
- const valueToInsert = (0, _richText.create)({
136
- html: content
137
- });
138
- (0, _utils.addActiveFormats)(valueToInsert, value.activeFormats);
139
- onChange((0, _richText.insert)(value, valueToInsert));
122
+ const transformed = formatTypes.reduce((accumlator, {
123
+ __unstablePasteRule
124
+ }) => {
125
+ // Only allow one transform.
126
+ if (__unstablePasteRule && accumlator === value) {
127
+ accumlator = __unstablePasteRule(value, {
128
+ html,
129
+ plainText
130
+ });
131
+ }
132
+ return accumlator;
133
+ }, value);
134
+ if (transformed !== value) {
135
+ onChange(transformed);
136
+ } else {
137
+ const valueToInsert = (0, _richText.create)({
138
+ html: content
139
+ });
140
+ (0, _utils.addActiveFormats)(valueToInsert, value.activeFormats);
141
+ onChange((0, _richText.insert)(value, valueToInsert));
142
+ }
140
143
  } else if (content.length > 0) {
141
144
  if (onReplace && (0, _richText.isEmpty)(value)) {
142
145
  onReplace(content, content.length - 1, -1);
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_compose","_blocks","_richText","_url","_utils","_splitValue","_pasting","usePasteHandler","props","propsRef","useRef","current","useRefEffect","element","_onPaste","event","isSelected","disableFormats","onChange","value","formatTypes","tagName","onReplace","onSplit","__unstableEmbedURLOnPaste","preserveWhiteSpace","pastePlainText","plainText","html","files","getPasteEventData","preventDefault","window","console","log","insert","transformed","reduce","accumlator","__unstablePasteRule","isInternal","clipboardData","getData","pastedValue","create","addActiveFormats","activeFormats","text","length","fromTransforms","getBlockTransforms","blocks","accumulator","file","transformation","findTransform","transform","type","isMatch","push","flat","isEmpty","splitValue","pastedBlocks","mode","isURL","trim","content","pasteHandler","HTML","valueToInsert","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/rich-text/use-paste-handler.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport {\n\tpasteHandler,\n\tfindTransform,\n\tgetBlockTransforms,\n} from '@wordpress/blocks';\nimport { isEmpty, insert, create } from '@wordpress/rich-text';\nimport { isURL } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { addActiveFormats } from './utils';\nimport { splitValue } from './split-value';\nimport { getPasteEventData } from '../../utils/pasting';\n\n/** @typedef {import('@wordpress/rich-text').RichTextValue} RichTextValue */\n\nexport function usePasteHandler( props ) {\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction _onPaste( event ) {\n\t\t\tconst {\n\t\t\t\tisSelected,\n\t\t\t\tdisableFormats,\n\t\t\t\tonChange,\n\t\t\t\tvalue,\n\t\t\t\tformatTypes,\n\t\t\t\ttagName,\n\t\t\t\tonReplace,\n\t\t\t\tonSplit,\n\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t\tpastePlainText,\n\t\t\t} = propsRef.current;\n\n\t\t\tif ( ! isSelected ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { plainText, html, files } = getPasteEventData( event );\n\n\t\t\tevent.preventDefault();\n\n\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\t\tif ( disableFormats ) {\n\t\t\t\tonChange( insert( value, plainText ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst transformed = formatTypes.reduce(\n\t\t\t\t( accumlator, { __unstablePasteRule } ) => {\n\t\t\t\t\t// Only allow one transform.\n\t\t\t\t\tif ( __unstablePasteRule && accumlator === value ) {\n\t\t\t\t\t\taccumlator = __unstablePasteRule( value, {\n\t\t\t\t\t\t\thtml,\n\t\t\t\t\t\t\tplainText,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn accumlator;\n\t\t\t\t},\n\t\t\t\tvalue\n\t\t\t);\n\n\t\t\tif ( transformed !== value ) {\n\t\t\t\tonChange( transformed );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isInternal =\n\t\t\t\tevent.clipboardData.getData( 'rich-text' ) === 'true';\n\n\t\t\t// If the data comes from a rich text instance, we can directly use it\n\t\t\t// without filtering the data. The filters are only meant for externally\n\t\t\t// pasted content and remove inline styles.\n\t\t\tif ( isInternal ) {\n\t\t\t\tconst pastedValue = create( {\n\t\t\t\t\thtml,\n\t\t\t\t\tpreserveWhiteSpace,\n\t\t\t\t} );\n\t\t\t\taddActiveFormats( pastedValue, value.activeFormats );\n\t\t\t\tonChange( insert( value, pastedValue ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( pastePlainText ) {\n\t\t\t\tonChange( insert( value, create( { text: plainText } ) ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( files?.length ) {\n\t\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\twindow.console.log( 'Received items:\\n\\n', files );\n\n\t\t\t\tconst fromTransforms = getBlockTransforms( 'from' );\n\t\t\t\tconst blocks = files\n\t\t\t\t\t.reduce( ( accumulator, file ) => {\n\t\t\t\t\t\tconst transformation = findTransform(\n\t\t\t\t\t\t\tfromTransforms,\n\t\t\t\t\t\t\t( transform ) =>\n\t\t\t\t\t\t\t\ttransform.type === 'files' &&\n\t\t\t\t\t\t\t\ttransform.isMatch( [ file ] )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( transformation ) {\n\t\t\t\t\t\t\taccumulator.push(\n\t\t\t\t\t\t\t\ttransformation.transform( [ file ] )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t}, [] )\n\t\t\t\t\t.flat();\n\t\t\t\tif ( ! blocks.length ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( onReplace && isEmpty( value ) ) {\n\t\t\t\t\tonReplace( blocks );\n\t\t\t\t} else {\n\t\t\t\t\tsplitValue( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tpastedBlocks: blocks,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet mode = onReplace && onSplit ? 'AUTO' : 'INLINE';\n\n\t\t\tif (\n\t\t\t\t__unstableEmbedURLOnPaste &&\n\t\t\t\tisEmpty( value ) &&\n\t\t\t\tisURL( plainText.trim() )\n\t\t\t) {\n\t\t\t\tmode = 'BLOCKS';\n\t\t\t}\n\n\t\t\tconst content = pasteHandler( {\n\t\t\t\tHTML: html,\n\t\t\t\tplainText,\n\t\t\t\tmode,\n\t\t\t\ttagName,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\n\t\t\tif ( typeof content === 'string' ) {\n\t\t\t\tconst valueToInsert = create( { html: content } );\n\t\t\t\taddActiveFormats( valueToInsert, value.activeFormats );\n\t\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t\t} else if ( content.length > 0 ) {\n\t\t\t\tif ( onReplace && isEmpty( value ) ) {\n\t\t\t\t\tonReplace( content, content.length - 1, -1 );\n\t\t\t\t} else {\n\t\t\t\t\tsplitValue( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tpastedBlocks: content,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\telement.addEventListener( 'paste', _onPaste );\n\t\treturn () => {\n\t\t\telement.removeEventListener( 'paste', _onPaste );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAKA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAA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GAAG,CAAC,EAAE,CAAC,CAAE,CAAC;QAC7C,CAAC,MAAM;UACN,IAAAc,sBAAU,EAAE;YACX3C,KAAK;YACL4C,YAAY,EAAEI,OAAO;YACrB7C,SAAS;YACTC;UACD,CAAE,CAAC;QACJ;MACD;IACD;IAEAV,OAAO,CAAC0D,gBAAgB,CAAE,OAAO,EAAEzD,QAAS,CAAC;IAC7C,OAAO,MAAM;MACZD,OAAO,CAAC2D,mBAAmB,CAAE,OAAO,EAAE1D,QAAS,CAAC;IACjD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
1
+ {"version":3,"names":["_element","require","_compose","_blocks","_richText","_url","_utils","_splitValue","_pasting","usePasteHandler","props","propsRef","useRef","current","useRefEffect","element","_onPaste","event","isSelected","disableFormats","onChange","value","formatTypes","tagName","onReplace","onSplit","__unstableEmbedURLOnPaste","preserveWhiteSpace","pastePlainText","plainText","html","files","getPasteEventData","preventDefault","window","console","log","insert","isInternal","clipboardData","getData","pastedValue","create","addActiveFormats","activeFormats","text","length","fromTransforms","getBlockTransforms","blocks","reduce","accumulator","file","transformation","findTransform","transform","type","isMatch","push","flat","isEmpty","splitValue","pastedBlocks","mode","trimmedPlainText","trim","isURL","test","content","pasteHandler","HTML","transformed","accumlator","__unstablePasteRule","valueToInsert","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/rich-text/use-paste-handler.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useRefEffect } from '@wordpress/compose';\nimport {\n\tpasteHandler,\n\tfindTransform,\n\tgetBlockTransforms,\n} from '@wordpress/blocks';\nimport { isEmpty, insert, create } from '@wordpress/rich-text';\nimport { isURL } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { addActiveFormats } from './utils';\nimport { splitValue } from './split-value';\nimport { getPasteEventData } from '../../utils/pasting';\n\n/** @typedef {import('@wordpress/rich-text').RichTextValue} RichTextValue */\n\nexport function usePasteHandler( props ) {\n\tconst propsRef = useRef( props );\n\tpropsRef.current = props;\n\treturn useRefEffect( ( element ) => {\n\t\tfunction _onPaste( event ) {\n\t\t\tconst {\n\t\t\t\tisSelected,\n\t\t\t\tdisableFormats,\n\t\t\t\tonChange,\n\t\t\t\tvalue,\n\t\t\t\tformatTypes,\n\t\t\t\ttagName,\n\t\t\t\tonReplace,\n\t\t\t\tonSplit,\n\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t\tpastePlainText,\n\t\t\t} = propsRef.current;\n\n\t\t\tif ( ! isSelected ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { plainText, html, files } = getPasteEventData( event );\n\n\t\t\tevent.preventDefault();\n\n\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\t\tif ( disableFormats ) {\n\t\t\t\tonChange( insert( value, plainText ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isInternal =\n\t\t\t\tevent.clipboardData.getData( 'rich-text' ) === 'true';\n\n\t\t\t// If the data comes from a rich text instance, we can directly use it\n\t\t\t// without filtering the data. The filters are only meant for externally\n\t\t\t// pasted content and remove inline styles.\n\t\t\tif ( isInternal ) {\n\t\t\t\tconst pastedValue = create( {\n\t\t\t\t\thtml,\n\t\t\t\t\tpreserveWhiteSpace,\n\t\t\t\t} );\n\t\t\t\taddActiveFormats( pastedValue, value.activeFormats );\n\t\t\t\tonChange( insert( value, pastedValue ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( pastePlainText ) {\n\t\t\t\tonChange( insert( value, create( { text: plainText } ) ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( files?.length ) {\n\t\t\t\t// Allows us to ask for this information when we get a report.\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\twindow.console.log( 'Received items:\\n\\n', files );\n\n\t\t\t\tconst fromTransforms = getBlockTransforms( 'from' );\n\t\t\t\tconst blocks = files\n\t\t\t\t\t.reduce( ( accumulator, file ) => {\n\t\t\t\t\t\tconst transformation = findTransform(\n\t\t\t\t\t\t\tfromTransforms,\n\t\t\t\t\t\t\t( transform ) =>\n\t\t\t\t\t\t\t\ttransform.type === 'files' &&\n\t\t\t\t\t\t\t\ttransform.isMatch( [ file ] )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( transformation ) {\n\t\t\t\t\t\t\taccumulator.push(\n\t\t\t\t\t\t\t\ttransformation.transform( [ file ] )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t}, [] )\n\t\t\t\t\t.flat();\n\t\t\t\tif ( ! blocks.length ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( onReplace && isEmpty( value ) ) {\n\t\t\t\t\tonReplace( blocks );\n\t\t\t\t} else {\n\t\t\t\t\tsplitValue( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tpastedBlocks: blocks,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet mode = onReplace && onSplit ? 'AUTO' : 'INLINE';\n\n\t\t\tconst trimmedPlainText = plainText.trim();\n\n\t\t\tif (\n\t\t\t\t__unstableEmbedURLOnPaste &&\n\t\t\t\tisEmpty( value ) &&\n\t\t\t\tisURL( trimmedPlainText ) &&\n\t\t\t\t// For the link pasting feature, allow only http(s) protocols.\n\t\t\t\t/^https?:/.test( trimmedPlainText )\n\t\t\t) {\n\t\t\t\tmode = 'BLOCKS';\n\t\t\t}\n\n\t\t\tconst content = pasteHandler( {\n\t\t\t\tHTML: html,\n\t\t\t\tplainText,\n\t\t\t\tmode,\n\t\t\t\ttagName,\n\t\t\t\tpreserveWhiteSpace,\n\t\t\t} );\n\n\t\t\tif ( typeof content === 'string' ) {\n\t\t\t\tconst transformed = formatTypes.reduce(\n\t\t\t\t\t( accumlator, { __unstablePasteRule } ) => {\n\t\t\t\t\t\t// Only allow one transform.\n\t\t\t\t\t\tif ( __unstablePasteRule && accumlator === value ) {\n\t\t\t\t\t\t\taccumlator = __unstablePasteRule( value, {\n\t\t\t\t\t\t\t\thtml,\n\t\t\t\t\t\t\t\tplainText,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn accumlator;\n\t\t\t\t\t},\n\t\t\t\t\tvalue\n\t\t\t\t);\n\n\t\t\t\tif ( transformed !== value ) {\n\t\t\t\t\tonChange( transformed );\n\t\t\t\t} else {\n\t\t\t\t\tconst valueToInsert = create( { html: content } );\n\t\t\t\t\taddActiveFormats( valueToInsert, value.activeFormats );\n\t\t\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t\t\t}\n\t\t\t} else if ( content.length > 0 ) {\n\t\t\t\tif ( onReplace && isEmpty( value ) ) {\n\t\t\t\t\tonReplace( content, content.length - 1, -1 );\n\t\t\t\t} else {\n\t\t\t\t\tsplitValue( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tpastedBlocks: content,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\telement.addEventListener( 'paste', _onPaste );\n\t\treturn () => {\n\t\t\telement.removeEventListener( 'paste', _onPaste );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAKA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAlBA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AAE,CAAC,CAAE,CAAC;QAC7C,CAAC,MAAM;UACN,IAAAe,sBAAU,EAAE;YACXxC,KAAK;YACLyC,YAAY,EAAEM,OAAO;YACrB5C,SAAS;YACTC;UACD,CAAE,CAAC;QACJ;MACD;IACD;IAEAV,OAAO,CAAC4D,gBAAgB,CAAE,OAAO,EAAE3D,QAAS,CAAC;IAC7C,OAAO,MAAM;MACZD,OAAO,CAAC6D,mBAAmB,CAAE,OAAO,EAAE5D,QAAS,CAAC;IACjD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
@@ -47,6 +47,94 @@ const CUSTOM_VALUE_SETTINGS = {
47
47
  rm: {
48
48
  max: 10,
49
49
  steps: 0.1
50
+ },
51
+ svw: {
52
+ max: 100,
53
+ steps: 1
54
+ },
55
+ lvw: {
56
+ max: 100,
57
+ steps: 1
58
+ },
59
+ dvw: {
60
+ max: 100,
61
+ steps: 1
62
+ },
63
+ svh: {
64
+ max: 100,
65
+ steps: 1
66
+ },
67
+ lvh: {
68
+ max: 100,
69
+ steps: 1
70
+ },
71
+ dvh: {
72
+ max: 100,
73
+ steps: 1
74
+ },
75
+ vi: {
76
+ max: 100,
77
+ steps: 1
78
+ },
79
+ svi: {
80
+ max: 100,
81
+ steps: 1
82
+ },
83
+ lvi: {
84
+ max: 100,
85
+ steps: 1
86
+ },
87
+ dvi: {
88
+ max: 100,
89
+ steps: 1
90
+ },
91
+ vb: {
92
+ max: 100,
93
+ steps: 1
94
+ },
95
+ svb: {
96
+ max: 100,
97
+ steps: 1
98
+ },
99
+ lvb: {
100
+ max: 100,
101
+ steps: 1
102
+ },
103
+ dvb: {
104
+ max: 100,
105
+ steps: 1
106
+ },
107
+ vmin: {
108
+ max: 100,
109
+ steps: 1
110
+ },
111
+ svmin: {
112
+ max: 100,
113
+ steps: 1
114
+ },
115
+ lvmin: {
116
+ max: 100,
117
+ steps: 1
118
+ },
119
+ dvmin: {
120
+ max: 100,
121
+ steps: 1
122
+ },
123
+ vmax: {
124
+ max: 100,
125
+ steps: 1
126
+ },
127
+ svmax: {
128
+ max: 100,
129
+ steps: 1
130
+ },
131
+ lvmax: {
132
+ max: 100,
133
+ steps: 1
134
+ },
135
+ dvmax: {
136
+ max: 100,
137
+ steps: 1
50
138
  }
51
139
  };
52
140
  function SpacingInputControl({
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_data","_element","_compose","_i18n","_icons","_useSetting","_interopRequireDefault","_store","_utils","CUSTOM_VALUE_SETTINGS","px","max","steps","vw","vh","em","rm","SpacingInputControl","icon","isMixed","minimumCustomValue","onChange","onMouseOut","onMouseOver","showSideInLabel","side","spacingSizes","type","value","_CUSTOM_VALUE_SETTING","_CUSTOM_VALUE_SETTING2","getPresetValueFromCustomValue","selectListSizes","showRangeControl","length","disableCustomSpacingSizes","useSelect","select","editorSettings","blockEditorStore","getSettings","showCustomValueControl","setShowCustomValueControl","useState","undefined","isValueSpacingPreset","previousValue","usePrevious","units","useCustomUnits","availableUnits","useSetting","currentValue","showCustomValueInSelectList","name","sprintf","__","slug","size","getSliderValueFromPreset","getCustomValueFromPreset","selectedUnit","useMemo","parseQuantityAndUnitFromRawValue","setInitialValue","customTooltipContent","newValue","customRangeValue","parseFloat","getNewCustomValue","newSize","isNumeric","isNaN","nextValue","getNewPresetValue","controlType","parseInt","handleCustomValueSliderChange","next","join","allPlaceholder","options","map","index","key","marks","_newValue","label","sideLabel","ALL_SIDES","includes","LABELS","typeLabel","toLowerCase","ariaLabel","trim","_react","createElement","__experimentalHStack","className","Icon","Fragment","__experimentalUnitControl","onFocus","onBlur","min","placeholder","disableUnits","hideLabelFromVision","RangeControl","step","withInputField","__nextHasNoMarginBottom","onMouseDown","event","nativeEvent","offsetX","renderTooltipContent","CustomSelectControl","find","option","selection","selectedItem","__nextUnconstrainedWidth","Button","settings","onClick","isPressed","isSmall","iconSize"],"sources":["@wordpress/block-editor/src/components/spacing-sizes-control/input-controls/spacing-input-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCustomSelectControl,\n\tIcon,\n\tRangeControl,\n\t__experimentalHStack as HStack,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { settings } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../../use-setting';\nimport { store as blockEditorStore } from '../../../store';\nimport {\n\tALL_SIDES,\n\tLABELS,\n\tgetSliderValueFromPreset,\n\tgetCustomValueFromPreset,\n\tgetPresetValueFromCustomValue,\n\tisValueSpacingPreset,\n} from '../utils';\n\nconst CUSTOM_VALUE_SETTINGS = {\n\tpx: { max: 300, steps: 1 },\n\t'%': { max: 100, steps: 1 },\n\tvw: { max: 100, steps: 1 },\n\tvh: { max: 100, steps: 1 },\n\tem: { max: 10, steps: 0.1 },\n\trm: { max: 10, steps: 0.1 },\n};\n\nexport default function SpacingInputControl( {\n\ticon,\n\tisMixed = false,\n\tminimumCustomValue,\n\tonChange,\n\tonMouseOut,\n\tonMouseOver,\n\tshowSideInLabel = true,\n\tside,\n\tspacingSizes,\n\ttype,\n\tvalue,\n} ) {\n\t// Treat value as a preset value if the passed in value matches the value of one of the spacingSizes.\n\tvalue = getPresetValueFromCustomValue( value, spacingSizes );\n\n\tlet selectListSizes = spacingSizes;\n\tconst showRangeControl = spacingSizes.length <= 8;\n\n\tconst disableCustomSpacingSizes = useSelect( ( select ) => {\n\t\tconst editorSettings = select( blockEditorStore ).getSettings();\n\t\treturn editorSettings?.disableCustomSpacingSizes;\n\t} );\n\n\tconst [ showCustomValueControl, setShowCustomValueControl ] = useState(\n\t\t! disableCustomSpacingSizes &&\n\t\t\tvalue !== undefined &&\n\t\t\t! isValueSpacingPreset( value )\n\t);\n\n\tconst previousValue = usePrevious( value );\n\tif (\n\t\t!! value &&\n\t\tpreviousValue !== value &&\n\t\t! isValueSpacingPreset( value ) &&\n\t\tshowCustomValueControl !== true\n\t) {\n\t\tsetShowCustomValueControl( true );\n\t}\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],\n\t} );\n\n\tlet currentValue = null;\n\n\tconst showCustomValueInSelectList =\n\t\t! showRangeControl &&\n\t\t! showCustomValueControl &&\n\t\tvalue !== undefined &&\n\t\t( ! isValueSpacingPreset( value ) ||\n\t\t\t( isValueSpacingPreset( value ) && isMixed ) );\n\n\tif ( showCustomValueInSelectList ) {\n\t\tselectListSizes = [\n\t\t\t...spacingSizes,\n\t\t\t{\n\t\t\t\tname: ! isMixed\n\t\t\t\t\t? // translators: A custom measurement, eg. 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 = selectListSizes.length - 1;\n\t} else if ( ! isMixed ) {\n\t\tcurrentValue = ! showCustomValueControl\n\t\t\t? getSliderValueFromPreset( value, spacingSizes )\n\t\t\t: getCustomValueFromPreset( value, spacingSizes );\n\t}\n\n\tconst selectedUnit =\n\t\tuseMemo(\n\t\t\t() => parseQuantityAndUnitFromRawValue( currentValue ),\n\t\t\t[ currentValue ]\n\t\t)[ 1 ] || units[ 0 ].value;\n\n\tconst setInitialValue = () => {\n\t\tif ( value === undefined ) {\n\t\t\tonChange( '0' );\n\t\t}\n\t};\n\n\tconst customTooltipContent = ( newValue ) =>\n\t\tvalue === undefined ? undefined : spacingSizes[ newValue ]?.name;\n\n\tconst customRangeValue = parseFloat( currentValue, 10 );\n\n\tconst getNewCustomValue = ( newSize ) => {\n\t\tconst isNumeric = ! isNaN( parseFloat( newSize ) );\n\t\tconst nextValue = isNumeric ? newSize : undefined;\n\t\treturn nextValue;\n\t};\n\n\tconst getNewPresetValue = ( newSize, controlType ) => {\n\t\tconst size = parseInt( newSize, 10 );\n\n\t\tif ( controlType === 'selectList' ) {\n\t\t\tif ( size === 0 ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif ( size === 1 ) {\n\t\t\t\treturn '0';\n\t\t\t}\n\t\t} else if ( size === 0 ) {\n\t\t\treturn '0';\n\t\t}\n\t\treturn `var:preset|spacing|${ spacingSizes[ newSize ]?.slug }`;\n\t};\n\n\tconst handleCustomValueSliderChange = ( next ) => {\n\t\tonChange( [ next, selectedUnit ].join( '' ) );\n\t};\n\n\tconst allPlaceholder = isMixed ? __( 'Mixed' ) : null;\n\n\tconst options = selectListSizes.map( ( size, index ) => ( {\n\t\tkey: index,\n\t\tname: size.name,\n\t} ) );\n\n\tconst marks = spacingSizes.map( ( _newValue, index ) => ( {\n\t\tvalue: index,\n\t\tlabel: undefined,\n\t} ) );\n\n\tconst sideLabel =\n\t\tALL_SIDES.includes( side ) && showSideInLabel ? LABELS[ side ] : '';\n\tconst typeLabel = showSideInLabel ? type?.toLowerCase() : type;\n\n\tconst ariaLabel = sprintf(\n\t\t// translators: 1: The side of the block being modified (top, bottom, left, All sides etc.). 2. Type of spacing being modified (Padding, margin, etc)\n\t\t__( '%1$s %2$s' ),\n\t\tsideLabel,\n\t\ttypeLabel\n\t).trim();\n\n\treturn (\n\t\t<HStack className=\"spacing-sizes-control__wrapper\">\n\t\t\t{ icon && (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"spacing-sizes-control__icon\"\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tsize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showCustomValueControl && (\n\t\t\t\t<>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t\t\tonChange={ ( newSize ) =>\n\t\t\t\t\t\t\tonChange( getNewCustomValue( newSize ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ currentValue }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tmin={ minimumCustomValue }\n\t\t\t\t\t\tplaceholder={ allPlaceholder }\n\t\t\t\t\t\tdisableUnits={ isMixed }\n\t\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t\tclassName=\"spacing-sizes-control__custom-value-input\"\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t\t\tvalue={ customRangeValue }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tmax={ CUSTOM_VALUE_SETTINGS[ selectedUnit ]?.max ?? 10 }\n\t\t\t\t\t\tstep={\n\t\t\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ selectedUnit ]?.steps ?? 0.1\n\t\t\t\t\t\t}\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\tonChange={ handleCustomValueSliderChange }\n\t\t\t\t\t\tclassName=\"spacing-sizes-control__custom-value-range\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<RangeControl\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tclassName=\"spacing-sizes-control__range-control\"\n\t\t\t\t\tvalue={ currentValue }\n\t\t\t\t\tonChange={ ( newSize ) =>\n\t\t\t\t\t\tonChange( getNewPresetValue( newSize ) )\n\t\t\t\t\t}\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\tif ( event?.nativeEvent?.offsetX < 35 ) {\n\t\t\t\t\t\t\tsetInitialValue();\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\twithInputField={ false }\n\t\t\t\t\taria-valuenow={ currentValue }\n\t\t\t\t\taria-valuetext={ spacingSizes[ currentValue ]?.name }\n\t\t\t\t\trenderTooltipContent={ customTooltipContent }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ spacingSizes.length - 1 }\n\t\t\t\t\tmarks={ marks }\n\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<CustomSelectControl\n\t\t\t\t\tclassName=\"spacing-sizes-control__custom-select-control\"\n\t\t\t\t\tvalue={\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) || '' // passing undefined here causes a downshift controlled/uncontrolled warning\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( selection ) => {\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tgetNewPresetValue(\n\t\t\t\t\t\t\t\tselection.selectedItem.key,\n\t\t\t\t\t\t\t\t'selectList'\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\toptions={ options }\n\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t__nextUnconstrainedWidth={ true }\n\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! disableCustomSpacingSizes && (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tshowCustomValueControl\n\t\t\t\t\t\t\t? __( 'Use size preset' )\n\t\t\t\t\t\t\t: __( 'Set custom size' )\n\t\t\t\t\t}\n\t\t\t\t\ticon={ settings }\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\tisPressed={ showCustomValueControl }\n\t\t\t\t\tisSmall\n\t\t\t\t\tclassName=\"spacing-sizes-control__custom-toggle\"\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAUA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAxBA;AACA;AACA;;AAiBA;AACA;AACA;;AAYA,MAAMU,qBAAqB,GAAG;EAC7BC,EAAE,EAAE;IAAEC,GAAG,EAAE,GAAG;IAAEC,KAAK,EAAE;EAAE,CAAC;EAC1B,GAAG,EAAE;IAAED,GAAG,EAAE,GAAG;IAAEC,KAAK,EAAE;EAAE,CAAC;EAC3BC,EAAE,EAAE;IAAEF,GAAG,EAAE,GAAG;I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,EACJ9C,sBAAsB,GACnB,IAAAe,QAAE,EAAE,iBAAkB,CAAC,GACvB,IAAAA,QAAE,EAAE,iBAAkB,CACzB;IACDtC,IAAI,EAAG2G,eAAU;IACjBC,OAAO,EAAGA,CAAA,KAAM;MACfpF,yBAAyB,CAAE,CAAED,sBAAuB,CAAC;IACtD,CAAG;IACHsF,SAAS,EAAGtF,sBAAwB;IACpCuF,OAAO;IACP7B,SAAS,EAAC,sCAAsC;IAChD8B,QAAQ,EAAG;EAAI,CACf,CAEK,CAAC;AAEX"}
1
+ {"version":3,"names":["_components","require","_data","_element","_compose","_i18n","_icons","_useSetting","_interopRequireDefault","_store","_utils","CUSTOM_VALUE_SETTINGS","px","max","steps","vw","vh","em","rm","svw","lvw","dvw","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","SpacingInputControl","icon","isMixed","minimumCustomValue","onChange","onMouseOut","onMouseOver","showSideInLabel","side","spacingSizes","type","value","_CUSTOM_VALUE_SETTING","_CUSTOM_VALUE_SETTING2","getPresetValueFromCustomValue","selectListSizes","showRangeControl","length","disableCustomSpacingSizes","useSelect","select","editorSettings","blockEditorStore","getSettings","showCustomValueControl","setShowCustomValueControl","useState","undefined","isValueSpacingPreset","previousValue","usePrevious","units","useCustomUnits","availableUnits","useSetting","currentValue","showCustomValueInSelectList","name","sprintf","__","slug","size","getSliderValueFromPreset","getCustomValueFromPreset","selectedUnit","useMemo","parseQuantityAndUnitFromRawValue","setInitialValue","customTooltipContent","newValue","customRangeValue","parseFloat","getNewCustomValue","newSize","isNumeric","isNaN","nextValue","getNewPresetValue","controlType","parseInt","handleCustomValueSliderChange","next","join","allPlaceholder","options","map","index","key","marks","_newValue","label","sideLabel","ALL_SIDES","includes","LABELS","typeLabel","toLowerCase","ariaLabel","trim","_react","createElement","__experimentalHStack","className","Icon","Fragment","__experimentalUnitControl","onFocus","onBlur","min","placeholder","disableUnits","hideLabelFromVision","RangeControl","step","withInputField","__nextHasNoMarginBottom","onMouseDown","event","nativeEvent","offsetX","renderTooltipContent","CustomSelectControl","find","option","selection","selectedItem","__nextUnconstrainedWidth","Button","settings","onClick","isPressed","isSmall","iconSize"],"sources":["@wordpress/block-editor/src/components/spacing-sizes-control/input-controls/spacing-input-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCustomSelectControl,\n\tIcon,\n\tRangeControl,\n\t__experimentalHStack as HStack,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { settings } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../../use-setting';\nimport { store as blockEditorStore } from '../../../store';\nimport {\n\tALL_SIDES,\n\tLABELS,\n\tgetSliderValueFromPreset,\n\tgetCustomValueFromPreset,\n\tgetPresetValueFromCustomValue,\n\tisValueSpacingPreset,\n} from '../utils';\n\nconst CUSTOM_VALUE_SETTINGS = {\n\tpx: { max: 300, steps: 1 },\n\t'%': { max: 100, steps: 1 },\n\tvw: { max: 100, steps: 1 },\n\tvh: { max: 100, steps: 1 },\n\tem: { max: 10, steps: 0.1 },\n\trm: { max: 10, steps: 0.1 },\n\tsvw: { max: 100, steps: 1 },\n\tlvw: { max: 100, steps: 1 },\n\tdvw: { max: 100, steps: 1 },\n\tsvh: { max: 100, steps: 1 },\n\tlvh: { max: 100, steps: 1 },\n\tdvh: { max: 100, steps: 1 },\n\tvi: { max: 100, steps: 1 },\n\tsvi: { max: 100, steps: 1 },\n\tlvi: { max: 100, steps: 1 },\n\tdvi: { max: 100, steps: 1 },\n\tvb: { max: 100, steps: 1 },\n\tsvb: { max: 100, steps: 1 },\n\tlvb: { max: 100, steps: 1 },\n\tdvb: { max: 100, steps: 1 },\n\tvmin: { max: 100, steps: 1 },\n\tsvmin: { max: 100, steps: 1 },\n\tlvmin: { max: 100, steps: 1 },\n\tdvmin: { max: 100, steps: 1 },\n\tvmax: { max: 100, steps: 1 },\n\tsvmax: { max: 100, steps: 1 },\n\tlvmax: { max: 100, steps: 1 },\n\tdvmax: { max: 100, steps: 1 },\n};\n\nexport default function SpacingInputControl( {\n\ticon,\n\tisMixed = false,\n\tminimumCustomValue,\n\tonChange,\n\tonMouseOut,\n\tonMouseOver,\n\tshowSideInLabel = true,\n\tside,\n\tspacingSizes,\n\ttype,\n\tvalue,\n} ) {\n\t// Treat value as a preset value if the passed in value matches the value of one of the spacingSizes.\n\tvalue = getPresetValueFromCustomValue( value, spacingSizes );\n\n\tlet selectListSizes = spacingSizes;\n\tconst showRangeControl = spacingSizes.length <= 8;\n\n\tconst disableCustomSpacingSizes = useSelect( ( select ) => {\n\t\tconst editorSettings = select( blockEditorStore ).getSettings();\n\t\treturn editorSettings?.disableCustomSpacingSizes;\n\t} );\n\n\tconst [ showCustomValueControl, setShowCustomValueControl ] = useState(\n\t\t! disableCustomSpacingSizes &&\n\t\t\tvalue !== undefined &&\n\t\t\t! isValueSpacingPreset( value )\n\t);\n\n\tconst previousValue = usePrevious( value );\n\tif (\n\t\t!! value &&\n\t\tpreviousValue !== value &&\n\t\t! isValueSpacingPreset( value ) &&\n\t\tshowCustomValueControl !== true\n\t) {\n\t\tsetShowCustomValueControl( true );\n\t}\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],\n\t} );\n\n\tlet currentValue = null;\n\n\tconst showCustomValueInSelectList =\n\t\t! showRangeControl &&\n\t\t! showCustomValueControl &&\n\t\tvalue !== undefined &&\n\t\t( ! isValueSpacingPreset( value ) ||\n\t\t\t( isValueSpacingPreset( value ) && isMixed ) );\n\n\tif ( showCustomValueInSelectList ) {\n\t\tselectListSizes = [\n\t\t\t...spacingSizes,\n\t\t\t{\n\t\t\t\tname: ! isMixed\n\t\t\t\t\t? // translators: A custom measurement, eg. 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 = selectListSizes.length - 1;\n\t} else if ( ! isMixed ) {\n\t\tcurrentValue = ! showCustomValueControl\n\t\t\t? getSliderValueFromPreset( value, spacingSizes )\n\t\t\t: getCustomValueFromPreset( value, spacingSizes );\n\t}\n\n\tconst selectedUnit =\n\t\tuseMemo(\n\t\t\t() => parseQuantityAndUnitFromRawValue( currentValue ),\n\t\t\t[ currentValue ]\n\t\t)[ 1 ] || units[ 0 ].value;\n\n\tconst setInitialValue = () => {\n\t\tif ( value === undefined ) {\n\t\t\tonChange( '0' );\n\t\t}\n\t};\n\n\tconst customTooltipContent = ( newValue ) =>\n\t\tvalue === undefined ? undefined : spacingSizes[ newValue ]?.name;\n\n\tconst customRangeValue = parseFloat( currentValue, 10 );\n\n\tconst getNewCustomValue = ( newSize ) => {\n\t\tconst isNumeric = ! isNaN( parseFloat( newSize ) );\n\t\tconst nextValue = isNumeric ? newSize : undefined;\n\t\treturn nextValue;\n\t};\n\n\tconst getNewPresetValue = ( newSize, controlType ) => {\n\t\tconst size = parseInt( newSize, 10 );\n\n\t\tif ( controlType === 'selectList' ) {\n\t\t\tif ( size === 0 ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif ( size === 1 ) {\n\t\t\t\treturn '0';\n\t\t\t}\n\t\t} else if ( size === 0 ) {\n\t\t\treturn '0';\n\t\t}\n\t\treturn `var:preset|spacing|${ spacingSizes[ newSize ]?.slug }`;\n\t};\n\n\tconst handleCustomValueSliderChange = ( next ) => {\n\t\tonChange( [ next, selectedUnit ].join( '' ) );\n\t};\n\n\tconst allPlaceholder = isMixed ? __( 'Mixed' ) : null;\n\n\tconst options = selectListSizes.map( ( size, index ) => ( {\n\t\tkey: index,\n\t\tname: size.name,\n\t} ) );\n\n\tconst marks = spacingSizes.map( ( _newValue, index ) => ( {\n\t\tvalue: index,\n\t\tlabel: undefined,\n\t} ) );\n\n\tconst sideLabel =\n\t\tALL_SIDES.includes( side ) && showSideInLabel ? LABELS[ side ] : '';\n\tconst typeLabel = showSideInLabel ? type?.toLowerCase() : type;\n\n\tconst ariaLabel = sprintf(\n\t\t// translators: 1: The side of the block being modified (top, bottom, left, All sides etc.). 2. Type of spacing being modified (Padding, margin, etc)\n\t\t__( '%1$s %2$s' ),\n\t\tsideLabel,\n\t\ttypeLabel\n\t).trim();\n\n\treturn (\n\t\t<HStack className=\"spacing-sizes-control__wrapper\">\n\t\t\t{ icon && (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"spacing-sizes-control__icon\"\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tsize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showCustomValueControl && (\n\t\t\t\t<>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t\t\tonChange={ ( newSize ) =>\n\t\t\t\t\t\t\tonChange( getNewCustomValue( newSize ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ currentValue }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tmin={ minimumCustomValue }\n\t\t\t\t\t\tplaceholder={ allPlaceholder }\n\t\t\t\t\t\tdisableUnits={ isMixed }\n\t\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t\tclassName=\"spacing-sizes-control__custom-value-input\"\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t\t\tvalue={ customRangeValue }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tmax={ CUSTOM_VALUE_SETTINGS[ selectedUnit ]?.max ?? 10 }\n\t\t\t\t\t\tstep={\n\t\t\t\t\t\t\tCUSTOM_VALUE_SETTINGS[ selectedUnit ]?.steps ?? 0.1\n\t\t\t\t\t\t}\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\tonChange={ handleCustomValueSliderChange }\n\t\t\t\t\t\tclassName=\"spacing-sizes-control__custom-value-range\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<RangeControl\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tclassName=\"spacing-sizes-control__range-control\"\n\t\t\t\t\tvalue={ currentValue }\n\t\t\t\t\tonChange={ ( newSize ) =>\n\t\t\t\t\t\tonChange( getNewPresetValue( newSize ) )\n\t\t\t\t\t}\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\tif ( event?.nativeEvent?.offsetX < 35 ) {\n\t\t\t\t\t\t\tsetInitialValue();\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\twithInputField={ false }\n\t\t\t\t\taria-valuenow={ currentValue }\n\t\t\t\t\taria-valuetext={ spacingSizes[ currentValue ]?.name }\n\t\t\t\t\trenderTooltipContent={ customTooltipContent }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ spacingSizes.length - 1 }\n\t\t\t\t\tmarks={ marks }\n\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<CustomSelectControl\n\t\t\t\t\tclassName=\"spacing-sizes-control__custom-select-control\"\n\t\t\t\t\tvalue={\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) || '' // passing undefined here causes a downshift controlled/uncontrolled warning\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( selection ) => {\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tgetNewPresetValue(\n\t\t\t\t\t\t\t\tselection.selectedItem.key,\n\t\t\t\t\t\t\t\t'selectList'\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\toptions={ options }\n\t\t\t\t\tlabel={ ariaLabel }\n\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t__nextUnconstrainedWidth={ true }\n\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\tonFocus={ onMouseOver }\n\t\t\t\t\tonBlur={ onMouseOut }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! disableCustomSpacingSizes && (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tshowCustomValueControl\n\t\t\t\t\t\t\t? __( 'Use size preset' )\n\t\t\t\t\t\t\t: __( 'Set custom size' )\n\t\t\t\t\t}\n\t\t\t\t\ticon={ settings }\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\tisPressed={ showCustomValueControl }\n\t\t\t\t\tisSmall\n\t\t\t\t\tclassName=\"spacing-sizes-control__custom-toggle\"\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAUA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAxBA;AACA;AACA;;AAiBA;AACA;AACA;;AAYA,MAAMU,qBAAqB,GAAG;EAC7BC,EAAE,EAAE;IAAEC,GAAG,EAAE,GAAG;IAAEC,KAAK,EAAE;EAAE,CAAC;EAC1B,GAAG,EAAE;IAAED,GAAG,EAAE,GAAG;IAAEC,KAAK,EAAE;EAAE,CAAC;EAC3BC,EAAE,EAAE;IAAEF,GAAG,EAAE,GAAG;IAAEC,KAAK,EAAE;EAAE,CAAC;EAC1BE,EAAE,EAAE;IAAEH,GAAG,EAAE,GAAG;IAAEC,KAAK,EAAE;EAAE,CAAC;EAC1BG,EAAE,EAAE;IAAEJ,GAAG,EAAE,EAAE;IAAEC,KAAK,EAAE;EAAI,CAAC;EAC3BI,EAAE,EAAE;IAAEL,GAAG,EAAE,EAAE;IAAEC,KAAK,EAAE;EAAI,CAAC;EAC3BK,GAAG,EAAE;IAAEN,GAAG,EAAE,GAAG;IAAEC,KAAK,EAAE;EAAE,CAAC;EAC3BM,GAAG,EAAE;IAAEP,GAAG,EAAE,GAAG;IAAEC,KAAK,EAAE;EAAE,CAAC;EAC3BO,GAAG,EAAE;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A,CAAAC,aAAA,EAACzH,WAAA,CAAAoJ,MAAM;IACNrC,KAAK,EACJ9C,sBAAsB,GACnB,IAAAe,QAAE,EAAE,iBAAkB,CAAC,GACvB,IAAAA,QAAE,EAAE,iBAAkB,CACzB;IACDtC,IAAI,EAAG2G,eAAU;IACjBC,OAAO,EAAGA,CAAA,KAAM;MACfpF,yBAAyB,CAAE,CAAED,sBAAuB,CAAC;IACtD,CAAG;IACHsF,SAAS,EAAGtF,sBAAwB;IACpCuF,OAAO;IACP7B,SAAS,EAAC,sCAAsC;IAChD8B,QAAQ,EAAG;EAAI,CACf,CAEK,CAAC;AAEX"}
@@ -47,8 +47,7 @@ function ToolSelector(props, ref) {
47
47
  label: (0, _i18n.__)('Tools')
48
48
  }),
49
49
  popoverProps: {
50
- placement: 'bottom-start',
51
- variant: undefined
50
+ placement: 'bottom-start'
52
51
  },
53
52
  renderContent: () => (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.NavigableMenu, {
54
53
  role: "menu",
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_data","_element","_icons","_store","selectIcon","_react","createElement","SVG","xmlns","width","height","viewBox","Path","d","ToolSelector","props","ref","mode","useSelect","select","blockEditorStore","__unstableGetEditorMode","__unstableSetEditorMode","useDispatch","Dropdown","renderToggle","isOpen","onToggle","Button","icon","editIcon","onClick","label","__","popoverProps","placement","variant","undefined","renderContent","Fragment","NavigableMenu","role","MenuItemsChoice","value","onSelect","choices","Icon","className","_default","forwardRef","exports","default"],"sources":["@wordpress/block-editor/src/components/tool-selector/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdown,\n\tButton,\n\tMenuItemsChoice,\n\tSVG,\n\tPath,\n\tNavigableMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, edit as editIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nconst selectIcon = (\n\t<SVG\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth=\"24\"\n\t\theight=\"24\"\n\t\tviewBox=\"0 0 24 24\"\n\t>\n\t\t<Path d=\"M9.4 20.5L5.2 3.8l14.6 9-2 .3c-.2 0-.4.1-.7.1-.9.2-1.6.3-2.2.5-.8.3-1.4.5-1.8.8-.4.3-.8.8-1.3 1.5-.4.5-.8 1.2-1.2 2l-.3.6-.9 1.9zM7.6 7.1l2.4 9.3c.2-.4.5-.8.7-1.1.6-.8 1.1-1.4 1.6-1.8.5-.4 1.3-.8 2.2-1.1l1.2-.3-8.1-5z\" />\n\t</SVG>\n);\n\nfunction ToolSelector( props, ref ) {\n\tconst mode = useSelect(\n\t\t( select ) => select( blockEditorStore ).__unstableGetEditorMode(),\n\t\t[]\n\t);\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<Dropdown\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\ticon={ mode === 'navigation' ? selectIcon : editIcon }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\tlabel={ __( 'Tools' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\tpopoverProps={ { placement: 'bottom-start', variant: undefined } }\n\t\t\trenderContent={ () => (\n\t\t\t\t<>\n\t\t\t\t\t<NavigableMenu role=\"menu\" aria-label={ __( 'Tools' ) }>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tmode === 'navigation' ? 'navigation' : 'edit'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonSelect={ __unstableSetEditorMode }\n\t\t\t\t\t\t\tchoices={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: 'edit',\n\t\t\t\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ editIcon } />\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: 'navigation',\n\t\t\t\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t{ selectIcon }\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Select' ) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t<div className=\"block-editor-tool-selector__help\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Tools provide different interactions for selecting, navigating, and editing blocks. Toggle between select and edit by pressing Escape and Enter.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( ToolSelector );\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAQA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAnBA;AACA;AACA;;AAcA;AACA;AACA;;AAGA,MAAMM,UAAU,GACf,IAAAC,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAU,GAAG;EACHC,K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EACJ1B,IAAI,KAAK,YAAY,GAAG,YAAY,GAAG,MACvC;MACD2B,QAAQ,EAAGtB,uBAAyB;MACpCuB,OAAO,EAAG,CACT;QACCF,KAAK,EAAE,MAAM;QACbX,KAAK,EACJ,IAAA3B,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAkC,QAAA,QACC,IAAAlC,MAAA,CAAAC,aAAA,EAACJ,MAAA,CAAA4C,IAAI;UAACjB,IAAI,EAAGC;QAAU,CAAE,CAAC,EACxB,IAAAG,QAAE,EAAE,MAAO,CACZ;MAEJ,CAAC,EACD;QACCU,KAAK,EAAE,YAAY;QACnBX,KAAK,EACJ,IAAA3B,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAkC,QAAA,QACGnC,UAAU,EACV,IAAA6B,QAAE,EAAE,QAAS,CACd;MAEJ,CAAC;IACC,CACH,CACa,CAAC,EAChB,IAAA5B,MAAA,CAAAC,aAAA;MAAKyC,SAAS,EAAC;IAAkC,GAC9C,IAAAd,QAAE,EACH,kJACD,CACI,CACJ;EACA,CACH,CAAC;AAEJ;AAAC,IAAAe,QAAA,GAEc,IAAAC,mBAAU,EAAEnC,YAAa,CAAC;AAAAoC,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
1
+ {"version":3,"names":["_components","require","_i18n","_data","_element","_icons","_store","selectIcon","_react","createElement","SVG","xmlns","width","height","viewBox","Path","d","ToolSelector","props","ref","mode","useSelect","select","blockEditorStore","__unstableGetEditorMode","__unstableSetEditorMode","useDispatch","Dropdown","renderToggle","isOpen","onToggle","Button","icon","editIcon","onClick","label","__","popoverProps","placement","renderContent","Fragment","NavigableMenu","role","MenuItemsChoice","value","onSelect","choices","Icon","className","_default","forwardRef","exports","default"],"sources":["@wordpress/block-editor/src/components/tool-selector/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdown,\n\tButton,\n\tMenuItemsChoice,\n\tSVG,\n\tPath,\n\tNavigableMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, edit as editIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nconst selectIcon = (\n\t<SVG\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\twidth=\"24\"\n\t\theight=\"24\"\n\t\tviewBox=\"0 0 24 24\"\n\t>\n\t\t<Path d=\"M9.4 20.5L5.2 3.8l14.6 9-2 .3c-.2 0-.4.1-.7.1-.9.2-1.6.3-2.2.5-.8.3-1.4.5-1.8.8-.4.3-.8.8-1.3 1.5-.4.5-.8 1.2-1.2 2l-.3.6-.9 1.9zM7.6 7.1l2.4 9.3c.2-.4.5-.8.7-1.1.6-.8 1.1-1.4 1.6-1.8.5-.4 1.3-.8 2.2-1.1l1.2-.3-8.1-5z\" />\n\t</SVG>\n);\n\nfunction ToolSelector( props, ref ) {\n\tconst mode = useSelect(\n\t\t( select ) => select( blockEditorStore ).__unstableGetEditorMode(),\n\t\t[]\n\t);\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<Dropdown\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\ticon={ mode === 'navigation' ? selectIcon : editIcon }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\tlabel={ __( 'Tools' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\trenderContent={ () => (\n\t\t\t\t<>\n\t\t\t\t\t<NavigableMenu role=\"menu\" aria-label={ __( 'Tools' ) }>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tmode === 'navigation' ? 'navigation' : 'edit'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonSelect={ __unstableSetEditorMode }\n\t\t\t\t\t\t\tchoices={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: 'edit',\n\t\t\t\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ editIcon } />\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: 'navigation',\n\t\t\t\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t{ selectIcon }\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Select' ) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t<div className=\"block-editor-tool-selector__help\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Tools provide different interactions for selecting, navigating, and editing blocks. Toggle between select and edit by pressing Escape and Enter.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( ToolSelector );\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAQA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;A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