@wordpress/block-editor 12.18.0 → 12.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/build/components/dimensions-tool/aspect-ratio-tool.js +2 -1
  2. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
  3. package/build/components/global-styles/dimensions-panel.js +30 -5
  4. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  5. package/build/components/global-styles/hooks.js +10 -9
  6. package/build/components/global-styles/hooks.js.map +1 -1
  7. package/build/components/global-styles/typography-panel.js +14 -31
  8. package/build/components/global-styles/typography-panel.js.map +1 -1
  9. package/build/components/global-styles/use-global-styles-output.js +6 -0
  10. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  11. package/build/components/rich-text/index.js +1 -1
  12. package/build/components/rich-text/index.js.map +1 -1
  13. package/build/components/url-popover/image-url-input-ui.js +55 -34
  14. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  15. package/build/components/url-popover/index.js +3 -1
  16. package/build/components/url-popover/index.js.map +1 -1
  17. package/build/components/url-popover/link-editor.js +2 -1
  18. package/build/components/url-popover/link-editor.js.map +1 -1
  19. package/build/components/url-popover/link-viewer.js +2 -1
  20. package/build/components/url-popover/link-viewer.js.map +1 -1
  21. package/build/hooks/dimensions.js +71 -1
  22. package/build/hooks/dimensions.js.map +1 -1
  23. package/build/hooks/index.js +2 -8
  24. package/build/hooks/index.js.map +1 -1
  25. package/build/hooks/index.native.js +0 -6
  26. package/build/hooks/index.native.js.map +1 -1
  27. package/build/hooks/style.js +3 -0
  28. package/build/hooks/style.js.map +1 -1
  29. package/build/hooks/use-bindings-attributes.js +2 -2
  30. package/build/hooks/use-bindings-attributes.js.map +1 -1
  31. package/build/hooks/use-shadow-props.js +0 -15
  32. package/build/hooks/use-shadow-props.js.map +1 -1
  33. package/build/hooks/utils.js +4 -6
  34. package/build/hooks/utils.js.map +1 -1
  35. package/build/index.js +0 -7
  36. package/build/index.js.map +1 -1
  37. package/build/utils/object.js +0 -17
  38. package/build/utils/object.js.map +1 -1
  39. package/build-module/components/dimensions-tool/aspect-ratio-tool.js +2 -1
  40. package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
  41. package/build-module/components/global-styles/dimensions-panel.js +30 -5
  42. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  43. package/build-module/components/global-styles/hooks.js +10 -9
  44. package/build-module/components/global-styles/hooks.js.map +1 -1
  45. package/build-module/components/global-styles/typography-panel.js +15 -32
  46. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  47. package/build-module/components/global-styles/use-global-styles-output.js +6 -0
  48. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  49. package/build-module/components/rich-text/index.js +1 -1
  50. package/build-module/components/rich-text/index.js.map +1 -1
  51. package/build-module/components/url-popover/image-url-input-ui.js +57 -36
  52. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  53. package/build-module/components/url-popover/index.js +3 -1
  54. package/build-module/components/url-popover/index.js.map +1 -1
  55. package/build-module/components/url-popover/link-editor.js +2 -1
  56. package/build-module/components/url-popover/link-editor.js.map +1 -1
  57. package/build-module/components/url-popover/link-viewer.js +2 -1
  58. package/build-module/components/url-popover/link-viewer.js.map +1 -1
  59. package/build-module/hooks/dimensions.js +70 -2
  60. package/build-module/hooks/dimensions.js.map +1 -1
  61. package/build-module/hooks/index.js +3 -2
  62. package/build-module/hooks/index.js.map +1 -1
  63. package/build-module/hooks/index.native.js +1 -1
  64. package/build-module/hooks/index.native.js.map +1 -1
  65. package/build-module/hooks/style.js +3 -0
  66. package/build-module/hooks/style.js.map +1 -1
  67. package/build-module/hooks/use-bindings-attributes.js +2 -2
  68. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  69. package/build-module/hooks/use-shadow-props.js +0 -14
  70. package/build-module/hooks/use-shadow-props.js.map +1 -1
  71. package/build-module/hooks/utils.js +4 -6
  72. package/build-module/hooks/utils.js.map +1 -1
  73. package/build-module/index.js +1 -1
  74. package/build-module/index.js.map +1 -1
  75. package/build-module/utils/object.js +0 -16
  76. package/build-module/utils/object.js.map +1 -1
  77. package/build-style/style-rtl.css +48 -31
  78. package/build-style/style.css +48 -31
  79. package/package.json +4 -4
  80. package/src/components/block-canvas/style.scss +2 -2
  81. package/src/components/dimensions-tool/aspect-ratio-tool.js +4 -1
  82. package/src/components/global-styles/dimensions-panel.js +50 -1
  83. package/src/components/global-styles/hooks.js +9 -8
  84. package/src/components/global-styles/typography-panel.js +13 -45
  85. package/src/components/global-styles/use-global-styles-output.js +6 -0
  86. package/src/components/media-replace-flow/style.scss +1 -1
  87. package/src/components/rich-text/index.js +1 -2
  88. package/src/components/url-popover/image-url-input-ui.js +86 -37
  89. package/src/components/url-popover/index.js +2 -0
  90. package/src/components/url-popover/link-editor.js +1 -0
  91. package/src/components/url-popover/link-viewer.js +1 -0
  92. package/src/components/url-popover/style.scss +51 -31
  93. package/src/hooks/dimensions.js +74 -3
  94. package/src/hooks/index.js +3 -1
  95. package/src/hooks/index.native.js +1 -1
  96. package/src/hooks/style.js +4 -0
  97. package/src/hooks/use-bindings-attributes.js +2 -5
  98. package/src/hooks/use-shadow-props.js +0 -14
  99. package/src/hooks/utils.js +8 -16
  100. package/src/index.js +0 -1
  101. package/src/utils/object.js +0 -16
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_data","_compose","_richText","_components","_blocks","_autocomplete","_blockEdit","_formatToolbarContainer","_store","_useUndoAutomaticChange","_useMarkPersistent","_usePasteHandler","_useBeforeInputRules","_useInputRules","_useDelete","_useEnter","_useFormatTypes","_useRemoveBrowserShortcuts","_useShortcuts","_useInputEvents","_useInsertReplacementText","_useFirefoxCompat","_formatEdit","_utils","_content","_withDeprecations","_lockUnlock","_shortcut","_toolbarButton","_inputEvent","keyboardShortcutContext","createContext","exports","inputEventContext","removeNativeProps","props","__unstableMobileNoFocusOnMount","deleteEnter","placeholderTextColor","textAlign","selectionColor","tagsToEliminate","disableEditingMenu","fontSize","fontFamily","fontWeight","fontStyle","minWidth","maxWidth","setRef","disableSuggestions","disableAutocorrection","restProps","RichTextWrapper","children","tagName","value","adjustedValue","onChange","adjustedOnChange","isSelected","originalIsSelected","multiline","inlineToolbar","wrapperClassName","autocompleters","onReplace","placeholder","allowedFormats","withoutInteractiveFormatting","onRemove","onMerge","onSplit","__unstableOnSplitAtEnd","onSplitAtEnd","__unstableOnSplitAtDoubleLineEnd","onSplitAtDoubleLineEnd","identifier","preserveWhiteSpace","__unstablePastePlainText","pastePlainText","__unstableEmbedURLOnPaste","__unstableDisableFormats","disableFormats","disableLineBreaks","__unstableAllowPrefixTransformations","forwardedRef","anchorRef","useRef","clientId","isBlockSelected","name","blockName","useBlockEditContext","selector","select","getSelectionStart","getSelectionEnd","getBlockAttributes","blockEditorStore","selectionStart","selectionEnd","blockBindings","metadata","bindings","undefined","attributeKey","shouldDisableEditing","blockTypeAttributes","getBlockType","attributes","getBlockBindingsSource","unlock","attribute","args","Object","entries","source","lockAttributesEditing","offset","useSelect","getBlockRootClientId","selectionChange","useDispatch","adjustedAllowedFormats","getAllowedFormats","hasFormats","length","onSelectionChange","useCallback","start","end","selection","unset","formatTypes","prepareHandlers","valueHandlers","changeHandlers","dependencies","useFormatTypes","addEditorOnlyFormats","reduce","accumulator","fn","text","formats","removeEditorOnlyFormats","forEach","formatType","__experimentalCreatePrepareEditableTree","removeFormat","addInvisibleFormats","getValue","ref","richTextRef","useRichText","html","__unstableFormats","__unstableText","values","changeHandler","__unstableIsSelected","__unstableDependencies","__unstableAfterParse","__unstableBeforeSerialize","__unstableAddInvisibleFormats","autocompleteProps","useBlockEditorAutocompleteProps","completers","record","useMarkPersistent","keyboardShortcuts","Set","inputEvents","onFocus","current","focus","TagName","_react","createElement","Fragment","Provider","Popover","__unstableSlotNameProvider","default","inline","editableContentElement","role","useMergeRefs","useBeforeInputRules","useInputRules","useInsertReplacementText","useRemoveBrowserShortcuts","useShortcuts","useInputEvents","useUndoAutomaticChange","usePasteHandler","useDelete","useEnter","useFirefoxCompat","contentEditable","suppressContentEditableWarning","className","classnames","tabIndex","ForwardedRichTextContainer","withDeprecations","forwardRef","Content","isEmpty","_default"],"sources":["@wordpress/block-editor/src/components/rich-text/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseCallback,\n\tforwardRef,\n\tcreateContext,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport {\n\t__unstableUseRichText as useRichText,\n\tremoveFormat,\n} from '@wordpress/rich-text';\nimport { Popover } from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditorAutocompleteProps } from '../autocomplete';\nimport { useBlockEditContext } from '../block-edit';\nimport FormatToolbarContainer from './format-toolbar-container';\nimport { store as blockEditorStore } from '../../store';\nimport { useUndoAutomaticChange } from './use-undo-automatic-change';\nimport { useMarkPersistent } from './use-mark-persistent';\nimport { usePasteHandler } from './use-paste-handler';\nimport { useBeforeInputRules } from './use-before-input-rules';\nimport { useInputRules } from './use-input-rules';\nimport { useDelete } from './use-delete';\nimport { useEnter } from './use-enter';\nimport { useFormatTypes } from './use-format-types';\nimport { useRemoveBrowserShortcuts } from './use-remove-browser-shortcuts';\nimport { useShortcuts } from './use-shortcuts';\nimport { useInputEvents } from './use-input-events';\nimport { useInsertReplacementText } from './use-insert-replacement-text';\nimport { useFirefoxCompat } from './use-firefox-compat';\nimport FormatEdit from './format-edit';\nimport { getAllowedFormats } from './utils';\nimport { Content } from './content';\nimport { withDeprecations } from './with-deprecations';\nimport { unlock } from '../../lock-unlock';\n\nexport const keyboardShortcutContext = createContext();\nexport const inputEventContext = createContext();\n\n/**\n * Removes props used for the native version of RichText so that they are not\n * passed to the DOM element and log warnings.\n *\n * @param {Object} props Props to filter.\n *\n * @return {Object} Filtered props.\n */\nfunction removeNativeProps( props ) {\n\tconst {\n\t\t__unstableMobileNoFocusOnMount,\n\t\tdeleteEnter,\n\t\tplaceholderTextColor,\n\t\ttextAlign,\n\t\tselectionColor,\n\t\ttagsToEliminate,\n\t\tdisableEditingMenu,\n\t\tfontSize,\n\t\tfontFamily,\n\t\tfontWeight,\n\t\tfontStyle,\n\t\tminWidth,\n\t\tmaxWidth,\n\t\tsetRef,\n\t\tdisableSuggestions,\n\t\tdisableAutocorrection,\n\t\t...restProps\n\t} = props;\n\treturn restProps;\n}\n\nexport function RichTextWrapper(\n\t{\n\t\tchildren,\n\t\ttagName = 'div',\n\t\tvalue: adjustedValue = '',\n\t\tonChange: adjustedOnChange,\n\t\tisSelected: originalIsSelected,\n\t\tmultiline,\n\t\tinlineToolbar,\n\t\twrapperClassName,\n\t\tautocompleters,\n\t\tonReplace,\n\t\tplaceholder,\n\t\tallowedFormats,\n\t\twithoutInteractiveFormatting,\n\t\tonRemove,\n\t\tonMerge,\n\t\tonSplit,\n\t\t__unstableOnSplitAtEnd: onSplitAtEnd,\n\t\t__unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd,\n\t\tidentifier,\n\t\tpreserveWhiteSpace,\n\t\t__unstablePastePlainText: pastePlainText,\n\t\t__unstableEmbedURLOnPaste,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tdisableLineBreaks,\n\t\t__unstableAllowPrefixTransformations,\n\t\t...props\n\t},\n\tforwardedRef\n) {\n\tprops = removeNativeProps( props );\n\n\tconst anchorRef = useRef();\n\tconst {\n\t\tclientId,\n\t\tisSelected: isBlockSelected,\n\t\tname: blockName,\n\t} = useBlockEditContext();\n\tconst selector = ( select ) => {\n\t\t// Avoid subscribing to the block editor store if the block is not\n\t\t// selected.\n\t\tif ( ! isBlockSelected ) {\n\t\t\treturn { isSelected: false };\n\t\t}\n\n\t\tconst { getSelectionStart, getSelectionEnd, getBlockAttributes } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionStart = getSelectionStart();\n\t\tconst selectionEnd = getSelectionEnd();\n\t\tconst blockBindings =\n\t\t\tgetBlockAttributes( clientId )?.metadata?.bindings;\n\n\t\tlet isSelected;\n\n\t\tif ( originalIsSelected === undefined ) {\n\t\t\tisSelected =\n\t\t\t\tselectionStart.clientId === clientId &&\n\t\t\t\tselectionEnd.clientId === clientId &&\n\t\t\t\tselectionStart.attributeKey === identifier;\n\t\t} else if ( originalIsSelected ) {\n\t\t\tisSelected = selectionStart.clientId === clientId;\n\t\t}\n\n\t\t// Disable Rich Text editing if block bindings specify that.\n\t\tlet shouldDisableEditing = false;\n\t\tif ( blockBindings ) {\n\t\t\tconst blockTypeAttributes = getBlockType( blockName ).attributes;\n\t\t\tconst { getBlockBindingsSource } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\tfor ( const [ attribute, args ] of Object.entries(\n\t\t\t\tblockBindings\n\t\t\t) ) {\n\t\t\t\t// If any of the attributes with source \"rich-text\" is part of the bindings,\n\t\t\t\t// has a source with `lockAttributesEditing`, disable it.\n\t\t\t\tif (\n\t\t\t\t\tblockTypeAttributes?.[ attribute ]?.source ===\n\t\t\t\t\t\t'rich-text' &&\n\t\t\t\t\tgetBlockBindingsSource( args.source.name )\n\t\t\t\t\t\t?.lockAttributesEditing\n\t\t\t\t) {\n\t\t\t\t\tshouldDisableEditing = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\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\tshouldDisableEditing,\n\t\t};\n\t};\n\tconst { selectionStart, selectionEnd, isSelected, shouldDisableEditing } =\n\t\tuseSelect( selector, [\n\t\t\tclientId,\n\t\t\tidentifier,\n\t\t\toriginalIsSelected,\n\t\t\tisBlockSelected,\n\t\t] );\n\tconst { getSelectionStart, getSelectionEnd, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { selectionChange } = useDispatch( blockEditorStore );\n\tconst adjustedAllowedFormats = getAllowedFormats( {\n\t\tallowedFormats,\n\t\tdisableFormats,\n\t} );\n\tconst hasFormats =\n\t\t! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;\n\n\tconst onSelectionChange = useCallback(\n\t\t( start, end ) => {\n\t\t\tconst selection = {};\n\t\t\tconst unset = start === undefined && end === undefined;\n\n\t\t\tif ( typeof start === 'number' || unset ) {\n\t\t\t\t// If we are only setting the start (or the end below), which\n\t\t\t\t// means a partial selection, and we're not updating a selection\n\t\t\t\t// with the same client ID, abort. This means the selected block\n\t\t\t\t// is a parent block.\n\t\t\t\tif (\n\t\t\t\t\tend === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionEnd().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.start = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: start,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( typeof end === 'number' || unset ) {\n\t\t\t\tif (\n\t\t\t\t\tstart === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionStart().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.end = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: end,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tselectionChange( selection );\n\t\t},\n\t\t[ clientId, identifier ]\n\t);\n\n\tconst {\n\t\tformatTypes,\n\t\tprepareHandlers,\n\t\tvalueHandlers,\n\t\tchangeHandlers,\n\t\tdependencies,\n\t} = useFormatTypes( {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats: adjustedAllowedFormats,\n\t} );\n\n\tfunction addEditorOnlyFormats( value ) {\n\t\treturn valueHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tfunction removeEditorOnlyFormats( value ) {\n\t\tformatTypes.forEach( ( formatType ) => {\n\t\t\t// Remove formats created by prepareEditableTree, because they are editor only.\n\t\t\tif ( formatType.__experimentalCreatePrepareEditableTree ) {\n\t\t\t\tvalue = removeFormat(\n\t\t\t\t\tvalue,\n\t\t\t\t\tformatType.name,\n\t\t\t\t\t0,\n\t\t\t\t\tvalue.text.length\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn value.formats;\n\t}\n\n\tfunction addInvisibleFormats( value ) {\n\t\treturn prepareHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tconst {\n\t\tvalue,\n\t\tgetValue,\n\t\tonChange,\n\t\tref: richTextRef,\n\t} = useRichText( {\n\t\tvalue: adjustedValue,\n\t\tonChange( html, { __unstableFormats, __unstableText } ) {\n\t\t\tadjustedOnChange( html );\n\t\t\tObject.values( changeHandlers ).forEach( ( changeHandler ) => {\n\t\t\t\tchangeHandler( __unstableFormats, __unstableText );\n\t\t\t} );\n\t\t},\n\t\tselectionStart,\n\t\tselectionEnd,\n\t\tonSelectionChange,\n\t\tplaceholder,\n\t\t__unstableIsSelected: isSelected,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tpreserveWhiteSpace,\n\t\t__unstableDependencies: [ ...dependencies, tagName ],\n\t\t__unstableAfterParse: addEditorOnlyFormats,\n\t\t__unstableBeforeSerialize: removeEditorOnlyFormats,\n\t\t__unstableAddInvisibleFormats: addInvisibleFormats,\n\t} );\n\tconst autocompleteProps = useBlockEditorAutocompleteProps( {\n\t\tonReplace,\n\t\tcompleters: autocompleters,\n\t\trecord: value,\n\t\tonChange,\n\t} );\n\n\tuseMarkPersistent( { html: adjustedValue, value } );\n\n\tconst keyboardShortcuts = useRef( new Set() );\n\tconst inputEvents = useRef( new Set() );\n\n\tfunction onFocus() {\n\t\tanchorRef.current?.focus();\n\t}\n\n\tconst TagName = tagName;\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<keyboardShortcutContext.Provider value={ keyboardShortcuts }>\n\t\t\t\t\t<inputEventContext.Provider value={ inputEvents }>\n\t\t\t\t\t\t<Popover.__unstableSlotNameProvider value=\"__unstable-block-tools-after\">\n\t\t\t\t\t\t\t{ children &&\n\t\t\t\t\t\t\t\tchildren( { value, onChange, onFocus } ) }\n\n\t\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\t\tforwardedRef={ anchorRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover.__unstableSlotNameProvider>\n\t\t\t\t\t</inputEventContext.Provider>\n\t\t\t\t</keyboardShortcutContext.Provider>\n\t\t\t) }\n\t\t\t{ isSelected && hasFormats && (\n\t\t\t\t<FormatToolbarContainer\n\t\t\t\t\tinline={ inlineToolbar }\n\t\t\t\t\teditableContentElement={ anchorRef.current }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<TagName\n\t\t\t\t// Overridable props.\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline={ ! disableLineBreaks }\n\t\t\t\taria-label={ placeholder }\n\t\t\t\t{ ...props }\n\t\t\t\t{ ...autocompleteProps }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\t// Rich text ref must be first because its focus listener\n\t\t\t\t\t// must be set up before any other ref calls .focus() on\n\t\t\t\t\t// mount.\n\t\t\t\t\trichTextRef,\n\t\t\t\t\tforwardedRef,\n\t\t\t\t\tautocompleteProps.ref,\n\t\t\t\t\tprops.ref,\n\t\t\t\t\tuseBeforeInputRules( { value, onChange } ),\n\t\t\t\t\tuseInputRules( {\n\t\t\t\t\t\tgetValue,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\t__unstableAllowPrefixTransformations,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tselectionChange,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseInsertReplacementText(),\n\t\t\t\t\tuseRemoveBrowserShortcuts(),\n\t\t\t\t\tuseShortcuts( keyboardShortcuts ),\n\t\t\t\t\tuseInputEvents( inputEvents ),\n\t\t\t\t\tuseUndoAutomaticChange(),\n\t\t\t\t\tusePasteHandler( {\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tdisableFormats,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\ttagName,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\t\t\tpastePlainText,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseDelete( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonMerge,\n\t\t\t\t\t\tonRemove,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseEnter( {\n\t\t\t\t\t\tremoveEditorOnlyFormats,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tdisableLineBreaks,\n\t\t\t\t\t\tonSplitAtEnd,\n\t\t\t\t\t\tonSplitAtDoubleLineEnd,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseFirefoxCompat(),\n\t\t\t\t\tanchorRef,\n\t\t\t\t] ) }\n\t\t\t\tcontentEditable={ ! shouldDisableEditing }\n\t\t\t\tsuppressContentEditableWarning={ true }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-rich-text__editable',\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'rich-text'\n\t\t\t\t) }\n\t\t\t\t// Setting tabIndex to 0 is unnecessary, the element is already\n\t\t\t\t// focusable because it's contentEditable. This also fixes a\n\t\t\t\t// Safari bug where it's not possible to Shift+Click multi\n\t\t\t\t// select blocks when Shift Clicking into an element with\n\t\t\t\t// tabIndex because Safari will focus the element. However,\n\t\t\t\t// Safari will correctly ignore nested contentEditable elements.\n\t\t\t\ttabIndex={\n\t\t\t\t\tprops.tabIndex === 0 && ! shouldDisableEditing\n\t\t\t\t\t\t? null\n\t\t\t\t\t\t: props.tabIndex\n\t\t\t\t}\n\t\t\t\tdata-wp-block-attribute-key={ identifier }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nconst ForwardedRichTextContainer = withDeprecations(\n\tforwardRef( RichTextWrapper )\n);\n\nForwardedRichTextContainer.Content = Content;\nForwardedRichTextContainer.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\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;AAMA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAIA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,uBAAA,GAAAV,s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AACrC,CAAC;;AAED;AACA;AACA;AAFA,IAAAmF,QAAA,GAGeL,0BAA0B;AAAA7K,OAAA,CAAAwJ,OAAA,GAAA0B,QAAA"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_data","_compose","_richText","_components","_blocks","_autocomplete","_blockEdit","_formatToolbarContainer","_store","_useUndoAutomaticChange","_useMarkPersistent","_usePasteHandler","_useBeforeInputRules","_useInputRules","_useDelete","_useEnter","_useFormatTypes","_useRemoveBrowserShortcuts","_useShortcuts","_useInputEvents","_useInsertReplacementText","_useFirefoxCompat","_formatEdit","_utils","_content","_withDeprecations","_lockUnlock","_shortcut","_toolbarButton","_inputEvent","keyboardShortcutContext","createContext","exports","inputEventContext","removeNativeProps","props","__unstableMobileNoFocusOnMount","deleteEnter","placeholderTextColor","textAlign","selectionColor","tagsToEliminate","disableEditingMenu","fontSize","fontFamily","fontWeight","fontStyle","minWidth","maxWidth","setRef","disableSuggestions","disableAutocorrection","restProps","RichTextWrapper","children","tagName","value","adjustedValue","onChange","adjustedOnChange","isSelected","originalIsSelected","multiline","inlineToolbar","wrapperClassName","autocompleters","onReplace","placeholder","allowedFormats","withoutInteractiveFormatting","onRemove","onMerge","onSplit","__unstableOnSplitAtEnd","onSplitAtEnd","__unstableOnSplitAtDoubleLineEnd","onSplitAtDoubleLineEnd","identifier","preserveWhiteSpace","__unstablePastePlainText","pastePlainText","__unstableEmbedURLOnPaste","__unstableDisableFormats","disableFormats","disableLineBreaks","__unstableAllowPrefixTransformations","forwardedRef","anchorRef","useRef","clientId","isBlockSelected","name","blockName","useBlockEditContext","selector","select","getSelectionStart","getSelectionEnd","getBlockAttributes","blockEditorStore","selectionStart","selectionEnd","blockBindings","metadata","bindings","undefined","attributeKey","shouldDisableEditing","blockTypeAttributes","getBlockType","attributes","getBlockBindingsSource","unlock","attribute","args","Object","entries","source","lockAttributesEditing","offset","useSelect","getBlockRootClientId","selectionChange","useDispatch","adjustedAllowedFormats","getAllowedFormats","hasFormats","length","onSelectionChange","useCallback","start","end","selection","unset","formatTypes","prepareHandlers","valueHandlers","changeHandlers","dependencies","useFormatTypes","addEditorOnlyFormats","reduce","accumulator","fn","text","formats","removeEditorOnlyFormats","forEach","formatType","__experimentalCreatePrepareEditableTree","removeFormat","addInvisibleFormats","getValue","ref","richTextRef","useRichText","html","__unstableFormats","__unstableText","values","changeHandler","__unstableIsSelected","__unstableDependencies","__unstableAfterParse","__unstableBeforeSerialize","__unstableAddInvisibleFormats","autocompleteProps","useBlockEditorAutocompleteProps","completers","record","useMarkPersistent","keyboardShortcuts","Set","inputEvents","onFocus","current","focus","TagName","_react","createElement","Fragment","Provider","Popover","__unstableSlotNameProvider","default","inline","editableContentElement","role","useMergeRefs","useBeforeInputRules","useInputRules","useInsertReplacementText","useRemoveBrowserShortcuts","useShortcuts","useInputEvents","useUndoAutomaticChange","usePasteHandler","useDelete","useEnter","useFirefoxCompat","contentEditable","suppressContentEditableWarning","className","classnames","tabIndex","ForwardedRichTextContainer","withDeprecations","forwardRef","Content","isEmpty","_default"],"sources":["@wordpress/block-editor/src/components/rich-text/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseCallback,\n\tforwardRef,\n\tcreateContext,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport {\n\t__unstableUseRichText as useRichText,\n\tremoveFormat,\n} from '@wordpress/rich-text';\nimport { Popover } from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditorAutocompleteProps } from '../autocomplete';\nimport { useBlockEditContext } from '../block-edit';\nimport FormatToolbarContainer from './format-toolbar-container';\nimport { store as blockEditorStore } from '../../store';\nimport { useUndoAutomaticChange } from './use-undo-automatic-change';\nimport { useMarkPersistent } from './use-mark-persistent';\nimport { usePasteHandler } from './use-paste-handler';\nimport { useBeforeInputRules } from './use-before-input-rules';\nimport { useInputRules } from './use-input-rules';\nimport { useDelete } from './use-delete';\nimport { useEnter } from './use-enter';\nimport { useFormatTypes } from './use-format-types';\nimport { useRemoveBrowserShortcuts } from './use-remove-browser-shortcuts';\nimport { useShortcuts } from './use-shortcuts';\nimport { useInputEvents } from './use-input-events';\nimport { useInsertReplacementText } from './use-insert-replacement-text';\nimport { useFirefoxCompat } from './use-firefox-compat';\nimport FormatEdit from './format-edit';\nimport { getAllowedFormats } from './utils';\nimport { Content } from './content';\nimport { withDeprecations } from './with-deprecations';\nimport { unlock } from '../../lock-unlock';\n\nexport const keyboardShortcutContext = createContext();\nexport const inputEventContext = createContext();\n\n/**\n * Removes props used for the native version of RichText so that they are not\n * passed to the DOM element and log warnings.\n *\n * @param {Object} props Props to filter.\n *\n * @return {Object} Filtered props.\n */\nfunction removeNativeProps( props ) {\n\tconst {\n\t\t__unstableMobileNoFocusOnMount,\n\t\tdeleteEnter,\n\t\tplaceholderTextColor,\n\t\ttextAlign,\n\t\tselectionColor,\n\t\ttagsToEliminate,\n\t\tdisableEditingMenu,\n\t\tfontSize,\n\t\tfontFamily,\n\t\tfontWeight,\n\t\tfontStyle,\n\t\tminWidth,\n\t\tmaxWidth,\n\t\tsetRef,\n\t\tdisableSuggestions,\n\t\tdisableAutocorrection,\n\t\t...restProps\n\t} = props;\n\treturn restProps;\n}\n\nexport function RichTextWrapper(\n\t{\n\t\tchildren,\n\t\ttagName = 'div',\n\t\tvalue: adjustedValue = '',\n\t\tonChange: adjustedOnChange,\n\t\tisSelected: originalIsSelected,\n\t\tmultiline,\n\t\tinlineToolbar,\n\t\twrapperClassName,\n\t\tautocompleters,\n\t\tonReplace,\n\t\tplaceholder,\n\t\tallowedFormats,\n\t\twithoutInteractiveFormatting,\n\t\tonRemove,\n\t\tonMerge,\n\t\tonSplit,\n\t\t__unstableOnSplitAtEnd: onSplitAtEnd,\n\t\t__unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd,\n\t\tidentifier,\n\t\tpreserveWhiteSpace,\n\t\t__unstablePastePlainText: pastePlainText,\n\t\t__unstableEmbedURLOnPaste,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tdisableLineBreaks,\n\t\t__unstableAllowPrefixTransformations,\n\t\t...props\n\t},\n\tforwardedRef\n) {\n\tprops = removeNativeProps( props );\n\n\tconst anchorRef = useRef();\n\tconst {\n\t\tclientId,\n\t\tisSelected: isBlockSelected,\n\t\tname: blockName,\n\t} = useBlockEditContext();\n\tconst selector = ( select ) => {\n\t\t// Avoid subscribing to the block editor store if the block is not\n\t\t// selected.\n\t\tif ( ! isBlockSelected ) {\n\t\t\treturn { isSelected: false };\n\t\t}\n\n\t\tconst { getSelectionStart, getSelectionEnd, getBlockAttributes } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionStart = getSelectionStart();\n\t\tconst selectionEnd = getSelectionEnd();\n\t\tconst blockBindings =\n\t\t\tgetBlockAttributes( clientId )?.metadata?.bindings;\n\n\t\tlet isSelected;\n\n\t\tif ( originalIsSelected === undefined ) {\n\t\t\tisSelected =\n\t\t\t\tselectionStart.clientId === clientId &&\n\t\t\t\tselectionEnd.clientId === clientId &&\n\t\t\t\tselectionStart.attributeKey === identifier;\n\t\t} else if ( originalIsSelected ) {\n\t\t\tisSelected = selectionStart.clientId === clientId;\n\t\t}\n\n\t\t// Disable Rich Text editing if block bindings specify that.\n\t\tlet shouldDisableEditing = false;\n\t\tif ( blockBindings ) {\n\t\t\tconst blockTypeAttributes = getBlockType( blockName ).attributes;\n\t\t\tconst { getBlockBindingsSource } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\tfor ( const [ attribute, args ] of Object.entries(\n\t\t\t\tblockBindings\n\t\t\t) ) {\n\t\t\t\t// If any of the attributes with source \"rich-text\" is part of the bindings,\n\t\t\t\t// has a source with `lockAttributesEditing`, disable it.\n\t\t\t\tif (\n\t\t\t\t\tblockTypeAttributes?.[ attribute ]?.source ===\n\t\t\t\t\t\t'rich-text' &&\n\t\t\t\t\tgetBlockBindingsSource( args.source )?.lockAttributesEditing\n\t\t\t\t) {\n\t\t\t\t\tshouldDisableEditing = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\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\tshouldDisableEditing,\n\t\t};\n\t};\n\tconst { selectionStart, selectionEnd, isSelected, shouldDisableEditing } =\n\t\tuseSelect( selector, [\n\t\t\tclientId,\n\t\t\tidentifier,\n\t\t\toriginalIsSelected,\n\t\t\tisBlockSelected,\n\t\t] );\n\tconst { getSelectionStart, getSelectionEnd, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { selectionChange } = useDispatch( blockEditorStore );\n\tconst adjustedAllowedFormats = getAllowedFormats( {\n\t\tallowedFormats,\n\t\tdisableFormats,\n\t} );\n\tconst hasFormats =\n\t\t! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;\n\n\tconst onSelectionChange = useCallback(\n\t\t( start, end ) => {\n\t\t\tconst selection = {};\n\t\t\tconst unset = start === undefined && end === undefined;\n\n\t\t\tif ( typeof start === 'number' || unset ) {\n\t\t\t\t// If we are only setting the start (or the end below), which\n\t\t\t\t// means a partial selection, and we're not updating a selection\n\t\t\t\t// with the same client ID, abort. This means the selected block\n\t\t\t\t// is a parent block.\n\t\t\t\tif (\n\t\t\t\t\tend === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionEnd().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.start = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: start,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( typeof end === 'number' || unset ) {\n\t\t\t\tif (\n\t\t\t\t\tstart === undefined &&\n\t\t\t\t\tgetBlockRootClientId( clientId ) !==\n\t\t\t\t\t\tgetBlockRootClientId( getSelectionStart().clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselection.end = {\n\t\t\t\t\tclientId,\n\t\t\t\t\tattributeKey: identifier,\n\t\t\t\t\toffset: end,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tselectionChange( selection );\n\t\t},\n\t\t[ clientId, identifier ]\n\t);\n\n\tconst {\n\t\tformatTypes,\n\t\tprepareHandlers,\n\t\tvalueHandlers,\n\t\tchangeHandlers,\n\t\tdependencies,\n\t} = useFormatTypes( {\n\t\tclientId,\n\t\tidentifier,\n\t\twithoutInteractiveFormatting,\n\t\tallowedFormats: adjustedAllowedFormats,\n\t} );\n\n\tfunction addEditorOnlyFormats( value ) {\n\t\treturn valueHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tfunction removeEditorOnlyFormats( value ) {\n\t\tformatTypes.forEach( ( formatType ) => {\n\t\t\t// Remove formats created by prepareEditableTree, because they are editor only.\n\t\t\tif ( formatType.__experimentalCreatePrepareEditableTree ) {\n\t\t\t\tvalue = removeFormat(\n\t\t\t\t\tvalue,\n\t\t\t\t\tformatType.name,\n\t\t\t\t\t0,\n\t\t\t\t\tvalue.text.length\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn value.formats;\n\t}\n\n\tfunction addInvisibleFormats( value ) {\n\t\treturn prepareHandlers.reduce(\n\t\t\t( accumulator, fn ) => fn( accumulator, value.text ),\n\t\t\tvalue.formats\n\t\t);\n\t}\n\n\tconst {\n\t\tvalue,\n\t\tgetValue,\n\t\tonChange,\n\t\tref: richTextRef,\n\t} = useRichText( {\n\t\tvalue: adjustedValue,\n\t\tonChange( html, { __unstableFormats, __unstableText } ) {\n\t\t\tadjustedOnChange( html );\n\t\t\tObject.values( changeHandlers ).forEach( ( changeHandler ) => {\n\t\t\t\tchangeHandler( __unstableFormats, __unstableText );\n\t\t\t} );\n\t\t},\n\t\tselectionStart,\n\t\tselectionEnd,\n\t\tonSelectionChange,\n\t\tplaceholder,\n\t\t__unstableIsSelected: isSelected,\n\t\t__unstableDisableFormats: disableFormats,\n\t\tpreserveWhiteSpace,\n\t\t__unstableDependencies: [ ...dependencies, tagName ],\n\t\t__unstableAfterParse: addEditorOnlyFormats,\n\t\t__unstableBeforeSerialize: removeEditorOnlyFormats,\n\t\t__unstableAddInvisibleFormats: addInvisibleFormats,\n\t} );\n\tconst autocompleteProps = useBlockEditorAutocompleteProps( {\n\t\tonReplace,\n\t\tcompleters: autocompleters,\n\t\trecord: value,\n\t\tonChange,\n\t} );\n\n\tuseMarkPersistent( { html: adjustedValue, value } );\n\n\tconst keyboardShortcuts = useRef( new Set() );\n\tconst inputEvents = useRef( new Set() );\n\n\tfunction onFocus() {\n\t\tanchorRef.current?.focus();\n\t}\n\n\tconst TagName = tagName;\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<keyboardShortcutContext.Provider value={ keyboardShortcuts }>\n\t\t\t\t\t<inputEventContext.Provider value={ inputEvents }>\n\t\t\t\t\t\t<Popover.__unstableSlotNameProvider value=\"__unstable-block-tools-after\">\n\t\t\t\t\t\t\t{ children &&\n\t\t\t\t\t\t\t\tchildren( { value, onChange, onFocus } ) }\n\n\t\t\t\t\t\t\t<FormatEdit\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tformatTypes={ formatTypes }\n\t\t\t\t\t\t\t\tforwardedRef={ anchorRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Popover.__unstableSlotNameProvider>\n\t\t\t\t\t</inputEventContext.Provider>\n\t\t\t\t</keyboardShortcutContext.Provider>\n\t\t\t) }\n\t\t\t{ isSelected && hasFormats && (\n\t\t\t\t<FormatToolbarContainer\n\t\t\t\t\tinline={ inlineToolbar }\n\t\t\t\t\teditableContentElement={ anchorRef.current }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<TagName\n\t\t\t\t// Overridable props.\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline={ ! disableLineBreaks }\n\t\t\t\taria-label={ placeholder }\n\t\t\t\t{ ...props }\n\t\t\t\t{ ...autocompleteProps }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\t// Rich text ref must be first because its focus listener\n\t\t\t\t\t// must be set up before any other ref calls .focus() on\n\t\t\t\t\t// mount.\n\t\t\t\t\trichTextRef,\n\t\t\t\t\tforwardedRef,\n\t\t\t\t\tautocompleteProps.ref,\n\t\t\t\t\tprops.ref,\n\t\t\t\t\tuseBeforeInputRules( { value, onChange } ),\n\t\t\t\t\tuseInputRules( {\n\t\t\t\t\t\tgetValue,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\t__unstableAllowPrefixTransformations,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tselectionChange,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseInsertReplacementText(),\n\t\t\t\t\tuseRemoveBrowserShortcuts(),\n\t\t\t\t\tuseShortcuts( keyboardShortcuts ),\n\t\t\t\t\tuseInputEvents( inputEvents ),\n\t\t\t\t\tuseUndoAutomaticChange(),\n\t\t\t\t\tusePasteHandler( {\n\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\tdisableFormats,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tformatTypes,\n\t\t\t\t\t\ttagName,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\t__unstableEmbedURLOnPaste,\n\t\t\t\t\t\tpastePlainText,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseDelete( {\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonMerge,\n\t\t\t\t\t\tonRemove,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseEnter( {\n\t\t\t\t\t\tremoveEditorOnlyFormats,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tonReplace,\n\t\t\t\t\t\tonSplit,\n\t\t\t\t\t\tonChange,\n\t\t\t\t\t\tdisableLineBreaks,\n\t\t\t\t\t\tonSplitAtEnd,\n\t\t\t\t\t\tonSplitAtDoubleLineEnd,\n\t\t\t\t\t} ),\n\t\t\t\t\tuseFirefoxCompat(),\n\t\t\t\t\tanchorRef,\n\t\t\t\t] ) }\n\t\t\t\tcontentEditable={ ! shouldDisableEditing }\n\t\t\t\tsuppressContentEditableWarning={ true }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-rich-text__editable',\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'rich-text'\n\t\t\t\t) }\n\t\t\t\t// Setting tabIndex to 0 is unnecessary, the element is already\n\t\t\t\t// focusable because it's contentEditable. This also fixes a\n\t\t\t\t// Safari bug where it's not possible to Shift+Click multi\n\t\t\t\t// select blocks when Shift Clicking into an element with\n\t\t\t\t// tabIndex because Safari will focus the element. However,\n\t\t\t\t// Safari will correctly ignore nested contentEditable elements.\n\t\t\t\ttabIndex={\n\t\t\t\t\tprops.tabIndex === 0 && ! shouldDisableEditing\n\t\t\t\t\t\t? null\n\t\t\t\t\t\t: props.tabIndex\n\t\t\t\t}\n\t\t\t\tdata-wp-block-attribute-key={ identifier }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nconst ForwardedRichTextContainer = withDeprecations(\n\tforwardRef( RichTextWrapper )\n);\n\nForwardedRichTextContainer.Content = Content;\nForwardedRichTextContainer.isEmpty = ( value ) => {\n\treturn ! value || value.length === 0;\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;AAMA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAIA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,uBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAX,OAAA;AACA,IAAAY,kBAAA,GAAAZ,OAAA;AACA,IAAAa,gBAAA,GAAAb,OAAA;AACA,IAAAc,oBAAA,GAAAd,OAAA;AACA,IAAAe,cAAA,GAAAf,OAAA;AACA,IAAAgB,UAAA,GAAAhB,OAAA;AACA,IAAAiB,SAAA,GAAAjB,OAAA;AACA,IAAAkB,eAAA,GAAAlB,OAAA;AACA,IAAAmB,0BAAA,GAAAnB,OAAA;AACA,IAAAoB,aAAA,GAAApB,OAAA;AACA,IAAAqB,eAAA,GAAArB,OAAA;AACA,IAAAsB,yBAAA,GAAAtB,OAAA;AACA,IAAAuB,iBAAA,GAAAvB,OAAA;AACA,IAAAwB,WAAA,GAAAzB,sBAAA,CAAAC,OAAA;AACA,IAAAyB,MAAA,GAAAzB,OAAA;AACA,IAAA0B,QAAA,GAAA1B,OAAA;AACA,IAAA2B,iBAAA,GAAA3B,OAAA;AACA,IAAA4B,WAAA,GAAA5B,OAAA;AAiZA,IAAA6B,SAAA,GAAA7B,OAAA;AACA,IAAA8B,cAAA,GAAA9B,OAAA;AACA,IAAA+B,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ACuK,SAAS,EACf,WACD;IACA;IACA;IACA;IACA;IACA;IACA;IAAA;IACAE,QAAQ,EACPzK,KAAK,CAACyK,QAAQ,KAAK,CAAC,IAAI,CAAEjG,oBAAoB,GAC3C,IAAI,GACJxE,KAAK,CAACyK,QACT;IACD,+BAA8B/H;EAAY,CAC1C,CACA,CAAC;AAEL;AAEA,MAAMgI,0BAA0B,GAAG,IAAAC,kCAAgB,EAClD,IAAAC,mBAAU,EAAE1J,eAAgB,CAC7B,CAAC;AAEDwJ,0BAA0B,CAACG,OAAO,GAAGA,gBAAO;AAC5CH,0BAA0B,CAACI,OAAO,GAAKzJ,KAAK,IAAM;EACjD,OAAO,CAAEA,KAAK,IAAIA,KAAK,CAACuE,MAAM,KAAK,CAAC;AACrC,CAAC;;AAED;AACA;AACA;AAFA,IAAAmF,QAAA,GAGeL,0BAA0B;AAAA7K,OAAA,CAAAwJ,OAAA,GAAA0B,QAAA"}
@@ -24,17 +24,6 @@ const LINK_DESTINATION_CUSTOM = 'custom';
24
24
  const LINK_DESTINATION_MEDIA = 'media';
25
25
  const LINK_DESTINATION_ATTACHMENT = 'attachment';
26
26
  const NEW_TAB_REL = ['noreferrer', 'noopener'];
27
- const icon = (0, _react.createElement)(_components.SVG, {
28
- viewBox: "0 0 24 24",
29
- xmlns: "http://www.w3.org/2000/svg"
30
- }, (0, _react.createElement)(_components.Path, {
31
- d: "M0,0h24v24H0V0z",
32
- fill: "none"
33
- }), (0, _react.createElement)(_components.Path, {
34
- d: "m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z"
35
- }), (0, _react.createElement)(_components.Path, {
36
- d: "m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z"
37
- }));
38
27
  const ImageURLInputUI = ({
39
28
  linkDestination,
40
29
  onChangeUrl,
@@ -44,7 +33,10 @@ const ImageURLInputUI = ({
44
33
  mediaLink,
45
34
  linkTarget,
46
35
  linkClass,
47
- rel
36
+ rel,
37
+ showLightboxSetting,
38
+ lightboxEnabled,
39
+ onSetLightbox
48
40
  }) => {
49
41
  const [isOpen, setIsOpen] = (0, _element.useState)(false);
50
42
  // Use internal state instead of a ref to make sure that the component
@@ -113,7 +105,10 @@ const ImageURLInputUI = ({
113
105
  const selectedDestination = getLinkDestinations().find(destination => destination.url === urlInput)?.linkDestination || LINK_DESTINATION_CUSTOM;
114
106
  onChangeUrl({
115
107
  href: urlInput,
116
- linkDestination: selectedDestination
108
+ linkDestination: selectedDestination,
109
+ lightbox: {
110
+ enabled: false
111
+ }
117
112
  });
118
113
  }
119
114
  stopEditLink();
@@ -130,24 +125,16 @@ const ImageURLInputUI = ({
130
125
  const getLinkDestinations = () => {
131
126
  const linkDestinations = [{
132
127
  linkDestination: LINK_DESTINATION_MEDIA,
133
- title: (0, _i18n.__)('Media File'),
128
+ title: (0, _i18n.__)('Link to image file'),
134
129
  url: mediaType === 'image' ? mediaUrl : undefined,
135
- icon
130
+ icon: _icons.image
136
131
  }];
137
132
  if (mediaType === 'image' && mediaLink) {
138
133
  linkDestinations.push({
139
134
  linkDestination: LINK_DESTINATION_ATTACHMENT,
140
- title: (0, _i18n.__)('Attachment Page'),
135
+ title: (0, _i18n.__)('Link to attachment page'),
141
136
  url: mediaType === 'image' ? mediaLink : undefined,
142
- icon: (0, _react.createElement)(_components.SVG, {
143
- viewBox: "0 0 24 24",
144
- xmlns: "http://www.w3.org/2000/svg"
145
- }, (0, _react.createElement)(_components.Path, {
146
- d: "M0 0h24v24H0V0z",
147
- fill: "none"
148
- }), (0, _react.createElement)(_components.Path, {
149
- d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"
150
- }))
137
+ icon: _icons.page
151
138
  });
152
139
  }
153
140
  return linkDestinations;
@@ -197,16 +184,17 @@ const ImageURLInputUI = ({
197
184
  onChange: onSetLinkRel
198
185
  }), (0, _react.createElement)(_components.TextControl, {
199
186
  __nextHasNoMarginBottom: true,
200
- label: (0, _i18n.__)('Link CSS Class'),
187
+ label: (0, _i18n.__)('Link CSS class'),
201
188
  value: linkClass || '',
202
189
  onChange: onSetLinkClass
203
190
  }));
204
191
  const linkEditorValue = urlInput !== null ? urlInput : url;
192
+ const showLinkEditor = (!linkEditorValue && !lightboxEnabled) === true;
205
193
  const urlLabel = (getLinkDestinations().find(destination => destination.linkDestination === linkDestination) || {}).title;
206
194
  return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.ToolbarButton, {
207
195
  icon: _icons.link,
208
196
  className: "components-toolbar__control",
209
- label: url ? (0, _i18n.__)('Edit link') : (0, _i18n.__)('Insert link'),
197
+ label: url ? (0, _i18n.__)('Edit link') : (0, _i18n.__)('Add link'),
210
198
  "aria-expanded": isOpen,
211
199
  onClick: openLinkUI,
212
200
  ref: setPopoverAnchor,
@@ -215,31 +203,64 @@ const ImageURLInputUI = ({
215
203
  anchor: popoverAnchor,
216
204
  onFocusOutside: onFocusOutside(),
217
205
  onClose: closeLinkUI,
218
- renderSettings: () => advancedOptions,
219
- additionalControls: !linkEditorValue && (0, _react.createElement)(_components.NavigableMenu, null, getLinkDestinations().map(link => (0, _react.createElement)(_components.MenuItem, {
206
+ renderSettings: !lightboxEnabled ? () => advancedOptions : null,
207
+ additionalControls: showLinkEditor && (0, _react.createElement)(_components.MenuGroup, null, getLinkDestinations().map(link => (0, _react.createElement)(_components.MenuItem, {
220
208
  key: link.linkDestination,
221
209
  icon: link.icon,
210
+ iconPosition: "left",
222
211
  onClick: () => {
223
212
  setUrlInput(null);
224
213
  onSetHref(link.url);
225
214
  stopEditLink();
226
215
  }
227
- }, link.title)))
228
- }, (!url || isEditingLink) && (0, _react.createElement)(_index.default.LinkEditor, {
216
+ }, link.title)), showLightboxSetting && (0, _react.createElement)(_components.MenuItem, {
217
+ key: "expand-on-click",
218
+ className: "block-editor-url-popover__expand-on-click",
219
+ icon: _icons.fullscreen,
220
+ info: (0, _i18n.__)('Scale the image with a lightbox effect.'),
221
+ iconPosition: "left",
222
+ onClick: () => {
223
+ setUrlInput(null);
224
+ onChangeUrl({
225
+ linkDestination: LINK_DESTINATION_NONE,
226
+ href: ''
227
+ });
228
+ onSetLightbox(true);
229
+ stopEditLink();
230
+ }
231
+ }, (0, _i18n.__)('Expand on click')))
232
+ }, (!url || isEditingLink) && !lightboxEnabled && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_index.default.LinkEditor, {
229
233
  className: "block-editor-format-toolbar__link-container-content",
230
234
  value: linkEditorValue,
231
235
  onChangeInputValue: setUrlInput,
232
236
  onSubmit: onSubmitLinkChange(),
233
237
  autocompleteRef: autocompleteRef
234
- }), url && !isEditingLink && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_index.default.LinkViewer, {
238
+ })), url && !isEditingLink && !lightboxEnabled && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_index.default.LinkViewer, {
235
239
  className: "block-editor-format-toolbar__link-container-content",
236
240
  url: url,
237
241
  onEditLinkClick: startEditLink,
238
242
  urlLabel: urlLabel
239
243
  }), (0, _react.createElement)(_components.Button, {
240
- icon: _icons.close,
244
+ icon: _icons.linkOff,
241
245
  label: (0, _i18n.__)('Remove link'),
242
- onClick: onLinkRemove
246
+ onClick: onLinkRemove,
247
+ size: "compact"
248
+ })), !url && !isEditingLink && lightboxEnabled && (0, _react.createElement)("div", {
249
+ className: "block-editor-url-popover__expand-on-click"
250
+ }, (0, _react.createElement)("div", {
251
+ className: "fullscreen-icon"
252
+ }, _icons.fullscreen), (0, _react.createElement)("div", {
253
+ className: "text"
254
+ }, (0, _react.createElement)("p", null, (0, _i18n.__)('Expand on click')), (0, _react.createElement)("p", {
255
+ className: "description"
256
+ }, (0, _i18n.__)('Scales the image with a lightbox effect'))), (0, _react.createElement)(_components.Button, {
257
+ icon: _icons.linkOff,
258
+ className: "remove-link",
259
+ label: (0, _i18n.__)('Disable expand on click'),
260
+ onClick: () => {
261
+ onSetLightbox(false);
262
+ },
263
+ size: "compact"
243
264
  }))));
244
265
  };
245
266
  exports.__experimentalImageURLInputUI = ImageURLInputUI;
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_components","_icons","_index","_interopRequireDefault","LINK_DESTINATION_NONE","LINK_DESTINATION_CUSTOM","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","NEW_TAB_REL","icon","_react","createElement","SVG","viewBox","xmlns","Path","d","fill","ImageURLInputUI","linkDestination","onChangeUrl","url","mediaType","mediaUrl","mediaLink","linkTarget","linkClass","rel","isOpen","setIsOpen","useState","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","useRef","startEditLink","stopEditLink","closeLinkUI","getUpdatedLinkTargetSettings","value","newLinkTarget","undefined","updatedRel","rels","split","forEach","relVal","includes","push","join","filter","length","onFocusOutside","event","autocompleteElement","current","contains","target","onSubmitLinkChange","selectedDestination","getLinkDestinations","find","destination","href","preventDefault","onLinkRemove","linkDestinations","title","__","onSetHref","linkDestinationInput","onSetNewTab","updatedLinkTarget","onSetLinkRel","onSetLinkClass","advancedOptions","__experimentalVStack","spacing","ToggleControl","__nextHasNoMarginBottom","label","onChange","checked","TextControl","linkEditorValue","urlLabel","Fragment","ToolbarButton","linkIcon","className","onClick","ref","isActive","default","anchor","onClose","renderSettings","additionalControls","NavigableMenu","map","link","MenuItem","key","LinkEditor","onChangeInputValue","onSubmit","LinkViewer","onEditLinkClick","Button","close","exports","__experimentalImageURLInputUI"],"sources":["@wordpress/block-editor/src/components/url-popover/image-url-input-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState } from '@wordpress/element';\nimport {\n\tToolbarButton,\n\tButton,\n\tNavigableMenu,\n\tMenuItem,\n\tToggleControl,\n\tTextControl,\n\tSVG,\n\tPath,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { link as linkIcon, close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLPopover from './index';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\n\nconst icon = (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path d=\"M0,0h24v24H0V0z\" fill=\"none\" />\n\t\t<Path d=\"m19 5v14h-14v-14h14m0-2h-14c-1.1 0-2 0.9-2 2v14c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-14c0-1.1-0.9-2-2-2z\" />\n\t\t<Path d=\"m14.14 11.86l-3 3.87-2.14-2.59-3 3.86h12l-3.86-5.14z\" />\n\t</SVG>\n);\n\nconst ImageURLInputUI = ( {\n\tlinkDestination,\n\tonChangeUrl,\n\turl,\n\tmediaType = 'image',\n\tmediaUrl,\n\tmediaLink,\n\tlinkTarget,\n\tlinkClass,\n\trel,\n} ) => {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst openLinkUI = () => {\n\t\tsetIsOpen( true );\n\t};\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState( false );\n\tconst [ urlInput, setUrlInput ] = useState( null );\n\n\tconst autocompleteRef = useRef( null );\n\n\tconst startEditLink = () => {\n\t\tif (\n\t\t\tlinkDestination === LINK_DESTINATION_MEDIA ||\n\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t) {\n\t\t\tsetUrlInput( '' );\n\t\t}\n\t\tsetIsEditingLink( true );\n\t};\n\n\tconst stopEditLink = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst closeLinkUI = () => {\n\t\tsetUrlInput( null );\n\t\tstopEditLink();\n\t\tsetIsOpen( false );\n\t};\n\n\tconst getUpdatedLinkTargetSettings = ( value ) => {\n\t\tconst newLinkTarget = value ? '_blank' : undefined;\n\n\t\tlet updatedRel;\n\t\tif ( newLinkTarget ) {\n\t\t\tconst rels = ( rel ?? '' ).split( ' ' );\n\t\t\tNEW_TAB_REL.forEach( ( relVal ) => {\n\t\t\t\tif ( ! rels.includes( relVal ) ) {\n\t\t\t\t\trels.push( relVal );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tupdatedRel = rels.join( ' ' );\n\t\t} else {\n\t\t\tconst rels = ( rel ?? '' )\n\t\t\t\t.split( ' ' )\n\t\t\t\t.filter(\n\t\t\t\t\t( relVal ) => NEW_TAB_REL.includes( relVal ) === false\n\t\t\t\t);\n\t\t\tupdatedRel = rels.length ? rels.join( ' ' ) : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tlinkTarget: newLinkTarget,\n\t\t\trel: updatedRel,\n\t\t};\n\t};\n\n\tconst onFocusOutside = () => {\n\t\treturn ( event ) => {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onFocusOutside fails to detect that a click on a suggestion occurred in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tconst autocompleteElement = autocompleteRef.current;\n\t\t\tif (\n\t\t\t\tautocompleteElement &&\n\t\t\t\tautocompleteElement.contains( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsOpen( false );\n\t\t\tsetUrlInput( null );\n\t\t\tstopEditLink();\n\t\t};\n\t};\n\n\tconst onSubmitLinkChange = () => {\n\t\treturn ( event ) => {\n\t\t\tif ( urlInput ) {\n\t\t\t\t// It is possible the entered URL actually matches a named link destination.\n\t\t\t\t// This check will ensure our link destination is correct.\n\t\t\t\tconst selectedDestination =\n\t\t\t\t\tgetLinkDestinations().find(\n\t\t\t\t\t\t( destination ) => destination.url === urlInput\n\t\t\t\t\t)?.linkDestination || LINK_DESTINATION_CUSTOM;\n\n\t\t\t\tonChangeUrl( {\n\t\t\t\t\thref: urlInput,\n\t\t\t\t\tlinkDestination: selectedDestination,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tstopEditLink();\n\t\t\tsetUrlInput( null );\n\t\t\tevent.preventDefault();\n\t\t};\n\t};\n\n\tconst onLinkRemove = () => {\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: LINK_DESTINATION_NONE,\n\t\t\thref: '',\n\t\t} );\n\t};\n\n\tconst getLinkDestinations = () => {\n\t\tconst linkDestinations = [\n\t\t\t{\n\t\t\t\tlinkDestination: LINK_DESTINATION_MEDIA,\n\t\t\t\ttitle: __( 'Media File' ),\n\t\t\t\turl: mediaType === 'image' ? mediaUrl : undefined,\n\t\t\t\ticon,\n\t\t\t},\n\t\t];\n\t\tif ( mediaType === 'image' && mediaLink ) {\n\t\t\tlinkDestinations.push( {\n\t\t\t\tlinkDestination: LINK_DESTINATION_ATTACHMENT,\n\t\t\t\ttitle: __( 'Attachment Page' ),\n\t\t\t\turl: mediaType === 'image' ? mediaLink : undefined,\n\t\t\t\ticon: (\n\t\t\t\t\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t\t\t<Path d=\"M0 0h24v24H0V0z\" fill=\"none\" />\n\t\t\t\t\t\t<Path d=\"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z\" />\n\t\t\t\t\t</SVG>\n\t\t\t\t),\n\t\t\t} );\n\t\t}\n\t\treturn linkDestinations;\n\t};\n\n\tconst onSetHref = ( value ) => {\n\t\tconst linkDestinations = getLinkDestinations();\n\t\tlet linkDestinationInput;\n\t\tif ( ! value ) {\n\t\t\tlinkDestinationInput = LINK_DESTINATION_NONE;\n\t\t} else {\n\t\t\tlinkDestinationInput = (\n\t\t\t\tlinkDestinations.find( ( destination ) => {\n\t\t\t\t\treturn destination.url === value;\n\t\t\t\t} ) || { linkDestination: LINK_DESTINATION_CUSTOM }\n\t\t\t).linkDestination;\n\t\t}\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: linkDestinationInput,\n\t\t\thref: value,\n\t\t} );\n\t};\n\n\tconst onSetNewTab = ( value ) => {\n\t\tconst updatedLinkTarget = getUpdatedLinkTargetSettings( value );\n\t\tonChangeUrl( updatedLinkTarget );\n\t};\n\n\tconst onSetLinkRel = ( value ) => {\n\t\tonChangeUrl( { rel: value } );\n\t};\n\n\tconst onSetLinkClass = ( value ) => {\n\t\tonChangeUrl( { linkClass: value } );\n\t};\n\n\tconst advancedOptions = (\n\t\t<VStack spacing=\"3\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonChange={ onSetNewTab }\n\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\tvalue={ rel ?? '' }\n\t\t\t\tonChange={ onSetLinkRel }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link CSS Class' ) }\n\t\t\t\tvalue={ linkClass || '' }\n\t\t\t\tonChange={ onSetLinkClass }\n\t\t\t/>\n\t\t</VStack>\n\t);\n\n\tconst linkEditorValue = urlInput !== null ? urlInput : url;\n\n\tconst urlLabel = (\n\t\tgetLinkDestinations().find(\n\t\t\t( destination ) => destination.linkDestination === linkDestination\n\t\t) || {}\n\t).title;\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ linkIcon }\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ url ? __( 'Edit link' ) : __( 'Insert link' ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tonClick={ openLinkUI }\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\tisActive={ !! url }\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<URLPopover\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonFocusOutside={ onFocusOutside() }\n\t\t\t\t\tonClose={ closeLinkUI }\n\t\t\t\t\trenderSettings={ () => advancedOptions }\n\t\t\t\t\tadditionalControls={\n\t\t\t\t\t\t! linkEditorValue && (\n\t\t\t\t\t\t\t<NavigableMenu>\n\t\t\t\t\t\t\t\t{ getLinkDestinations().map( ( link ) => (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey={ link.linkDestination }\n\t\t\t\t\t\t\t\t\t\ticon={ link.icon }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonSetHref( link.url );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\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\t\t{ link.title }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ ( ! url || isEditingLink ) && (\n\t\t\t\t\t\t<URLPopover.LinkEditor\n\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\tvalue={ linkEditorValue }\n\t\t\t\t\t\t\tonChangeInputValue={ setUrlInput }\n\t\t\t\t\t\t\tonSubmit={ onSubmitLinkChange() }\n\t\t\t\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ url && ! isEditingLink && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkViewer\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tonEditLinkClick={ startEditLink }\n\t\t\t\t\t\t\t\turlLabel={ urlLabel }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\t\t\tonClick={ onLinkRemove }\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</URLPopover>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport { ImageURLInputUI as __experimentalImageURLInputUI };\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAWA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AArBA;AACA;AACA;;AAgBA;AACA;AACA;;AAGA,MAAMM,qBAAqB,GAAG,MAAM;AACpC,MAAMC,uBAAuB,GAAG,QAAQ;AACxC,MAAMC,sBAAsB,GAAG,OAAO;AACtC,MAAMC,2BAA2B,GAAG,YAAY;AAChD,MAAMC,WAAW,GAAG,CAAE,YAAY,EAAE,UAAU,CAAE;AAEhD,MAAMC,IAAI,GACT,IAAAC,MAAA,CAAAC,aAAA,EAACX,WAAA,CAAAY,GAAG;EAACC,OAAO,EAAC,WAAW;EAACC,KAAK,EAAC;AAA4B,GAC1D,IAAAJ,MAAA,CAAAC,aAAA,EAACX,WAAA,CAAAe,IAAI;EAACC,CAAC,EAAC,iBAAiB;EAACC,IAAI,EAAC;AA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aAAA,EAACT,MAAA,CAAAgG,OAAU,CAACa,UAAU;IACrBjB,SAAS,EAAC,qDAAqD;IAC/DzE,GAAG,EAAGA,GAAK;IACX2F,eAAe,EAAGxE,aAAe;IACjCkD,QAAQ,EAAGA;EAAU,CACrB,CAAC,EACF,IAAAhF,MAAA,CAAAC,aAAA,EAACX,WAAA,CAAAiH,MAAM;IACNxG,IAAI,EAAGyG,YAAO;IACd7B,KAAK,EAAG,IAAAZ,QAAE,EAAE,aAAc,CAAG;IAC7BsB,OAAO,EAAGzB;EAAc,CACxB,CACA,CAEQ,CAEZ,CAAC;AAEL,CAAC;AAAC6C,OAAA,CAAAC,6BAAA,GAAAlG,eAAA"}
1
+ {"version":3,"names":["_i18n","require","_element","_components","_icons","_index","_interopRequireDefault","LINK_DESTINATION_NONE","LINK_DESTINATION_CUSTOM","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","NEW_TAB_REL","ImageURLInputUI","linkDestination","onChangeUrl","url","mediaType","mediaUrl","mediaLink","linkTarget","linkClass","rel","showLightboxSetting","lightboxEnabled","onSetLightbox","isOpen","setIsOpen","useState","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","useRef","startEditLink","stopEditLink","closeLinkUI","getUpdatedLinkTargetSettings","value","newLinkTarget","undefined","updatedRel","rels","split","forEach","relVal","includes","push","join","filter","length","onFocusOutside","event","autocompleteElement","current","contains","target","onSubmitLinkChange","selectedDestination","getLinkDestinations","find","destination","href","lightbox","enabled","preventDefault","onLinkRemove","linkDestinations","title","__","icon","image","page","onSetHref","linkDestinationInput","onSetNewTab","updatedLinkTarget","onSetLinkRel","onSetLinkClass","advancedOptions","_react","createElement","__experimentalVStack","spacing","ToggleControl","__nextHasNoMarginBottom","label","onChange","checked","TextControl","linkEditorValue","showLinkEditor","urlLabel","Fragment","ToolbarButton","linkIcon","className","onClick","ref","isActive","default","anchor","onClose","renderSettings","additionalControls","MenuGroup","map","link","MenuItem","key","iconPosition","fullscreen","info","LinkEditor","onChangeInputValue","onSubmit","LinkViewer","onEditLinkClick","Button","linkOff","size","exports","__experimentalImageURLInputUI"],"sources":["@wordpress/block-editor/src/components/url-popover/image-url-input-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState } from '@wordpress/element';\nimport {\n\tToolbarButton,\n\tButton,\n\tMenuItem,\n\tToggleControl,\n\tTextControl,\n\tMenuGroup,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tlink as linkIcon,\n\timage,\n\tpage,\n\tfullscreen,\n\tlinkOff,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLPopover from './index';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\n\nconst ImageURLInputUI = ( {\n\tlinkDestination,\n\tonChangeUrl,\n\turl,\n\tmediaType = 'image',\n\tmediaUrl,\n\tmediaLink,\n\tlinkTarget,\n\tlinkClass,\n\trel,\n\tshowLightboxSetting,\n\tlightboxEnabled,\n\tonSetLightbox,\n} ) => {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst openLinkUI = () => {\n\t\tsetIsOpen( true );\n\t};\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState( false );\n\tconst [ urlInput, setUrlInput ] = useState( null );\n\n\tconst autocompleteRef = useRef( null );\n\n\tconst startEditLink = () => {\n\t\tif (\n\t\t\tlinkDestination === LINK_DESTINATION_MEDIA ||\n\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t) {\n\t\t\tsetUrlInput( '' );\n\t\t}\n\t\tsetIsEditingLink( true );\n\t};\n\n\tconst stopEditLink = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst closeLinkUI = () => {\n\t\tsetUrlInput( null );\n\t\tstopEditLink();\n\t\tsetIsOpen( false );\n\t};\n\n\tconst getUpdatedLinkTargetSettings = ( value ) => {\n\t\tconst newLinkTarget = value ? '_blank' : undefined;\n\n\t\tlet updatedRel;\n\t\tif ( newLinkTarget ) {\n\t\t\tconst rels = ( rel ?? '' ).split( ' ' );\n\t\t\tNEW_TAB_REL.forEach( ( relVal ) => {\n\t\t\t\tif ( ! rels.includes( relVal ) ) {\n\t\t\t\t\trels.push( relVal );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tupdatedRel = rels.join( ' ' );\n\t\t} else {\n\t\t\tconst rels = ( rel ?? '' )\n\t\t\t\t.split( ' ' )\n\t\t\t\t.filter(\n\t\t\t\t\t( relVal ) => NEW_TAB_REL.includes( relVal ) === false\n\t\t\t\t);\n\t\t\tupdatedRel = rels.length ? rels.join( ' ' ) : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tlinkTarget: newLinkTarget,\n\t\t\trel: updatedRel,\n\t\t};\n\t};\n\n\tconst onFocusOutside = () => {\n\t\treturn ( event ) => {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onFocusOutside fails to detect that a click on a suggestion occurred in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tconst autocompleteElement = autocompleteRef.current;\n\t\t\tif (\n\t\t\t\tautocompleteElement &&\n\t\t\t\tautocompleteElement.contains( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsOpen( false );\n\t\t\tsetUrlInput( null );\n\t\t\tstopEditLink();\n\t\t};\n\t};\n\n\tconst onSubmitLinkChange = () => {\n\t\treturn ( event ) => {\n\t\t\tif ( urlInput ) {\n\t\t\t\t// It is possible the entered URL actually matches a named link destination.\n\t\t\t\t// This check will ensure our link destination is correct.\n\t\t\t\tconst selectedDestination =\n\t\t\t\t\tgetLinkDestinations().find(\n\t\t\t\t\t\t( destination ) => destination.url === urlInput\n\t\t\t\t\t)?.linkDestination || LINK_DESTINATION_CUSTOM;\n\n\t\t\t\tonChangeUrl( {\n\t\t\t\t\thref: urlInput,\n\t\t\t\t\tlinkDestination: selectedDestination,\n\t\t\t\t\tlightbox: { enabled: false },\n\t\t\t\t} );\n\t\t\t}\n\t\t\tstopEditLink();\n\t\t\tsetUrlInput( null );\n\t\t\tevent.preventDefault();\n\t\t};\n\t};\n\n\tconst onLinkRemove = () => {\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: LINK_DESTINATION_NONE,\n\t\t\thref: '',\n\t\t} );\n\t};\n\n\tconst getLinkDestinations = () => {\n\t\tconst linkDestinations = [\n\t\t\t{\n\t\t\t\tlinkDestination: LINK_DESTINATION_MEDIA,\n\t\t\t\ttitle: __( 'Link to image file' ),\n\t\t\t\turl: mediaType === 'image' ? mediaUrl : undefined,\n\t\t\t\ticon: image,\n\t\t\t},\n\t\t];\n\t\tif ( mediaType === 'image' && mediaLink ) {\n\t\t\tlinkDestinations.push( {\n\t\t\t\tlinkDestination: LINK_DESTINATION_ATTACHMENT,\n\t\t\t\ttitle: __( 'Link to attachment page' ),\n\t\t\t\turl: mediaType === 'image' ? mediaLink : undefined,\n\t\t\t\ticon: page,\n\t\t\t} );\n\t\t}\n\t\treturn linkDestinations;\n\t};\n\n\tconst onSetHref = ( value ) => {\n\t\tconst linkDestinations = getLinkDestinations();\n\t\tlet linkDestinationInput;\n\t\tif ( ! value ) {\n\t\t\tlinkDestinationInput = LINK_DESTINATION_NONE;\n\t\t} else {\n\t\t\tlinkDestinationInput = (\n\t\t\t\tlinkDestinations.find( ( destination ) => {\n\t\t\t\t\treturn destination.url === value;\n\t\t\t\t} ) || { linkDestination: LINK_DESTINATION_CUSTOM }\n\t\t\t).linkDestination;\n\t\t}\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: linkDestinationInput,\n\t\t\thref: value,\n\t\t} );\n\t};\n\n\tconst onSetNewTab = ( value ) => {\n\t\tconst updatedLinkTarget = getUpdatedLinkTargetSettings( value );\n\t\tonChangeUrl( updatedLinkTarget );\n\t};\n\n\tconst onSetLinkRel = ( value ) => {\n\t\tonChangeUrl( { rel: value } );\n\t};\n\n\tconst onSetLinkClass = ( value ) => {\n\t\tonChangeUrl( { linkClass: value } );\n\t};\n\n\tconst advancedOptions = (\n\t\t<VStack spacing=\"3\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonChange={ onSetNewTab }\n\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\tvalue={ rel ?? '' }\n\t\t\t\tonChange={ onSetLinkRel }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link CSS class' ) }\n\t\t\t\tvalue={ linkClass || '' }\n\t\t\t\tonChange={ onSetLinkClass }\n\t\t\t/>\n\t\t</VStack>\n\t);\n\n\tconst linkEditorValue = urlInput !== null ? urlInput : url;\n\tconst showLinkEditor = ( ! linkEditorValue && ! lightboxEnabled ) === true;\n\n\tconst urlLabel = (\n\t\tgetLinkDestinations().find(\n\t\t\t( destination ) => destination.linkDestination === linkDestination\n\t\t) || {}\n\t).title;\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ linkIcon }\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ url ? __( 'Edit link' ) : __( 'Add link' ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tonClick={ openLinkUI }\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\tisActive={ !! url }\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<URLPopover\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonFocusOutside={ onFocusOutside() }\n\t\t\t\t\tonClose={ closeLinkUI }\n\t\t\t\t\trenderSettings={\n\t\t\t\t\t\t! lightboxEnabled ? () => advancedOptions : null\n\t\t\t\t\t}\n\t\t\t\t\tadditionalControls={\n\t\t\t\t\t\tshowLinkEditor && (\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t{ getLinkDestinations().map( ( link ) => (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey={ link.linkDestination }\n\t\t\t\t\t\t\t\t\t\ticon={ link.icon }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonSetHref( link.url );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\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\t\t{ link.title }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t{ showLightboxSetting && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey=\"expand-on-click\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__expand-on-click\"\n\t\t\t\t\t\t\t\t\t\ticon={ fullscreen }\n\t\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Scale the image with a lightbox effect.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonChangeUrl( {\n\t\t\t\t\t\t\t\t\t\t\t\tlinkDestination:\n\t\t\t\t\t\t\t\t\t\t\t\t\tLINK_DESTINATION_NONE,\n\t\t\t\t\t\t\t\t\t\t\t\thref: '',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\tonSetLightbox( true );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\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\t\t{ __( 'Expand on click' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ ( ! url || isEditingLink ) && ! lightboxEnabled && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkEditor\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\tvalue={ linkEditorValue }\n\t\t\t\t\t\t\t\tonChangeInputValue={ setUrlInput }\n\t\t\t\t\t\t\t\tonSubmit={ onSubmitLinkChange() }\n\t\t\t\t\t\t\t\tautocompleteRef={ autocompleteRef }\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\t{ url && ! isEditingLink && ! lightboxEnabled && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkViewer\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tonEditLinkClick={ startEditLink }\n\t\t\t\t\t\t\t\turlLabel={ urlLabel }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\t\t\tonClick={ onLinkRemove }\n\t\t\t\t\t\t\t\tsize=\"compact\"\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\t{ ! url && ! isEditingLink && lightboxEnabled && (\n\t\t\t\t\t\t<div className=\"block-editor-url-popover__expand-on-click\">\n\t\t\t\t\t\t\t<div className=\"fullscreen-icon\">\n\t\t\t\t\t\t\t\t{ fullscreen }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"text\">\n\t\t\t\t\t\t\t\t<p>{ __( 'Expand on click' ) }</p>\n\t\t\t\t\t\t\t\t<p className=\"description\">\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Scales the image with a lightbox effect'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\t\t\tclassName=\"remove-link\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Disable expand on click' ) }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonSetLightbox( false );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</URLPopover>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport { ImageURLInputUI as __experimentalImageURLInputUI };\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,MAAA,GAAAH,OAAA;AAWA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AAzBA;AACA;AACA;;A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AC,EAClC,IAAAW,MAAA,CAAAC,aAAA;IAAGe,SAAS,EAAC;EAAa,GACvB,IAAA3B,QAAE,EACH,yCACD,CACE,CACC,CAAC,EACN,IAAAW,MAAA,CAAAC,aAAA,EAACjF,WAAA,CAAAsH,MAAM;IACNhD,IAAI,EAAGiD,cAAS;IAChBvB,SAAS,EAAC,aAAa;IACvBV,KAAK,EAAG,IAAAjB,QAAE,EAAE,yBAA0B,CAAG;IACzC4B,OAAO,EAAGA,CAAA,KAAM;MACf5E,aAAa,CAAE,KAAM,CAAC;IACvB,CAAG;IACHmG,IAAI,EAAC;EAAS,CACd,CACG,CAEK,CAEZ,CAAC;AAEL,CAAC;AAACC,OAAA,CAAAC,6BAAA,GAAAjH,eAAA"}
@@ -66,6 +66,7 @@ function URLPopover({
66
66
  focusOnMount: focusOnMount,
67
67
  placement: computedPlacement,
68
68
  shift: true,
69
+ variant: "toolbar",
69
70
  ...popoverProps
70
71
  }, (0, _react.createElement)("div", {
71
72
  className: "block-editor-url-popover__input-container"
@@ -76,7 +77,8 @@ function URLPopover({
76
77
  icon: _icons.chevronDown,
77
78
  label: (0, _i18n.__)('Link settings'),
78
79
  onClick: toggleSettingsVisibility,
79
- "aria-expanded": isSettingsExpanded
80
+ "aria-expanded": isSettingsExpanded,
81
+ size: "compact"
80
82
  })), showSettings && (0, _react.createElement)("div", {
81
83
  className: "block-editor-url-popover__row block-editor-url-popover__settings"
82
84
  }, renderSettings())), additionalControls && !showSettings && (0, _react.createElement)("div", {
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_components","_icons","_deprecated","_interopRequireDefault","_linkViewer","_linkEditor","_lockUnlock","__experimentalPopoverLegacyPositionToPlacement","unlock","componentsPrivateApis","DEFAULT_PLACEMENT","URLPopover","additionalControls","children","renderSettings","placement","focusOnMount","position","popoverProps","undefined","deprecated","since","alternative","computedPlacement","isSettingsExpanded","setIsSettingsExpanded","useState","showSettings","toggleSettingsVisibility","_react","createElement","Popover","className","shift","Button","icon","chevronDown","label","__","onClick","LinkEditor","LinkViewer","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/url-popover/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport {\n\tButton,\n\tPopover,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport LinkViewer from './link-viewer';\nimport LinkEditor from './link-editor';\nimport { unlock } from '../../lock-unlock';\n\nconst { __experimentalPopoverLegacyPositionToPlacement } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst DEFAULT_PLACEMENT = 'bottom';\n\nfunction URLPopover( {\n\tadditionalControls,\n\tchildren,\n\trenderSettings,\n\t// The DEFAULT_PLACEMENT value is assigned inside the function's body\n\tplacement,\n\tfocusOnMount = 'firstElement',\n\t// Deprecated\n\tposition,\n\t// Rest\n\t...popoverProps\n} ) {\n\tif ( position !== undefined ) {\n\t\tdeprecated( '`position` prop in wp.blockEditor.URLPopover', {\n\t\t\tsince: '6.2',\n\t\t\talternative: '`placement` prop',\n\t\t} );\n\t}\n\n\t// Compute popover's placement:\n\t// - give priority to `placement` prop, if defined\n\t// - otherwise, compute it from the legacy `position` prop (if defined)\n\t// - finally, fallback to the DEFAULT_PLACEMENT.\n\tlet computedPlacement;\n\tif ( placement !== undefined ) {\n\t\tcomputedPlacement = placement;\n\t} else if ( position !== undefined ) {\n\t\tcomputedPlacement =\n\t\t\t__experimentalPopoverLegacyPositionToPlacement( position );\n\t}\n\tcomputedPlacement = computedPlacement || DEFAULT_PLACEMENT;\n\n\tconst [ isSettingsExpanded, setIsSettingsExpanded ] = useState( false );\n\n\tconst showSettings = !! renderSettings && isSettingsExpanded;\n\n\tconst toggleSettingsVisibility = () => {\n\t\tsetIsSettingsExpanded( ! isSettingsExpanded );\n\t};\n\n\treturn (\n\t\t<Popover\n\t\t\tclassName=\"block-editor-url-popover\"\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\tplacement={ computedPlacement }\n\t\t\tshift\n\t\t\t{ ...popoverProps }\n\t\t>\n\t\t\t<div className=\"block-editor-url-popover__input-container\">\n\t\t\t\t<div className=\"block-editor-url-popover__row\">\n\t\t\t\t\t{ children }\n\t\t\t\t\t{ !! renderSettings && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__settings-toggle\"\n\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\tlabel={ __( 'Link settings' ) }\n\t\t\t\t\t\t\tonClick={ toggleSettingsVisibility }\n\t\t\t\t\t\t\taria-expanded={ isSettingsExpanded }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t{ showSettings && (\n\t\t\t\t\t<div className=\"block-editor-url-popover__row block-editor-url-popover__settings\">\n\t\t\t\t\t\t{ renderSettings() }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ additionalControls && ! showSettings && (\n\t\t\t\t<div className=\"block-editor-url-popover__additional-controls\">\n\t\t\t\t\t{ additionalControls }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nURLPopover.LinkEditor = LinkEditor;\n\nURLPopover.LinkViewer = LinkViewer;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-popover/README.md\n */\nexport default URLPopover;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAC,sBAAA,CAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,WAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IA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2C,GACzD,IAAAH,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAA+B,GAC3CnB,QAAQ,EACR,CAAC,CAAEC,cAAc,IAClB,IAAAe,MAAA,CAAAC,aAAA,EAAC9B,WAAA,CAAAkC,MAAM;IACNF,SAAS,EAAC,2CAA2C;IACrDG,IAAI,EAAGC,kBAAa;IACpBC,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB,CAAG;IAC/BC,OAAO,EAAGX,wBAA0B;IACpC,iBAAgBJ;EAAoB,CACpC,CAEE,CAAC,EACJG,YAAY,IACb,IAAAE,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAAkE,GAC9ElB,cAAc,CAAC,CACb,CAEF,CAAC,EACJF,kBAAkB,IAAI,CAAEe,YAAY,IACrC,IAAAE,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAA+C,GAC3DpB,kBACE,CAEE,CAAC;AAEZ;AAEAD,UAAU,CAAC6B,UAAU,GAAGA,mBAAU;AAElC7B,UAAU,CAAC8B,UAAU,GAAGA,mBAAU;;AAElC;AACA;AACA;AAFA,IAAAC,QAAA,GAGe/B,UAAU;AAAAgC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_i18n","require","_element","_components","_icons","_deprecated","_interopRequireDefault","_linkViewer","_linkEditor","_lockUnlock","__experimentalPopoverLegacyPositionToPlacement","unlock","componentsPrivateApis","DEFAULT_PLACEMENT","URLPopover","additionalControls","children","renderSettings","placement","focusOnMount","position","popoverProps","undefined","deprecated","since","alternative","computedPlacement","isSettingsExpanded","setIsSettingsExpanded","useState","showSettings","toggleSettingsVisibility","_react","createElement","Popover","className","shift","variant","Button","icon","chevronDown","label","__","onClick","size","LinkEditor","LinkViewer","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/url-popover/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport {\n\tButton,\n\tPopover,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport LinkViewer from './link-viewer';\nimport LinkEditor from './link-editor';\nimport { unlock } from '../../lock-unlock';\n\nconst { __experimentalPopoverLegacyPositionToPlacement } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst DEFAULT_PLACEMENT = 'bottom';\n\nfunction URLPopover( {\n\tadditionalControls,\n\tchildren,\n\trenderSettings,\n\t// The DEFAULT_PLACEMENT value is assigned inside the function's body\n\tplacement,\n\tfocusOnMount = 'firstElement',\n\t// Deprecated\n\tposition,\n\t// Rest\n\t...popoverProps\n} ) {\n\tif ( position !== undefined ) {\n\t\tdeprecated( '`position` prop in wp.blockEditor.URLPopover', {\n\t\t\tsince: '6.2',\n\t\t\talternative: '`placement` prop',\n\t\t} );\n\t}\n\n\t// Compute popover's placement:\n\t// - give priority to `placement` prop, if defined\n\t// - otherwise, compute it from the legacy `position` prop (if defined)\n\t// - finally, fallback to the DEFAULT_PLACEMENT.\n\tlet computedPlacement;\n\tif ( placement !== undefined ) {\n\t\tcomputedPlacement = placement;\n\t} else if ( position !== undefined ) {\n\t\tcomputedPlacement =\n\t\t\t__experimentalPopoverLegacyPositionToPlacement( position );\n\t}\n\tcomputedPlacement = computedPlacement || DEFAULT_PLACEMENT;\n\n\tconst [ isSettingsExpanded, setIsSettingsExpanded ] = useState( false );\n\n\tconst showSettings = !! renderSettings && isSettingsExpanded;\n\n\tconst toggleSettingsVisibility = () => {\n\t\tsetIsSettingsExpanded( ! isSettingsExpanded );\n\t};\n\n\treturn (\n\t\t<Popover\n\t\t\tclassName=\"block-editor-url-popover\"\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\tplacement={ computedPlacement }\n\t\t\tshift\n\t\t\tvariant=\"toolbar\"\n\t\t\t{ ...popoverProps }\n\t\t>\n\t\t\t<div className=\"block-editor-url-popover__input-container\">\n\t\t\t\t<div className=\"block-editor-url-popover__row\">\n\t\t\t\t\t{ children }\n\t\t\t\t\t{ !! renderSettings && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__settings-toggle\"\n\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\tlabel={ __( 'Link settings' ) }\n\t\t\t\t\t\t\tonClick={ toggleSettingsVisibility }\n\t\t\t\t\t\t\taria-expanded={ isSettingsExpanded }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t{ showSettings && (\n\t\t\t\t\t<div className=\"block-editor-url-popover__row block-editor-url-popover__settings\">\n\t\t\t\t\t\t{ renderSettings() }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ additionalControls && ! showSettings && (\n\t\t\t\t<div className=\"block-editor-url-popover__additional-controls\">\n\t\t\t\t\t{ additionalControls }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nURLPopover.LinkEditor = LinkEditor;\n\nURLPopover.LinkViewer = LinkViewer;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-popover/README.md\n */\nexport default URLPopover;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAC,sBAAA,CAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,WAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAlBA;AACA;AACA;;AAWA;AACA;AACA;;AAKA,MAAM;EAAES;AAA+C,CAAC,GAAG,IAAAC,kBAAM,EAChEC,uBACD,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Ac,IAClB,IAAAe,MAAA,CAAAC,aAAA,EAAC9B,WAAA,CAAAmC,MAAM;IACNH,SAAS,EAAC,2CAA2C;IACrDI,IAAI,EAAGC,kBAAa;IACpBC,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB,CAAG;IAC/BC,OAAO,EAAGZ,wBAA0B;IACpC,iBAAgBJ,kBAAoB;IACpCiB,IAAI,EAAC;EAAS,CACd,CAEE,CAAC,EACJd,YAAY,IACb,IAAAE,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAAkE,GAC9ElB,cAAc,CAAC,CACb,CAEF,CAAC,EACJF,kBAAkB,IAAI,CAAEe,YAAY,IACrC,IAAAE,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAA+C,GAC3DpB,kBACE,CAEE,CAAC;AAEZ;AAEAD,UAAU,CAAC+B,UAAU,GAAGA,mBAAU;AAElC/B,UAAU,CAACgC,UAAU,GAAGA,mBAAU;;AAElC;AACA;AACA;AAFA,IAAAC,QAAA,GAGejC,UAAU;AAAAkC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -41,7 +41,8 @@ function LinkEditor({
41
41
  }), (0, _react.createElement)(_components.Button, {
42
42
  icon: _icons.keyboardReturn,
43
43
  label: (0, _i18n.__)('Apply'),
44
- type: "submit"
44
+ type: "submit",
45
+ size: "compact"
45
46
  }));
46
47
  }
47
48
  //# sourceMappingURL=link-editor.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_icons","_urlInput","LinkEditor","autocompleteRef","className","onChangeInputValue","value","props","_react","createElement","classnames","default","__nextHasNoMarginBottom","onChange","Button","icon","keyboardReturn","label","__","type"],"sources":["@wordpress/block-editor/src/components/url-popover/link-editor.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { keyboardReturn } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLInput from '../url-input';\n\nexport default function LinkEditor( {\n\tautocompleteRef,\n\tclassName,\n\tonChangeInputValue,\n\tvalue,\n\t...props\n} ) {\n\treturn (\n\t\t<form\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-url-popover__link-editor',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<URLInput\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeInputValue }\n\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\ttype=\"submit\"\n\t\t\t/>\n\t\t</form>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASK,UAAUA,CAAE;EACnCC,eAAe;EACfC,SAAS;EACTC,kBAAkB;EAClBC,KAAK;EACL,GAAGC;AACJ,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA;IACCL,SAAS,EAAG,IAAAM,mBAAU,EACrB,uCAAuC,EACvCN,SACD,CAAG;IAAA,GACEG;EAAK,GAEV,IAAAC,MAAA,CAAAC,aAAA,EAACR,SAAA,CAAAU,OAAQ;IACRC,uBAAuB;IACvBN,KAAK,EAAGA,KAAO;IACfO,QAAQ,EAAGR,kBAAoB;IAC/BF,eAAe,EAAGA;EAAiB,CACnC,CAAC,EACF,IAAAK,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAe,MAAM;IACNC,IAAI,EAAGC,qBAAgB;IACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,OAAQ,CAAG;IACvBC,IAAI,EAAC;EAAQ,CACb,CACI,CAAC;AAET"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_icons","_urlInput","LinkEditor","autocompleteRef","className","onChangeInputValue","value","props","_react","createElement","classnames","default","__nextHasNoMarginBottom","onChange","Button","icon","keyboardReturn","label","__","type","size"],"sources":["@wordpress/block-editor/src/components/url-popover/link-editor.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { keyboardReturn } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLInput from '../url-input';\n\nexport default function LinkEditor( {\n\tautocompleteRef,\n\tclassName,\n\tonChangeInputValue,\n\tvalue,\n\t...props\n} ) {\n\treturn (\n\t\t<form\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-url-popover__link-editor',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<URLInput\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeInputValue }\n\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\ttype=\"submit\"\n\t\t\t\tsize=\"compact\"\n\t\t\t/>\n\t\t</form>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASK,UAAUA,CAAE;EACnCC,eAAe;EACfC,SAAS;EACTC,kBAAkB;EAClBC,KAAK;EACL,GAAGC;AACJ,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA;IACCL,SAAS,EAAG,IAAAM,mBAAU,EACrB,uCAAuC,EACvCN,SACD,CAAG;IAAA,GACEG;EAAK,GAEV,IAAAC,MAAA,CAAAC,aAAA,EAACR,SAAA,CAAAU,OAAQ;IACRC,uBAAuB;IACvBN,KAAK,EAAGA,KAAO;IACfO,QAAQ,EAAGR,kBAAoB;IAC/BF,eAAe,EAAGA;EAAiB,CACnC,CAAC,EACF,IAAAK,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAe,MAAM;IACNC,IAAI,EAAGC,qBAAgB;IACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,OAAQ,CAAG;IACvBC,IAAI,EAAC,QAAQ;IACbC,IAAI,EAAC;EAAS,CACd,CACI,CAAC;AAET"}
@@ -41,7 +41,8 @@ function LinkViewer({
41
41
  }), onEditLinkClick && (0, _react.createElement)(_components.Button, {
42
42
  icon: _icons.edit,
43
43
  label: (0, _i18n.__)('Edit'),
44
- onClick: onEditLinkClick
44
+ onClick: onEditLinkClick,
45
+ size: "compact"
45
46
  }));
46
47
  }
47
48
  //# sourceMappingURL=link-viewer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_icons","_linkViewerUrl","LinkViewer","className","linkClassName","onEditLinkClick","url","urlLabel","props","_react","createElement","classnames","default","Button","icon","edit","label","__","onClick"],"sources":["@wordpress/block-editor/src/components/url-popover/link-viewer.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { edit } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport LinkViewerURL from './link-viewer-url';\n\nexport default function LinkViewer( {\n\tclassName,\n\tlinkClassName,\n\tonEditLinkClick,\n\turl,\n\turlLabel,\n\t...props\n} ) {\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-url-popover__link-viewer',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<LinkViewerURL\n\t\t\t\turl={ url }\n\t\t\t\turlLabel={ urlLabel }\n\t\t\t\tclassName={ linkClassName }\n\t\t\t/>\n\t\t\t{ onEditLinkClick && (\n\t\t\t\t<Button\n\t\t\t\t\ticon={ edit }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\tonClick={ onEditLinkClick }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASK,UAAUA,CAAE;EACnCC,SAAS;EACTC,aAAa;EACbC,eAAe;EACfC,GAAG;EACHC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA;IACCP,SAAS,EAAG,IAAAQ,mBAAU,EACrB,uCAAuC,EACvCR,SACD,CAAG;IAAA,GACEK;EAAK,GAEV,IAAAC,MAAA,CAAAC,aAAA,EAACT,cAAA,CAAAW,OAAa;IACbN,GAAG,EAAGA,GAAK;IACXC,QAAQ,EAAGA,QAAU;IACrBJ,SAAS,EAAGC;EAAe,CAC3B,CAAC,EACAC,eAAe,IAChB,IAAAI,MAAA,CAAAC,aAAA,EAACX,WAAA,CAAAc,MAAM;IACNC,IAAI,EAAGC,WAAM;IACbC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBC,OAAO,EAAGb;EAAiB,CAC3B,CAEE,CAAC;AAER"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_icons","_linkViewerUrl","LinkViewer","className","linkClassName","onEditLinkClick","url","urlLabel","props","_react","createElement","classnames","default","Button","icon","edit","label","__","onClick","size"],"sources":["@wordpress/block-editor/src/components/url-popover/link-viewer.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { edit } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport LinkViewerURL from './link-viewer-url';\n\nexport default function LinkViewer( {\n\tclassName,\n\tlinkClassName,\n\tonEditLinkClick,\n\turl,\n\turlLabel,\n\t...props\n} ) {\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-url-popover__link-viewer',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<LinkViewerURL\n\t\t\t\turl={ url }\n\t\t\t\turlLabel={ urlLabel }\n\t\t\t\tclassName={ linkClassName }\n\t\t\t/>\n\t\t\t{ onEditLinkClick && (\n\t\t\t\t<Button\n\t\t\t\t\ticon={ edit }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\tonClick={ onEditLinkClick }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASK,UAAUA,CAAE;EACnCC,SAAS;EACTC,aAAa;EACbC,eAAe;EACfC,GAAG;EACHC,QAAQ;EACR,GAAGC;AACJ,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA;IACCP,SAAS,EAAG,IAAAQ,mBAAU,EACrB,uCAAuC,EACvCR,SACD,CAAG;IAAA,GACEK;EAAK,GAEV,IAAAC,MAAA,CAAAC,aAAA,EAACT,cAAA,CAAAW,OAAa;IACbN,GAAG,EAAGA,GAAK;IACXC,QAAQ,EAAGA,QAAU;IACrBJ,SAAS,EAAGC;EAAe,CAC3B,CAAC,EACAC,eAAe,IAChB,IAAAI,MAAA,CAAAC,aAAA,EAACX,WAAA,CAAAc,MAAM;IACNC,IAAI,EAAGC,WAAM;IACbC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBC,OAAO,EAAGb,eAAiB;IAC3Bc,IAAI,EAAC;EAAS,CACd,CAEE,CAAC;AAER"}
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.DIMENSIONS_SUPPORT_KEY = exports.AXIAL_SIDES = exports.ALL_SIDES = void 0;
8
8
  exports.DimensionsPanel = DimensionsPanel;
9
- exports.SPACING_SUPPORT_KEY = void 0;
9
+ exports.default = exports.SPACING_SUPPORT_KEY = void 0;
10
+ exports.hasDimensionsSupport = hasDimensionsSupport;
10
11
  exports.useCustomSides = useCustomSides;
11
12
  var _react = require("react");
13
+ var _classnames = _interopRequireDefault(require("classnames"));
12
14
  var _element = require("@wordpress/element");
13
15
  var _data = require("@wordpress/data");
14
16
  var _blocks = require("@wordpress/blocks");
@@ -20,6 +22,10 @@ var _padding = require("./padding");
20
22
  var _store = require("../store");
21
23
  var _lockUnlock = require("../lock-unlock");
22
24
  var _utils = require("./utils");
25
+ /**
26
+ * External dependencies
27
+ */
28
+
23
29
  /**
24
30
  * WordPress dependencies
25
31
  */
@@ -110,6 +116,70 @@ function DimensionsPanel({
110
116
  }));
111
117
  }
112
118
 
119
+ /**
120
+ * Determine whether there is block support for dimensions.
121
+ *
122
+ * @param {string} blockName Block name.
123
+ * @param {string} feature Background image feature to check for.
124
+ *
125
+ * @return {boolean} Whether there is support.
126
+ */
127
+ function hasDimensionsSupport(blockName, feature = 'any') {
128
+ if (_element.Platform.OS !== 'web') {
129
+ return false;
130
+ }
131
+ const support = (0, _blocks.getBlockSupport)(blockName, DIMENSIONS_SUPPORT_KEY);
132
+ if (support === true) {
133
+ return true;
134
+ }
135
+ if (feature === 'any') {
136
+ return !!(support?.aspectRatio || !!support?.minHeight);
137
+ }
138
+ return !!support?.[feature];
139
+ }
140
+ var _default = {
141
+ useBlockProps,
142
+ attributeKeys: ['minHeight', 'style'],
143
+ hasSupport(name) {
144
+ return hasDimensionsSupport(name, 'aspectRatio');
145
+ }
146
+ };
147
+ exports.default = _default;
148
+ function useBlockProps({
149
+ name,
150
+ minHeight,
151
+ style
152
+ }) {
153
+ if (!hasDimensionsSupport(name, 'aspectRatio') || (0, _utils.shouldSkipSerialization)(name, DIMENSIONS_SUPPORT_KEY, 'aspectRatio')) {
154
+ return {};
155
+ }
156
+ const className = (0, _classnames.default)({
157
+ 'has-aspect-ratio': !!style?.dimensions?.aspectRatio
158
+ });
159
+
160
+ // Allow dimensions-based inline style overrides to override any global styles rules that
161
+ // might be set for the block, and therefore affect the display of the aspect ratio.
162
+ const inlineStyleOverrides = {};
163
+
164
+ // Apply rules to unset incompatible styles.
165
+ // Note that a set `aspectRatio` will win out if both an aspect ratio and a minHeight are set.
166
+ // This is because the aspect ratio is a newer block support, so (in theory) any aspect ratio
167
+ // that is set should be intentional and should override any existing minHeight. The Cover block
168
+ // and dimensions controls have logic that will manually clear the aspect ratio if a minHeight
169
+ // is set.
170
+ if (style?.dimensions?.aspectRatio) {
171
+ // To ensure the aspect ratio does not get overridden by `minHeight` unset any existing rule.
172
+ inlineStyleOverrides.minHeight = 'unset';
173
+ } else if (minHeight || style?.dimensions?.minHeight) {
174
+ // To ensure the minHeight does not get overridden by `aspectRatio` unset any existing rule.
175
+ inlineStyleOverrides.aspectRatio = 'unset';
176
+ }
177
+ return {
178
+ className,
179
+ style: inlineStyleOverrides
180
+ };
181
+ }
182
+
113
183
  /**
114
184
  * @deprecated
115
185
  */