@wordpress/block-editor 11.3.6 → 11.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -1
- package/build/components/block-lock/modal.js +1 -0
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-popover/inbetween.js +10 -33
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.js +2 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +2 -0
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/child-layout-control/index.js +107 -0
- package/build/components/child-layout-control/index.js.map +1 -0
- package/build/components/colors-gradients/control.js +6 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/date-format-picker/index.js +3 -3
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +0 -3
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +594 -0
- package/build/components/global-styles/dimensions-panel.js.map +1 -0
- package/build/components/global-styles/hooks.js +142 -45
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +38 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +434 -0
- package/build/components/global-styles/typography-panel.js.map +1 -0
- package/build/components/global-styles/use-global-styles-output.js +7 -3
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +17 -11
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +2 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-size-control/index.js +6 -11
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.native.js +23 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +9 -15
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +4 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +4 -1
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-results.native.js +4 -1
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js +38 -9
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/link-control/index.js +55 -28
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +72 -30
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/settings.js +53 -0
- package/build/components/link-control/settings.js.map +1 -0
- package/build/components/list-view/block.js +4 -2
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/expander.js +2 -1
- package/build/components/list-view/expander.js.map +1 -1
- package/build/components/list-view/index.js +6 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +5 -10
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/block-contents.js +3 -2
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +1 -0
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +7 -3
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +24 -4
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build/components/off-canvas-editor/link-ui.js +2 -0
- package/build/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -0
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/index.js +9 -45
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-delete.js +73 -0
- package/build/components/rich-text/use-delete.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +14 -6
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/url-input/index.js +2 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +4 -1
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/hooks/align.js +3 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/dimensions.js +78 -190
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +94 -25
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +2 -76
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +3 -51
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +0 -201
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +14 -5
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/line-height.js +0 -42
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/margin.js +7 -163
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +7 -163
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/typography.js +98 -128
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +75 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/flex.js +1 -0
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +24 -12
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +53 -47
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +22 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +36 -3
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-lock/modal.js +1 -0
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +10 -33
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.js +2 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -0
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +98 -0
- package/build-module/components/child-layout-control/index.js.map +1 -0
- package/build-module/components/colors-gradients/control.js +6 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +4 -4
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +2 -1
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +574 -0
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +138 -46
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +415 -0
- package/build-module/components/global-styles/typography-panel.js.map +1 -0
- package/build-module/components/global-styles/use-global-styles-output.js +7 -3
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +17 -11
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +2 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-size-control/index.js +7 -12
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +9 -15
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +3 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +3 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +3 -1
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +39 -9
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/link-control/index.js +56 -28
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +68 -30
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/settings.js +44 -0
- package/build-module/components/link-control/settings.js.map +1 -0
- package/build-module/components/list-view/block.js +4 -2
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/expander.js +2 -1
- package/build-module/components/list-view/expander.js.map +1 -1
- package/build-module/components/list-view/index.js +6 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +5 -10
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js +3 -2
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +1 -0
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +7 -3
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +27 -7
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build-module/components/off-canvas-editor/link-ui.js +2 -0
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -0
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +9 -45
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-delete.js +62 -0
- package/build-module/components/rich-text/use-delete.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +14 -6
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/url-input/index.js +2 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +4 -1
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/hooks/align.js +3 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/dimensions.js +81 -187
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +86 -24
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +3 -69
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +6 -47
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +0 -182
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +14 -5
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/line-height.js +0 -38
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/margin.js +4 -143
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +4 -143
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/typography.js +97 -123
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +70 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/flex.js +1 -0
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +24 -12
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +53 -45
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +22 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +36 -3
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +54 -64
- package/build-style/style.css +54 -64
- package/package.json +31 -31
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +24 -24
- package/src/components/block-lock/modal.js +1 -0
- package/src/components/block-lock/style.scss +0 -9
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +20 -20
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +15 -15
- package/src/components/block-popover/inbetween.js +21 -53
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/src/components/block-styles/index.js +5 -1
- package/src/components/block-types-list/index.native.js +2 -0
- package/src/components/child-layout-control/index.js +106 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/colors-gradients/control.js +3 -0
- package/src/components/date-format-picker/index.js +6 -8
- package/src/components/date-format-picker/style.scss +0 -5
- package/src/components/font-appearance-control/index.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +627 -0
- package/src/components/global-styles/hooks.js +229 -66
- package/src/components/global-styles/index.js +9 -0
- package/src/components/global-styles/typography-panel.js +428 -0
- package/src/components/global-styles/use-global-styles-output.js +10 -5
- package/src/components/global-styles/utils.js +2 -0
- package/src/components/iframe/index.js +20 -18
- package/src/components/image-editor/aspect-ratio-dropdown.js +1 -0
- package/src/components/image-size-control/index.js +10 -12
- package/src/components/image-size-control/style.scss +3 -21
- package/src/components/index.native.js +5 -0
- package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
- package/src/components/inserter/block-patterns-tab.js +9 -23
- package/src/components/inserter/block-types-tab.native.js +2 -0
- package/src/components/inserter/reusable-blocks-tab.native.js +2 -0
- package/src/components/inserter/search-results.native.js +2 -0
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +15 -15
- package/src/components/inspector-controls/block-support-tools-panel.js +0 -1
- package/src/components/inspector-controls/fill.js +32 -8
- package/src/components/link-control/index.js +69 -34
- package/src/components/link-control/settings-drawer.js +85 -29
- package/src/components/link-control/settings.js +42 -0
- package/src/components/link-control/style.scss +63 -37
- package/src/components/link-control/test/index.js +347 -9
- package/src/components/list-view/block.js +7 -1
- package/src/components/list-view/expander.js +1 -0
- package/src/components/list-view/index.js +5 -0
- package/src/components/media-replace-flow/style.scss +7 -9
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/off-canvas-editor/appender.js +13 -16
- package/src/components/off-canvas-editor/block-contents.js +2 -1
- package/src/components/off-canvas-editor/branch.js +1 -0
- package/src/components/off-canvas-editor/index.js +8 -2
- package/src/components/off-canvas-editor/leaf-more-menu.js +52 -15
- package/src/components/off-canvas-editor/link-ui.js +2 -0
- package/src/components/responsive-block-control/index.js +1 -0
- package/src/components/rich-text/index.js +8 -46
- package/src/components/rich-text/use-delete.js +59 -0
- package/src/components/rich-text/use-input-rules.js +13 -5
- package/src/components/url-input/index.js +3 -2
- package/src/components/url-popover/stories/index.js +1 -0
- package/src/components/writing-flow/use-selection-observer.js +5 -1
- package/src/hooks/align.js +1 -1
- package/src/hooks/dimensions.js +97 -269
- package/src/hooks/duotone.js +100 -30
- package/src/hooks/font-family.js +0 -58
- package/src/hooks/font-size.js +1 -36
- package/src/hooks/gap.js +0 -201
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout.js +19 -6
- package/src/hooks/line-height.js +0 -33
- package/src/hooks/margin.js +1 -164
- package/src/hooks/padding.js +1 -163
- package/src/hooks/test/__snapshots__/align.native.js.snap +24 -24
- package/src/hooks/test/duotone.js +102 -0
- package/src/hooks/typography.js +112 -213
- package/src/hooks/utils.js +90 -0
- package/src/layouts/flex.js +1 -0
- package/src/store/actions.js +12 -4
- package/src/store/reducer.js +68 -43
- package/src/store/selectors.js +20 -1
- package/src/store/test/actions.js +4 -2
- package/src/utils/parse-css-unit-to-px.js +35 -5
- package/src/utils/test/parse-css-unit-to-px.js +12 -0
- package/build/hooks/child-layout.js +0 -213
- package/build/hooks/child-layout.js.map +0 -1
- package/build/hooks/font-appearance.js +0 -188
- package/build/hooks/font-appearance.js.map +0 -1
- package/build/hooks/letter-spacing.js +0 -129
- package/build/hooks/letter-spacing.js.map +0 -1
- package/build/hooks/min-height.js +0 -139
- package/build/hooks/min-height.js.map +0 -1
- package/build/hooks/text-decoration.js +0 -130
- package/build/hooks/text-decoration.js.map +0 -1
- package/build/hooks/text-transform.js +0 -130
- package/build/hooks/text-transform.js.map +0 -1
- package/build-module/hooks/child-layout.js +0 -193
- package/build-module/hooks/child-layout.js.map +0 -1
- package/build-module/hooks/font-appearance.js +0 -161
- package/build-module/hooks/font-appearance.js.map +0 -1
- package/build-module/hooks/letter-spacing.js +0 -107
- package/build-module/hooks/letter-spacing.js.map +0 -1
- package/build-module/hooks/min-height.js +0 -116
- package/build-module/hooks/min-height.js.map +0 -1
- package/build-module/hooks/text-decoration.js +0 -108
- package/build-module/hooks/text-decoration.js.map +0 -1
- package/build-module/hooks/text-transform.js +0 -108
- package/build-module/hooks/text-transform.js.map +0 -1
- package/src/hooks/child-layout.js +0 -195
- package/src/hooks/font-appearance.js +0 -146
- package/src/hooks/letter-spacing.js +0 -101
- package/src/hooks/min-height.js +0 -104
- package/src/hooks/text-decoration.js +0 -102
- package/src/hooks/text-transform.js +0 -101
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/url-input/index.js"],"names":["classnames","scrollIntoView","deprecated","__","sprintf","_n","Component","createRef","UP","DOWN","ENTER","TAB","BaseControl","Button","Spinner","withSpokenMessages","Popover","compose","debounce","withInstanceId","withSafeTimeout","withSelect","isURL","store","blockEditorStore","isFunction","maybeFunc","URLInput","constructor","props","onChange","bind","onFocus","onKeyDown","selectLink","handleOnClick","bindSuggestionNode","autocompleteRef","inputRef","updateSuggestions","suggestionNodes","suggestionsRequest","state","suggestions","showSuggestions","isUpdatingSuggestions","suggestionsValue","selectedSuggestion","suggestionsListboxId","suggestionOptionIdPrefix","componentDidUpdate","prevProps","value","__experimentalShowInitialSuggestions","scrollingIntoView","current","onlyScrollIfNeeded","setTimeout","disableSuggestions","length","componentDidMount","shouldShowInitialSuggestions","componentWillUnmount","cancel","index","ref","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalHandleURLSuggestions","handleURLSuggestions","isInitialSuggestions","trim","setState","loading","request","then","debouncedSpeak","catch","event","target","keyCode","selectionStart","preventDefault","setSelectionRange","onSubmit","suggestion","previousIndex","nextIndex","speak","url","focus","getDerivedStateFromProps","instanceId","shouldShowSuggestions","hasValue","render","renderControl","renderSuggestions","__nextHasNoMarginBottom","label","className","isFullWidth","placeholder","__experimentalRenderControl","inputId","controlProps","id","inputProps","required","type","role","undefined","since","version","hint","__experimentalRenderSuggestions","suggestionsListProps","buildSuggestionItemProps","tabIndex","isLoading","handleSuggestionClick","currentInputValue","map","title","select","getSettings"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,OAAOC,cAAP,MAA2B,sBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,SAAT,EAAoBC,SAApB,QAAqC,oBAArC;AACA,SAASC,EAAT,EAAaC,IAAb,EAAmBC,KAAnB,EAA0BC,GAA1B,QAAqC,qBAArC;AACA,SACCC,WADD,EAECC,MAFD,EAGCC,OAHD,EAICC,kBAJD,EAKCC,OALD,QAMO,uBANP;AAOA,SACCC,OADD,EAECC,QAFD,EAGCC,cAHD,EAICC,eAJD,QAKO,oBALP;AAMA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAT,QAAsB,gBAAtB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,UAAT,CAAqBC,SAArB,EAAiC;AAChC,SA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aAAL,CAAoBkD,UAApB;AATjB,QAWGA,UAAU,CAACsC,KAXd,CADC,CAPH,CADD,CADD;AA2BA;;AArhB+B;AAwhBjC;AACA;AACA;;;AACA,eAAe1G,OAAO,CACrBG,eADqB,EAErBL,kBAFqB,EAGrBI,cAHqB,EAIrBE,UAAU,CAAE,CAAEuG,MAAF,EAAU/F,KAAV,KAAqB;AAChC;AACA;AACA,MAAKJ,UAAU,CAAEI,KAAK,CAACqC,kCAAR,CAAf,EAA8D;AAC7D;AACA;;AACD,QAAM;AAAE2D,IAAAA;AAAF,MAAkBD,MAAM,CAAEpG,gBAAF,CAA9B;AACA,SAAO;AACN0C,IAAAA,kCAAkC,EACjC2D,WAAW,GAAG3D;AAFT,GAAP;AAIA,CAXS,CAJW,CAAP,CAgBZvC,QAhBY,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport scrollIntoView from 'dom-scroll-into-view';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { Component, createRef } from '@wordpress/element';\nimport { UP, DOWN, ENTER, TAB } from '@wordpress/keycodes';\nimport {\n\tBaseControl,\n\tButton,\n\tSpinner,\n\twithSpokenMessages,\n\tPopover,\n} from '@wordpress/components';\nimport {\n\tcompose,\n\tdebounce,\n\twithInstanceId,\n\twithSafeTimeout,\n} from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport { isURL } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Whether the argument is a function.\n *\n * @param {*} maybeFunc The argument to check.\n * @return {boolean} True if the argument is a function, false otherwise.\n */\nfunction isFunction( maybeFunc ) {\n\treturn typeof maybeFunc === 'function';\n}\n\nclass URLInput extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.onChange = this.onChange.bind( this );\n\t\tthis.onFocus = this.onFocus.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.selectLink = this.selectLink.bind( this );\n\t\tthis.handleOnClick = this.handleOnClick.bind( this );\n\t\tthis.bindSuggestionNode = this.bindSuggestionNode.bind( this );\n\t\tthis.autocompleteRef = props.autocompleteRef || createRef();\n\t\tthis.inputRef = createRef();\n\t\tthis.updateSuggestions = debounce(\n\t\t\tthis.updateSuggestions.bind( this ),\n\t\t\t200\n\t\t);\n\n\t\tthis.suggestionNodes = [];\n\n\t\tthis.suggestionsRequest = null;\n\n\t\tthis.state = {\n\t\t\tsuggestions: [],\n\t\t\tshowSuggestions: false,\n\t\t\tisUpdatingSuggestions: false,\n\t\t\tsuggestionsValue: null,\n\t\t\tselectedSuggestion: null,\n\t\t\tsuggestionsListboxId: '',\n\t\t\tsuggestionOptionIdPrefix: '',\n\t\t};\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { showSuggestions, selectedSuggestion } = this.state;\n\t\tconst { value, __experimentalShowInitialSuggestions = false } =\n\t\t\tthis.props;\n\n\t\t// Only have to worry about scrolling selected suggestion into view\n\t\t// when already expanded.\n\t\tif (\n\t\t\tshowSuggestions &&\n\t\t\tselectedSuggestion !== null &&\n\t\t\tthis.suggestionNodes[ selectedSuggestion ] &&\n\t\t\t! this.scrollingIntoView\n\t\t) {\n\t\t\tthis.scrollingIntoView = true;\n\t\t\tscrollIntoView(\n\t\t\t\tthis.suggestionNodes[ selectedSuggestion ],\n\t\t\t\tthis.autocompleteRef.current,\n\t\t\t\t{\n\t\t\t\t\tonlyScrollIfNeeded: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tthis.props.setTimeout( () => {\n\t\t\t\tthis.scrollingIntoView = false;\n\t\t\t}, 100 );\n\t\t}\n\n\t\t// Update suggestions when the value changes.\n\t\tif (\n\t\t\tprevProps.value !== value &&\n\t\t\t! this.props.disableSuggestions &&\n\t\t\t! this.state.isUpdatingSuggestions\n\t\t) {\n\t\t\tif ( value?.length ) {\n\t\t\t\t// If the new value is not empty we need to update with suggestions for it.\n\t\t\t\tthis.updateSuggestions( value );\n\t\t\t} else if ( __experimentalShowInitialSuggestions ) {\n\t\t\t\t// If the new value is empty and we can show initial suggestions, then show initial suggestions.\n\t\t\t\tthis.updateSuggestions();\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.shouldShowInitialSuggestions() ) {\n\t\t\tthis.updateSuggestions();\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.suggestionsRequest?.cancel?.();\n\t\tthis.suggestionsRequest = null;\n\t}\n\n\tbindSuggestionNode( index ) {\n\t\treturn ( ref ) => {\n\t\t\tthis.suggestionNodes[ index ] = ref;\n\t\t};\n\t}\n\n\tshouldShowInitialSuggestions() {\n\t\tconst { __experimentalShowInitialSuggestions = false, value } =\n\t\t\tthis.props;\n\t\treturn (\n\t\t\t__experimentalShowInitialSuggestions && ! ( value && value.length )\n\t\t);\n\t}\n\n\tupdateSuggestions( value = '' ) {\n\t\tconst {\n\t\t\t__experimentalFetchLinkSuggestions: fetchLinkSuggestions,\n\t\t\t__experimentalHandleURLSuggestions: handleURLSuggestions,\n\t\t} = this.props;\n\n\t\tif ( ! fetchLinkSuggestions ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Initial suggestions may only show if there is no value\n\t\t// (note: this includes whitespace).\n\t\tconst isInitialSuggestions = ! value?.length;\n\n\t\t// Trim only now we've determined whether or not it originally had a \"length\"\n\t\t// (even if that value was all whitespace).\n\t\tvalue = value.trim();\n\n\t\t// Allow a suggestions request if:\n\t\t// - there are at least 2 characters in the search input (except manual searches where\n\t\t// search input length is not required to trigger a fetch)\n\t\t// - this is a direct entry (eg: a URL)\n\t\tif (\n\t\t\t! isInitialSuggestions &&\n\t\t\t( value.length < 2 || ( ! handleURLSuggestions && isURL( value ) ) )\n\t\t) {\n\t\t\tthis.suggestionsRequest?.cancel?.();\n\t\t\tthis.suggestionsRequest = null;\n\n\t\t\tthis.setState( {\n\t\t\t\tsuggestions: [],\n\t\t\t\tshowSuggestions: false,\n\t\t\t\tsuggestionsValue: value,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: false,\n\t\t\t} );\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setState( {\n\t\t\tisUpdatingSuggestions: true,\n\t\t\tselectedSuggestion: null,\n\t\t\tloading: true,\n\t\t} );\n\n\t\tconst request = fetchLinkSuggestions( value, {\n\t\t\tisInitialSuggestions,\n\t\t} );\n\n\t\trequest\n\t\t\t.then( ( suggestions ) => {\n\t\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\t\tif ( this.suggestionsRequest !== request ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.setState( {\n\t\t\t\t\tsuggestions,\n\t\t\t\t\tisUpdatingSuggestions: false,\n\t\t\t\t\tsuggestionsValue: value,\n\t\t\t\t\tloading: false,\n\t\t\t\t\tshowSuggestions: !! suggestions.length,\n\t\t\t\t} );\n\n\t\t\t\tif ( !! suggestions.length ) {\n\t\t\t\t\tthis.props.debouncedSpeak(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: number of results. */\n\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t\tsuggestions.length\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tsuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tthis.props.debouncedSpeak(\n\t\t\t\t\t\t__( 'No results.' ),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( () => {\n\t\t\t\tif ( this.suggestionsRequest !== request ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.setState( {\n\t\t\t\t\tisUpdatingSuggestions: false,\n\t\t\t\t\tloading: false,\n\t\t\t\t} );\n\t\t\t} );\n\n\t\t// Note that this assignment is handled *before* the async search request\n\t\t// as a Promise always resolves on the next tick of the event loop.\n\t\tthis.suggestionsRequest = request;\n\t}\n\n\tonChange( event ) {\n\t\tthis.props.onChange( event.target.value );\n\t}\n\n\tonFocus() {\n\t\tconst { suggestions } = this.state;\n\t\tconst { disableSuggestions, value } = this.props;\n\n\t\t// When opening the link editor, if there's a value present, we want to load the suggestions pane with the results for this input search value\n\t\t// Don't re-run the suggestions on focus if there are already suggestions present (prevents searching again when tabbing between the input and buttons)\n\t\tif (\n\t\t\tvalue &&\n\t\t\t! disableSuggestions &&\n\t\t\t! this.state.isUpdatingSuggestions &&\n\t\t\t! ( suggestions && suggestions.length )\n\t\t) {\n\t\t\t// Ensure the suggestions are updated with the current input value.\n\t\t\tthis.updateSuggestions( value );\n\t\t}\n\t}\n\n\tonKeyDown( event ) {\n\t\tconst { showSuggestions, selectedSuggestion, suggestions, loading } =\n\t\t\tthis.state;\n\n\t\t// If the suggestions are not shown or loading, we shouldn't handle the arrow keys\n\t\t// We shouldn't preventDefault to allow block arrow keys navigation.\n\t\tif ( ! showSuggestions || ! suggestions.length || loading ) {\n\t\t\t// In the Windows version of Firefox the up and down arrows don't move the caret\n\t\t\t// within an input field like they do for Mac Firefox/Chrome/Safari. This causes\n\t\t\t// a form of focus trapping that is disruptive to the user experience. This disruption\n\t\t\t// only happens if the caret is not in the first or last position in the text input.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\n\t\t\tswitch ( event.keyCode ) {\n\t\t\t\t// When UP is pressed, if the caret is at the start of the text, move it to the 0\n\t\t\t\t// position.\n\t\t\t\tcase UP: {\n\t\t\t\t\tif ( 0 !== event.target.selectionStart ) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to position 0.\n\t\t\t\t\t\tevent.target.setSelectionRange( 0, 0 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// When DOWN is pressed, if the caret is not at the end of the text, move it to the\n\t\t\t\t// last position.\n\t\t\t\tcase DOWN: {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.props.value.length !== event.target.selectionStart\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to the last position.\n\t\t\t\t\t\tevent.target.setSelectionRange(\n\t\t\t\t\t\t\tthis.props.value.length,\n\t\t\t\t\t\t\tthis.props.value.length\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Submitting while loading should trigger onSubmit.\n\t\t\t\tcase ENTER: {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( this.props.onSubmit ) {\n\t\t\t\t\t\tthis.props.onSubmit( null, event );\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst suggestion =\n\t\t\tthis.state.suggestions[ this.state.selectedSuggestion ];\n\n\t\tswitch ( event.keyCode ) {\n\t\t\tcase UP: {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst previousIndex = ! selectedSuggestion\n\t\t\t\t\t? suggestions.length - 1\n\t\t\t\t\t: selectedSuggestion - 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: previousIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase DOWN: {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst nextIndex =\n\t\t\t\t\tselectedSuggestion === null ||\n\t\t\t\t\tselectedSuggestion === suggestions.length - 1\n\t\t\t\t\t\t? 0\n\t\t\t\t\t\t: selectedSuggestion + 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: nextIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase TAB: {\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tthis.selectLink( suggestion );\n\t\t\t\t\t// Announce a link has been selected when tabbing away from the input field.\n\t\t\t\t\tthis.props.speak( __( 'Link selected.' ) );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ENTER: {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tthis.selectLink( suggestion );\n\n\t\t\t\t\tif ( this.props.onSubmit ) {\n\t\t\t\t\t\tthis.props.onSubmit( suggestion, event );\n\t\t\t\t\t}\n\t\t\t\t} else if ( this.props.onSubmit ) {\n\t\t\t\t\tthis.props.onSubmit( null, event );\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tselectLink( suggestion ) {\n\t\tthis.props.onChange( suggestion.url, suggestion );\n\t\tthis.setState( {\n\t\t\tselectedSuggestion: null,\n\t\t\tshowSuggestions: false,\n\t\t} );\n\t}\n\n\thandleOnClick( suggestion ) {\n\t\tthis.selectLink( suggestion );\n\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\tthis.inputRef.current.focus();\n\t}\n\n\tstatic getDerivedStateFromProps(\n\t\t{\n\t\t\tvalue,\n\t\t\tinstanceId,\n\t\t\tdisableSuggestions,\n\t\t\t__experimentalShowInitialSuggestions = false,\n\t\t},\n\t\t{ showSuggestions }\n\t) {\n\t\tlet shouldShowSuggestions = showSuggestions;\n\n\t\tconst hasValue = value && value.length;\n\n\t\tif ( ! __experimentalShowInitialSuggestions && ! hasValue ) {\n\t\t\tshouldShowSuggestions = false;\n\t\t}\n\n\t\tif ( disableSuggestions === true ) {\n\t\t\tshouldShowSuggestions = false;\n\t\t}\n\n\t\treturn {\n\t\t\tshowSuggestions: shouldShowSuggestions,\n\t\t\tsuggestionsListboxId: `block-editor-url-input-suggestions-${ instanceId }`,\n\t\t\tsuggestionOptionIdPrefix: `block-editor-url-input-suggestion-${ instanceId }`,\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ this.renderControl() }\n\t\t\t\t{ this.renderSuggestions() }\n\t\t\t</>\n\t\t);\n\t}\n\n\trenderControl() {\n\t\tconst {\n\t\t\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t\t\t__nextHasNoMarginBottom = false,\n\t\t\tlabel = null,\n\t\t\tclassName,\n\t\t\tisFullWidth,\n\t\t\tinstanceId,\n\t\t\tplaceholder = __( 'Paste URL or type to search' ),\n\t\t\t__experimentalRenderControl: renderControl,\n\t\t\tvalue = '',\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\tloading,\n\t\t\tshowSuggestions,\n\t\t\tselectedSuggestion,\n\t\t\tsuggestionsListboxId,\n\t\t\tsuggestionOptionIdPrefix,\n\t\t} = this.state;\n\n\t\tconst inputId = `url-input-control-${ instanceId }`;\n\n\t\tconst controlProps = {\n\t\t\tid: inputId, // Passes attribute to label for the for attribute\n\t\t\tlabel,\n\t\t\tclassName: classnames( 'block-editor-url-input', className, {\n\t\t\t\t'is-full-width': isFullWidth,\n\t\t\t} ),\n\t\t};\n\n\t\tconst inputProps = {\n\t\t\tid: inputId,\n\t\t\tvalue,\n\t\t\trequired: true,\n\t\t\tclassName: 'block-editor-url-input__input',\n\t\t\ttype: 'text',\n\t\t\tonChange: this.onChange,\n\t\t\tonFocus: this.onFocus,\n\t\t\tplaceholder,\n\t\t\tonKeyDown: this.onKeyDown,\n\t\t\trole: 'combobox',\n\t\t\t'aria-label': label ? undefined : __( 'URL' ), // Ensure input always has an accessible label\n\t\t\t'aria-expanded': showSuggestions,\n\t\t\t'aria-autocomplete': 'list',\n\t\t\t'aria-controls': suggestionsListboxId,\n\t\t\t'aria-activedescendant':\n\t\t\t\tselectedSuggestion !== null\n\t\t\t\t\t? `${ suggestionOptionIdPrefix }-${ selectedSuggestion }`\n\t\t\t\t\t: undefined,\n\t\t\tref: this.inputRef,\n\t\t};\n\n\t\tif ( renderControl ) {\n\t\t\treturn renderControl( controlProps, inputProps, loading );\n\t\t}\n\n\t\tif ( ! __nextHasNoMarginBottom ) {\n\t\t\tdeprecated( 'Bottom margin styles for wp.blockEditor.URLInput', {\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.5',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t} );\n\t\t}\n\n\t\treturn (\n\t\t\t<BaseControl\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t{ ...controlProps }\n\t\t\t>\n\t\t\t\t<input { ...inputProps } />\n\t\t\t\t{ loading && <Spinner /> }\n\t\t\t</BaseControl>\n\t\t);\n\t}\n\n\trenderSuggestions() {\n\t\tconst {\n\t\t\tclassName,\n\t\t\t__experimentalRenderSuggestions: renderSuggestions,\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\tshowSuggestions,\n\t\t\tsuggestions,\n\t\t\tsuggestionsValue,\n\t\t\tselectedSuggestion,\n\t\t\tsuggestionsListboxId,\n\t\t\tsuggestionOptionIdPrefix,\n\t\t\tloading,\n\t\t} = this.state;\n\n\t\tif ( ! showSuggestions || suggestions.length === 0 ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst suggestionsListProps = {\n\t\t\tid: suggestionsListboxId,\n\t\t\tref: this.autocompleteRef,\n\t\t\trole: 'listbox',\n\t\t};\n\n\t\tconst buildSuggestionItemProps = ( suggestion, index ) => {\n\t\t\treturn {\n\t\t\t\trole: 'option',\n\t\t\t\ttabIndex: '-1',\n\t\t\t\tid: `${ suggestionOptionIdPrefix }-${ index }`,\n\t\t\t\tref: this.bindSuggestionNode( index ),\n\t\t\t\t'aria-selected': index === selectedSuggestion,\n\t\t\t};\n\t\t};\n\n\t\tif ( isFunction( renderSuggestions ) ) {\n\t\t\treturn renderSuggestions( {\n\t\t\t\tsuggestions,\n\t\t\t\tselectedSuggestion,\n\t\t\t\tsuggestionsListProps,\n\t\t\t\tbuildSuggestionItemProps,\n\t\t\t\tisLoading: loading,\n\t\t\t\thandleSuggestionClick: this.handleOnClick,\n\t\t\t\tisInitialSuggestions: ! suggestionsValue?.length,\n\t\t\t\tcurrentInputValue: suggestionsValue,\n\t\t\t} );\n\t\t}\n\n\t\treturn (\n\t\t\t<Popover placement=\"bottom\" focusOnMount={ false }>\n\t\t\t\t<div\n\t\t\t\t\t{ ...suggestionsListProps }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-url-input__suggestions',\n\t\t\t\t\t\t`${ className }__suggestions`\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ suggestions.map( ( suggestion, index ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t{ ...buildSuggestionItemProps( suggestion, index ) }\n\t\t\t\t\t\t\tkey={ suggestion.id }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-url-input__suggestion',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => this.handleOnClick( suggestion ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ suggestion.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) ) }\n\t\t\t\t</div>\n\t\t\t</Popover>\n\t\t);\n\t}\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md\n */\nexport default compose(\n\twithSafeTimeout,\n\twithSpokenMessages,\n\twithInstanceId,\n\twithSelect( ( select, props ) => {\n\t\t// If a link suggestions handler is already provided then\n\t\t// bail.\n\t\tif ( isFunction( props.__experimentalFetchLinkSuggestions ) ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\t__experimentalFetchLinkSuggestions:\n\t\t\t\tgetSettings().__experimentalFetchLinkSuggestions,\n\t\t};\n\t} )\n)( URLInput );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/url-input/index.js"],"names":["classnames","scrollIntoView","deprecated","__","sprintf","_n","Component","createRef","UP","DOWN","ENTER","TAB","BaseControl","Button","Spinner","withSpokenMessages","Popover","compose","debounce","withInstanceId","withSafeTimeout","withSelect","isURL","store","blockEditorStore","isFunction","maybeFunc","URLInput","constructor","props","onChange","bind","onFocus","onKeyDown","selectLink","handleOnClick","bindSuggestionNode","autocompleteRef","inputRef","updateSuggestions","suggestionNodes","suggestionsRequest","state","suggestions","showSuggestions","isUpdatingSuggestions","suggestionsValue","selectedSuggestion","suggestionsListboxId","suggestionOptionIdPrefix","componentDidUpdate","prevProps","value","__experimentalShowInitialSuggestions","scrollingIntoView","current","onlyScrollIfNeeded","setTimeout","disableSuggestions","length","componentDidMount","shouldShowInitialSuggestions","componentWillUnmount","cancel","index","ref","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalHandleURLSuggestions","handleURLSuggestions","isInitialSuggestions","trim","setState","loading","request","then","debouncedSpeak","catch","event","target","keyCode","selectionStart","preventDefault","setSelectionRange","onSubmit","suggestion","previousIndex","nextIndex","speak","url","focus","getDerivedStateFromProps","instanceId","shouldShowSuggestions","hasValue","render","renderControl","renderSuggestions","__nextHasNoMarginBottom","label","className","isFullWidth","placeholder","__experimentalRenderControl","inputId","controlProps","id","inputProps","required","type","role","undefined","since","version","hint","__experimentalRenderSuggestions","suggestionsListProps","buildSuggestionItemProps","tabIndex","isLoading","handleSuggestionClick","currentInputValue","map","title","select","getSettings"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,OAAOC,cAAP,MAA2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ExB,gBAAF,aAAEA,gBAAF,eAAEA,gBAAgB,CAAEa,MAApB,CAPG;AAQzB8D,QAAAA,iBAAiB,EAAE3E;AARM,OAAF,CAAxB;AAUA;;AAED,WACC,cAAC,OAAD;AAAS,MAAA,SAAS,EAAC,QAAnB;AAA4B,MAAA,YAAY,EAAG;AAA3C,OACC,kCACMsE,oBADN;AAEC,MAAA,SAAS,EAAGpH,UAAU,CACrB,qCADqB,EAEpB,GAAGoG,SAAW,eAFM;AAFvB,QAOGzD,WAAW,CAAC+E,GAAZ,CAAiB,CAAErC,UAAF,EAAcrB,KAAd,KAClB,cAAC,MAAD,eACMqD,wBAAwB,CAAEhC,UAAF,EAAcrB,KAAd,CAD9B;AAEC,MAAA,GAAG,EAAGqB,UAAU,CAACqB,EAFlB;AAGC,MAAA,SAAS,EAAG1G,UAAU,CACrB,oCADqB,EAErB;AACC,uBAAegE,KAAK,KAAKjB;AAD1B,OAFqB,CAHvB;AASC,MAAA,OAAO,EAAG,MAAM,KAAKZ,aAAL,CAAoBkD,UAApB;AATjB,QAWGA,UAAU,CAACsC,KAXd,CADC,CAPH,CADD,CADD;AA2BA;;AAthB+B;AAyhBjC;AACA;AACA;;;AACA,eAAe1G,OAAO,CACrBG,eADqB,EAErBL,kBAFqB,EAGrBI,cAHqB,EAIrBE,UAAU,CAAE,CAAEuG,MAAF,EAAU/F,KAAV,KAAqB;AAChC;AACA;AACA,MAAKJ,UAAU,CAAEI,KAAK,CAACqC,kCAAR,CAAf,EAA8D;AAC7D;AACA;;AACD,QAAM;AAAE2D,IAAAA;AAAF,MAAkBD,MAAM,CAAEpG,gBAAF,CAA9B;AACA,SAAO;AACN0C,IAAAA,kCAAkC,EACjC2D,WAAW,GAAG3D;AAFT,GAAP;AAIA,CAXS,CAJW,CAAP,CAgBZvC,QAhBY,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport scrollIntoView from 'dom-scroll-into-view';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { Component, createRef } from '@wordpress/element';\nimport { UP, DOWN, ENTER, TAB } from '@wordpress/keycodes';\nimport {\n\tBaseControl,\n\tButton,\n\tSpinner,\n\twithSpokenMessages,\n\tPopover,\n} from '@wordpress/components';\nimport {\n\tcompose,\n\tdebounce,\n\twithInstanceId,\n\twithSafeTimeout,\n} from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport { isURL } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Whether the argument is a function.\n *\n * @param {*} maybeFunc The argument to check.\n * @return {boolean} True if the argument is a function, false otherwise.\n */\nfunction isFunction( maybeFunc ) {\n\treturn typeof maybeFunc === 'function';\n}\n\nclass URLInput extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.onChange = this.onChange.bind( this );\n\t\tthis.onFocus = this.onFocus.bind( this );\n\t\tthis.onKeyDown = this.onKeyDown.bind( this );\n\t\tthis.selectLink = this.selectLink.bind( this );\n\t\tthis.handleOnClick = this.handleOnClick.bind( this );\n\t\tthis.bindSuggestionNode = this.bindSuggestionNode.bind( this );\n\t\tthis.autocompleteRef = props.autocompleteRef || createRef();\n\t\tthis.inputRef = createRef();\n\t\tthis.updateSuggestions = debounce(\n\t\t\tthis.updateSuggestions.bind( this ),\n\t\t\t200\n\t\t);\n\n\t\tthis.suggestionNodes = [];\n\n\t\tthis.suggestionsRequest = null;\n\n\t\tthis.state = {\n\t\t\tsuggestions: [],\n\t\t\tshowSuggestions: false,\n\t\t\tisUpdatingSuggestions: false,\n\t\t\tsuggestionsValue: null,\n\t\t\tselectedSuggestion: null,\n\t\t\tsuggestionsListboxId: '',\n\t\t\tsuggestionOptionIdPrefix: '',\n\t\t};\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { showSuggestions, selectedSuggestion } = this.state;\n\t\tconst { value, __experimentalShowInitialSuggestions = false } =\n\t\t\tthis.props;\n\n\t\t// Only have to worry about scrolling selected suggestion into view\n\t\t// when already expanded.\n\t\tif (\n\t\t\tshowSuggestions &&\n\t\t\tselectedSuggestion !== null &&\n\t\t\tthis.suggestionNodes[ selectedSuggestion ] &&\n\t\t\t! this.scrollingIntoView\n\t\t) {\n\t\t\tthis.scrollingIntoView = true;\n\t\t\tscrollIntoView(\n\t\t\t\tthis.suggestionNodes[ selectedSuggestion ],\n\t\t\t\tthis.autocompleteRef.current,\n\t\t\t\t{\n\t\t\t\t\tonlyScrollIfNeeded: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tthis.props.setTimeout( () => {\n\t\t\t\tthis.scrollingIntoView = false;\n\t\t\t}, 100 );\n\t\t}\n\n\t\t// Update suggestions when the value changes.\n\t\tif (\n\t\t\tprevProps.value !== value &&\n\t\t\t! this.props.disableSuggestions &&\n\t\t\t! this.state.isUpdatingSuggestions\n\t\t) {\n\t\t\tif ( value?.length ) {\n\t\t\t\t// If the new value is not empty we need to update with suggestions for it.\n\t\t\t\tthis.updateSuggestions( value );\n\t\t\t} else if ( __experimentalShowInitialSuggestions ) {\n\t\t\t\t// If the new value is empty and we can show initial suggestions, then show initial suggestions.\n\t\t\t\tthis.updateSuggestions();\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.shouldShowInitialSuggestions() ) {\n\t\t\tthis.updateSuggestions();\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.suggestionsRequest?.cancel?.();\n\t\tthis.suggestionsRequest = null;\n\t}\n\n\tbindSuggestionNode( index ) {\n\t\treturn ( ref ) => {\n\t\t\tthis.suggestionNodes[ index ] = ref;\n\t\t};\n\t}\n\n\tshouldShowInitialSuggestions() {\n\t\tconst { __experimentalShowInitialSuggestions = false, value } =\n\t\t\tthis.props;\n\t\treturn (\n\t\t\t__experimentalShowInitialSuggestions && ! ( value && value.length )\n\t\t);\n\t}\n\n\tupdateSuggestions( value = '' ) {\n\t\tconst {\n\t\t\t__experimentalFetchLinkSuggestions: fetchLinkSuggestions,\n\t\t\t__experimentalHandleURLSuggestions: handleURLSuggestions,\n\t\t} = this.props;\n\n\t\tif ( ! fetchLinkSuggestions ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Initial suggestions may only show if there is no value\n\t\t// (note: this includes whitespace).\n\t\tconst isInitialSuggestions = ! value?.length;\n\n\t\t// Trim only now we've determined whether or not it originally had a \"length\"\n\t\t// (even if that value was all whitespace).\n\t\tvalue = value.trim();\n\n\t\t// Allow a suggestions request if:\n\t\t// - there are at least 2 characters in the search input (except manual searches where\n\t\t// search input length is not required to trigger a fetch)\n\t\t// - this is a direct entry (eg: a URL)\n\t\tif (\n\t\t\t! isInitialSuggestions &&\n\t\t\t( value.length < 2 || ( ! handleURLSuggestions && isURL( value ) ) )\n\t\t) {\n\t\t\tthis.suggestionsRequest?.cancel?.();\n\t\t\tthis.suggestionsRequest = null;\n\n\t\t\tthis.setState( {\n\t\t\t\tsuggestions: [],\n\t\t\t\tshowSuggestions: false,\n\t\t\t\tsuggestionsValue: value,\n\t\t\t\tselectedSuggestion: null,\n\t\t\t\tloading: false,\n\t\t\t} );\n\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setState( {\n\t\t\tisUpdatingSuggestions: true,\n\t\t\tselectedSuggestion: null,\n\t\t\tloading: true,\n\t\t} );\n\n\t\tconst request = fetchLinkSuggestions( value, {\n\t\t\tisInitialSuggestions,\n\t\t} );\n\n\t\trequest\n\t\t\t.then( ( suggestions ) => {\n\t\t\t\t// A fetch Promise doesn't have an abort option. It's mimicked by\n\t\t\t\t// comparing the request reference in on the instance, which is\n\t\t\t\t// reset or deleted on subsequent requests or unmounting.\n\t\t\t\tif ( this.suggestionsRequest !== request ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.setState( {\n\t\t\t\t\tsuggestions,\n\t\t\t\t\tisUpdatingSuggestions: false,\n\t\t\t\t\tsuggestionsValue: value,\n\t\t\t\t\tloading: false,\n\t\t\t\t\tshowSuggestions: !! suggestions.length,\n\t\t\t\t} );\n\n\t\t\t\tif ( !! suggestions.length ) {\n\t\t\t\t\tthis.props.debouncedSpeak(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: number of results. */\n\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t\tsuggestions.length\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tsuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tthis.props.debouncedSpeak(\n\t\t\t\t\t\t__( 'No results.' ),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( () => {\n\t\t\t\tif ( this.suggestionsRequest !== request ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.setState( {\n\t\t\t\t\tisUpdatingSuggestions: false,\n\t\t\t\t\tloading: false,\n\t\t\t\t} );\n\t\t\t} );\n\n\t\t// Note that this assignment is handled *before* the async search request\n\t\t// as a Promise always resolves on the next tick of the event loop.\n\t\tthis.suggestionsRequest = request;\n\t}\n\n\tonChange( event ) {\n\t\tthis.props.onChange( event.target.value );\n\t}\n\n\tonFocus() {\n\t\tconst { suggestions } = this.state;\n\t\tconst { disableSuggestions, value } = this.props;\n\n\t\t// When opening the link editor, if there's a value present, we want to load the suggestions pane with the results for this input search value\n\t\t// Don't re-run the suggestions on focus if there are already suggestions present (prevents searching again when tabbing between the input and buttons)\n\t\tif (\n\t\t\tvalue &&\n\t\t\t! disableSuggestions &&\n\t\t\t! this.state.isUpdatingSuggestions &&\n\t\t\t! ( suggestions && suggestions.length )\n\t\t) {\n\t\t\t// Ensure the suggestions are updated with the current input value.\n\t\t\tthis.updateSuggestions( value );\n\t\t}\n\t}\n\n\tonKeyDown( event ) {\n\t\tconst { showSuggestions, selectedSuggestion, suggestions, loading } =\n\t\t\tthis.state;\n\n\t\t// If the suggestions are not shown or loading, we shouldn't handle the arrow keys\n\t\t// We shouldn't preventDefault to allow block arrow keys navigation.\n\t\tif ( ! showSuggestions || ! suggestions.length || loading ) {\n\t\t\t// In the Windows version of Firefox the up and down arrows don't move the caret\n\t\t\t// within an input field like they do for Mac Firefox/Chrome/Safari. This causes\n\t\t\t// a form of focus trapping that is disruptive to the user experience. This disruption\n\t\t\t// only happens if the caret is not in the first or last position in the text input.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/5693#issuecomment-436684747\n\t\t\tswitch ( event.keyCode ) {\n\t\t\t\t// When UP is pressed, if the caret is at the start of the text, move it to the 0\n\t\t\t\t// position.\n\t\t\t\tcase UP: {\n\t\t\t\t\tif ( 0 !== event.target.selectionStart ) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to position 0.\n\t\t\t\t\t\tevent.target.setSelectionRange( 0, 0 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t// When DOWN is pressed, if the caret is not at the end of the text, move it to the\n\t\t\t\t// last position.\n\t\t\t\tcase DOWN: {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.props.value.length !== event.target.selectionStart\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\t// Set the input caret to the last position.\n\t\t\t\t\t\tevent.target.setSelectionRange(\n\t\t\t\t\t\t\tthis.props.value.length,\n\t\t\t\t\t\t\tthis.props.value.length\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t// Submitting while loading should trigger onSubmit.\n\t\t\t\tcase ENTER: {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( this.props.onSubmit ) {\n\t\t\t\t\t\tthis.props.onSubmit( null, event );\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst suggestion =\n\t\t\tthis.state.suggestions[ this.state.selectedSuggestion ];\n\n\t\tswitch ( event.keyCode ) {\n\t\t\tcase UP: {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst previousIndex = ! selectedSuggestion\n\t\t\t\t\t? suggestions.length - 1\n\t\t\t\t\t: selectedSuggestion - 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: previousIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase DOWN: {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst nextIndex =\n\t\t\t\t\tselectedSuggestion === null ||\n\t\t\t\t\tselectedSuggestion === suggestions.length - 1\n\t\t\t\t\t\t? 0\n\t\t\t\t\t\t: selectedSuggestion + 1;\n\t\t\t\tthis.setState( {\n\t\t\t\t\tselectedSuggestion: nextIndex,\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase TAB: {\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tthis.selectLink( suggestion );\n\t\t\t\t\t// Announce a link has been selected when tabbing away from the input field.\n\t\t\t\t\tthis.props.speak( __( 'Link selected.' ) );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ENTER: {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( this.state.selectedSuggestion !== null ) {\n\t\t\t\t\tthis.selectLink( suggestion );\n\n\t\t\t\t\tif ( this.props.onSubmit ) {\n\t\t\t\t\t\tthis.props.onSubmit( suggestion, event );\n\t\t\t\t\t}\n\t\t\t\t} else if ( this.props.onSubmit ) {\n\t\t\t\t\tthis.props.onSubmit( null, event );\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tselectLink( suggestion ) {\n\t\tthis.props.onChange( suggestion.url, suggestion );\n\t\tthis.setState( {\n\t\t\tselectedSuggestion: null,\n\t\t\tshowSuggestions: false,\n\t\t} );\n\t}\n\n\thandleOnClick( suggestion ) {\n\t\tthis.selectLink( suggestion );\n\t\t// Move focus to the input field when a link suggestion is clicked.\n\t\tthis.inputRef.current.focus();\n\t}\n\n\tstatic getDerivedStateFromProps(\n\t\t{\n\t\t\tvalue,\n\t\t\tinstanceId,\n\t\t\tdisableSuggestions,\n\t\t\t__experimentalShowInitialSuggestions = false,\n\t\t},\n\t\t{ showSuggestions }\n\t) {\n\t\tlet shouldShowSuggestions = showSuggestions;\n\n\t\tconst hasValue = value && value.length;\n\n\t\tif ( ! __experimentalShowInitialSuggestions && ! hasValue ) {\n\t\t\tshouldShowSuggestions = false;\n\t\t}\n\n\t\tif ( disableSuggestions === true ) {\n\t\t\tshouldShowSuggestions = false;\n\t\t}\n\n\t\treturn {\n\t\t\tshowSuggestions: shouldShowSuggestions,\n\t\t\tsuggestionsListboxId: `block-editor-url-input-suggestions-${ instanceId }`,\n\t\t\tsuggestionOptionIdPrefix: `block-editor-url-input-suggestion-${ instanceId }`,\n\t\t};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ this.renderControl() }\n\t\t\t\t{ this.renderSuggestions() }\n\t\t\t</>\n\t\t);\n\t}\n\n\trenderControl() {\n\t\tconst {\n\t\t\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t\t\t__nextHasNoMarginBottom = false,\n\t\t\tlabel = null,\n\t\t\tclassName,\n\t\t\tisFullWidth,\n\t\t\tinstanceId,\n\t\t\tplaceholder = __( 'Paste URL or type to search' ),\n\t\t\t__experimentalRenderControl: renderControl,\n\t\t\tvalue = '',\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\tloading,\n\t\t\tshowSuggestions,\n\t\t\tselectedSuggestion,\n\t\t\tsuggestionsListboxId,\n\t\t\tsuggestionOptionIdPrefix,\n\t\t} = this.state;\n\n\t\tconst inputId = `url-input-control-${ instanceId }`;\n\n\t\tconst controlProps = {\n\t\t\tid: inputId, // Passes attribute to label for the for attribute\n\t\t\tlabel,\n\t\t\tclassName: classnames( 'block-editor-url-input', className, {\n\t\t\t\t'is-full-width': isFullWidth,\n\t\t\t} ),\n\t\t};\n\n\t\tconst inputProps = {\n\t\t\tid: inputId,\n\t\t\tvalue,\n\t\t\trequired: true,\n\t\t\tclassName: 'block-editor-url-input__input',\n\t\t\ttype: 'text',\n\t\t\tonChange: this.onChange,\n\t\t\tonFocus: this.onFocus,\n\t\t\tplaceholder,\n\t\t\tonKeyDown: this.onKeyDown,\n\t\t\trole: 'combobox',\n\t\t\t'aria-label': label ? undefined : __( 'URL' ), // Ensure input always has an accessible label\n\t\t\t'aria-expanded': showSuggestions,\n\t\t\t'aria-autocomplete': 'list',\n\t\t\t'aria-owns': suggestionsListboxId,\n\t\t\t'aria-activedescendant':\n\t\t\t\tselectedSuggestion !== null\n\t\t\t\t\t? `${ suggestionOptionIdPrefix }-${ selectedSuggestion }`\n\t\t\t\t\t: undefined,\n\t\t\tref: this.inputRef,\n\t\t};\n\n\t\tif ( renderControl ) {\n\t\t\treturn renderControl( controlProps, inputProps, loading );\n\t\t}\n\n\t\tif ( ! __nextHasNoMarginBottom ) {\n\t\t\tdeprecated( 'Bottom margin styles for wp.blockEditor.URLInput', {\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.5',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t} );\n\t\t}\n\n\t\treturn (\n\t\t\t<BaseControl\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t{ ...controlProps }\n\t\t\t>\n\t\t\t\t<input { ...inputProps } />\n\t\t\t\t{ loading && <Spinner /> }\n\t\t\t</BaseControl>\n\t\t);\n\t}\n\n\trenderSuggestions() {\n\t\tconst {\n\t\t\tclassName,\n\t\t\t__experimentalRenderSuggestions: renderSuggestions,\n\t\t} = this.props;\n\n\t\tconst {\n\t\t\tshowSuggestions,\n\t\t\tsuggestions,\n\t\t\tsuggestionsValue,\n\t\t\tselectedSuggestion,\n\t\t\tsuggestionsListboxId,\n\t\t\tsuggestionOptionIdPrefix,\n\t\t\tloading,\n\t\t} = this.state;\n\n\t\tif ( ! showSuggestions || suggestions.length === 0 ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst suggestionsListProps = {\n\t\t\tid: suggestionsListboxId,\n\t\t\tref: this.autocompleteRef,\n\t\t\trole: 'listbox',\n\t\t};\n\n\t\tconst buildSuggestionItemProps = ( suggestion, index ) => {\n\t\t\treturn {\n\t\t\t\trole: 'option',\n\t\t\t\ttabIndex: '-1',\n\t\t\t\tid: `${ suggestionOptionIdPrefix }-${ index }`,\n\t\t\t\tref: this.bindSuggestionNode( index ),\n\t\t\t\t'aria-selected':\n\t\t\t\t\tindex === selectedSuggestion ? true : undefined,\n\t\t\t};\n\t\t};\n\n\t\tif ( isFunction( renderSuggestions ) ) {\n\t\t\treturn renderSuggestions( {\n\t\t\t\tsuggestions,\n\t\t\t\tselectedSuggestion,\n\t\t\t\tsuggestionsListProps,\n\t\t\t\tbuildSuggestionItemProps,\n\t\t\t\tisLoading: loading,\n\t\t\t\thandleSuggestionClick: this.handleOnClick,\n\t\t\t\tisInitialSuggestions: ! suggestionsValue?.length,\n\t\t\t\tcurrentInputValue: suggestionsValue,\n\t\t\t} );\n\t\t}\n\n\t\treturn (\n\t\t\t<Popover placement=\"bottom\" focusOnMount={ false }>\n\t\t\t\t<div\n\t\t\t\t\t{ ...suggestionsListProps }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-url-input__suggestions',\n\t\t\t\t\t\t`${ className }__suggestions`\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ suggestions.map( ( suggestion, index ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t{ ...buildSuggestionItemProps( suggestion, index ) }\n\t\t\t\t\t\t\tkey={ suggestion.id }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-url-input__suggestion',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-selected': index === selectedSuggestion,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => this.handleOnClick( suggestion ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ suggestion.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) ) }\n\t\t\t\t</div>\n\t\t\t</Popover>\n\t\t);\n\t}\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md\n */\nexport default compose(\n\twithSafeTimeout,\n\twithSpokenMessages,\n\twithInstanceId,\n\twithSelect( ( select, props ) => {\n\t\t// If a link suggestions handler is already provided then\n\t\t// bail.\n\t\tif ( isFunction( props.__experimentalFetchLinkSuggestions ) ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\t__experimentalFetchLinkSuggestions:\n\t\t\t\tgetSettings().__experimentalFetchLinkSuggestions,\n\t\t};\n\t} )\n)( URLInput );\n"]}
|
|
@@ -80,7 +80,10 @@ function findDepth(a, b) {
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
function setContentEditableWrapper(node, value) {
|
|
83
|
-
|
|
83
|
+
// Since we are calling this on every selection change, check if the value
|
|
84
|
+
// needs to be updated first because it trigger the browser to recalculate
|
|
85
|
+
// style.
|
|
86
|
+
if (node.contentEditable !== String(value)) node.contentEditable = value; // Firefox doesn't automatically move focus.
|
|
84
87
|
|
|
85
88
|
if (value) node.focus();
|
|
86
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-selection-observer.js"],"names":["useSelect","useDispatch","useRefEffect","store","blockEditorStore","getBlockClientId","extractSelectionStartNode","selection","anchorNode","anchorOffset","nodeType","TEXT_NODE","childNodes","extractSelectionEndNode","focusNode","focusOffset","length","findDepth","a","b","depth","setContentEditableWrapper","node","value","contentEditable","focus","useSelectionObserver","multiSelect","selectBlock","selectionChange","getBlockParents","getBlockSelectionStart","ownerDocument","defaultView","onSelectionChange","event","getSelection","rangeCount","isClickShift","shiftKey","type","isCollapsed","startClientId","endClientId","selectedClientId","clickedClientId","target","focusNodeIsNonSelectable","undefined","isSingularSelection","startPath","endPath","addListeners","addEventListener","removeListeners","removeEventListener","resetListeners"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,SAASC,gBAAT,QAAiC,iBAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,yBAAT,CAAoCC,SAApC,EAAgD;AAC/C,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA+BF,SAArC;;AAEA,MAAKC,UAAU,CAACE,QAAX,KAAwBF,UAAU,CAACG,SAAxC,EAAoD;AACnD,WAAOH,UAAP;AACA;;AAED,MAAKC,YAAY,KAAK,CAAtB,EAA0B;AACzB,WAAOD,UAAP;AACA;;AAED,SAAOA,UAAU,CAACI,UAAX,CAAuBH,YAAY,GAAG,CAAtC,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASI,uBAAT,CAAkCN,SAAlC,EAA8C;AAC7C,QAAM;AAAEO,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA6BR,SAAnC;;AAEA,MAAKO,SAAS,CAACJ,QAAV,KAAuBI,SAAS,CAACH,SAAtC,EAAkD;AACjD,WAAOG,SAAP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IA,cAAMvB,KAAK,GAAGH,SAAS,CAAEiC,SAAF,EAAaC,OAAb,CAAvB;AAEAxB,QAAAA,WAAW,CAAEuB,SAAS,CAAE9B,KAAF,CAAX,EAAsB+B,OAAO,CAAE/B,KAAF,CAA7B,CAAX;AACA;AACD;;AAED,aAASgC,YAAT,GAAwB;AACvBpB,MAAAA,aAAa,CAACqB,gBAAd,CACC,iBADD,EAECnB,iBAFD;AAIAD,MAAAA,WAAW,CAACoB,gBAAZ,CAA8B,SAA9B,EAAyCnB,iBAAzC;AACA;;AAED,aAASoB,eAAT,GAA2B;AAC1BtB,MAAAA,aAAa,CAACuB,mBAAd,CACC,iBADD,EAECrB,iBAFD;AAIAD,MAAAA,WAAW,CAACsB,mBAAZ,CAAiC,SAAjC,EAA4CrB,iBAA5C;AACA;;AAED,aAASsB,cAAT,GAA0B;AACzBF,MAAAA,eAAe;AACfF,MAAAA,YAAY;AACZ;;AAEDA,IAAAA,YAAY,GAtGD,CAuGX;AACA;AACA;;AACA9B,IAAAA,IAAI,CAAC+B,gBAAL,CAAuB,SAAvB,EAAkCG,cAAlC;AACA,WAAO,MAAM;AACZF,MAAAA,eAAe;AACfhC,MAAAA,IAAI,CAACiC,mBAAL,CAA0B,SAA1B,EAAqCC,cAArC;AACA,KAHD;AAIA,GAhHiB,EAiHlB,CAAE7B,WAAF,EAAeC,WAAf,EAA4BC,eAA5B,EAA6CC,eAA7C,CAjHkB,CAAnB;AAmHA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getBlockClientId } from '../../utils/dom';\n\n/**\n * Extract the selection start node from the selection. When the anchor node is\n * not a text node, the selection offset is the index of a child node.\n *\n * @param {Selection} selection The selection.\n *\n * @return {Element} The selection start node.\n */\nfunction extractSelectionStartNode( selection ) {\n\tconst { anchorNode, anchorOffset } = selection;\n\n\tif ( anchorNode.nodeType === anchorNode.TEXT_NODE ) {\n\t\treturn anchorNode;\n\t}\n\n\tif ( anchorOffset === 0 ) {\n\t\treturn anchorNode;\n\t}\n\n\treturn anchorNode.childNodes[ anchorOffset - 1 ];\n}\n\n/**\n * Extract the selection end node from the selection. When the focus node is not\n * a text node, the selection offset is the index of a child node. The selection\n * reaches up to but excluding that child node.\n *\n * @param {Selection} selection The selection.\n *\n * @return {Element} The selection start node.\n */\nfunction extractSelectionEndNode( selection ) {\n\tconst { focusNode, focusOffset } = selection;\n\n\tif ( focusNode.nodeType === focusNode.TEXT_NODE ) {\n\t\treturn focusNode;\n\t}\n\n\tif ( focusOffset === focusNode.childNodes.length ) {\n\t\treturn focusNode;\n\t}\n\n\treturn focusNode.childNodes[ focusOffset ];\n}\n\nfunction findDepth( a, b ) {\n\tlet depth = 0;\n\n\twhile ( a[ depth ] === b[ depth ] ) {\n\t\tdepth++;\n\t}\n\n\treturn depth;\n}\n\n/**\n * Sets the `contenteditable` wrapper element to `value`.\n *\n * @param {HTMLElement} node Block element.\n * @param {boolean} value `contentEditable` value (true or false)\n */\nfunction setContentEditableWrapper( node, value ) {\n\tnode.contentEditable = value;\n\t// Firefox doesn't automatically move focus.\n\tif ( value ) node.focus();\n}\n\n/**\n * Sets a multi-selection based on the native selection across blocks.\n */\nexport default function useSelectionObserver() {\n\tconst { multiSelect, selectBlock, selectionChange } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { getBlockParents, getBlockSelectionStart } =\n\t\tuseSelect( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tfunction onSelectionChange( event ) {\n\t\t\t\tconst selection = defaultView.getSelection();\n\n\t\t\t\tif ( ! selection.rangeCount ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// If selection is collapsed and we haven't used `shift+click`,\n\t\t\t\t// end multi selection and disable the contentEditable wrapper.\n\t\t\t\t// We have to check about `shift+click` case because elements\n\t\t\t\t// that don't support text selection might be involved, and we might\n\t\t\t\t// update the clientIds to multi-select blocks.\n\t\t\t\t// For now we check if the event is a `mouse` event.\n\t\t\t\tconst isClickShift = event.shiftKey && event.type === 'mouseup';\n\t\t\t\tif ( selection.isCollapsed && ! isClickShift ) {\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet startClientId = getBlockClientId(\n\t\t\t\t\textractSelectionStartNode( selection )\n\t\t\t\t);\n\t\t\t\tlet endClientId = getBlockClientId(\n\t\t\t\t\textractSelectionEndNode( selection )\n\t\t\t\t);\n\t\t\t\t// If the selection has changed and we had pressed `shift+click`,\n\t\t\t\t// we need to check if in an element that doesn't support\n\t\t\t\t// text selection has been clicked.\n\t\t\t\tif ( isClickShift ) {\n\t\t\t\t\tconst selectedClientId = getBlockSelectionStart();\n\t\t\t\t\tconst clickedClientId = getBlockClientId( event.target );\n\t\t\t\t\t// `endClientId` is not defined if we end the selection by clicking a non-selectable block.\n\t\t\t\t\t// We need to check if there was already a selection with a non-selectable focusNode.\n\t\t\t\t\tconst focusNodeIsNonSelectable =\n\t\t\t\t\t\tclickedClientId !== endClientId;\n\t\t\t\t\tif (\n\t\t\t\t\t\t( startClientId === endClientId &&\n\t\t\t\t\t\t\tselection.isCollapsed ) ||\n\t\t\t\t\t\t! endClientId ||\n\t\t\t\t\t\tfocusNodeIsNonSelectable\n\t\t\t\t\t) {\n\t\t\t\t\t\tendClientId = clickedClientId;\n\t\t\t\t\t}\n\t\t\t\t\t// Handle the case when we have a non-selectable block\n\t\t\t\t\t// selected and click another one.\n\t\t\t\t\tif ( startClientId !== selectedClientId ) {\n\t\t\t\t\t\tstartClientId = selectedClientId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If the selection did not involve a block, return.\n\t\t\t\tif (\n\t\t\t\t\tstartClientId === undefined &&\n\t\t\t\t\tendClientId === undefined\n\t\t\t\t) {\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst isSingularSelection = startClientId === endClientId;\n\t\t\t\tif ( isSingularSelection ) {\n\t\t\t\t\tselectBlock( startClientId );\n\t\t\t\t} else {\n\t\t\t\t\tconst startPath = [\n\t\t\t\t\t\t...getBlockParents( startClientId ),\n\t\t\t\t\t\tstartClientId,\n\t\t\t\t\t];\n\t\t\t\t\tconst endPath = [\n\t\t\t\t\t\t...getBlockParents( endClientId ),\n\t\t\t\t\t\tendClientId,\n\t\t\t\t\t];\n\t\t\t\t\tconst depth = findDepth( startPath, endPath );\n\n\t\t\t\t\tmultiSelect( startPath[ depth ], endPath[ depth ] );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction addListeners() {\n\t\t\t\townerDocument.addEventListener(\n\t\t\t\t\t'selectionchange',\n\t\t\t\t\tonSelectionChange\n\t\t\t\t);\n\t\t\t\tdefaultView.addEventListener( 'mouseup', onSelectionChange );\n\t\t\t}\n\n\t\t\tfunction removeListeners() {\n\t\t\t\townerDocument.removeEventListener(\n\t\t\t\t\t'selectionchange',\n\t\t\t\t\tonSelectionChange\n\t\t\t\t);\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onSelectionChange );\n\t\t\t}\n\n\t\t\tfunction resetListeners() {\n\t\t\t\tremoveListeners();\n\t\t\t\taddListeners();\n\t\t\t}\n\n\t\t\taddListeners();\n\t\t\t// We must allow rich text to set selection first. This ensures that\n\t\t\t// our `selectionchange` listener is always reset to be called after\n\t\t\t// the rich text one.\n\t\t\tnode.addEventListener( 'focusin', resetListeners );\n\t\t\treturn () => {\n\t\t\t\tremoveListeners();\n\t\t\t\tnode.removeEventListener( 'focusin', resetListeners );\n\t\t\t};\n\t\t},\n\t\t[ multiSelect, selectBlock, selectionChange, getBlockParents ]\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/writing-flow/use-selection-observer.js"],"names":["useSelect","useDispatch","useRefEffect","store","blockEditorStore","getBlockClientId","extractSelectionStartNode","selection","anchorNode","anchorOffset","nodeType","TEXT_NODE","childNodes","extractSelectionEndNode","focusNode","focusOffset","length","findDepth","a","b","depth","setContentEditableWrapper","node","value","contentEditable","String","focus","useSelectionObserver","multiSelect","selectBlock","selectionChange","getBlockParents","getBlockSelectionStart","ownerDocument","defaultView","onSelectionChange","event","getSelection","rangeCount","isClickShift","shiftKey","type","isCollapsed","startClientId","endClientId","selectedClientId","clickedClientId","target","focusNodeIsNonSelectable","undefined","isSingularSelection","startPath","endPath","addListeners","addEventListener","removeListeners","removeEventListener","resetListeners"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,SAASC,gBAAT,QAAiC,iBAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,yBAAT,CAAoCC,SAApC,EAAgD;AAC/C,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA+BF,SAArC;;AAEA,MAAKC,UAAU,CAACE,QAAX,KAAwBF,UAAU,CAACG,SAAxC,EAAoD;AACnD,WAAOH,UAAP;AACA;;AAED,MAAKC,YAAY,KAAK,CAAtB,EAA0B;AACzB,WAAOD,UAAP;AACA;;AAED,SAAOA,UAAU,CAACI,UAAX,CAAuBH,YAAY,GAAG,CAAtC,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASI,uBAAT,CAAkCN,SAAlC,EAA8C;AAC7C,QAAM;AAAEO,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA6BR,SAAnC;;AAEA,MAAKO,SAAS,CAACJ,QAAV,KAAuBI,SAAS,CAACH,SAAtC,EAAkD;AACjD,WA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,cAAMS,OAAO,GAAG,CACf,GAAGrB,eAAe,CAAEa,WAAF,CADH,EAEfA,WAFe,CAAhB;AAIA,cAAMxB,KAAK,GAAGH,SAAS,CAAEkC,SAAF,EAAaC,OAAb,CAAvB;AAEAxB,QAAAA,WAAW,CAAEuB,SAAS,CAAE/B,KAAF,CAAX,EAAsBgC,OAAO,CAAEhC,KAAF,CAA7B,CAAX;AACA;AACD;;AAED,aAASiC,YAAT,GAAwB;AACvBpB,MAAAA,aAAa,CAACqB,gBAAd,CACC,iBADD,EAECnB,iBAFD;AAIAD,MAAAA,WAAW,CAACoB,gBAAZ,CAA8B,SAA9B,EAAyCnB,iBAAzC;AACA;;AAED,aAASoB,eAAT,GAA2B;AAC1BtB,MAAAA,aAAa,CAACuB,mBAAd,CACC,iBADD,EAECrB,iBAFD;AAIAD,MAAAA,WAAW,CAACsB,mBAAZ,CAAiC,SAAjC,EAA4CrB,iBAA5C;AACA;;AAED,aAASsB,cAAT,GAA0B;AACzBF,MAAAA,eAAe;AACfF,MAAAA,YAAY;AACZ;;AAEDA,IAAAA,YAAY,GAtGD,CAuGX;AACA;AACA;;AACA/B,IAAAA,IAAI,CAACgC,gBAAL,CAAuB,SAAvB,EAAkCG,cAAlC;AACA,WAAO,MAAM;AACZF,MAAAA,eAAe;AACfjC,MAAAA,IAAI,CAACkC,mBAAL,CAA0B,SAA1B,EAAqCC,cAArC;AACA,KAHD;AAIA,GAhHiB,EAiHlB,CAAE7B,WAAF,EAAeC,WAAf,EAA4BC,eAA5B,EAA6CC,eAA7C,CAjHkB,CAAnB;AAmHA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getBlockClientId } from '../../utils/dom';\n\n/**\n * Extract the selection start node from the selection. When the anchor node is\n * not a text node, the selection offset is the index of a child node.\n *\n * @param {Selection} selection The selection.\n *\n * @return {Element} The selection start node.\n */\nfunction extractSelectionStartNode( selection ) {\n\tconst { anchorNode, anchorOffset } = selection;\n\n\tif ( anchorNode.nodeType === anchorNode.TEXT_NODE ) {\n\t\treturn anchorNode;\n\t}\n\n\tif ( anchorOffset === 0 ) {\n\t\treturn anchorNode;\n\t}\n\n\treturn anchorNode.childNodes[ anchorOffset - 1 ];\n}\n\n/**\n * Extract the selection end node from the selection. When the focus node is not\n * a text node, the selection offset is the index of a child node. The selection\n * reaches up to but excluding that child node.\n *\n * @param {Selection} selection The selection.\n *\n * @return {Element} The selection start node.\n */\nfunction extractSelectionEndNode( selection ) {\n\tconst { focusNode, focusOffset } = selection;\n\n\tif ( focusNode.nodeType === focusNode.TEXT_NODE ) {\n\t\treturn focusNode;\n\t}\n\n\tif ( focusOffset === focusNode.childNodes.length ) {\n\t\treturn focusNode;\n\t}\n\n\treturn focusNode.childNodes[ focusOffset ];\n}\n\nfunction findDepth( a, b ) {\n\tlet depth = 0;\n\n\twhile ( a[ depth ] === b[ depth ] ) {\n\t\tdepth++;\n\t}\n\n\treturn depth;\n}\n\n/**\n * Sets the `contenteditable` wrapper element to `value`.\n *\n * @param {HTMLElement} node Block element.\n * @param {boolean} value `contentEditable` value (true or false)\n */\nfunction setContentEditableWrapper( node, value ) {\n\t// Since we are calling this on every selection change, check if the value\n\t// needs to be updated first because it trigger the browser to recalculate\n\t// style.\n\tif ( node.contentEditable !== String( value ) )\n\t\tnode.contentEditable = value;\n\t// Firefox doesn't automatically move focus.\n\tif ( value ) node.focus();\n}\n\n/**\n * Sets a multi-selection based on the native selection across blocks.\n */\nexport default function useSelectionObserver() {\n\tconst { multiSelect, selectBlock, selectionChange } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { getBlockParents, getBlockSelectionStart } =\n\t\tuseSelect( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tfunction onSelectionChange( event ) {\n\t\t\t\tconst selection = defaultView.getSelection();\n\n\t\t\t\tif ( ! selection.rangeCount ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// If selection is collapsed and we haven't used `shift+click`,\n\t\t\t\t// end multi selection and disable the contentEditable wrapper.\n\t\t\t\t// We have to check about `shift+click` case because elements\n\t\t\t\t// that don't support text selection might be involved, and we might\n\t\t\t\t// update the clientIds to multi-select blocks.\n\t\t\t\t// For now we check if the event is a `mouse` event.\n\t\t\t\tconst isClickShift = event.shiftKey && event.type === 'mouseup';\n\t\t\t\tif ( selection.isCollapsed && ! isClickShift ) {\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet startClientId = getBlockClientId(\n\t\t\t\t\textractSelectionStartNode( selection )\n\t\t\t\t);\n\t\t\t\tlet endClientId = getBlockClientId(\n\t\t\t\t\textractSelectionEndNode( selection )\n\t\t\t\t);\n\t\t\t\t// If the selection has changed and we had pressed `shift+click`,\n\t\t\t\t// we need to check if in an element that doesn't support\n\t\t\t\t// text selection has been clicked.\n\t\t\t\tif ( isClickShift ) {\n\t\t\t\t\tconst selectedClientId = getBlockSelectionStart();\n\t\t\t\t\tconst clickedClientId = getBlockClientId( event.target );\n\t\t\t\t\t// `endClientId` is not defined if we end the selection by clicking a non-selectable block.\n\t\t\t\t\t// We need to check if there was already a selection with a non-selectable focusNode.\n\t\t\t\t\tconst focusNodeIsNonSelectable =\n\t\t\t\t\t\tclickedClientId !== endClientId;\n\t\t\t\t\tif (\n\t\t\t\t\t\t( startClientId === endClientId &&\n\t\t\t\t\t\t\tselection.isCollapsed ) ||\n\t\t\t\t\t\t! endClientId ||\n\t\t\t\t\t\tfocusNodeIsNonSelectable\n\t\t\t\t\t) {\n\t\t\t\t\t\tendClientId = clickedClientId;\n\t\t\t\t\t}\n\t\t\t\t\t// Handle the case when we have a non-selectable block\n\t\t\t\t\t// selected and click another one.\n\t\t\t\t\tif ( startClientId !== selectedClientId ) {\n\t\t\t\t\t\tstartClientId = selectedClientId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If the selection did not involve a block, return.\n\t\t\t\tif (\n\t\t\t\t\tstartClientId === undefined &&\n\t\t\t\t\tendClientId === undefined\n\t\t\t\t) {\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst isSingularSelection = startClientId === endClientId;\n\t\t\t\tif ( isSingularSelection ) {\n\t\t\t\t\tselectBlock( startClientId );\n\t\t\t\t} else {\n\t\t\t\t\tconst startPath = [\n\t\t\t\t\t\t...getBlockParents( startClientId ),\n\t\t\t\t\t\tstartClientId,\n\t\t\t\t\t];\n\t\t\t\t\tconst endPath = [\n\t\t\t\t\t\t...getBlockParents( endClientId ),\n\t\t\t\t\t\tendClientId,\n\t\t\t\t\t];\n\t\t\t\t\tconst depth = findDepth( startPath, endPath );\n\n\t\t\t\t\tmultiSelect( startPath[ depth ], endPath[ depth ] );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction addListeners() {\n\t\t\t\townerDocument.addEventListener(\n\t\t\t\t\t'selectionchange',\n\t\t\t\t\tonSelectionChange\n\t\t\t\t);\n\t\t\t\tdefaultView.addEventListener( 'mouseup', onSelectionChange );\n\t\t\t}\n\n\t\t\tfunction removeListeners() {\n\t\t\t\townerDocument.removeEventListener(\n\t\t\t\t\t'selectionchange',\n\t\t\t\t\tonSelectionChange\n\t\t\t\t);\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onSelectionChange );\n\t\t\t}\n\n\t\t\tfunction resetListeners() {\n\t\t\t\tremoveListeners();\n\t\t\t\taddListeners();\n\t\t\t}\n\n\t\t\taddListeners();\n\t\t\t// We must allow rich text to set selection first. This ensures that\n\t\t\t// our `selectionchange` listener is always reset to be called after\n\t\t\t// the rich text one.\n\t\t\tnode.addEventListener( 'focusin', resetListeners );\n\t\t\treturn () => {\n\t\t\t\tremoveListeners();\n\t\t\t\tnode.removeEventListener( 'focusin', resetListeners );\n\t\t\t};\n\t\t},\n\t\t[ multiSelect, selectBlock, selectionChange, getBlockParents ]\n\t);\n}\n"]}
|
|
@@ -111,7 +111,9 @@ export function addAttribute(settings) {
|
|
|
111
111
|
*/
|
|
112
112
|
|
|
113
113
|
export const withToolbarControls = createHigherOrderComponent(BlockEdit => props => {
|
|
114
|
-
const blockEdit = createElement(BlockEdit,
|
|
114
|
+
const blockEdit = createElement(BlockEdit, _extends({
|
|
115
|
+
key: "edit"
|
|
116
|
+
}, props));
|
|
115
117
|
const {
|
|
116
118
|
name: blockName
|
|
117
119
|
} = props; // Compute the block valid alignments by taking into account,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/align.js"],"names":["classnames","createHigherOrderComponent","addFilter","getBlockSupport","getBlockType","hasBlockSupport","useSelect","BlockControls","BlockAlignmentControl","useAvailableAlignments","store","blockEditorStore","ALL_ALIGNMENTS","WIDE_ALIGNMENTS","getValidAlignments","blockAlign","hasWideBlockSupport","hasWideEnabled","validAlignments","Array","isArray","filter","value","includes","alignment","addAttribute","settings","attributes","align","type","enum","withToolbarControls","BlockEdit","props","blockEdit","name","blockName","blockAllowedAlignments","map","isContentLocked","select","__unstableGetContentLockingParent","clientId","length","updateAlignment","nextAlign","blockType","blockDefaultAlign","default","setAttributes","withDataAlign","BlockListBlock","undefined","wrapperProps","some","addAssignedAlign","isAlignValid","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SACCC,eADD,EAECC,YAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,aAAT,EAAwBC,qBAAxB,QAAqD,eAArD;AACA,OAAOC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,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { BlockControls, BlockAlignmentControl } from '../components';\nimport useAvailableAlignments from '../components/block-alignment-control/use-available-alignments';\nimport { store as blockEditorStore } from '../store';\n\n/**\n * An array which includes all possible valid alignments,\n * used to validate if an alignment is valid or not.\n *\n * @constant\n * @type {string[]}\n */\nconst ALL_ALIGNMENTS = [ 'left', 'center', 'right', 'wide', 'full' ];\n\n/**\n * An array which includes all wide alignments.\n * In order for this alignments to be valid they need to be supported by the block,\n * and by the theme.\n *\n * @constant\n * @type {string[]}\n */\nconst WIDE_ALIGNMENTS = [ 'wide', 'full' ];\n\n/**\n * Returns the valid alignments.\n * Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not.\n * Exported just for testing purposes, not exported outside the module.\n *\n * @param {?boolean|string[]} blockAlign Aligns supported by the block.\n * @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise.\n * @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise.\n *\n * @return {string[]} Valid alignments.\n */\nexport function getValidAlignments(\n\tblockAlign,\n\thasWideBlockSupport = true,\n\thasWideEnabled = true\n) {\n\tlet validAlignments;\n\tif ( Array.isArray( blockAlign ) ) {\n\t\tvalidAlignments = ALL_ALIGNMENTS.filter( ( value ) =>\n\t\t\tblockAlign.includes( value )\n\t\t);\n\t} else if ( blockAlign === true ) {\n\t\t// `true` includes all alignments...\n\t\tvalidAlignments = [ ...ALL_ALIGNMENTS ];\n\t} else {\n\t\tvalidAlignments = [];\n\t}\n\n\tif (\n\t\t! hasWideEnabled ||\n\t\t( blockAlign === true && ! hasWideBlockSupport )\n\t) {\n\t\treturn validAlignments.filter(\n\t\t\t( alignment ) => ! WIDE_ALIGNMENTS.includes( alignment )\n\t\t);\n\t}\n\n\treturn validAlignments;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `align`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.align ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'align' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\talign: {\n\t\t\t\ttype: 'string',\n\t\t\t\t// Allow for '' since it is used by updateAlignment function\n\t\t\t\t// in withToolbarControls for special cases with defined default values.\n\t\t\t\tenum: [ ...ALL_ALIGNMENTS, '' ],\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new toolbar controls for block\n * alignment, if block defines support.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withToolbarControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEdit = <BlockEdit { ...props } />;\n\t\tconst { name: blockName } = props;\n\t\t// Compute the block valid alignments by taking into account,\n\t\t// if the theme supports wide alignments or not and the layout's\n\t\t// availble alignments. We do that for conditionally rendering\n\t\t// Slot.\n\t\tconst blockAllowedAlignments = getValidAlignments(\n\t\t\tgetBlockSupport( blockName, 'align' ),\n\t\t\thasBlockSupport( blockName, 'alignWide', true )\n\t\t);\n\n\t\tconst validAlignments = useAvailableAlignments(\n\t\t\tblockAllowedAlignments\n\t\t).map( ( { name } ) => name );\n\t\tconst isContentLocked = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).__unstableGetContentLockingParent( props.clientId );\n\t\t\t},\n\t\t\t[ props.clientId ]\n\t\t);\n\t\tif ( ! validAlignments.length || isContentLocked ) {\n\t\t\treturn blockEdit;\n\t\t}\n\n\t\tconst updateAlignment = ( nextAlign ) => {\n\t\t\tif ( ! nextAlign ) {\n\t\t\t\tconst blockType = getBlockType( props.name );\n\t\t\t\tconst blockDefaultAlign = blockType?.attributes?.align?.default;\n\t\t\t\tif ( blockDefaultAlign ) {\n\t\t\t\t\tnextAlign = '';\n\t\t\t\t}\n\t\t\t}\n\t\t\tprops.setAttributes( { align: nextAlign } );\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\t\tvalue={ props.attributes.align }\n\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t\tcontrols={ validAlignments }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t\t{ blockEdit }\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n/**\n * Override the default block element to add alignment wrapper props.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withDataAlign = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst { align } = attributes;\n\t\tconst blockAllowedAlignments = getValidAlignments(\n\t\t\tgetBlockSupport( name, 'align' ),\n\t\t\thasBlockSupport( name, 'alignWide', true )\n\t\t);\n\t\tconst validAlignments = useAvailableAlignments(\n\t\t\tblockAllowedAlignments\n\t\t);\n\n\t\t// If an alignment is not assigned, there's no need to go through the\n\t\t// effort to validate or assign its value.\n\t\tif ( align === undefined ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tlet wrapperProps = props.wrapperProps;\n\t\tif (\n\t\t\tvalidAlignments.some( ( alignment ) => alignment.name === align )\n\t\t) {\n\t\t\twrapperProps = { ...wrapperProps, 'data-align': align };\n\t\t}\n\n\t\treturn <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;\n\t}\n);\n\n/**\n * Override props assigned to save component to inject alignment class name if\n * block supports it.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addAssignedAlign( props, blockType, attributes ) {\n\tconst { align } = attributes;\n\tconst blockAlign = getBlockSupport( blockType, 'align' );\n\tconst hasWideBlockSupport = hasBlockSupport( blockType, 'alignWide', true );\n\n\t// Compute valid alignments without taking into account if\n\t// the theme supports wide alignments or not.\n\t// This way changing themes does not impact the block save.\n\tconst isAlignValid = getValidAlignments(\n\t\tblockAlign,\n\t\thasWideBlockSupport\n\t).includes( align );\n\tif ( isAlignValid ) {\n\t\tprops.className = classnames( `align${ align }`, props.className );\n\t}\n\n\treturn props;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/align/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/align/with-data-align',\n\twithDataAlign\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/align/with-toolbar-controls',\n\twithToolbarControls\n);\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/align/addAssignedAlign',\n\taddAssignedAlign\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/align.js"],"names":["classnames","createHigherOrderComponent","addFilter","getBlockSupport","getBlockType","hasBlockSupport","useSelect","BlockControls","BlockAlignmentControl","useAvailableAlignments","store","blockEditorStore","ALL_ALIGNMENTS","WIDE_ALIGNMENTS","getValidAlignments","blockAlign","hasWideBlockSupport","hasWideEnabled","validAlignments","Array","isArray","filter","value","includes","alignment","addAttribute","settings","attributes","align","type","enum","withToolbarControls","BlockEdit","props","blockEdit","name","blockName","blockAllowedAlignments","map","isContentLocked","select","__unstableGetContentLockingParent","clientId","length","updateAlignment","nextAlign","blockType","blockDefaultAlign","default","setAttributes","withDataAlign","BlockListBlock","undefined","wrapperProps","some","addAssignedAlign","isAlignValid","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SACCC,eADD,EAECC,YAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,aAAT,EAAwBC,qBAAxB,QAAqD,eAArD;AACA,OAAOC,sBAAP,MAAmC,gEAAnC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,cAAc,GAAG,CAAE,MAAF,EAAU,QAAV,EAAoB,OAApB,EAA6B,MAA7B,EAAqC,MAArC,CAAvB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,eAAe,GAAG,CAAE,MAAF,EAAU,MAAV,CAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CACNC,UADM,EAIL;AAAA,MAFDC,mBAEC,uEAFqB,IAErB;AAAA,MADDC,cACC,uEADgB,IAChB;AACD,MAAIC,eAAJ;;AACA,MAAKC,KAAK,CAACC,OAAN,CAAeL,UAAf,CAAL,EAAmC;AAClCG,IAAAA,eAAe,GAAGN,cAAc,CAACS,MAAf,CAAyBC,KAAF,IACxCP,UAAU,CAACQ,QAAX,CAAqBD,KAArB,CADiB,CAAlB;AAGA,GAJD,MAIO,IAAKP,UAAU,KAAK,IAApB,EAA2B;AACjC;AACAG,IAAAA,eAAe,GAAG,CAAE,GAAGN,cAAL,CAAlB;AACA,GAHM,MAGA;AACNM,IAAAA,eAAe,GAAG,EAAlB;AACA;;AAED,MACC,CAAED,cAAF,IACEF,UAAU,KAAK,IAAf,IAAuB,C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EAAoB;AACnBvB,IAAAA,KAAK,CAACwB,SAAN,GAAkBzD,UAAU,CAAG,QAAQ4B,KAAO,EAAlB,EAAqBK,KAAK,CAACwB,SAA3B,CAA5B;AACA;;AAED,SAAOxB,KAAP;AACA;AAED/B,SAAS,CACR,0BADQ,EAER,yBAFQ,EAGRuB,YAHQ,CAAT;AAKAvB,SAAS,CACR,uBADQ,EAER,mCAFQ,EAGRgD,aAHQ,CAAT;AAKAhD,SAAS,CACR,kBADQ,EAER,yCAFQ,EAGR6B,mBAHQ,CAAT;AAKA7B,SAAS,CACR,kCADQ,EAER,6BAFQ,EAGRqD,gBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { BlockControls, BlockAlignmentControl } from '../components';\nimport useAvailableAlignments from '../components/block-alignment-control/use-available-alignments';\nimport { store as blockEditorStore } from '../store';\n\n/**\n * An array which includes all possible valid alignments,\n * used to validate if an alignment is valid or not.\n *\n * @constant\n * @type {string[]}\n */\nconst ALL_ALIGNMENTS = [ 'left', 'center', 'right', 'wide', 'full' ];\n\n/**\n * An array which includes all wide alignments.\n * In order for this alignments to be valid they need to be supported by the block,\n * and by the theme.\n *\n * @constant\n * @type {string[]}\n */\nconst WIDE_ALIGNMENTS = [ 'wide', 'full' ];\n\n/**\n * Returns the valid alignments.\n * Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not.\n * Exported just for testing purposes, not exported outside the module.\n *\n * @param {?boolean|string[]} blockAlign Aligns supported by the block.\n * @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise.\n * @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise.\n *\n * @return {string[]} Valid alignments.\n */\nexport function getValidAlignments(\n\tblockAlign,\n\thasWideBlockSupport = true,\n\thasWideEnabled = true\n) {\n\tlet validAlignments;\n\tif ( Array.isArray( blockAlign ) ) {\n\t\tvalidAlignments = ALL_ALIGNMENTS.filter( ( value ) =>\n\t\t\tblockAlign.includes( value )\n\t\t);\n\t} else if ( blockAlign === true ) {\n\t\t// `true` includes all alignments...\n\t\tvalidAlignments = [ ...ALL_ALIGNMENTS ];\n\t} else {\n\t\tvalidAlignments = [];\n\t}\n\n\tif (\n\t\t! hasWideEnabled ||\n\t\t( blockAlign === true && ! hasWideBlockSupport )\n\t) {\n\t\treturn validAlignments.filter(\n\t\t\t( alignment ) => ! WIDE_ALIGNMENTS.includes( alignment )\n\t\t);\n\t}\n\n\treturn validAlignments;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `align`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.align ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'align' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\talign: {\n\t\t\t\ttype: 'string',\n\t\t\t\t// Allow for '' since it is used by updateAlignment function\n\t\t\t\t// in withToolbarControls for special cases with defined default values.\n\t\t\t\tenum: [ ...ALL_ALIGNMENTS, '' ],\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new toolbar controls for block\n * alignment, if block defines support.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withToolbarControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEdit = <BlockEdit key=\"edit\" { ...props } />;\n\t\tconst { name: blockName } = props;\n\t\t// Compute the block valid alignments by taking into account,\n\t\t// if the theme supports wide alignments or not and the layout's\n\t\t// availble alignments. We do that for conditionally rendering\n\t\t// Slot.\n\t\tconst blockAllowedAlignments = getValidAlignments(\n\t\t\tgetBlockSupport( blockName, 'align' ),\n\t\t\thasBlockSupport( blockName, 'alignWide', true )\n\t\t);\n\n\t\tconst validAlignments = useAvailableAlignments(\n\t\t\tblockAllowedAlignments\n\t\t).map( ( { name } ) => name );\n\t\tconst isContentLocked = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).__unstableGetContentLockingParent( props.clientId );\n\t\t\t},\n\t\t\t[ props.clientId ]\n\t\t);\n\t\tif ( ! validAlignments.length || isContentLocked ) {\n\t\t\treturn blockEdit;\n\t\t}\n\n\t\tconst updateAlignment = ( nextAlign ) => {\n\t\t\tif ( ! nextAlign ) {\n\t\t\t\tconst blockType = getBlockType( props.name );\n\t\t\t\tconst blockDefaultAlign = blockType?.attributes?.align?.default;\n\t\t\t\tif ( blockDefaultAlign ) {\n\t\t\t\t\tnextAlign = '';\n\t\t\t\t}\n\t\t\t}\n\t\t\tprops.setAttributes( { align: nextAlign } );\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\t\tvalue={ props.attributes.align }\n\t\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\t\tcontrols={ validAlignments }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t\t{ blockEdit }\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n/**\n * Override the default block element to add alignment wrapper props.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withDataAlign = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst { align } = attributes;\n\t\tconst blockAllowedAlignments = getValidAlignments(\n\t\t\tgetBlockSupport( name, 'align' ),\n\t\t\thasBlockSupport( name, 'alignWide', true )\n\t\t);\n\t\tconst validAlignments = useAvailableAlignments(\n\t\t\tblockAllowedAlignments\n\t\t);\n\n\t\t// If an alignment is not assigned, there's no need to go through the\n\t\t// effort to validate or assign its value.\n\t\tif ( align === undefined ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tlet wrapperProps = props.wrapperProps;\n\t\tif (\n\t\t\tvalidAlignments.some( ( alignment ) => alignment.name === align )\n\t\t) {\n\t\t\twrapperProps = { ...wrapperProps, 'data-align': align };\n\t\t}\n\n\t\treturn <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;\n\t}\n);\n\n/**\n * Override props assigned to save component to inject alignment class name if\n * block supports it.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addAssignedAlign( props, blockType, attributes ) {\n\tconst { align } = attributes;\n\tconst blockAlign = getBlockSupport( blockType, 'align' );\n\tconst hasWideBlockSupport = hasBlockSupport( blockType, 'alignWide', true );\n\n\t// Compute valid alignments without taking into account if\n\t// the theme supports wide alignments or not.\n\t// This way changing themes does not impact the block save.\n\tconst isAlignValid = getValidAlignments(\n\t\tblockAlign,\n\t\thasWideBlockSupport\n\t).includes( align );\n\tif ( isAlignValid ) {\n\t\tprops.className = classnames( `align${ align }`, props.className );\n\t}\n\n\treturn props;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/align/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/align/with-data-align',\n\twithDataAlign\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/align/with-toolbar-controls',\n\twithToolbarControls\n);\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/align/addAssignedAlign',\n\taddAssignedAlign\n);\n"]}
|
|
@@ -1,229 +1,117 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { createElement, Fragment } from "@wordpress/element";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* External dependencies
|
|
6
|
-
*/
|
|
7
|
-
import classnames from 'classnames';
|
|
8
4
|
/**
|
|
9
5
|
* WordPress dependencies
|
|
10
6
|
*/
|
|
11
|
-
|
|
12
|
-
import { __experimentalToolsPanelItem as ToolsPanelItem, __experimentalVStack as VStack } from '@wordpress/components';
|
|
13
|
-
import { Platform, useState } from '@wordpress/element';
|
|
14
|
-
import { __ } from '@wordpress/i18n';
|
|
15
|
-
import { getBlockSupport } from '@wordpress/blocks';
|
|
7
|
+
import { useState, useEffect, useCallback } from '@wordpress/element';
|
|
16
8
|
import { useDispatch } from '@wordpress/data';
|
|
9
|
+
import { getBlockSupport } from '@wordpress/blocks';
|
|
10
|
+
import deprecated from '@wordpress/deprecated';
|
|
17
11
|
/**
|
|
18
12
|
* Internal dependencies
|
|
19
13
|
*/
|
|
20
14
|
|
|
21
15
|
import InspectorControls from '../components/inspector-controls';
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { PaddingEdit, PaddingVisualizer, hasPaddingSupport, hasPaddingValue, resetPadding, useIsPaddingDisabled } from './padding';
|
|
26
|
-
import { ChildLayoutEdit, hasChildLayoutSupport, hasChildLayoutValue, resetChildLayout, useIsChildLayoutDisabled, childLayoutOrientation } from './child-layout';
|
|
27
|
-
import useSetting from '../components/use-setting';
|
|
16
|
+
import { DimensionsPanel as StylesDimensionsPanel, useHasDimensionsPanel } from '../components/global-styles';
|
|
17
|
+
import { MarginVisualizer } from './margin';
|
|
18
|
+
import { PaddingVisualizer } from './padding';
|
|
28
19
|
import { store as blockEditorStore } from '../store';
|
|
29
20
|
import { unlock } from '../lock-unlock';
|
|
21
|
+
import { cleanEmptyObject, useBlockSettings } from './utils';
|
|
30
22
|
export const DIMENSIONS_SUPPORT_KEY = 'dimensions';
|
|
31
23
|
export const SPACING_SUPPORT_KEY = 'spacing';
|
|
32
24
|
export const ALL_SIDES = ['top', 'right', 'bottom', 'left'];
|
|
33
25
|
export const AXIAL_SIDES = ['vertical', 'horizontal'];
|
|
34
26
|
|
|
35
|
-
function
|
|
36
|
-
const [
|
|
27
|
+
function useVisualizer() {
|
|
28
|
+
const [property, setProperty] = useState(false);
|
|
37
29
|
const {
|
|
38
30
|
hideBlockInterface,
|
|
39
31
|
showBlockInterface
|
|
40
32
|
} = unlock(useDispatch(blockEditorStore));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
e.stopPropagation();
|
|
50
|
-
showBlockInterface();
|
|
51
|
-
setIsMouseOver(false);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
isMouseOver,
|
|
56
|
-
onMouseOver,
|
|
57
|
-
onMouseOut
|
|
58
|
-
};
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!property) {
|
|
35
|
+
showBlockInterface();
|
|
36
|
+
} else {
|
|
37
|
+
hideBlockInterface();
|
|
38
|
+
}
|
|
39
|
+
}, [property, showBlockInterface, hideBlockInterface]);
|
|
40
|
+
return [property, setProperty];
|
|
59
41
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Inspector controls for dimensions support.
|
|
62
|
-
*
|
|
63
|
-
* @param {Object} props Block props.
|
|
64
|
-
*
|
|
65
|
-
* @return {WPElement} Inspector controls for dimensions and spacing support features.
|
|
66
|
-
*/
|
|
67
42
|
|
|
43
|
+
function DimensionsInspectorControl(_ref) {
|
|
44
|
+
let {
|
|
45
|
+
children,
|
|
46
|
+
resetAllFilter
|
|
47
|
+
} = _ref;
|
|
48
|
+
const attributesResetAllFilter = useCallback(attributes => {
|
|
49
|
+
const existingStyle = attributes.style;
|
|
50
|
+
const updatedStyle = resetAllFilter(existingStyle);
|
|
51
|
+
return { ...attributes,
|
|
52
|
+
style: updatedStyle
|
|
53
|
+
};
|
|
54
|
+
}, [resetAllFilter]);
|
|
55
|
+
return createElement(InspectorControls, {
|
|
56
|
+
group: "dimensions",
|
|
57
|
+
resetAllFilter: attributesResetAllFilter
|
|
58
|
+
}, children);
|
|
59
|
+
}
|
|
68
60
|
|
|
69
61
|
export function DimensionsPanel(props) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
62
|
+
var _settings$spacing, _settings$spacing2;
|
|
63
|
+
|
|
64
|
+
const {
|
|
65
|
+
clientId,
|
|
66
|
+
name,
|
|
67
|
+
attributes,
|
|
68
|
+
setAttributes,
|
|
69
|
+
__unstableParentLayout
|
|
70
|
+
} = props;
|
|
71
|
+
const settings = useBlockSettings(name, __unstableParentLayout);
|
|
72
|
+
const isEnabled = useHasDimensionsPanel(settings);
|
|
73
|
+
const value = attributes.style;
|
|
74
|
+
const [visualizedProperty, setVisualizedProperty] = useVisualizer();
|
|
75
|
+
|
|
76
|
+
const onChange = newStyle => {
|
|
77
|
+
setAttributes({
|
|
78
|
+
style: cleanEmptyObject(newStyle)
|
|
79
|
+
});
|
|
80
|
+
};
|
|
80
81
|
|
|
81
|
-
if (
|
|
82
|
+
if (!isEnabled) {
|
|
82
83
|
return null;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
const defaultDimensionsControls = getBlockSupport(props.name, [DIMENSIONS_SUPPORT_KEY, '__experimentalDefaultControls']);
|
|
86
87
|
const defaultSpacingControls = getBlockSupport(props.name, [SPACING_SUPPORT_KEY, '__experimentalDefaultControls']);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var _newAttributes$style;
|
|
90
|
-
|
|
91
|
-
return { ...newAttributes,
|
|
92
|
-
style: { ...newAttributes.style,
|
|
93
|
-
[featureSet]: { ...((_newAttributes$style = newAttributes.style) === null || _newAttributes$style === void 0 ? void 0 : _newAttributes$style[featureSet]),
|
|
94
|
-
[attribute]: undefined
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
88
|
+
const defaultControls = { ...defaultDimensionsControls,
|
|
89
|
+
...defaultSpacingControls
|
|
98
90
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
onDeselect: () => resetPadding(props),
|
|
113
|
-
resetAllFilter: createResetAllFilter('padding', 'spacing'),
|
|
114
|
-
isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.padding,
|
|
115
|
-
panelId: props.clientId
|
|
116
|
-
}, createElement(PaddingEdit, _extends({
|
|
117
|
-
onMouseOver: paddingMouseOver.onMouseOver,
|
|
118
|
-
onMouseOut: paddingMouseOver.onMouseOut
|
|
119
|
-
}, props))), !isMarginDisabled && createElement(ToolsPanelItem, {
|
|
120
|
-
className: spacingClassnames,
|
|
121
|
-
hasValue: () => hasMarginValue(props),
|
|
122
|
-
label: __('Margin'),
|
|
123
|
-
onDeselect: () => resetMargin(props),
|
|
124
|
-
resetAllFilter: createResetAllFilter('margin', 'spacing'),
|
|
125
|
-
isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.margin,
|
|
126
|
-
panelId: props.clientId
|
|
127
|
-
}, createElement(MarginEdit, _extends({
|
|
128
|
-
onMouseOver: marginMouseOver.onMouseOver,
|
|
129
|
-
onMouseOut: marginMouseOver.onMouseOut
|
|
130
|
-
}, props))), !isGapDisabled && createElement(ToolsPanelItem, {
|
|
131
|
-
className: spacingClassnames,
|
|
132
|
-
hasValue: () => hasGapValue(props),
|
|
133
|
-
label: __('Block spacing'),
|
|
134
|
-
onDeselect: () => resetGap(props),
|
|
135
|
-
resetAllFilter: createResetAllFilter('blockGap', 'spacing'),
|
|
136
|
-
isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.blockGap,
|
|
137
|
-
panelId: props.clientId
|
|
138
|
-
}, createElement(GapEdit, props)), !isMinHeightDisabled && createElement(ToolsPanelItem, {
|
|
139
|
-
hasValue: () => hasMinHeightValue(props),
|
|
140
|
-
label: __('Min. height'),
|
|
141
|
-
onDeselect: () => resetMinHeight(props),
|
|
142
|
-
resetAllFilter: createResetAllFilter('minHeight', 'dimensions'),
|
|
143
|
-
isShownByDefault: defaultDimensionsControls === null || defaultDimensionsControls === void 0 ? void 0 : defaultDimensionsControls.minHeight,
|
|
144
|
-
panelId: props.clientId
|
|
145
|
-
}, createElement(MinHeightEdit, props)), !isChildLayoutDisabled && createElement(VStack, {
|
|
146
|
-
as: ToolsPanelItem,
|
|
147
|
-
spacing: 2,
|
|
148
|
-
hasValue: () => hasChildLayoutValue(props),
|
|
149
|
-
label: childLayoutOrientation(parentLayout),
|
|
150
|
-
onDeselect: () => resetChildLayout(props),
|
|
151
|
-
resetAllFilter: createResetAllFilter('selfStretch', 'layout'),
|
|
152
|
-
isShownByDefault: false,
|
|
153
|
-
panelId: props.clientId
|
|
154
|
-
}, createElement(ChildLayoutEdit, props))), !isPaddingDisabled && createElement(PaddingVisualizer, _extends({
|
|
155
|
-
forceShow: paddingMouseOver.isMouseOver
|
|
156
|
-
}, props)), !isMarginDisabled && createElement(MarginVisualizer, _extends({
|
|
157
|
-
forceShow: marginMouseOver.isMouseOver
|
|
91
|
+
return createElement(Fragment, null, createElement(StylesDimensionsPanel, {
|
|
92
|
+
as: DimensionsInspectorControl,
|
|
93
|
+
panelId: clientId,
|
|
94
|
+
name: name,
|
|
95
|
+
settings: settings,
|
|
96
|
+
value: value,
|
|
97
|
+
onChange: onChange,
|
|
98
|
+
defaultControls: defaultControls,
|
|
99
|
+
onVisualize: setVisualizedProperty
|
|
100
|
+
}), !!(settings !== null && settings !== void 0 && (_settings$spacing = settings.spacing) !== null && _settings$spacing !== void 0 && _settings$spacing.padding) && createElement(PaddingVisualizer, _extends({
|
|
101
|
+
forceShow: visualizedProperty === 'padding'
|
|
102
|
+
}, props)), !!(settings !== null && settings !== void 0 && (_settings$spacing2 = settings.spacing) !== null && _settings$spacing2 !== void 0 && _settings$spacing2.margin) && createElement(MarginVisualizer, _extends({
|
|
103
|
+
forceShow: visualizedProperty === 'margin'
|
|
158
104
|
}, props)));
|
|
159
105
|
}
|
|
160
106
|
/**
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* @param {Object} props Block props.
|
|
164
|
-
*
|
|
165
|
-
* @return {boolean} Whether there is support.
|
|
166
|
-
*/
|
|
167
|
-
|
|
168
|
-
export function hasDimensionsSupport(props) {
|
|
169
|
-
if (Platform.OS !== 'web') {
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const {
|
|
174
|
-
name: blockName
|
|
175
|
-
} = props;
|
|
176
|
-
return hasGapSupport(blockName) || hasMinHeightSupport(blockName) || hasPaddingSupport(blockName) || hasMarginSupport(blockName) || hasChildLayoutSupport(props);
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Determines whether dimensions support has been disabled.
|
|
180
|
-
*
|
|
181
|
-
* @param {Object} props Block properties.
|
|
182
|
-
*
|
|
183
|
-
* @return {boolean} If spacing support is completely disabled.
|
|
107
|
+
* @deprecated
|
|
184
108
|
*/
|
|
185
109
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const marginDisabled = useIsMarginDisabled(props);
|
|
192
|
-
const childLayoutDisabled = useIsChildLayoutDisabled(props);
|
|
193
|
-
return gapDisabled && minHeightDisabled && paddingDisabled && marginDisabled && childLayoutDisabled;
|
|
194
|
-
};
|
|
195
|
-
/**
|
|
196
|
-
* Custom hook to retrieve which padding/margin/blockGap is supported
|
|
197
|
-
* e.g. top, right, bottom or left.
|
|
198
|
-
*
|
|
199
|
-
* Sides are opted into by default. It is only if a specific side is set to
|
|
200
|
-
* false that it is omitted.
|
|
201
|
-
*
|
|
202
|
-
* @param {string} blockName Block name.
|
|
203
|
-
* @param {string} feature The feature custom sides relate to e.g. padding or margins.
|
|
204
|
-
*
|
|
205
|
-
* @return {string[] | undefined} Strings representing the custom sides available.
|
|
206
|
-
*/
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
export function useCustomSides(blockName, feature) {
|
|
210
|
-
var _support$feature;
|
|
211
|
-
|
|
212
|
-
const support = getBlockSupport(blockName, SPACING_SUPPORT_KEY); // Skip when setting is boolean as theme isn't setting arbitrary sides.
|
|
213
|
-
|
|
214
|
-
if (!support || typeof support[feature] === 'boolean') {
|
|
215
|
-
return;
|
|
216
|
-
} // Return if the setting is an array of sides (e.g. `[ 'top', 'bottom' ]`).
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if (Array.isArray(support[feature])) {
|
|
220
|
-
return support[feature];
|
|
221
|
-
} // Finally, attempt to return `.sides` if the setting is an object.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
if ((_support$feature = support[feature]) !== null && _support$feature !== void 0 && _support$feature.sides) {
|
|
225
|
-
return support[feature].sides;
|
|
226
|
-
}
|
|
110
|
+
export function useCustomSides() {
|
|
111
|
+
deprecated('wp.blockEditor.__experimentalUseCustomSides', {
|
|
112
|
+
since: '6.3',
|
|
113
|
+
version: '6.4'
|
|
114
|
+
});
|
|
227
115
|
}
|
|
228
116
|
/**
|
|
229
117
|
* Custom hook to determine whether the sides configured in the
|
|
@@ -245,6 +133,12 @@ export function useIsDimensionsSupportValid(blockName, feature) {
|
|
|
245
133
|
return false;
|
|
246
134
|
}
|
|
247
135
|
|
|
136
|
+
if (sides !== null && sides !== void 0 && sides.length && feature === 'blockGap' && !AXIAL_SIDES.every(side => sides.includes(side))) {
|
|
137
|
+
// eslint-disable-next-line no-console
|
|
138
|
+
console.warn(`The ${feature} support for the "${blockName}" block can not be configured to support arbitrary sides.`);
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
|
|
248
142
|
return true;
|
|
249
143
|
}
|
|
250
144
|
//# sourceMappingURL=dimensions.js.map
|