@wordpress/block-editor 15.21.1 → 15.22.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 +6 -0
- package/README.md +2 -2
- package/build/components/block-card/index.cjs +4 -5
- package/build/components/block-card/index.cjs.map +2 -2
- package/build/components/block-editing-mode/index.cjs +13 -7
- package/build/components/block-editing-mode/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +35 -20
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-mover/mover-description.cjs +6 -6
- package/build/components/block-mover/mover-description.cjs.map +1 -1
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-patterns-paging/index.cjs +4 -4
- package/build/components/block-patterns-paging/index.cjs.map +2 -2
- package/build/components/block-popover/use-popover-scroll.cjs.map +1 -1
- package/build/components/block-quick-navigation/index.cjs +7 -5
- package/build/components/block-quick-navigation/index.cjs.map +2 -2
- package/build/components/block-rename/modal.cjs +0 -1
- package/build/components/block-rename/modal.cjs.map +2 -2
- package/build/components/block-toolbar/block-toolbar-icon.cjs +14 -6
- package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
- package/build/components/block-toolbar/edit-section-button.cjs.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs +10 -4
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs.map +2 -2
- package/build/components/child-layout-control/index.cjs +51 -19
- package/build/components/child-layout-control/index.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs +25 -14
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/colors-gradients/dropdown.cjs +4 -1
- package/build/components/colors-gradients/dropdown.cjs.map +3 -3
- package/build/components/contrast-checker/index.cjs +22 -4
- package/build/components/contrast-checker/index.cjs.map +2 -2
- package/build/components/date-format-picker/index.cjs +0 -1
- package/build/components/date-format-picker/index.cjs.map +2 -2
- package/build/components/dimensions-tool/index.cjs +4 -5
- package/build/components/dimensions-tool/index.cjs.map +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs +1 -1
- package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +153 -25
- package/build/components/global-styles/background-panel.cjs.map +3 -3
- package/build/components/global-styles/color-gradient-dropdown-item.cjs +227 -0
- package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +7 -0
- package/build/components/global-styles/color-panel.cjs +98 -375
- package/build/components/global-styles/color-panel.cjs.map +3 -3
- package/build/components/global-styles/dimensions-panel.cjs +1 -4
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/hooks.cjs +34 -0
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/global-styles/typography-panel.cjs +82 -10
- package/build/components/global-styles/typography-panel.cjs.map +3 -3
- package/build/components/grid/grid-item-resizer.cjs.map +1 -1
- package/build/components/grid/grid-visualizer.cjs.map +1 -1
- package/build/components/iframe/index.cjs +6 -3
- package/build/components/iframe/index.cjs.map +3 -3
- package/build/components/image-editor/use-transform-image.cjs.map +1 -1
- package/build/components/inserter/get-appender-label.cjs.map +1 -1
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter/search-items.cjs.map +1 -1
- package/build/components/inspector-controls/fill.cjs +1 -3
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/groups.cjs +2 -0
- package/build/components/inspector-controls/groups.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/styles-tab.cjs +76 -32
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
- package/build/components/line-height-control/index.cjs.map +1 -1
- package/build/components/link-control/index.cjs +2 -3
- package/build/components/link-control/index.cjs.map +2 -2
- package/build/components/link-control/normalize-url.cjs.map +1 -1
- package/build/components/list-view/block-select-button.cjs +1 -10
- package/build/components/list-view/block-select-button.cjs.map +3 -3
- package/build/components/list-view/utils.cjs.map +1 -1
- package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
- package/build/components/provider/index.cjs.map +1 -1
- package/build/components/provider/use-block-sync.cjs +3 -1
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/before-input-rules.cjs +1 -1
- package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs.map +1 -1
- package/build/components/url-popover/image-url-input-ui.cjs +0 -2
- package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
- package/build/components/use-block-display-information/index.cjs +10 -3
- package/build/components/use-block-display-information/index.cjs.map +2 -2
- package/build/components/writing-flow/use-tab-nav.cjs.map +1 -1
- package/build/hooks/anchor.cjs +1 -2
- package/build/hooks/anchor.cjs.map +2 -2
- package/build/hooks/background.cjs +124 -75
- package/build/hooks/background.cjs.map +3 -3
- package/build/hooks/block-fields/index.cjs +13 -2
- package/build/hooks/block-fields/index.cjs.map +2 -2
- package/build/hooks/color.cjs +0 -162
- package/build/hooks/color.cjs.map +3 -3
- package/build/hooks/contrast-checker.cjs +31 -28
- package/build/hooks/contrast-checker.cjs.map +3 -3
- package/build/hooks/custom-class-name.cjs +0 -1
- package/build/hooks/custom-class-name.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +13 -2
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/elements.cjs +142 -0
- package/build/hooks/elements.cjs.map +7 -0
- package/build/hooks/grid-visualizer.cjs +21 -11
- package/build/hooks/grid-visualizer.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +65 -10
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/layout.cjs +6 -3
- package/build/hooks/layout.cjs.map +2 -2
- package/build/hooks/list-view.cjs +10 -7
- package/build/hooks/list-view.cjs.map +2 -2
- package/build/hooks/spacing-visualizer.cjs.map +1 -1
- package/build/hooks/state-utils.cjs.map +1 -1
- package/build/hooks/states.cjs +2 -2
- package/build/hooks/states.cjs.map +2 -2
- package/build/hooks/style.cjs +50 -6
- package/build/hooks/style.cjs.map +2 -2
- package/build/hooks/typography.cjs +62 -10
- package/build/hooks/typography.cjs.map +3 -3
- package/build/layouts/flex.cjs +99 -6
- package/build/layouts/flex.cjs.map +2 -2
- package/build/private-apis.cjs +4 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs.map +1 -1
- package/build/store/private-selectors.cjs +19 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs.map +1 -1
- package/build/store/selectors.cjs.map +1 -1
- package/build/utils/block-bindings.cjs +9 -9
- package/build/utils/block-bindings.cjs.map +3 -3
- package/build/utils/color-values.cjs +10 -1
- package/build/utils/color-values.cjs.map +3 -3
- package/build/utils/dom.cjs +2 -5
- package/build/utils/dom.cjs.map +3 -3
- package/build/utils/fit-text-frontend.cjs +6 -2
- package/build/utils/fit-text-frontend.cjs.map +3 -3
- package/build/utils/fit-text-utils.cjs +1 -1
- package/build/utils/fit-text-utils.cjs.map +3 -3
- package/build/utils/format-font-style.cjs +1 -1
- package/build/utils/format-font-style.cjs.map +3 -3
- package/build/utils/format-font-weight.cjs +1 -1
- package/build/utils/format-font-weight.cjs.map +3 -3
- package/build/utils/get-editor-region.cjs +4 -2
- package/build/utils/get-editor-region.cjs.map +3 -3
- package/build/utils/get-font-styles-and-weights.cjs +8 -12
- package/build/utils/get-font-styles-and-weights.cjs.map +3 -3
- package/build/utils/get-px-from-css-unit.cjs +1 -1
- package/build/utils/get-px-from-css-unit.cjs.map +1 -1
- package/build/utils/index.cjs +1 -1
- package/build/utils/index.cjs.map +1 -1
- package/build/utils/math.cjs +1 -1
- package/build/utils/math.cjs.map +3 -3
- package/build/utils/object.cjs +8 -8
- package/build/utils/object.cjs.map +3 -3
- package/build/utils/order-inserter-block-items.cjs +1 -1
- package/build/utils/order-inserter-block-items.cjs.map +3 -3
- package/build/utils/pasting.cjs +4 -2
- package/build/utils/pasting.cjs.map +3 -3
- package/build/utils/selection.cjs +3 -2
- package/build/utils/selection.cjs.map +3 -3
- package/build/utils/sorting.cjs +9 -3
- package/build/utils/sorting.cjs.map +3 -3
- package/build/utils/transform-styles/index.cjs +3 -2
- package/build/utils/transform-styles/index.cjs.map +3 -3
- package/build/utils/transform-styles/postcss-urlrebase.d.cjs +2 -0
- package/build/utils/transform-styles/postcss-urlrebase.d.cjs.map +7 -0
- package/build/utils/transform-styles/types.cjs +19 -0
- package/build/utils/transform-styles/types.cjs.map +7 -0
- package/build/utils/types.cjs +19 -0
- package/build/utils/types.cjs.map +7 -0
- package/build-module/components/block-card/index.mjs +5 -6
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-editing-mode/index.mjs +14 -8
- package/build-module/components/block-editing-mode/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +35 -21
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-mover/mover-description.mjs +6 -6
- package/build-module/components/block-mover/mover-description.mjs.map +1 -1
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-patterns-paging/index.mjs +4 -4
- package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
- package/build-module/components/block-popover/use-popover-scroll.mjs.map +1 -1
- package/build-module/components/block-quick-navigation/index.mjs +8 -6
- package/build-module/components/block-quick-navigation/index.mjs.map +2 -2
- package/build-module/components/block-rename/modal.mjs +0 -1
- package/build-module/components/block-rename/modal.mjs.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs +14 -6
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
- package/build-module/components/block-toolbar/edit-section-button.mjs.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs +10 -4
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +51 -19
- package/build-module/components/child-layout-control/index.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +27 -15
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/colors-gradients/dropdown.mjs +4 -1
- package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
- package/build-module/components/contrast-checker/index.mjs +18 -4
- package/build-module/components/contrast-checker/index.mjs.map +2 -2
- package/build-module/components/date-format-picker/index.mjs +0 -1
- package/build-module/components/date-format-picker/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/index.mjs +4 -5
- package/build-module/components/dimensions-tool/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs +1 -1
- package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +155 -27
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +207 -0
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +7 -0
- package/build-module/components/global-styles/color-panel.mjs +106 -387
- package/build-module/components/global-styles/color-panel.mjs.map +3 -3
- package/build-module/components/global-styles/dimensions-panel.mjs +1 -5
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +33 -0
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/global-styles/typography-panel.mjs +84 -10
- package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
- package/build-module/components/grid/grid-item-resizer.mjs.map +1 -1
- package/build-module/components/grid/grid-visualizer.mjs.map +1 -1
- package/build-module/components/iframe/index.mjs +6 -3
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/image-editor/use-transform-image.mjs.map +1 -1
- package/build-module/components/inserter/get-appender-label.mjs.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter/search-items.mjs.map +1 -1
- package/build-module/components/inspector-controls/fill.mjs +1 -3
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/groups.mjs +2 -0
- package/build-module/components/inspector-controls/groups.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +76 -32
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -1
- package/build-module/components/line-height-control/index.mjs.map +1 -1
- package/build-module/components/link-control/index.mjs +2 -3
- package/build-module/components/link-control/index.mjs.map +2 -2
- package/build-module/components/link-control/normalize-url.mjs.map +1 -1
- package/build-module/components/list-view/block-select-button.mjs +2 -17
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs.map +1 -1
- package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
- package/build-module/components/provider/index.mjs.map +1 -1
- package/build-module/components/provider/use-block-sync.mjs +3 -1
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +1 -1
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.mjs +0 -2
- package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
- package/build-module/components/use-block-display-information/index.mjs +10 -3
- package/build-module/components/use-block-display-information/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-tab-nav.mjs.map +1 -1
- package/build-module/hooks/anchor.mjs +1 -2
- package/build-module/hooks/anchor.mjs.map +2 -2
- package/build-module/hooks/background.mjs +123 -75
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-fields/index.mjs +13 -2
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/color.mjs +2 -175
- package/build-module/hooks/color.mjs.map +2 -2
- package/build-module/hooks/contrast-checker.mjs +32 -19
- package/build-module/hooks/contrast-checker.mjs.map +2 -2
- package/build-module/hooks/custom-class-name.mjs +0 -1
- package/build-module/hooks/custom-class-name.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +12 -2
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/elements.mjs +115 -0
- package/build-module/hooks/elements.mjs.map +7 -0
- package/build-module/hooks/grid-visualizer.mjs +21 -11
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +68 -10
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +6 -3
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +10 -7
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/spacing-visualizer.mjs.map +1 -1
- package/build-module/hooks/state-utils.mjs.map +1 -1
- package/build-module/hooks/states.mjs +2 -2
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/hooks/style.mjs +53 -8
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +62 -10
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +105 -7
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/private-apis.mjs +8 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs.map +1 -1
- package/build-module/store/private-selectors.mjs +18 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs.map +1 -1
- package/build-module/store/selectors.mjs.map +1 -1
- package/build-module/utils/block-bindings.mjs +9 -9
- package/build-module/utils/block-bindings.mjs.map +3 -3
- package/build-module/utils/color-values.mjs +9 -1
- package/build-module/utils/color-values.mjs.map +3 -3
- package/build-module/utils/dom.mjs +2 -5
- package/build-module/utils/dom.mjs.map +3 -3
- package/build-module/utils/fit-text-frontend.mjs +6 -2
- package/build-module/utils/fit-text-frontend.mjs.map +3 -3
- package/build-module/utils/fit-text-utils.mjs +1 -1
- package/build-module/utils/fit-text-utils.mjs.map +3 -3
- package/build-module/utils/format-font-style.mjs +1 -1
- package/build-module/utils/format-font-style.mjs.map +3 -3
- package/build-module/utils/format-font-weight.mjs +1 -1
- package/build-module/utils/format-font-weight.mjs.map +3 -3
- package/build-module/utils/get-editor-region.mjs +4 -2
- package/build-module/utils/get-editor-region.mjs.map +3 -3
- package/build-module/utils/get-font-styles-and-weights.mjs +8 -12
- package/build-module/utils/get-font-styles-and-weights.mjs.map +3 -3
- package/build-module/utils/get-px-from-css-unit.mjs +1 -1
- package/build-module/utils/get-px-from-css-unit.mjs.map +1 -1
- package/build-module/utils/index.mjs +1 -1
- package/build-module/utils/index.mjs.map +1 -1
- package/build-module/utils/math.mjs +1 -1
- package/build-module/utils/math.mjs.map +3 -3
- package/build-module/utils/object.mjs +8 -8
- package/build-module/utils/object.mjs.map +3 -3
- package/build-module/utils/order-inserter-block-items.mjs +1 -1
- package/build-module/utils/order-inserter-block-items.mjs.map +3 -3
- package/build-module/utils/pasting.mjs +4 -2
- package/build-module/utils/pasting.mjs.map +3 -3
- package/build-module/utils/selection.mjs +3 -2
- package/build-module/utils/selection.mjs.map +3 -3
- package/build-module/utils/sorting.mjs +9 -3
- package/build-module/utils/sorting.mjs.map +3 -3
- package/build-module/utils/transform-styles/index.mjs +3 -2
- package/build-module/utils/transform-styles/index.mjs.map +3 -3
- package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs +1 -0
- package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs.map +7 -0
- package/build-module/utils/transform-styles/types.mjs +1 -0
- package/build-module/utils/transform-styles/types.mjs.map +7 -0
- package/build-module/utils/types.mjs +1 -0
- package/build-module/utils/types.mjs.map +7 -0
- package/build-style/content-rtl.css +2 -0
- package/build-style/content.css +2 -0
- package/build-style/style-rtl.css +34 -41
- package/build-style/style.css +34 -41
- package/build-types/utils/block-bindings.d.ts +27 -0
- package/build-types/utils/block-bindings.d.ts.map +1 -0
- package/build-types/utils/color-values.d.ts +40 -0
- package/build-types/utils/color-values.d.ts.map +1 -0
- package/build-types/utils/dom.d.ts +19 -19
- package/build-types/utils/dom.d.ts.map +1 -1
- package/build-types/utils/fit-text-frontend.d.ts +7 -0
- package/build-types/utils/fit-text-frontend.d.ts.map +1 -0
- package/build-types/utils/fit-text-utils.d.ts +15 -0
- package/build-types/utils/fit-text-utils.d.ts.map +1 -0
- package/build-types/utils/format-font-style.d.ts +12 -0
- package/build-types/utils/format-font-style.d.ts.map +1 -0
- package/build-types/utils/format-font-weight.d.ts +12 -0
- package/build-types/utils/format-font-weight.d.ts.map +1 -0
- package/build-types/utils/get-editor-region.d.ts +9 -0
- package/build-types/utils/get-editor-region.d.ts.map +1 -0
- package/build-types/utils/get-font-styles-and-weights.d.ts +16 -0
- package/build-types/utils/get-font-styles-and-weights.d.ts.map +1 -0
- package/build-types/utils/get-px-from-css-unit.d.ts +10 -0
- package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -0
- package/build-types/utils/index.d.ts +3 -0
- package/build-types/utils/index.d.ts.map +1 -0
- package/build-types/utils/math.d.ts +61 -0
- package/build-types/utils/math.d.ts.map +1 -0
- package/build-types/utils/object.d.ts +39 -0
- package/build-types/utils/object.d.ts.map +1 -0
- package/build-types/utils/order-inserter-block-items.d.ts +13 -0
- package/build-types/utils/order-inserter-block-items.d.ts.map +1 -0
- package/build-types/utils/pasting.d.ts +28 -0
- package/build-types/utils/pasting.d.ts.map +1 -0
- package/build-types/utils/selection.d.ts +21 -0
- package/build-types/utils/selection.d.ts.map +1 -0
- package/build-types/utils/sorting.d.ts +17 -0
- package/build-types/utils/sorting.d.ts.map +1 -0
- package/build-types/utils/transform-styles/index.d.ts +15 -0
- package/build-types/utils/transform-styles/index.d.ts.map +1 -0
- package/build-types/utils/transform-styles/types.d.ts +13 -0
- package/build-types/utils/transform-styles/types.d.ts.map +1 -0
- package/build-types/utils/types.d.ts +28 -0
- package/build-types/utils/types.d.ts.map +1 -0
- package/package.json +46 -40
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -0
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -0
- package/src/components/block-card/index.js +7 -13
- package/src/components/block-editing-mode/index.js +17 -9
- package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -0
- package/src/components/block-inspector/index.js +22 -20
- package/src/components/block-patterns-list/index.js +0 -1
- package/src/components/block-quick-navigation/index.js +7 -7
- package/src/components/block-rename/modal.js +0 -1
- package/src/components/block-toolbar/block-toolbar-icon.js +22 -6
- package/src/components/block-toolbar/test/block-toolbar-icon.js +99 -0
- package/src/components/block-tools/use-block-toolbar-popover-props.js +10 -4
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +4 -0
- package/src/components/child-layout-control/index.js +65 -20
- package/src/components/child-layout-control/test/index.js +64 -0
- package/src/components/colors-gradients/control.js +29 -12
- package/src/components/colors-gradients/dropdown.js +4 -1
- package/src/components/colors-gradients/style.scss +39 -2
- package/src/components/contrast-checker/README.md +9 -0
- package/src/components/contrast-checker/index.js +42 -3
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/default-block-appender/content.scss +3 -0
- package/src/components/dimensions-tool/index.js +4 -9
- package/src/components/dimensions-tool/scale-tool.js +1 -2
- package/src/components/dimensions-tool/test/index.js +89 -11
- package/src/components/global-styles/background-panel.js +201 -34
- package/src/components/global-styles/color-gradient-dropdown-item.js +258 -0
- package/src/components/global-styles/color-panel.js +125 -487
- package/src/components/global-styles/dimensions-panel.js +1 -5
- package/src/components/global-styles/hooks.js +45 -0
- package/src/components/global-styles/shadow-panel-components.js +0 -1
- package/src/components/global-styles/test/background-panel.js +56 -0
- package/src/components/global-styles/test/color-panel.js +172 -118
- package/src/components/global-styles/test/typography-panel.js +167 -0
- package/src/components/global-styles/typography-panel.js +100 -11
- package/src/components/iframe/index.js +8 -3
- package/src/components/inserter/media-tab/media-preview.js +0 -1
- package/src/components/inspector-controls/README.md +0 -2
- package/src/components/inspector-controls/fill.js +6 -8
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +0 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +78 -28
- package/src/components/link-control/index.js +0 -1
- package/src/components/link-control/test/index.js +2 -3
- package/src/components/list-view/block-select-button.js +2 -18
- package/src/components/preset-input-control/custom-value-controls.js +0 -1
- package/src/components/provider/use-block-sync.js +3 -1
- package/src/components/rich-text/content.scss +2 -0
- package/src/components/url-popover/image-url-input-ui.js +0 -2
- package/src/components/use-block-display-information/index.js +15 -2
- package/src/components/use-block-display-information/test/index.js +140 -0
- package/src/hooks/anchor.js +0 -1
- package/src/hooks/background.js +210 -133
- package/src/hooks/background.scss +0 -35
- package/src/hooks/block-fields/index.js +27 -2
- package/src/hooks/color.js +2 -205
- package/src/hooks/color.scss +3 -9
- package/src/hooks/contrast-checker.js +60 -17
- package/src/hooks/custom-class-name.js +0 -1
- package/src/hooks/dimensions.js +14 -3
- package/src/hooks/elements.js +140 -0
- package/src/hooks/elements.scss +8 -0
- package/src/hooks/grid-visualizer.js +59 -45
- package/src/hooks/layout-child.js +92 -14
- package/src/hooks/layout.js +6 -3
- package/src/hooks/list-view.js +10 -11
- package/src/hooks/states.js +2 -2
- package/src/hooks/style.js +91 -9
- package/src/hooks/test/background.js +59 -0
- package/src/hooks/test/block-style-state.js +14 -14
- package/src/hooks/test/dimensions.js +71 -0
- package/src/hooks/test/layout-child.js +165 -0
- package/src/hooks/test/layout.js +6 -6
- package/src/hooks/test/style.js +133 -11
- package/src/hooks/typography.js +70 -6
- package/src/layouts/flex.js +118 -15
- package/src/private-apis.js +8 -0
- package/src/store/private-selectors.js +47 -0
- package/src/store/test/private-selectors.js +166 -7
- package/src/store/test/reducer.js +61 -10
- package/src/style.scss +1 -0
- package/src/utils/block-bindings.ts +51 -0
- package/src/utils/color-values.ts +63 -0
- package/src/utils/{dom.js → dom.ts} +27 -27
- package/src/utils/{fit-text-frontend.js → fit-text-frontend.ts} +12 -4
- package/src/utils/{fit-text-utils.js → fit-text-utils.ts} +15 -7
- package/src/utils/{format-font-style.js → format-font-style.ts} +10 -3
- package/src/utils/{format-font-weight.js → format-font-weight.ts} +10 -3
- package/src/utils/{get-editor-region.js → get-editor-region.ts} +10 -6
- package/src/utils/{get-font-styles-and-weights.js → get-font-styles-and-weights.ts} +21 -17
- package/src/utils/{math.js → math.ts} +37 -30
- package/src/utils/object.ts +89 -0
- package/src/utils/{order-inserter-block-items.js → order-inserter-block-items.ts} +8 -5
- package/src/utils/{pasting.js → pasting.ts} +18 -11
- package/src/utils/{selection.js → selection.ts} +11 -4
- package/src/utils/sorting.ts +81 -0
- package/src/utils/test/color-values.js +44 -1
- package/src/utils/transform-styles/{index.js → index.ts} +25 -25
- package/src/utils/transform-styles/postcss-urlrebase.d.ts +15 -0
- package/src/utils/transform-styles/types.ts +13 -0
- package/src/utils/types.ts +29 -0
- package/src/utils/block-bindings.js +0 -46
- package/src/utils/color-values.js +0 -28
- package/src/utils/object.js +0 -67
- package/src/utils/sorting.js +0 -54
- /package/src/utils/{get-px-from-css-unit.js → get-px-from-css-unit.ts} +0 -0
- /package/src/utils/{index.js → index.ts} +0 -0
|
@@ -35,20 +35,21 @@ __export(styles_tab_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(styles_tab_exports);
|
|
36
36
|
var import_i18n = require("@wordpress/i18n");
|
|
37
37
|
var import_data = require("@wordpress/data");
|
|
38
|
+
var import_element = require("@wordpress/element");
|
|
38
39
|
var import_block_styles = __toESM(require("../block-styles/index.cjs"));
|
|
39
40
|
var import_inspector_controls = __toESM(require("../inspector-controls/index.cjs"));
|
|
40
41
|
var import_position_controls_panel = __toESM(require("./position-controls-panel.cjs"));
|
|
41
42
|
var import_border = require("../../hooks/border.cjs");
|
|
42
43
|
var import_utils = require("../../hooks/utils.cjs");
|
|
43
44
|
var import_store = require("../../store/index.cjs");
|
|
44
|
-
var
|
|
45
|
+
var import_elements = require("../../hooks/elements.cjs");
|
|
46
|
+
var import_typography = require("../../hooks/typography.cjs");
|
|
47
|
+
var import_background = require("../../hooks/background.cjs");
|
|
45
48
|
var import_color_panel = require("../global-styles/color-panel.cjs");
|
|
49
|
+
var import_typography_panel = require("../global-styles/typography-panel.cjs");
|
|
50
|
+
var import_background_panel = require("../global-styles/background-panel.cjs");
|
|
46
51
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
47
|
-
function
|
|
48
|
-
blockName,
|
|
49
|
-
clientId,
|
|
50
|
-
contentClientIds
|
|
51
|
-
}) {
|
|
52
|
+
function SectionStyleControls({ blockName, clientId, contentClientIds }) {
|
|
52
53
|
const settings = (0, import_utils.useBlockSettings)(blockName);
|
|
53
54
|
const { updateBlockAttributes } = (0, import_data.useDispatch)(import_store.store);
|
|
54
55
|
const { hasButtons, hasHeading } = (0, import_data.useSelect)(
|
|
@@ -66,23 +67,58 @@ function SectionBlockColorControls({
|
|
|
66
67
|
const setAttributes = (newAttributes) => {
|
|
67
68
|
updateBlockAttributes(clientId, newAttributes);
|
|
68
69
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
background: true,
|
|
81
|
-
button: hasButtons,
|
|
82
|
-
heading: hasHeading
|
|
70
|
+
const typographySettings = (0, import_element.useMemo)(
|
|
71
|
+
() => ({ ...settings, typography: {} }),
|
|
72
|
+
[settings]
|
|
73
|
+
);
|
|
74
|
+
const backgroundSettings = (0, import_element.useMemo)(
|
|
75
|
+
() => ({
|
|
76
|
+
...settings,
|
|
77
|
+
background: {
|
|
78
|
+
...settings.background,
|
|
79
|
+
backgroundImage: false,
|
|
80
|
+
backgroundSize: false
|
|
83
81
|
}
|
|
84
|
-
}
|
|
82
|
+
}),
|
|
83
|
+
[settings]
|
|
85
84
|
);
|
|
85
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
|
+
import_typography.TypographyPanel,
|
|
88
|
+
{
|
|
89
|
+
clientId,
|
|
90
|
+
name: blockName,
|
|
91
|
+
settings: typographySettings,
|
|
92
|
+
setAttributes,
|
|
93
|
+
asWrapper: import_typography_panel.TypographyToolsPanel
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
97
|
+
import_background.BackgroundImagePanel,
|
|
98
|
+
{
|
|
99
|
+
clientId,
|
|
100
|
+
name: blockName,
|
|
101
|
+
settings: backgroundSettings,
|
|
102
|
+
setAttributes,
|
|
103
|
+
asWrapper: import_background_panel.BackgroundToolsPanel
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
107
|
+
import_elements.ElementsEdit,
|
|
108
|
+
{
|
|
109
|
+
clientId,
|
|
110
|
+
name: blockName,
|
|
111
|
+
settings,
|
|
112
|
+
setAttributes,
|
|
113
|
+
asWrapper: import_color_panel.ColorToolsPanel,
|
|
114
|
+
label: (0, import_i18n.__)("Elements"),
|
|
115
|
+
defaultControls: {
|
|
116
|
+
button: hasButtons,
|
|
117
|
+
heading: hasHeading
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] });
|
|
86
122
|
}
|
|
87
123
|
var StylesTab = ({
|
|
88
124
|
blockName,
|
|
@@ -94,15 +130,22 @@ var StylesTab = ({
|
|
|
94
130
|
const borderPanelLabel = (0, import_border.useBorderPanelLabel)({ blockName });
|
|
95
131
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
96
132
|
hasBlockStyles && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_styles.default, { clientId }),
|
|
97
|
-
isSectionBlock && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
98
|
-
|
|
133
|
+
isSectionBlock && blockName !== "core/template-part" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
134
|
+
SectionStyleControls,
|
|
99
135
|
{
|
|
100
136
|
blockName,
|
|
101
137
|
clientId,
|
|
102
138
|
contentClientIds
|
|
103
139
|
}
|
|
104
140
|
),
|
|
105
|
-
!isSectionBlock && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
141
|
+
(!isSectionBlock || blockName === "core/template-part") && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
142
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
143
|
+
import_inspector_controls.default.Slot,
|
|
144
|
+
{
|
|
145
|
+
group: "typography",
|
|
146
|
+
label: (0, import_i18n.__)("Typography")
|
|
147
|
+
}
|
|
148
|
+
),
|
|
106
149
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
107
150
|
import_inspector_controls.default.Slot,
|
|
108
151
|
{
|
|
@@ -115,18 +158,11 @@ var StylesTab = ({
|
|
|
115
158
|
import_inspector_controls.default.Slot,
|
|
116
159
|
{
|
|
117
160
|
group: "background",
|
|
118
|
-
label: (0, import_i18n.__)("Background
|
|
161
|
+
label: (0, import_i18n.__)("Background"),
|
|
119
162
|
className: "background-block-support-panel__inner-wrapper"
|
|
120
163
|
}
|
|
121
164
|
),
|
|
122
165
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_inspector_controls.default.Slot, { group: "filter" }),
|
|
123
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
124
|
-
import_inspector_controls.default.Slot,
|
|
125
|
-
{
|
|
126
|
-
group: "typography",
|
|
127
|
-
label: (0, import_i18n.__)("Typography")
|
|
128
|
-
}
|
|
129
|
-
),
|
|
130
166
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
131
167
|
import_inspector_controls.default.Slot,
|
|
132
168
|
{
|
|
@@ -148,6 +184,14 @@ var StylesTab = ({
|
|
|
148
184
|
label: borderPanelLabel
|
|
149
185
|
}
|
|
150
186
|
),
|
|
187
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
188
|
+
import_inspector_controls.default.Slot,
|
|
189
|
+
{
|
|
190
|
+
group: "elements",
|
|
191
|
+
label: (0, import_i18n.__)("Elements"),
|
|
192
|
+
className: "elements-block-support-panel__inner-wrapper"
|
|
193
|
+
}
|
|
194
|
+
),
|
|
151
195
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_position_controls_panel.default, {}),
|
|
152
196
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_inspector_controls.default.Slot, { group: "styles" })
|
|
153
197
|
] })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/inspector-controls-tabs/styles-tab.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockStyles from '../block-styles';\nimport InspectorControls from '../inspector-controls';\nimport PositionControls from './position-controls-panel';\nimport { useBorderPanelLabel } from '../../hooks/border';\nimport { useBlockSettings } from '../../hooks/utils';\nimport { store as blockEditorStore } from '../../store';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAAuC;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockStyles from '../block-styles';\nimport InspectorControls from '../inspector-controls';\nimport PositionControls from './position-controls-panel';\nimport { useBorderPanelLabel } from '../../hooks/border';\nimport { useBlockSettings } from '../../hooks/utils';\nimport { store as blockEditorStore } from '../../store';\nimport { ElementsEdit } from '../../hooks/elements';\nimport { TypographyPanel } from '../../hooks/typography';\nimport { BackgroundImagePanel } from '../../hooks/background';\nimport { ColorToolsPanel } from '../global-styles/color-panel';\nimport { TypographyToolsPanel } from '../global-styles/typography-panel';\nimport { BackgroundToolsPanel } from '../global-styles/background-panel';\n\n// Section blocks present a curated subset of the normal block style panels.\n// Their block-support fills are gated off by editing mode (see\n// `BlockStyleControls` in hooks/style.js), so each panel is direct-rendered\n// here rather than via the inspector slots, with settings restricted to the\n// supports a section should expose:\n// - Typography: text color only (font controls disabled).\n// - Background: color + gradient only (image controls disabled).\n// - Elements: link/heading/button/caption colors (unchanged).\nfunction SectionStyleControls( { blockName, clientId, contentClientIds } ) {\n\tconst settings = useBlockSettings( blockName );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst { hasButtons, hasHeading } = useSelect(\n\t\t( select ) => {\n\t\t\tconst blockNames =\n\t\t\t\tselect( blockEditorStore ).getBlockNamesByClientId(\n\t\t\t\t\tcontentClientIds\n\t\t\t\t);\n\t\t\treturn {\n\t\t\t\thasButtons: blockNames.includes( 'core/buttons' ),\n\t\t\t\thasHeading: blockNames.includes( 'core/heading' ),\n\t\t\t};\n\t\t},\n\t\t[ contentClientIds ]\n\t);\n\n\tconst setAttributes = ( newAttributes ) => {\n\t\tupdateBlockAttributes( clientId, newAttributes );\n\t};\n\n\tconst typographySettings = useMemo(\n\t\t() => ( { ...settings, typography: {} } ),\n\t\t[ settings ]\n\t);\n\tconst backgroundSettings = useMemo(\n\t\t() => ( {\n\t\t\t...settings,\n\t\t\tbackground: {\n\t\t\t\t...settings.background,\n\t\t\t\tbackgroundImage: false,\n\t\t\t\tbackgroundSize: false,\n\t\t\t},\n\t\t} ),\n\t\t[ settings ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<TypographyPanel\n\t\t\t\tclientId={ clientId }\n\t\t\t\tname={ blockName }\n\t\t\t\tsettings={ typographySettings }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tasWrapper={ TypographyToolsPanel }\n\t\t\t/>\n\t\t\t<BackgroundImagePanel\n\t\t\t\tclientId={ clientId }\n\t\t\t\tname={ blockName }\n\t\t\t\tsettings={ backgroundSettings }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tasWrapper={ BackgroundToolsPanel }\n\t\t\t/>\n\t\t\t<ElementsEdit\n\t\t\t\tclientId={ clientId }\n\t\t\t\tname={ blockName }\n\t\t\t\tsettings={ settings }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tasWrapper={ ColorToolsPanel }\n\t\t\t\tlabel={ __( 'Elements' ) }\n\t\t\t\tdefaultControls={ {\n\t\t\t\t\tbutton: hasButtons,\n\t\t\t\t\theading: hasHeading,\n\t\t\t\t} }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nconst StylesTab = ( {\n\tblockName,\n\tclientId,\n\thasBlockStyles,\n\tisSectionBlock,\n\tcontentClientIds,\n} ) => {\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\n\treturn (\n\t\t<>\n\t\t\t{ hasBlockStyles && <BlockStyles clientId={ clientId } /> }\n\t\t\t{ isSectionBlock && blockName !== 'core/template-part' && (\n\t\t\t\t<SectionStyleControls\n\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{\n\t\t\t\t// Extenders have in the past always been allowed to add controls to group\n\t\t\t\t// the restrictions are lessened for that block. Template parts are\n\t\t\t\t// excluded from the curated section controls above and fall through\n\t\t\t\t// to the full panel set here.\n\t\t\t }\n\t\t\t{ ( ! isSectionBlock || blockName === 'core/template-part' ) && (\n\t\t\t\t<>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"typography\"\n\t\t\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"color\"\n\t\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"background\"\n\t\t\t\t\t\tlabel={ __( 'Background' ) }\n\t\t\t\t\t\tclassName=\"background-block-support-panel__inner-wrapper\"\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot group=\"filter\" />\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"layout\"\n\t\t\t\t\t\tlabel={ __( 'Layout' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"dimensions\"\n\t\t\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"border\"\n\t\t\t\t\t\tlabel={ borderPanelLabel }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"elements\"\n\t\t\t\t\t\tlabel={ __( 'Elements' ) }\n\t\t\t\t\t\tclassName=\"elements-block-support-panel__inner-wrapper\"\n\t\t\t\t\t/>\n\t\t\t\t\t<PositionControls />\n\t\t\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t\t\t</>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport default StylesTab;\n"],
|
|
5
|
+
"mappings": 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S;AAAA;AAAA,MACtB;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,WAAQ,gBAAI,YAAa;AAAA;AAAA,MAC1B;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,OAAQ;AAAA;AAAA,MACT;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,WAAQ,gBAAI,UAAW;AAAA,UACvB,WAAU;AAAA;AAAA,MACX;AAAA,MACA,4CAAC,+BAAAC,SAAA,EAAiB;AAAA,MAClB,4CAAC,0BAAAD,QAAkB,MAAlB,EAAuB,OAAM,UAAS;AAAA,OACxC;AAAA,KAEF;AAEF;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": ["blockEditorStore", "BlockStyles", "InspectorControls", "PositionControls"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/keyboard-shortcuts/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\nfunction KeyboardShortcuts() {\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/copy',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Copy the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'c',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/cut',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Cut the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'x',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Paste the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/duplicate',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Duplicate the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'd',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/remove',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Remove the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste-styles',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Paste the copied style to the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-before',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block before the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-after',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block after the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/delete-multi-selection',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Delete selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'del',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tcharacter: 'backspace',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/stop-editing-as-blocks',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Finish editing a design.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/select-all',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __(\n\t\t\t\t'Select all text when typing. Press again to select all blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'a',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/unselect',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Clear selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/multi-text-selection',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Select text across multiple blocks.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'shift',\n\t\t\t\t// Spotted during my own research
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\nfunction KeyboardShortcuts() {\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/copy',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Copy the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'c',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/cut',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Cut the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'x',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Paste the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/duplicate',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Duplicate the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'd',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/remove',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Remove the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste-styles',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Paste the copied style to the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-before',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block before the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-after',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block after the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/delete-multi-selection',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Delete selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'del',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tcharacter: 'backspace',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/stop-editing-as-blocks',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Finish editing a design.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/select-all',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __(\n\t\t\t\t'Select all text when typing. Press again to select all blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'a',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/unselect',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Clear selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/multi-text-selection',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Select text across multiple blocks.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'shift',\n\t\t\t\t// Spotted during my own research — invalid character?\n\t\t\t\tcharacter: 'arrow',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/focus-toolbar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the nearest toolbar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'F10',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-up',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) up.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-down',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) down.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\t// List view shortcuts.\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/collapse-list-view',\n\t\t\tcategory: 'list-view',\n\t\t\tdescription: __( 'Collapse all other items.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'l',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/group',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Create a group block from the selected multiple blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'g',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/toggle-block-visibility',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Show or hide the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/rename',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Rename the selected block.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'r',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\n\nexport default KeyboardShortcuts;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA0B;AAC1B,kBAA4B;AAC5B,gCAAgD;AAChD,kBAAmB;AAEnB,SAAS,oBAAoB;AAC5B,SAAO;AACR;AAEA,SAAS,4BAA4B;AAEpC,QAAM,EAAE,iBAAiB,QAAI,yBAAa,0BAAAA,KAAuB;AACjE,gCAAW,MAAM;AAChB,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa,gBAAI,6BAA8B;AAAA,MAC/C,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa,gBAAI,4BAA6B;AAAA,MAC9C,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;A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C7C,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa;AAAA,QACZ;AAAA,MACD;AAAA,MACA,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa,gBAAI,qCAAsC;AAAA,MACvD,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa,gBAAI,4BAA6B;AAAA,MAC9C,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAE,gBAAiB,CAAE;AAExB,SAAO;AACR;AAEA,kBAAkB,WAAW;AAE7B,IAAO,6BAAQ;",
|
|
6
6
|
"names": ["keyboardShortcutsStore"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/line-height-control/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBASE_DEFAULT_VALUE,\n\tRESET_VALUE,\n\tSTEP,\n\tSPIN_FACTOR,\n\tisLineHeightDefined,\n} from './utils';\n\nconst LineHeightControl = ( {\n\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t__next40pxDefaultSize = false,\n\tvalue: lineHeight,\n\tonChange,\n\t__unstableInputWidth = '60px',\n\t...otherProps\n} ) => {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\n\tconst adjustNextValue = ( nextValue, wasTypedOrPasted ) => {\n\t\t// Set the next value without modification if lineHeight has been defined.\n\t\tif ( isDefined ) {\n\t\t\treturn nextValue;\n\t\t}\n\n\t\t/**\n\t\t * The following logic handles the initial spin up/down action\n\t\t * (from an undefined value state) so that the next values are better suited for\n\t\t * line-height rendering. For example, the first spin up should immediately\n\t\t * go to 1.6, rather than the normally expected 0.1.\n\t\t *\n\t\t * Spin up/down actions can be triggered by keydowns of the up/down arrow keys,\n\t\t * dragging the input or by clicking the spin buttons.\n\t\t */\n\t\tconst spin = STEP * SPIN_FACTOR;\n\t\tswitch ( `${ nextValue }` ) {\n\t\t\tcase `${ spin }`:\n\t\t\t\t// Increment by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE + spin;\n\t\t\tcase '0': {\n\t\t\t\t// This means the user explicitly input '0', rather than using the\n\t\t\t\t// spin down action from an undefined value state.\n\t\t\t\tif ( wasTypedOrPasted ) {\n\t\t\t\t\treturn nextValue;\n\t\t\t\t}\n\t\t\t\t// Decrement by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE - spin;\n\t\t\t}\n\t\t\tcase '':\n\t\t\t\treturn BASE_DEFAULT_VALUE;\n\t\t\tdefault:\n\t\t\t\treturn nextValue;\n\t\t}\n\t};\n\n\tconst stateReducer = ( state, action ) => {\n\t\t// Be careful when changing this
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBASE_DEFAULT_VALUE,\n\tRESET_VALUE,\n\tSTEP,\n\tSPIN_FACTOR,\n\tisLineHeightDefined,\n} from './utils';\n\nconst LineHeightControl = ( {\n\t/** Start opting into the larger default height that will become the default size in a future version. */\n\t__next40pxDefaultSize = false,\n\tvalue: lineHeight,\n\tonChange,\n\t__unstableInputWidth = '60px',\n\t...otherProps\n} ) => {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\n\tconst adjustNextValue = ( nextValue, wasTypedOrPasted ) => {\n\t\t// Set the next value without modification if lineHeight has been defined.\n\t\tif ( isDefined ) {\n\t\t\treturn nextValue;\n\t\t}\n\n\t\t/**\n\t\t * The following logic handles the initial spin up/down action\n\t\t * (from an undefined value state) so that the next values are better suited for\n\t\t * line-height rendering. For example, the first spin up should immediately\n\t\t * go to 1.6, rather than the normally expected 0.1.\n\t\t *\n\t\t * Spin up/down actions can be triggered by keydowns of the up/down arrow keys,\n\t\t * dragging the input or by clicking the spin buttons.\n\t\t */\n\t\tconst spin = STEP * SPIN_FACTOR;\n\t\tswitch ( `${ nextValue }` ) {\n\t\t\tcase `${ spin }`:\n\t\t\t\t// Increment by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE + spin;\n\t\t\tcase '0': {\n\t\t\t\t// This means the user explicitly input '0', rather than using the\n\t\t\t\t// spin down action from an undefined value state.\n\t\t\t\tif ( wasTypedOrPasted ) {\n\t\t\t\t\treturn nextValue;\n\t\t\t\t}\n\t\t\t\t// Decrement by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE - spin;\n\t\t\t}\n\t\t\tcase '':\n\t\t\t\treturn BASE_DEFAULT_VALUE;\n\t\t\tdefault:\n\t\t\t\treturn nextValue;\n\t\t}\n\t};\n\n\tconst stateReducer = ( state, action ) => {\n\t\t// Be careful when changing this — cross-browser behavior of the\n\t\t// `inputType` field in `input` events are inconsistent.\n\t\t// For example, Firefox emits an input event with inputType=\"insertReplacementText\"\n\t\t// on spin button clicks, while other browsers do not even emit an input event.\n\t\tconst wasTypedOrPasted = [ 'insertText', 'insertFromPaste' ].includes(\n\t\t\taction.payload.event.nativeEvent?.inputType\n\t\t);\n\t\tconst value = adjustNextValue( state.value, wasTypedOrPasted );\n\t\treturn { ...state, value };\n\t};\n\n\tconst value = isDefined ? lineHeight : RESET_VALUE;\n\n\tconst handleOnChange = ( nextValue, { event } ) => {\n\t\tif ( nextValue === '' ) {\n\t\t\tonChange();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.type === 'click' ) {\n\t\t\tonChange( adjustNextValue( `${ nextValue }`, false ) );\n\t\t\treturn;\n\t\t}\n\n\t\tonChange( `${ nextValue }` );\n\t};\n\n\tif (\n\t\t! __next40pxDefaultSize &&\n\t\t( otherProps.size === undefined || otherProps.size === 'default' )\n\t) {\n\t\tdeprecated( `36px default size for wp.blockEditor.LineHeightControl`, {\n\t\t\tsince: '6.8',\n\t\t\tversion: '7.1',\n\t\t\thint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.',\n\t\t} );\n\t}\n\n\treturn (\n\t\t<div className=\"block-editor-line-height-control\">\n\t\t\t<NumberControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\t\tonChange={ handleOnChange }\n\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\tplaceholder={ BASE_DEFAULT_VALUE }\n\t\t\t\tstep={ STEP }\n\t\t\t\tspinFactor={ SPIN_FACTOR }\n\t\t\t\tvalue={ value }\n\t\t\t\tmin={ 0 }\n\t\t\t\tspinControls=\"custom\"\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md\n */\nexport default LineHeightControl;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,wBAA6D;AAC7D,wBAAuB;AAKvB,mBAMO;AAyFJ;AAvFH,IAAM,oBAAoB,CAAE;AAAA;AAAA,EAE3B,wB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A;AAAA,MACE,GAAG;AAAA,MACL,mCAAiC;AAAA,MACjC;AAAA,MACA;AAAA,MACA,wBAAyB;AAAA,MACzB,UAAW;AAAA,MACX,WAAQ,gBAAI,aAAc;AAAA,MAC1B,aAAc;AAAA,MACd,MAAO;AAAA,MACP,YAAa;AAAA,MACb;AAAA,MACA,KAAM;AAAA,MACN,cAAa;AAAA;AAAA,EACd,GACD;AAEF;AAKA,IAAO,8BAAQ;",
|
|
6
6
|
"names": ["value", "deprecated", "NumberControl"]
|
|
7
7
|
}
|
|
@@ -337,7 +337,7 @@ function LinkControl({
|
|
|
337
337
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {}),
|
|
338
338
|
" ",
|
|
339
339
|
(0, import_i18n.__)("Creating"),
|
|
340
|
-
"
|
|
340
|
+
"…"
|
|
341
341
|
] }),
|
|
342
342
|
isEditing && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
343
343
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -357,8 +357,7 @@ function LinkControl({
|
|
|
357
357
|
label: (0, import_i18n.__)("Text"),
|
|
358
358
|
value: internalControlValue?.title,
|
|
359
359
|
onChange: setInternalTextInputValue,
|
|
360
|
-
onKeyDown: handleSubmitWithEnter
|
|
361
|
-
__next40pxDefaultSize: true
|
|
360
|
+
onKeyDown: handleSubmitWithEnter
|
|
362
361
|
}
|
|
363
362
|
),
|
|
364
363
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/link-control/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tSpinner,\n\tNotice,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useRef, useState, useEffect, useMemo } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\nimport { isShallowEqualObjects } from '@wordpress/is-shallow-equal';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { keyboardReturn, linkOff } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\nimport { isURL, prependHTTPS } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport LinkSettings from './settings';\nimport useCreatePage from './use-create-page';\nimport useInternalValue from './use-internal-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS, LINK_ENTRY_TYPES } from './constants';\nimport isURLLike, { isHashLink, isRelativePath } from './is-url-like';\nimport normalizeUrl from './normalize-url';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {Function=} onInputChange Callback fired when the search input value changes.\n * Use this for observation only (e.g., to track search state).\n * @property {string=} inputValue Initial value for the search input (uncontrolled).\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n * @property {boolean=} handleEntities Whether to handle entity links (links with ID). When true and a link has an ID, the input will be disabled and show an unlink button.\n */\n\nconst noop = () => {};\n\nconst PREFERENCE_SCOPE = 'core/block-editor';\nconst PREFERENCE_KEY = 'linkControlSettingsDrawer';\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n * ## Usage Patterns\n *\n * The component does not support a fully controlled implementation,\n * but it does support an observable implementation.\n *\n * ### Uncontrolled (default)\n * The component manages its own search input state:\n * ```jsx\n * <LinkControl value={ link } onChange={ setLink } />\n * ```\n *\n * ### Observable\n * Observe input changes without controlling the value:\n * ```jsx\n * <LinkControl\n * value={ link }\n * onChange={ setLink }\n * onInputChange={ ( newValue ) => console.log( newValue ) }\n * />\n * ```\n *\n * ### Uncontrolled with Initial Value\n * Pre-populate the search input with a default value:\n * ```jsx\n * <LinkControl\n * value={ link }\n * onChange={ setLink }\n * inputValue=\"wordpress\"\n * onInputChange={ ( newValue ) => console.log( newValue ) }\n * />\n * ```\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonInputChange,\n\tonRemove,\n\tonCancel,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n\thandleEntities = false,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst [ settingsOpen, setSettingsOpen ] = useState( false );\n\t// Sets if the URL value is valid when submitted. The value could be set to\n\t// { type: 'invalid', message: 'Please enter a valid URL.' } or { type: 'valid' }.\n\t// When it is undefined, the URL value has not been validated.\n\tconst [ customValidity, setCustomValidity ] = useState( undefined );\n\n\tconst { advancedSettingsPreference } = useSelect( ( select ) => {\n\t\tconst prefsStore = select( preferencesStore );\n\n\t\treturn {\n\t\t\tadvancedSettingsPreference:\n\t\t\t\tprefsStore.get( PREFERENCE_SCOPE, PREFERENCE_KEY ) ?? false,\n\t\t};\n\t}, [] );\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\t/**\n\t * Sets the open/closed state of the Advanced Settings Drawer,\n\t * optionlly persisting the state to the user's preferences.\n\t *\n\t * Note that Block Editor components can be consumed by non-WordPress\n\t * environments which may not have preferences setup.\n\t * Therefore a local state is also used as a fallback.\n\t *\n\t * @param {boolean} prefVal the open/closed state of the Advanced Settings Drawer.\n\t */\n\tconst setSettingsOpenWithPreference = ( prefVal ) => {\n\t\tif ( setPreference ) {\n\t\t\tsetPreference( PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal );\n\t\t}\n\t\tsetSettingsOpen( prefVal );\n\t};\n\n\t// Block Editor components can be consumed by non-WordPress environments\n\t// which may not have these preferences setup.\n\t// Therefore a local state is used as a fallback.\n\tconst isSettingsOpen = advancedSettingsPreference || settingsOpen;\n\n\tconst isMountingRef = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst searchInputRef = useRef();\n\t// TODO: Remove entityUrlFallbackRef and previewValue in favor of value prop after taxonomy entity binding\n\t// is stable and returns the correct URL instead of null while resolving when creating the entity.\n\t//\n\t// Preserve the URL from entity suggestions before binding overrides it\n\t// This is due to entity binding not being available immediately after the suggestion is selected.\n\t// The URL can return null, especially for taxonomy entities, while entity binding is being resolved.\n\t// To avoid unnecessary rerenders and focus loss, we preserve the URL from the suggestion and use it\n\t// as a fallback until the entity binding is available.\n\tconst entityUrlFallbackRef = useRef();\n\n\tconst settingsKeys = settings.map( ( { id } ) => id );\n\n\tconst [\n\t\tinternalControlValue,\n\t\tsetInternalControlValue,\n\t\tsetInternalURLInputValue,\n\t\tsetInternalTextInputValue,\n\t\tcreateSetInternalSettingValueHandler,\n\t] = useInternalValue( value );\n\n\t// Wrapper for input changes that calls both internal and external handlers\n\tconst handleInputChange = ( newValue ) => {\n\t\tsetInternalURLInputValue( newValue );\n\t\tonInputChange?.( newValue );\n\t};\n\n\t// Compute isEntity internally based on handleEntities prop and presence of ID\n\tconst isEntity = handleEntities && !! internalControlValue?.id;\n\n\t// Generate help text ID for accessibility association\n\tconst baseId = useInstanceId( LinkControl, 'link-control' );\n\tconst helpTextId = isEntity ? `${ baseId }__help` : null;\n\n\tconst valueHasChanges =\n\t\tvalue && ! isShallowEqualObjects( internalControlValue, value );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif ( forceIsEditingLink === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsEditingLink( forceIsEditingLink );\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMountingRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[ 0 ] ||\n\t\t\twrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\t// The component mounting reference is maintained separately\n\t// to correctly reset values in `StrictMode`.\n\tuseEffect( () => {\n\t\tisMountingRef.current = false;\n\n\t\treturn () => {\n\t\t\tisMountingRef.current = true;\n\t\t};\n\t}, [] );\n\n\t// Warn when inputValue changes after mount. inputValue only sets the\n\t// initial value. The component is uncontrolled and changes\n\t// from the parent will not update the search input.\n\tconst prevInputValueRef = useRef();\n\tuseEffect( () => {\n\t\tif ( prevInputValueRef.current === undefined ) {\n\t\t\tprevInputValueRef.current = propInputValue;\n\t\t\treturn;\n\t\t}\n\n\t\tif ( prevInputValueRef.current !== propInputValue ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(\n\t\t\t\t'LinkControl: The inputValue prop is uncontrolled and only sets the initial value. onInputChange is an observer for the input value. Changes to inputValue from the parent will not update the search input.'\n\t\t\t);\n\t\t\tprevInputValueRef.current = propInputValue;\n\t\t}\n\t}, [ propInputValue ] );\n\n\t// Trigger validation display when customValidity becomes invalid.\n\t// This effect runs after React has applied the customValidity state update\n\t// and ControlWithError's useEffect has set the native validity on the input.\n\tuseEffect( () => {\n\t\tif ( customValidity?.type === 'invalid' ) {\n\t\t\tconst inputElement = searchInputRef.current;\n\t\t\tif (\n\t\t\t\tinputElement &&\n\t\t\t\ttypeof inputElement.reportValidity === 'function'\n\t\t\t) {\n\t\t\t\tinputElement.reportValidity();\n\t\t\t}\n\t\t}\n\t}, [ customValidity ] );\n\n\tconst hasLinkValue = value?.url?.trim()?.length > 0;\n\n\t/**\n\t * Cancels editing state.\n\t */\n\tconst stopEditing = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\t/**\n\t * Validates a URL string using a multi-stage validation process.\n\t * This helper consolidates URL validation logic used throughout the component.\n\t *\n\t * @param {string} urlToValidate - The URL string to validate\n\t * @return {Object} Validation result with isValid boolean and optional errorMessage\n\t */\n\tconst validateUrl = ( urlToValidate ) => {\n\t\tconst invalidResult = {\n\t\t\ttype: 'invalid',\n\t\t\tmessage: __( 'Please enter a valid URL.' ),\n\t\t};\n\n\t\tconst validResult = {\n\t\t\ttype: 'valid',\n\t\t};\n\n\t\tconst trimmedValue = urlToValidate?.trim();\n\n\t\t// If empty or not URL-like, return invalid\n\t\tif ( ! trimmedValue?.length || ! isURLLike( trimmedValue ) ) {\n\t\t\treturn invalidResult;\n\t\t}\n\n\t\t// Hash links (internal anchor links) and relative paths (/, ./, ../) are\n\t\t// valid href values but cannot be validated by the native URL constructor\n\t\t// (which requires absolute URLs). These are already validated by isURLLike.\n\t\t// Skip URL constructor validation for these cases.\n\t\tif ( isHashLink( trimmedValue ) || isRelativePath( trimmedValue ) ) {\n\t\t\treturn validResult;\n\t\t}\n\n\t\t// Perform URL validation using the native URL constructor as the authoritative source.\n\t\t// The native URL constructor is the standard for URL validity - if it accepts a URL,\n\t\t// we should allow it. For URLs without a protocol (e.g., \"www.wordpress.org\"),\n\t\t// prepend \"http://\" before validating, as the URL constructor requires a protocol.\n\t\t//\n\t\t// Note: Protocol URLs (mailto:, tel:, etc.) are also validated by the native\n\t\t// URL constructor, so we don't need special handling for them.\n\t\t//\n\t\t// Note: We rely on the native URL constructor rather than implementing custom TLD\n\t\t// validation to avoid blocking valid URLs. If a URL passes the native constructor,\n\t\t// it's technically valid according to web standards.\n\t\tconst urlToCheck = prependHTTPS( trimmedValue );\n\t\treturn isURL( urlToCheck ) ? validResult : invalidResult;\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\t// Validate URL suggestions (link, mailto, tel, internal) or manually entered URLs.\n\t\t// Entity suggestions (post, page, category, etc.) don't need validation as they come from the database.\n\t\t// However, URL suggestions (created from user input with types like 'link', 'mailto', etc.)\n\t\t// still need validation as they may contain invalid URLs like \"www.wordp\".\n\t\tconst isEntitySuggestion =\n\t\t\tupdatedValue &&\n\t\t\tupdatedValue.id &&\n\t\t\tupdatedValue.type &&\n\t\t\t! LINK_ENTRY_TYPES.includes( updatedValue.type );\n\n\t\tif ( ! isEntitySuggestion ) {\n\t\t\t// URL suggestion (link, mailto, tel, internal) or manually entered URL - validate before submitting\n\t\t\t// Use the URL from the suggestion, or fall back to currentUrlInputValue\n\t\t\tconst urlToValidate = updatedValue?.url || currentUrlInputValue;\n\n\t\t\t// Validate the URL using the shared validation helper\n\t\t\tconst validation = validateUrl( urlToValidate );\n\t\t\tif ( validation.type === 'invalid' ) {\n\t\t\t\tsetCustomValidity( validation );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Validation passed - normalize the URL\n\t\t\tconst { url: normalizedUrl } = normalizeUrl( urlToValidate );\n\t\t\tupdatedValue = {\n\t\t\t\t...updatedValue,\n\t\t\t\turl: normalizedUrl,\n\t\t\t};\n\t\t}\n\n\t\t// Preserve the URL for taxonomy entities before binding overrides it\n\t\tif ( updatedValue?.kind === 'taxonomy' && updatedValue?.url ) {\n\t\t\tentityUrlFallbackRef.current = updatedValue.url;\n\t\t}\n\n\t\t// Suggestions may contains \"settings\" values (e.g. `opensInNewTab`)\n\t\t// which should not override any existing settings values set by the\n\t\t// user. This filters out any settings values from the suggestion.\n\t\tconst nonSettingsChanges = Object.keys( updatedValue ).reduce(\n\t\t\t( acc, key ) => {\n\t\t\t\tif ( ! settingsKeys.includes( key ) ) {\n\t\t\t\t\tacc[ key ] = updatedValue[ key ];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\tonChange( {\n\t\t\t...internalControlValue,\n\t\t\t...nonSettingsChanges,\n\t\t\t// As title is not a setting, it must be manually applied\n\t\t\t// in such a way as to preserve the users changes over\n\t\t\t// any \"title\" value provided by the \"suggestion\".\n\t\t\ttitle: internalControlValue?.title || updatedValue?.title,\n\t\t} );\n\n\t\t// Reset validation state when a suggestion is selected\n\t\tsetCustomValidity( undefined );\n\n\t\tstopEditing();\n\t};\n\n\t// Centralized validation function\n\tconst validateAndSetValidity = () => {\n\t\tif ( currentInputIsEmpty ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst trimmedValue = currentUrlInputValue.trim();\n\n\t\t// If the current value is an entity link (has id and type not in LINK_ENTRY_TYPES)\n\t\t// and the URL hasn't changed from the original value, skip validation.\n\t\t// This allows entity links with permalink formats like \"?p=2\" to work without\n\t\t// requiring URL validation when only settings are being changed.\n\t\tconst isEntityLink =\n\t\t\tinternalControlValue &&\n\t\t\tinternalControlValue.id &&\n\t\t\tinternalControlValue.type &&\n\t\t\t! LINK_ENTRY_TYPES.includes( internalControlValue.type );\n\t\tconst urlUnchanged = value?.url === trimmedValue;\n\n\t\tif ( isEntityLink && urlUnchanged ) {\n\t\t\t// Entity link with unchanged URL - skip validation\n\t\t\tsetCustomValidity( undefined );\n\t\t\treturn true;\n\t\t}\n\n\t\t// Validate the URL using the shared validation helper\n\t\tconst validation = validateUrl( currentUrlInputValue );\n\n\t\tif ( validation.type === 'invalid' ) {\n\t\t\tsetCustomValidity( validation );\n\t\t\treturn false;\n\t\t}\n\n\t\t// Valid URL\n\t\tsetCustomValidity( undefined );\n\t\treturn true;\n\t};\n\n\t// Centralized submission function\n\tconst submitUrlValue = () => {\n\t\tif ( valueHasChanges ) {\n\t\t\t// Submit the original value with new stored values applied\n\t\t\t// on top. URL is a special case as it may also be a prop.\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\t...internalControlValue,\n\t\t\t\turl: normalizeUrl( currentUrlInputValue ).url,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t\tsetCustomValidity( undefined );\n\t};\n\n\tconst handleSubmit = () => {\n\t\t// Validate URL before submitting\n\t\tif ( ! validateAndSetValidity() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Validation passed - proceed with submission\n\t\tsubmitUrlValue();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst resetInternalValues = () => {\n\t\tsetInternalControlValue( value );\n\t};\n\n\tconst handleCancel = ( event ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\t// Ensure that any unsubmitted input changes are reset.\n\t\tresetInternalValues();\n\n\t\t// Reset validation state\n\t\tsetCustomValidity( undefined );\n\n\t\tif ( hasLinkValue ) {\n\t\t\t// If there is a link then exist editing mode and show preview.\n\t\t\tstopEditing();\n\t\t} else {\n\t\t\t// If there is no link value, then remove the link entirely.\n\t\t\tonRemove?.();\n\t\t}\n\n\t\tonCancel?.();\n\t};\n\n\tconst [ shouldFocusSearchInput, setShouldFocusSearchInput ] =\n\t\tuseState( false );\n\n\tconst handleUnlink = () => {\n\t\t// Clear the internal state to remove the ID and re-enable the field\n\t\t// Explicitly set id, kind, and type to undefined so they override\n\t\t// the original values when spread in handleSubmit. This ensures that\n\t\t// when the user types a custom URL and submits, the entity link is\n\t\t// properly severed (not just when selecting a different entity from suggestions).\n\t\tconst { id, kind, type, ...restValue } = internalControlValue;\n\t\tsetInternalControlValue( {\n\t\t\t...restValue,\n\t\t\tid: undefined,\n\t\t\tkind: undefined,\n\t\t\ttype: undefined,\n\t\t\turl: undefined,\n\t\t} );\n\n\t\t// Request focus after the component re-renders with the cleared state\n\t\t// We can't focus immediately because the input might still be disabled\n\t\tsetShouldFocusSearchInput( true );\n\t};\n\n\t// Focus the search input when requested, once the component has re-rendered\n\t// This ensures the input is enabled and ready to receive focus\n\tuseEffect( () => {\n\t\tif ( shouldFocusSearchInput ) {\n\t\t\tsearchInputRef.current?.focus();\n\t\t\tsetShouldFocusSearchInput( false );\n\t\t}\n\t}, [ shouldFocusSearchInput ] );\n\n\t// Prioritize internal value (even if empty string), but allow propInputValue to set\n\t// the initial default value.\n\tconst currentUrlInputValue =\n\t\tinternalControlValue?.url !== undefined\n\t\t\t? internalControlValue.url\n\t\t\t: propInputValue || '';\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\t// Reset validation state when the URL value changes\n\tuseEffect( () => {\n\t\tsetCustomValidity( undefined );\n\t}, [ currentUrlInputValue ] );\n\n\tconst isUrlValid = ! customValidity;\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showActions = isEditingLink && hasLinkValue;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = hasLinkValue && hasTextControl;\n\n\tconst isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;\n\t// When creating a new link (no existing value), allow submission if input is not empty and URL is valid\n\t// When editing an existing link, also require that the value has changed\n\tconst isDisabled =\n\t\tcurrentInputIsEmpty || ! isUrlValid || ( value && ! valueHasChanges );\n\tconst showSettings = !! settings?.length && isEditingLink && hasLinkValue;\n\n\tconst previewValue = useMemo( () => {\n\t\t// There is a chance that the value is not yet set from the entity binding, so we use the preserved URL.\n\t\tif (\n\t\t\tvalue?.kind === 'taxonomy' &&\n\t\t\t! value?.url &&\n\t\t\tentityUrlFallbackRef.current\n\t\t) {\n\t\t\t// combine the value prop with the preserved URL from the suggestion\n\t\t\treturn {\n\t\t\t\t...value,\n\t\t\t\turl: entityUrlFallbackRef.current,\n\t\t\t};\n\t\t}\n\n\t\t// If we don't have a fallback URL, use the value prop.\n\t\treturn value;\n\t}, [ value ] );\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }\u2026\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ clsx( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t\t'has-actions': showActions,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t\tvalue={ internalControlValue?.title }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextInputValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tref={ searchInputRef }\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ handleInputChange }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thideLabelFromVision={ ! showTextControl }\n\t\t\t\t\t\t\tisEntity={ isEntity }\n\t\t\t\t\t\t\tcustomValidity={ customValidity }\n\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t<SearchSuffixControl\n\t\t\t\t\t\t\t\t\tisEntity={ isEntity }\n\t\t\t\t\t\t\t\t\tshowActions={ showActions }\n\t\t\t\t\t\t\t\t\tisDisabled={ isDisabled }\n\t\t\t\t\t\t\t\t\tonUnlink={ handleUnlink }\n\t\t\t\t\t\t\t\t\tonSubmit={ handleSubmit }\n\t\t\t\t\t\t\t\t\thelpTextId={ helpTextId }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isEntity && helpTextId && (\n\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\tid={ helpTextId }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__help\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: entity type (e.g., page, post) */\n\t\t\t\t\t\t\t\t\t__( 'Synced with the selected %s.' ),\n\t\t\t\t\t\t\t\t\tinternalControlValue?.type || 'item'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ previewValue?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ previewValue }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\tsetIsEditingLink( true );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ showSettings && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t{ ! currentInputIsEmpty && (\n\t\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\t\tsettingsOpen={ isSettingsOpen }\n\t\t\t\t\t\t\tsetSettingsOpen={ setSettingsOpenWithPreference }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkSettings\n\t\t\t\t\t\t\t\tvalue={ internalControlValue }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\tonChange={ createSetInternalSettingValueHandler(\n\t\t\t\t\t\t\t\t\tsettingsKeys\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</LinkControlSettingsDrawer>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ showActions && (\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"right\"\n\t\t\t\t\tclassName=\"block-editor-link-control__search-actions\"\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ handleCancel }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ isDisabled ? noop : handleSubmit }\n\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t) }\n\n\t\t\t{ ! isCreatingPage && renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\n/**\n * Suffix control component for LinkControl search input.\n * Handles the display of unlink button for entities and submit button for regular links.\n *\n * @param {Object} props - Component props\n * @param {boolean} props.isEntity - Whether the link is bound to an entity\n * @param {boolean} props.showActions - Whether to show action buttons\n * @param {boolean} props.isDisabled - Whether the submit button should be disabled\n * @param {Function} props.onUnlink - Callback when unlink button is clicked\n * @param {Function} props.onSubmit - Callback when submit button is clicked\n * @param {string} props.helpTextId - ID of the help text element for accessibility\n */\nfunction SearchSuffixControl( {\n\tisEntity,\n\tshowActions,\n\tisDisabled,\n\tonUnlink,\n\tonSubmit,\n\thelpTextId,\n} ) {\n\tif ( isEntity ) {\n\t\treturn (\n\t\t\t<Button\n\t\t\t\ticon={ linkOff }\n\t\t\t\tonClick={ onUnlink }\n\t\t\t\taria-describedby={ helpTextId }\n\t\t\t\tshowTooltip\n\t\t\t\tlabel={ __( 'Unsync and edit' ) }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( showActions ) {\n\t\treturn undefined;\n\t}\n\n\treturn (\n\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t<Button\n\t\t\t\tonClick={ isDisabled ? noop : onSubmit }\n\t\t\t\tlabel={ __( 'Submit' ) }\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\tsize=\"small\"\n\t\t\t/>\n\t\t</InputControlSuffixWrapper>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\nLinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS;\n\nconst DeprecatedExperimentalLinkControl = ( props ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalLinkControl', {\n\t\tsince: '6.8',\n\t\talternative: 'wp.blockEditor.LinkControl',\n\t} );\n\n\treturn <LinkControl { ...props } />;\n};\n\nDeprecatedExperimentalLinkControl.ViewerFill = LinkControl.ViewerFill;\nDeprecatedExperimentalLinkControl.DEFAULT_LINK_SETTINGS =\n\tLinkControl.DEFAULT_LINK_SETTINGS;\n\nexport { DeprecatedExperimentalLinkControl };\nexport default LinkControl;\n"],
|
|
5
|
-
"mappings": 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
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tSpinner,\n\tNotice,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useRef, useState, useEffect, useMemo } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\nimport { isShallowEqualObjects } from '@wordpress/is-shallow-equal';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { keyboardReturn, linkOff } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\nimport { isURL, prependHTTPS } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport LinkSettings from './settings';\nimport useCreatePage from './use-create-page';\nimport useInternalValue from './use-internal-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS, LINK_ENTRY_TYPES } from './constants';\nimport isURLLike, { isHashLink, isRelativePath } from './is-url-like';\nimport normalizeUrl from './normalize-url';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {Function=} onInputChange Callback fired when the search input value changes.\n * Use this for observation only (e.g., to track search state).\n * @property {string=} inputValue Initial value for the search input (uncontrolled).\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n * @property {boolean=} handleEntities Whether to handle entity links (links with ID). When true and a link has an ID, the input will be disabled and show an unlink button.\n */\n\nconst noop = () => {};\n\nconst PREFERENCE_SCOPE = 'core/block-editor';\nconst PREFERENCE_KEY = 'linkControlSettingsDrawer';\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n * ## Usage Patterns\n *\n * The component does not support a fully controlled implementation,\n * but it does support an observable implementation.\n *\n * ### Uncontrolled (default)\n * The component manages its own search input state:\n * ```jsx\n * <LinkControl value={ link } onChange={ setLink } />\n * ```\n *\n * ### Observable\n * Observe input changes without controlling the value:\n * ```jsx\n * <LinkControl\n * value={ link }\n * onChange={ setLink }\n * onInputChange={ ( newValue ) => console.log( newValue ) }\n * />\n * ```\n *\n * ### Uncontrolled with Initial Value\n * Pre-populate the search input with a default value:\n * ```jsx\n * <LinkControl\n * value={ link }\n * onChange={ setLink }\n * inputValue=\"wordpress\"\n * onInputChange={ ( newValue ) => console.log( newValue ) }\n * />\n * ```\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonInputChange,\n\tonRemove,\n\tonCancel,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n\thandleEntities = false,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst [ settingsOpen, setSettingsOpen ] = useState( false );\n\t// Sets if the URL value is valid when submitted. The value could be set to\n\t// { type: 'invalid', message: 'Please enter a valid URL.' } or { type: 'valid' }.\n\t// When it is undefined, the URL value has not been validated.\n\tconst [ customValidity, setCustomValidity ] = useState( undefined );\n\n\tconst { advancedSettingsPreference } = useSelect( ( select ) => {\n\t\tconst prefsStore = select( preferencesStore );\n\n\t\treturn {\n\t\t\tadvancedSettingsPreference:\n\t\t\t\tprefsStore.get( PREFERENCE_SCOPE, PREFERENCE_KEY ) ?? false,\n\t\t};\n\t}, [] );\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\t/**\n\t * Sets the open/closed state of the Advanced Settings Drawer,\n\t * optionlly persisting the state to the user's preferences.\n\t *\n\t * Note that Block Editor components can be consumed by non-WordPress\n\t * environments which may not have preferences setup.\n\t * Therefore a local state is also used as a fallback.\n\t *\n\t * @param {boolean} prefVal the open/closed state of the Advanced Settings Drawer.\n\t */\n\tconst setSettingsOpenWithPreference = ( prefVal ) => {\n\t\tif ( setPreference ) {\n\t\t\tsetPreference( PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal );\n\t\t}\n\t\tsetSettingsOpen( prefVal );\n\t};\n\n\t// Block Editor components can be consumed by non-WordPress environments\n\t// which may not have these preferences setup.\n\t// Therefore a local state is used as a fallback.\n\tconst isSettingsOpen = advancedSettingsPreference || settingsOpen;\n\n\tconst isMountingRef = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst searchInputRef = useRef();\n\t// TODO: Remove entityUrlFallbackRef and previewValue in favor of value prop after taxonomy entity binding\n\t// is stable and returns the correct URL instead of null while resolving when creating the entity.\n\t//\n\t// Preserve the URL from entity suggestions before binding overrides it\n\t// This is due to entity binding not being available immediately after the suggestion is selected.\n\t// The URL can return null, especially for taxonomy entities, while entity binding is being resolved.\n\t// To avoid unnecessary rerenders and focus loss, we preserve the URL from the suggestion and use it\n\t// as a fallback until the entity binding is available.\n\tconst entityUrlFallbackRef = useRef();\n\n\tconst settingsKeys = settings.map( ( { id } ) => id );\n\n\tconst [\n\t\tinternalControlValue,\n\t\tsetInternalControlValue,\n\t\tsetInternalURLInputValue,\n\t\tsetInternalTextInputValue,\n\t\tcreateSetInternalSettingValueHandler,\n\t] = useInternalValue( value );\n\n\t// Wrapper for input changes that calls both internal and external handlers\n\tconst handleInputChange = ( newValue ) => {\n\t\tsetInternalURLInputValue( newValue );\n\t\tonInputChange?.( newValue );\n\t};\n\n\t// Compute isEntity internally based on handleEntities prop and presence of ID\n\tconst isEntity = handleEntities && !! internalControlValue?.id;\n\n\t// Generate help text ID for accessibility association\n\tconst baseId = useInstanceId( LinkControl, 'link-control' );\n\tconst helpTextId = isEntity ? `${ baseId }__help` : null;\n\n\tconst valueHasChanges =\n\t\tvalue && ! isShallowEqualObjects( internalControlValue, value );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif ( forceIsEditingLink === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsEditingLink( forceIsEditingLink );\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMountingRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[ 0 ] ||\n\t\t\twrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\t// The component mounting reference is maintained separately\n\t// to correctly reset values in `StrictMode`.\n\tuseEffect( () => {\n\t\tisMountingRef.current = false;\n\n\t\treturn () => {\n\t\t\tisMountingRef.current = true;\n\t\t};\n\t}, [] );\n\n\t// Warn when inputValue changes after mount. inputValue only sets the\n\t// initial value. The component is uncontrolled and changes\n\t// from the parent will not update the search input.\n\tconst prevInputValueRef = useRef();\n\tuseEffect( () => {\n\t\tif ( prevInputValueRef.current === undefined ) {\n\t\t\tprevInputValueRef.current = propInputValue;\n\t\t\treturn;\n\t\t}\n\n\t\tif ( prevInputValueRef.current !== propInputValue ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(\n\t\t\t\t'LinkControl: The inputValue prop is uncontrolled and only sets the initial value. onInputChange is an observer for the input value. Changes to inputValue from the parent will not update the search input.'\n\t\t\t);\n\t\t\tprevInputValueRef.current = propInputValue;\n\t\t}\n\t}, [ propInputValue ] );\n\n\t// Trigger validation display when customValidity becomes invalid.\n\t// This effect runs after React has applied the customValidity state update\n\t// and ControlWithError's useEffect has set the native validity on the input.\n\tuseEffect( () => {\n\t\tif ( customValidity?.type === 'invalid' ) {\n\t\t\tconst inputElement = searchInputRef.current;\n\t\t\tif (\n\t\t\t\tinputElement &&\n\t\t\t\ttypeof inputElement.reportValidity === 'function'\n\t\t\t) {\n\t\t\t\tinputElement.reportValidity();\n\t\t\t}\n\t\t}\n\t}, [ customValidity ] );\n\n\tconst hasLinkValue = value?.url?.trim()?.length > 0;\n\n\t/**\n\t * Cancels editing state.\n\t */\n\tconst stopEditing = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\t/**\n\t * Validates a URL string using a multi-stage validation process.\n\t * This helper consolidates URL validation logic used throughout the component.\n\t *\n\t * @param {string} urlToValidate - The URL string to validate\n\t * @return {Object} Validation result with isValid boolean and optional errorMessage\n\t */\n\tconst validateUrl = ( urlToValidate ) => {\n\t\tconst invalidResult = {\n\t\t\ttype: 'invalid',\n\t\t\tmessage: __( 'Please enter a valid URL.' ),\n\t\t};\n\n\t\tconst validResult = {\n\t\t\ttype: 'valid',\n\t\t};\n\n\t\tconst trimmedValue = urlToValidate?.trim();\n\n\t\t// If empty or not URL-like, return invalid\n\t\tif ( ! trimmedValue?.length || ! isURLLike( trimmedValue ) ) {\n\t\t\treturn invalidResult;\n\t\t}\n\n\t\t// Hash links (internal anchor links) and relative paths (/, ./, ../) are\n\t\t// valid href values but cannot be validated by the native URL constructor\n\t\t// (which requires absolute URLs). These are already validated by isURLLike.\n\t\t// Skip URL constructor validation for these cases.\n\t\tif ( isHashLink( trimmedValue ) || isRelativePath( trimmedValue ) ) {\n\t\t\treturn validResult;\n\t\t}\n\n\t\t// Perform URL validation using the native URL constructor as the authoritative source.\n\t\t// The native URL constructor is the standard for URL validity - if it accepts a URL,\n\t\t// we should allow it. For URLs without a protocol (e.g., \"www.wordpress.org\"),\n\t\t// prepend \"http://\" before validating, as the URL constructor requires a protocol.\n\t\t//\n\t\t// Note: Protocol URLs (mailto:, tel:, etc.) are also validated by the native\n\t\t// URL constructor, so we don't need special handling for them.\n\t\t//\n\t\t// Note: We rely on the native URL constructor rather than implementing custom TLD\n\t\t// validation to avoid blocking valid URLs. If a URL passes the native constructor,\n\t\t// it's technically valid according to web standards.\n\t\tconst urlToCheck = prependHTTPS( trimmedValue );\n\t\treturn isURL( urlToCheck ) ? validResult : invalidResult;\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\t// Validate URL suggestions (link, mailto, tel, internal) or manually entered URLs.\n\t\t// Entity suggestions (post, page, category, etc.) don't need validation as they come from the database.\n\t\t// However, URL suggestions (created from user input with types like 'link', 'mailto', etc.)\n\t\t// still need validation as they may contain invalid URLs like \"www.wordp\".\n\t\tconst isEntitySuggestion =\n\t\t\tupdatedValue &&\n\t\t\tupdatedValue.id &&\n\t\t\tupdatedValue.type &&\n\t\t\t! LINK_ENTRY_TYPES.includes( updatedValue.type );\n\n\t\tif ( ! isEntitySuggestion ) {\n\t\t\t// URL suggestion (link, mailto, tel, internal) or manually entered URL - validate before submitting\n\t\t\t// Use the URL from the suggestion, or fall back to currentUrlInputValue\n\t\t\tconst urlToValidate = updatedValue?.url || currentUrlInputValue;\n\n\t\t\t// Validate the URL using the shared validation helper\n\t\t\tconst validation = validateUrl( urlToValidate );\n\t\t\tif ( validation.type === 'invalid' ) {\n\t\t\t\tsetCustomValidity( validation );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Validation passed - normalize the URL\n\t\t\tconst { url: normalizedUrl } = normalizeUrl( urlToValidate );\n\t\t\tupdatedValue = {\n\t\t\t\t...updatedValue,\n\t\t\t\turl: normalizedUrl,\n\t\t\t};\n\t\t}\n\n\t\t// Preserve the URL for taxonomy entities before binding overrides it\n\t\tif ( updatedValue?.kind === 'taxonomy' && updatedValue?.url ) {\n\t\t\tentityUrlFallbackRef.current = updatedValue.url;\n\t\t}\n\n\t\t// Suggestions may contains \"settings\" values (e.g. `opensInNewTab`)\n\t\t// which should not override any existing settings values set by the\n\t\t// user. This filters out any settings values from the suggestion.\n\t\tconst nonSettingsChanges = Object.keys( updatedValue ).reduce(\n\t\t\t( acc, key ) => {\n\t\t\t\tif ( ! settingsKeys.includes( key ) ) {\n\t\t\t\t\tacc[ key ] = updatedValue[ key ];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\tonChange( {\n\t\t\t...internalControlValue,\n\t\t\t...nonSettingsChanges,\n\t\t\t// As title is not a setting, it must be manually applied\n\t\t\t// in such a way as to preserve the users changes over\n\t\t\t// any \"title\" value provided by the \"suggestion\".\n\t\t\ttitle: internalControlValue?.title || updatedValue?.title,\n\t\t} );\n\n\t\t// Reset validation state when a suggestion is selected\n\t\tsetCustomValidity( undefined );\n\n\t\tstopEditing();\n\t};\n\n\t// Centralized validation function\n\tconst validateAndSetValidity = () => {\n\t\tif ( currentInputIsEmpty ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst trimmedValue = currentUrlInputValue.trim();\n\n\t\t// If the current value is an entity link (has id and type not in LINK_ENTRY_TYPES)\n\t\t// and the URL hasn't changed from the original value, skip validation.\n\t\t// This allows entity links with permalink formats like \"?p=2\" to work without\n\t\t// requiring URL validation when only settings are being changed.\n\t\tconst isEntityLink =\n\t\t\tinternalControlValue &&\n\t\t\tinternalControlValue.id &&\n\t\t\tinternalControlValue.type &&\n\t\t\t! LINK_ENTRY_TYPES.includes( internalControlValue.type );\n\t\tconst urlUnchanged = value?.url === trimmedValue;\n\n\t\tif ( isEntityLink && urlUnchanged ) {\n\t\t\t// Entity link with unchanged URL - skip validation\n\t\t\tsetCustomValidity( undefined );\n\t\t\treturn true;\n\t\t}\n\n\t\t// Validate the URL using the shared validation helper\n\t\tconst validation = validateUrl( currentUrlInputValue );\n\n\t\tif ( validation.type === 'invalid' ) {\n\t\t\tsetCustomValidity( validation );\n\t\t\treturn false;\n\t\t}\n\n\t\t// Valid URL\n\t\tsetCustomValidity( undefined );\n\t\treturn true;\n\t};\n\n\t// Centralized submission function\n\tconst submitUrlValue = () => {\n\t\tif ( valueHasChanges ) {\n\t\t\t// Submit the original value with new stored values applied\n\t\t\t// on top. URL is a special case as it may also be a prop.\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\t...internalControlValue,\n\t\t\t\turl: normalizeUrl( currentUrlInputValue ).url,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t\tsetCustomValidity( undefined );\n\t};\n\n\tconst handleSubmit = () => {\n\t\t// Validate URL before submitting\n\t\tif ( ! validateAndSetValidity() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Validation passed - proceed with submission\n\t\tsubmitUrlValue();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst resetInternalValues = () => {\n\t\tsetInternalControlValue( value );\n\t};\n\n\tconst handleCancel = ( event ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\t// Ensure that any unsubmitted input changes are reset.\n\t\tresetInternalValues();\n\n\t\t// Reset validation state\n\t\tsetCustomValidity( undefined );\n\n\t\tif ( hasLinkValue ) {\n\t\t\t// If there is a link then exist editing mode and show preview.\n\t\t\tstopEditing();\n\t\t} else {\n\t\t\t// If there is no link value, then remove the link entirely.\n\t\t\tonRemove?.();\n\t\t}\n\n\t\tonCancel?.();\n\t};\n\n\tconst [ shouldFocusSearchInput, setShouldFocusSearchInput ] =\n\t\tuseState( false );\n\n\tconst handleUnlink = () => {\n\t\t// Clear the internal state to remove the ID and re-enable the field\n\t\t// Explicitly set id, kind, and type to undefined so they override\n\t\t// the original values when spread in handleSubmit. This ensures that\n\t\t// when the user types a custom URL and submits, the entity link is\n\t\t// properly severed (not just when selecting a different entity from suggestions).\n\t\tconst { id, kind, type, ...restValue } = internalControlValue;\n\t\tsetInternalControlValue( {\n\t\t\t...restValue,\n\t\t\tid: undefined,\n\t\t\tkind: undefined,\n\t\t\ttype: undefined,\n\t\t\turl: undefined,\n\t\t} );\n\n\t\t// Request focus after the component re-renders with the cleared state\n\t\t// We can't focus immediately because the input might still be disabled\n\t\tsetShouldFocusSearchInput( true );\n\t};\n\n\t// Focus the search input when requested, once the component has re-rendered\n\t// This ensures the input is enabled and ready to receive focus\n\tuseEffect( () => {\n\t\tif ( shouldFocusSearchInput ) {\n\t\t\tsearchInputRef.current?.focus();\n\t\t\tsetShouldFocusSearchInput( false );\n\t\t}\n\t}, [ shouldFocusSearchInput ] );\n\n\t// Prioritize internal value (even if empty string), but allow propInputValue to set\n\t// the initial default value.\n\tconst currentUrlInputValue =\n\t\tinternalControlValue?.url !== undefined\n\t\t\t? internalControlValue.url\n\t\t\t: propInputValue || '';\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\t// Reset validation state when the URL value changes\n\tuseEffect( () => {\n\t\tsetCustomValidity( undefined );\n\t}, [ currentUrlInputValue ] );\n\n\tconst isUrlValid = ! customValidity;\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showActions = isEditingLink && hasLinkValue;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = hasLinkValue && hasTextControl;\n\n\tconst isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;\n\t// When creating a new link (no existing value), allow submission if input is not empty and URL is valid\n\t// When editing an existing link, also require that the value has changed\n\tconst isDisabled =\n\t\tcurrentInputIsEmpty || ! isUrlValid || ( value && ! valueHasChanges );\n\tconst showSettings = !! settings?.length && isEditingLink && hasLinkValue;\n\n\tconst previewValue = useMemo( () => {\n\t\t// There is a chance that the value is not yet set from the entity binding, so we use the preserved URL.\n\t\tif (\n\t\t\tvalue?.kind === 'taxonomy' &&\n\t\t\t! value?.url &&\n\t\t\tentityUrlFallbackRef.current\n\t\t) {\n\t\t\t// combine the value prop with the preserved URL from the suggestion\n\t\t\treturn {\n\t\t\t\t...value,\n\t\t\t\turl: entityUrlFallbackRef.current,\n\t\t\t};\n\t\t}\n\n\t\t// If we don't have a fallback URL, use the value prop.\n\t\treturn value;\n\t}, [ value ] );\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ clsx( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t\t'has-actions': showActions,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t\tvalue={ internalControlValue?.title }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextInputValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tref={ searchInputRef }\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ handleInputChange }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thideLabelFromVision={ ! showTextControl }\n\t\t\t\t\t\t\tisEntity={ isEntity }\n\t\t\t\t\t\t\tcustomValidity={ customValidity }\n\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t<SearchSuffixControl\n\t\t\t\t\t\t\t\t\tisEntity={ isEntity }\n\t\t\t\t\t\t\t\t\tshowActions={ showActions }\n\t\t\t\t\t\t\t\t\tisDisabled={ isDisabled }\n\t\t\t\t\t\t\t\t\tonUnlink={ handleUnlink }\n\t\t\t\t\t\t\t\t\tonSubmit={ handleSubmit }\n\t\t\t\t\t\t\t\t\thelpTextId={ helpTextId }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isEntity && helpTextId && (\n\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\tid={ helpTextId }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__help\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: entity type (e.g., page, post) */\n\t\t\t\t\t\t\t\t\t__( 'Synced with the selected %s.' ),\n\t\t\t\t\t\t\t\t\tinternalControlValue?.type || 'item'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ previewValue?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ previewValue }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\tsetIsEditingLink( true );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ showSettings && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t{ ! currentInputIsEmpty && (\n\t\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\t\tsettingsOpen={ isSettingsOpen }\n\t\t\t\t\t\t\tsetSettingsOpen={ setSettingsOpenWithPreference }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkSettings\n\t\t\t\t\t\t\t\tvalue={ internalControlValue }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\tonChange={ createSetInternalSettingValueHandler(\n\t\t\t\t\t\t\t\t\tsettingsKeys\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</LinkControlSettingsDrawer>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ showActions && (\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"right\"\n\t\t\t\t\tclassName=\"block-editor-link-control__search-actions\"\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ handleCancel }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ isDisabled ? noop : handleSubmit }\n\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t) }\n\n\t\t\t{ ! isCreatingPage && renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\n/**\n * Suffix control component for LinkControl search input.\n * Handles the display of unlink button for entities and submit button for regular links.\n *\n * @param {Object} props - Component props\n * @param {boolean} props.isEntity - Whether the link is bound to an entity\n * @param {boolean} props.showActions - Whether to show action buttons\n * @param {boolean} props.isDisabled - Whether the submit button should be disabled\n * @param {Function} props.onUnlink - Callback when unlink button is clicked\n * @param {Function} props.onSubmit - Callback when submit button is clicked\n * @param {string} props.helpTextId - ID of the help text element for accessibility\n */\nfunction SearchSuffixControl( {\n\tisEntity,\n\tshowActions,\n\tisDisabled,\n\tonUnlink,\n\tonSubmit,\n\thelpTextId,\n} ) {\n\tif ( isEntity ) {\n\t\treturn (\n\t\t\t<Button\n\t\t\t\ticon={ linkOff }\n\t\t\t\tonClick={ onUnlink }\n\t\t\t\taria-describedby={ helpTextId }\n\t\t\t\tshowTooltip\n\t\t\t\tlabel={ __( 'Unsync and edit' ) }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( showActions ) {\n\t\treturn undefined;\n\t}\n\n\treturn (\n\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t<Button\n\t\t\t\tonClick={ isDisabled ? noop : onSubmit }\n\t\t\t\tlabel={ __( 'Submit' ) }\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\tsize=\"small\"\n\t\t\t/>\n\t\t</InputControlSuffixWrapper>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\nLinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS;\n\nconst DeprecatedExperimentalLinkControl = ( props ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalLinkControl', {\n\t\tsince: '6.8',\n\t\talternative: 'wp.blockEditor.LinkControl',\n\t} );\n\n\treturn <LinkControl { ...props } />;\n};\n\nDeprecatedExperimentalLinkControl.ViewerFill = LinkControl.ViewerFill;\nDeprecatedExperimentalLinkControl.DEFAULT_LINK_SETTINGS =\n\tLinkControl.DEFAULT_LINK_SETTINGS;\n\nexport { DeprecatedExperimentalLinkControl };\nexport default LinkControl;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAOO;AACP,kBAA4B;AAC5B,qBAAqD;AACrD,qBAA8B;AAC9B,iBAAsB;AACtB,sBAAsB;AACtB,8BAAsC;AACtC,kBAAuC;AACvC,yBAA0C;AAC1C,mBAAwC;AACxC,wBAAuB;AACvB,iBAAoC;AAKpC,6BAAsC;AACtC,0BAAmC;AACnC,0BAAwB;AACxB,sBAAyB;AACzB,6BAA0B;AAC1B,gCAA6B;AAC7B,yBAA2B;AAC3B,uBAAwD;AACxD,yBAAsD;AACtD,2BAAyB;AAymBrB;AA3hBJ,IAAM,OAAO,MAAM;AAAC;AAEpB,IAAM,mBAAmB;AACzB,IAAM,iBAAiB;AAwCvB,SAAS,YAAa;AAAA,EACrB;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,iBAAiB;AAAA,EAC7B,mBAAmB,CAAC;AAAA,EACpB,kBAAkB;AAAA,EAClB;AAAA,EACA,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,iBAAiB;AAClB,GAAI;AACH,MAAK,yBAAyB,UAAa,kBAAmB;AAC7D,2BAAuB;AAAA,EACxB;AAEA,QAAM,CAAE,cAAc,eAAgB,QAAI,yBAAU,KAAM;AAI1D,QAAM,CAAE,gBAAgB,iBAAkB,QAAI,yBAAU,MAAU;AAElE,QAAM,EAAE,2BAA2B,QAAI,uBAAW,CAAE,WAAY;AAC/D,UAAM,aAAa,OAAQ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,SAAU,aAAa,OAAO;AAAA,MAC9B,WAAQ,gBAAI,QAAS;AAAA,MACrB,MAAO;AAAA,MACP,WAAU;AAAA,MACV,iBAAgB;AAAA,MAChB,MAAK;AAAA;AAAA,EACN,GACD;AAEF;AAEA,YAAY,aAAa;AACzB,YAAY,wBAAwB;AAEpC,IAAM,oCAAoC,CAAE,UAAW;AACtD,wBAAAC,SAAY,4CAA4C;AAAA,IACvD,OAAO;AAAA,IACP,aAAa;AAAA,EACd,CAAE;AAEF,SAAO,4CAAC,eAAc,GAAG,OAAQ;AAClC;AAEA,kCAAkC,aAAa,YAAY;AAC3D,kCAAkC,wBACjC,YAAY;AAGb,IAAO,uBAAQ;",
|
|
6
6
|
"names": ["preferencesStore", "useInternalValue", "useCreatePage", "isURLLike", "normalizeUrl", "clsx", "LinkControlSearchInput", "LinkPreview", "LinkControlSettingsDrawer", "LinkSettings", "HStack", "InputControlSuffixWrapper", "deprecated"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/link-control/normalize-url.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getProtocol, prependHTTPS } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { isHashLink, isRelativePath } from './is-url-like';\nimport { TEL_TYPE, MAILTO_TYPE, INTERNAL_TYPE, URL_TYPE } from './constants';\n\n/**\n * Normalizes a URL string by adding https:// protocol if needed.\n * This function determines the final URL that will be saved.\n *\n * Normalization rules:\n * - Bare domains (wordpress.org, www.wordpress.org)
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getProtocol, prependHTTPS } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { isHashLink, isRelativePath } from './is-url-like';\nimport { TEL_TYPE, MAILTO_TYPE, INTERNAL_TYPE, URL_TYPE } from './constants';\n\n/**\n * Normalizes a URL string by adding https:// protocol if needed.\n * This function determines the final URL that will be saved.\n *\n * Normalization rules:\n * - Bare domains (wordpress.org, www.wordpress.org) → prepend https://\n * - URLs with explicit protocols (http://, https://, mailto:, tel:, etc.) → keep as-is\n * - Relative paths (/, ./, ../) → keep as-is\n * - Hash links (#section) → keep as-is\n *\n * @param {string} url - The URL to normalize\n * @return {Object} An object containing the normalized URL and its type\n */\nexport default function normalizeUrl( url ) {\n\tconst trimmedUrl = url?.trim();\n\n\tif ( ! trimmedUrl ) {\n\t\treturn { url: trimmedUrl, type: URL_TYPE };\n\t}\n\n\tlet type = URL_TYPE;\n\tconst protocol = getProtocol( trimmedUrl ) || '';\n\n\t// Determine the type based on the URL format\n\tif ( protocol.includes( 'mailto' ) ) {\n\t\ttype = MAILTO_TYPE;\n\t} else if ( protocol.includes( 'tel' ) ) {\n\t\ttype = TEL_TYPE;\n\t} else if ( trimmedUrl?.startsWith( '#' ) ) {\n\t\ttype = INTERNAL_TYPE;\n\t}\n\n\t// Hash links, relative paths, query parameters, and URLs with protocols should not be modified\n\tif (\n\t\tisHashLink( trimmedUrl ) ||\n\t\tisRelativePath( trimmedUrl ) ||\n\t\ttrimmedUrl.startsWith( '?' ) ||\n\t\tprotocol\n\t) {\n\t\treturn { url: trimmedUrl, type };\n\t}\n\n\t// Bare domains need https:// prepended\n\treturn { url: prependHTTPS( trimmedUrl ), type };\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBAA0C;AAK1C,yBAA2C;AAC3C,uBAA+D;AAehD,SAAR,aAA+B,KAAM;AAC3C,QAAM,aAAa,KAAK,KAAK;AAE7B,MAAK,CAAE,YAAa;AACnB,WAAO,EAAE,KAAK,YAAY,MAAM,0BAAS;AAAA,EAC1C;AAEA,MAAI,OAAO;AACX,QAAM,eAAW,wBAAa,UAAW,KAAK;AAG9C,MAAK,SAAS,SAAU,QAAS,GAAI;AACpC,WAAO;AAAA,EACR,WAAY,SAAS,SAAU,KAAM,GAAI;AACxC,WAAO;AAAA,EACR,WAAY,YAAY,WAAY,GAAI,GAAI;AAC3C,WAAO;AAAA,EACR;AAGA,UACC,+BAAY,UAAW,SACvB,mCAAgB,UAAW,KAC3B,WAAW,WAAY,GAAI,KAC3B,UACC;AACD,WAAO,EAAE,KAAK,YAAY,KAAK;AAAA,EAChC;AAGA,SAAO,EAAE,SAAK,yBAAc,UAAW,GAAG,KAAK;AAChD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,7 +38,6 @@ var import_components = require("@wordpress/components");
|
|
|
38
38
|
var import_element = require("@wordpress/element");
|
|
39
39
|
var import_icons = require("@wordpress/icons");
|
|
40
40
|
var import_keycodes = require("@wordpress/keycodes");
|
|
41
|
-
var import_data = require("@wordpress/data");
|
|
42
41
|
var import_ui = require("@wordpress/ui");
|
|
43
42
|
var import_block_icon = __toESM(require("../block-icon/index.cjs"));
|
|
44
43
|
var import_use_block_display_information = __toESM(require("../use-block-display-information/index.cjs"));
|
|
@@ -46,7 +45,6 @@ var import_use_block_display_title = __toESM(require("../block-title/use-block-d
|
|
|
46
45
|
var import_expander = __toESM(require("./expander.cjs"));
|
|
47
46
|
var import_block_lock = require("../block-lock/index.cjs");
|
|
48
47
|
var import_use_list_view_images = __toESM(require("./use-list-view-images.cjs"));
|
|
49
|
-
var import_store = require("../../store/index.cjs");
|
|
50
48
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
51
49
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
50
|
var { Badge: WCBadge } = (0, import_lock_unlock.unlock)(import_components.privateApis);
|
|
@@ -72,13 +70,6 @@ function ListViewBlockSelectButton({
|
|
|
72
70
|
context: "list-view"
|
|
73
71
|
});
|
|
74
72
|
const { isLocked } = (0, import_block_lock.useBlockLock)(clientId);
|
|
75
|
-
const hasPatternName = (0, import_data.useSelect)(
|
|
76
|
-
(select) => {
|
|
77
|
-
const { getBlockAttributes } = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
78
|
-
return !!getBlockAttributes(clientId)?.metadata?.patternName;
|
|
79
|
-
},
|
|
80
|
-
[clientId]
|
|
81
|
-
);
|
|
82
73
|
const shouldShowLockIcon = isLocked;
|
|
83
74
|
const isSticky = blockInformation?.positionType === "sticky";
|
|
84
75
|
const images = (0, import_use_list_view_images.default)({ clientId, isExpanded });
|
|
@@ -116,7 +107,7 @@ function ListViewBlockSelectButton({
|
|
|
116
107
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
108
|
import_block_icon.default,
|
|
118
109
|
{
|
|
119
|
-
icon:
|
|
110
|
+
icon: blockInformation?.icon,
|
|
120
111
|
showColors: true,
|
|
121
112
|
context: "list-view"
|
|
122
113
|
}
|