@wordpress/block-editor 12.21.0 → 12.23.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 +4 -0
- package/README.md +4 -0
- package/build/components/block-actions/index.js +2 -4
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +5 -5
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.native.js +5 -4
- package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build/components/block-list/block-crash-boundary.native.js +49 -0
- package/build/components/block-list/block-crash-boundary.native.js.map +1 -0
- package/build/components/block-list/block-crash-warning.native.js +24 -0
- package/build/components/block-list/block-crash-warning.native.js.map +1 -0
- package/build/components/block-list/block.js +11 -3
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +7 -2
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-mover/button.js +4 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +5 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +4 -1
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-settings/container.native.js +2 -1
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +36 -32
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -3
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +4 -3
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +8 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +19 -10
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +48 -8
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +14 -2
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +108 -11
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +11 -0
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +9 -2
- package/build/components/global-styles/advanced-panel.js.map +1 -1
- package/build/components/global-styles/background-panel.js +444 -0
- package/build/components/global-styles/background-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +2 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +8 -33
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +3 -0
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/hooks.js +1 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +13 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +16 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -3
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +43 -34
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/index.js +3 -6
- package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build/components/inserter/library.js +2 -0
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +11 -11
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +1 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/search-items.js +36 -15
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +2 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -2
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js +36 -0
- package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +11 -0
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +18 -12
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +4 -11
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/index.js +17 -2
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-collapse-items.js +47 -0
- package/build/components/list-view/use-list-view-collapse-items.js.map +1 -0
- package/build/components/list-view/utils.js +5 -3
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/rich-text/index.js +14 -11
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +17 -11
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +2 -2
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/with-deprecations.js +0 -3
- package/build/components/rich-text/with-deprecations.js.map +1 -1
- package/build/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +50 -36
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-display-information/index.js +4 -6
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +4 -0
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/warning/index.native.js +9 -4
- package/build/components/warning/index.native.js.map +1 -1
- package/build/hooks/anchor.js +9 -10
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/background.js +85 -402
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/index.js +9 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +28 -6
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +21 -10
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +1 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/use-zoom-out.js +47 -0
- package/build/hooks/use-zoom-out.js.map +1 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/private-apis.js +6 -1
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +5 -1
- package/build/private-apis.native.js.map +1 -1
- package/build/store/private-actions.js +13 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/store/private-selectors.js +24 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +53 -26
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +34 -32
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +7 -1
- package/build/store/utils.js.map +1 -1
- package/build/utils/transform-styles/index.js +2 -1
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +2 -4
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +5 -5
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.native.js +5 -4
- package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build-module/components/block-list/block-crash-boundary.native.js +42 -0
- package/build-module/components/block-list/block-crash-boundary.native.js.map +1 -0
- package/build-module/components/block-list/block-crash-warning.native.js +15 -0
- package/build-module/components/block-list/block-crash-warning.native.js.map +1 -0
- package/build-module/components/block-list/block.js +11 -3
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +7 -2
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +4 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +5 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +4 -1
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +3 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +37 -33
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -3
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +4 -3
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +8 -5
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +19 -10
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +50 -10
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +14 -2
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +109 -12
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +12 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +9 -2
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +430 -0
- package/build-module/components/global-styles/background-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +2 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +9 -34
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +3 -0
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +17 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +43 -34
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js +3 -6
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build-module/components/inserter/library.js +2 -0
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +11 -11
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/search-items.js +33 -15
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +2 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -2
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js +28 -0
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +11 -0
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +19 -13
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +6 -13
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/index.js +17 -2
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-collapse-items.js +40 -0
- package/build-module/components/list-view/use-list-view-collapse-items.js.map +1 -0
- package/build-module/components/list-view/utils.js +2 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/rich-text/index.js +15 -12
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +16 -11
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +2 -2
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/with-deprecations.js +0 -3
- package/build-module/components/rich-text/with-deprecations.js.map +1 -1
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +50 -36
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +5 -7
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +4 -0
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/warning/index.native.js +9 -4
- package/build-module/components/warning/index.native.js.map +1 -1
- package/build-module/hooks/anchor.js +10 -11
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/background.js +82 -397
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/index.js +3 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +28 -6
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +21 -10
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +1 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +41 -0
- package/build-module/hooks/use-zoom-out.js.map +1 -0
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/private-apis.js +7 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +5 -1
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/private-actions.js +12 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-keys.js +1 -0
- package/build-module/store/private-keys.js.map +1 -1
- package/build-module/store/private-selectors.js +22 -4
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +52 -26
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +35 -33
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +6 -1
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +2 -1
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +18 -1
- package/build-style/content.css +18 -1
- package/build-style/style-rtl.css +92 -99
- package/build-style/style.css +92 -99
- package/package.json +31 -31
- package/src/components/block-actions/index.js +2 -8
- package/src/components/block-bindings-toolbar-indicator/style.scss +10 -8
- package/src/components/block-heading-level-dropdown/README.md +5 -5
- package/src/components/block-heading-level-dropdown/index.js +5 -5
- package/src/components/block-heading-level-dropdown/index.native.js +5 -4
- package/src/components/block-list/block-crash-boundary.native.js +43 -0
- package/src/components/block-list/block-crash-warning.native.js +19 -0
- package/src/components/block-list/block.js +19 -3
- package/src/components/block-list/block.native.js +14 -7
- package/src/components/block-list/content.scss +16 -0
- package/src/components/block-mover/button.js +4 -1
- package/src/components/block-mover/index.js +8 -1
- package/src/components/block-patterns-list/index.js +22 -17
- package/src/components/block-preview/style.scss +28 -0
- package/src/components/block-settings/container.native.js +5 -1
- package/src/components/block-settings-menu/block-settings-dropdown.js +49 -58
- package/src/components/block-settings-menu-controls/README.md +0 -9
- package/src/components/block-settings-menu-controls/index.js +1 -6
- package/src/components/block-switcher/index.js +5 -3
- package/src/components/block-switcher/style.scss +1 -1
- package/src/components/block-toolbar/index.js +25 -20
- package/src/components/block-toolbar/shuffle.js +20 -14
- package/src/components/block-toolbar/style.scss +1 -1
- package/src/components/block-toolbar/test/index.native.js +1 -7
- package/src/components/block-tools/block-selection-button.js +66 -9
- package/src/components/block-tools/index.js +18 -1
- package/src/components/button-block-appender/content.scss +5 -1
- package/src/components/child-layout-control/index.js +147 -35
- package/src/components/convert-to-group-buttons/toolbar.js +13 -1
- package/src/components/default-block-appender/content.scss +2 -2
- package/src/components/global-styles/advanced-panel.js +8 -2
- package/src/components/global-styles/background-panel.js +591 -0
- package/src/components/global-styles/color-panel.js +2 -1
- package/src/components/global-styles/dimensions-panel.js +9 -34
- package/src/components/global-styles/get-global-styles-changes.js +3 -0
- package/src/components/global-styles/hooks.js +1 -0
- package/src/components/global-styles/index.js +4 -0
- package/src/components/global-styles/style.scss +78 -1
- package/src/{hooks/test/background.js → components/global-styles/test/background-panel.js} +36 -1
- package/src/components/global-styles/test/get-global-styles-changes.js +22 -3
- package/src/components/global-styles/test/use-global-styles-output.js +40 -9
- package/src/components/global-styles/use-global-styles-output.js +30 -17
- package/src/components/global-styles/utils.js +1 -18
- package/src/components/iframe/index.js +79 -53
- package/src/components/inserter/block-patterns-explorer/index.js +2 -9
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +7 -1
- package/src/components/inserter/block-patterns-tab/index.js +1 -0
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
- package/src/components/inserter/library.js +4 -0
- package/src/components/inserter/menu.js +12 -11
- package/src/components/inserter/mobile-tab-navigation.js +1 -1
- package/src/components/inserter/search-items.js +37 -15
- package/src/components/inserter/search-results.js +1 -2
- package/src/components/inserter/style.scss +6 -12
- package/src/components/inserter/tabs.js +1 -2
- package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +31 -0
- package/src/components/keyboard-shortcuts/index.js +11 -0
- package/src/components/link-control/style.scss +0 -5
- package/src/components/list-view/block-select-button.js +15 -19
- package/src/components/list-view/block.js +12 -21
- package/src/components/list-view/index.js +18 -1
- package/src/components/list-view/style.scss +38 -28
- package/src/components/list-view/use-list-view-collapse-items.js +33 -0
- package/src/components/list-view/utils.js +4 -1
- package/src/components/rich-text/README.md +6 -0
- package/src/components/rich-text/index.js +30 -13
- package/src/components/rich-text/index.native.js +14 -11
- package/src/components/rich-text/native/get-format-colors.native.js +1 -1
- package/src/components/rich-text/native/index.native.js +2 -2
- package/src/components/rich-text/with-deprecations.js +0 -3
- package/src/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/src/components/url-popover/image-url-input-ui.js +68 -51
- package/src/components/use-block-display-information/index.js +8 -10
- package/src/components/use-moving-animation/index.js +1 -0
- package/src/components/warning/index.native.js +19 -15
- package/src/hooks/anchor.js +43 -61
- package/src/hooks/background.js +100 -516
- package/src/hooks/index.js +3 -0
- package/src/hooks/layout-child.js +44 -8
- package/src/hooks/layout.js +22 -18
- package/src/hooks/position.js +1 -1
- package/src/hooks/test/__snapshots__/anchor.native.js.snap +7 -0
- package/src/hooks/test/anchor.native.js +32 -0
- package/src/hooks/use-zoom-out.js +36 -0
- package/src/index.js +1 -0
- package/src/private-apis.js +13 -1
- package/src/private-apis.native.js +4 -0
- package/src/store/private-actions.js +12 -0
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +54 -27
- package/src/store/reducer.js +63 -41
- package/src/store/selectors.js +195 -180
- package/src/store/test/private-actions.js +10 -0
- package/src/store/test/private-selectors.js +13 -0
- package/src/store/test/reducer.js +26 -0
- package/src/store/test/selectors.js +90 -199
- package/src/store/utils.js +13 -0
- package/src/style.scss +0 -2
- package/src/utils/transform-styles/index.js +2 -1
- package/tsconfig.json +1 -0
- package/build/utils/calculate-scale.js +0 -17
- package/build/utils/calculate-scale.js.map +0 -1
- package/build-module/utils/calculate-scale.js +0 -11
- package/build-module/utils/calculate-scale.js.map +0 -1
- package/src/hooks/anchor.scss +0 -4
- package/src/hooks/background.scss +0 -75
- package/src/utils/calculate-scale.js +0 -20
|
@@ -30,7 +30,7 @@ import { useBlockSelectionClearer } from '../block-selection-clearer';
|
|
|
30
30
|
import { useWritingFlow } from '../writing-flow';
|
|
31
31
|
import { getCompatibilityStyles } from './get-compatibility-styles';
|
|
32
32
|
import { store as blockEditorStore } from '../../store';
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
function bubbleEvent( event, Constructor, frame ) {
|
|
35
35
|
const init = {};
|
|
36
36
|
|
|
@@ -104,25 +104,21 @@ function Iframe( {
|
|
|
104
104
|
contentRef,
|
|
105
105
|
children,
|
|
106
106
|
tabIndex = 0,
|
|
107
|
-
|
|
107
|
+
scale = 1,
|
|
108
|
+
frameSize = 0,
|
|
108
109
|
readonly,
|
|
109
110
|
forwardedRef: ref,
|
|
110
111
|
title = __( 'Editor canvas' ),
|
|
111
112
|
...props
|
|
112
113
|
} ) {
|
|
113
|
-
const { resolvedAssets, isPreviewMode
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
|
|
122
|
-
};
|
|
123
|
-
},
|
|
124
|
-
[]
|
|
125
|
-
);
|
|
114
|
+
const { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {
|
|
115
|
+
const { getSettings } = select( blockEditorStore );
|
|
116
|
+
const settings = getSettings();
|
|
117
|
+
return {
|
|
118
|
+
resolvedAssets: settings.__unstableResolvedAssets,
|
|
119
|
+
isPreviewMode: settings.__unstableIsPreviewMode,
|
|
120
|
+
};
|
|
121
|
+
}, [] );
|
|
126
122
|
const { styles = '', scripts = '' } = resolvedAssets;
|
|
127
123
|
const [ iframeDocument, setIframeDocument ] = useState();
|
|
128
124
|
const [ bodyClasses, setBodyClasses ] = useState( [] );
|
|
@@ -133,24 +129,6 @@ function Iframe( {
|
|
|
133
129
|
{ height: contentHeight, width: contentWidth },
|
|
134
130
|
] = useResizeObserver();
|
|
135
131
|
|
|
136
|
-
// When zoom-out mode is enabled, the iframe is scaled down to fit the
|
|
137
|
-
// content within the viewport.
|
|
138
|
-
// At 1000px wide, the iframe is scaled to 45%.
|
|
139
|
-
// At 400px wide, the iframe is scaled to 90%.
|
|
140
|
-
const scale =
|
|
141
|
-
isZoomOutMode && shouldZoom
|
|
142
|
-
? calculateScale(
|
|
143
|
-
{
|
|
144
|
-
maxWidth: 1000,
|
|
145
|
-
minWidth: 400,
|
|
146
|
-
maxScale: 0.45,
|
|
147
|
-
minScale: 0.9,
|
|
148
|
-
},
|
|
149
|
-
contentWidth
|
|
150
|
-
)
|
|
151
|
-
: 1;
|
|
152
|
-
const frameSize = isZoomOutMode ? 100 : 0;
|
|
153
|
-
|
|
154
132
|
const setRef = useRefEffect( ( node ) => {
|
|
155
133
|
node._load = () => {
|
|
156
134
|
setIframeDocument( node.contentDocument );
|
|
@@ -163,6 +141,13 @@ function Iframe( {
|
|
|
163
141
|
function onLoad() {
|
|
164
142
|
const { contentDocument, ownerDocument } = node;
|
|
165
143
|
const { documentElement } = contentDocument;
|
|
144
|
+
// Get any CSS classes the iframe document body may initially have
|
|
145
|
+
// to re-apply them later together with the ones of the main document
|
|
146
|
+
// body. This is necessary for some CSS classes for example the
|
|
147
|
+
// `is-dark-theme` class added by useDarkThemeBodyClassName.
|
|
148
|
+
const initialIframeBodyClasses = Array.from(
|
|
149
|
+
contentDocument.body.classList
|
|
150
|
+
);
|
|
166
151
|
iFrameDocument = contentDocument;
|
|
167
152
|
|
|
168
153
|
documentElement.classList.add( 'block-editor-iframe__html' );
|
|
@@ -173,12 +158,15 @@ function Iframe( {
|
|
|
173
158
|
// be added in the editor too, which we'll somehow have to get from
|
|
174
159
|
// the server in the future (which will run the PHP filters).
|
|
175
160
|
setBodyClasses(
|
|
176
|
-
Array.from( ownerDocument.body.classList )
|
|
177
|
-
(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
161
|
+
Array.from( ownerDocument.body.classList )
|
|
162
|
+
.concat( initialIframeBodyClasses )
|
|
163
|
+
.filter(
|
|
164
|
+
( name ) =>
|
|
165
|
+
name.startsWith( 'admin-color-' ) ||
|
|
166
|
+
name.startsWith( 'post-type-' ) ||
|
|
167
|
+
name === 'wp-embed-responsive' ||
|
|
168
|
+
name === 'is-dark-theme'
|
|
169
|
+
)
|
|
182
170
|
);
|
|
183
171
|
|
|
184
172
|
contentDocument.dir = ownerDocument.dir;
|
|
@@ -229,6 +217,20 @@ function Iframe( {
|
|
|
229
217
|
};
|
|
230
218
|
}, [] );
|
|
231
219
|
|
|
220
|
+
const windowResizeRef = useRefEffect( ( node ) => {
|
|
221
|
+
const nodeWindow = node.ownerDocument.defaultView;
|
|
222
|
+
|
|
223
|
+
const onResize = () => {
|
|
224
|
+
setIframeWindowInnerHeight( nodeWindow.innerHeight );
|
|
225
|
+
};
|
|
226
|
+
nodeWindow.addEventListener( 'resize', onResize );
|
|
227
|
+
return () => {
|
|
228
|
+
nodeWindow.removeEventListener( 'resize', onResize );
|
|
229
|
+
};
|
|
230
|
+
}, [] );
|
|
231
|
+
|
|
232
|
+
const [ iframeWindowInnerHeight, setIframeWindowInnerHeight ] = useState();
|
|
233
|
+
|
|
232
234
|
const disabledRef = useDisabled( { isDisabled: ! readonly } );
|
|
233
235
|
const bodyRef = useMergeRefs( [
|
|
234
236
|
useBubbleEvents( iframeDocument ),
|
|
@@ -236,6 +238,7 @@ function Iframe( {
|
|
|
236
238
|
clearerRef,
|
|
237
239
|
writingFlowRef,
|
|
238
240
|
disabledRef,
|
|
241
|
+
windowResizeRef,
|
|
239
242
|
] );
|
|
240
243
|
|
|
241
244
|
// Correct doctype is required to enable rendering in standards
|
|
@@ -251,12 +254,12 @@ function Iframe( {
|
|
|
251
254
|
height: auto !important;
|
|
252
255
|
min-height: 100%;
|
|
253
256
|
}
|
|
254
|
-
|
|
255
|
-
body {
|
|
257
|
+
/* Lowest specificity to not override global styles */
|
|
258
|
+
:where(body) {
|
|
256
259
|
margin: 0;
|
|
257
260
|
/* Default background color in case zoom out mode background
|
|
258
261
|
colors the html element */
|
|
259
|
-
background: white;
|
|
262
|
+
background-color: white;
|
|
260
263
|
}
|
|
261
264
|
</style>
|
|
262
265
|
${ styles }
|
|
@@ -276,25 +279,48 @@ function Iframe( {
|
|
|
276
279
|
|
|
277
280
|
useEffect( () => cleanup, [ cleanup ] );
|
|
278
281
|
|
|
279
|
-
// We need to counter the margin created by scaling the iframe. If the scale
|
|
280
|
-
// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the
|
|
281
|
-
// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).
|
|
282
|
-
const marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;
|
|
283
|
-
|
|
284
282
|
useEffect( () => {
|
|
285
|
-
if ( iframeDocument
|
|
286
|
-
|
|
283
|
+
if ( ! iframeDocument ) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const _scale =
|
|
288
|
+
typeof scale === 'function'
|
|
289
|
+
? scale( contentWidth, contentHeight )
|
|
290
|
+
: scale;
|
|
291
|
+
|
|
292
|
+
if ( _scale !== 1 ) {
|
|
293
|
+
// Hack to get proper margins when scaling the iframe document.
|
|
294
|
+
const bottomFrameSize = frameSize - contentHeight * ( 1 - _scale );
|
|
295
|
+
|
|
296
|
+
iframeDocument.body.classList.add( 'is-zoomed-out' );
|
|
297
|
+
|
|
298
|
+
iframeDocument.documentElement.style.transform = `scale( ${ _scale } )`;
|
|
287
299
|
iframeDocument.documentElement.style.marginTop = `${ frameSize }px`;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
300
|
+
// TODO: `marginBottom` doesn't work in Firefox. We need another way to do this.
|
|
301
|
+
iframeDocument.documentElement.style.marginBottom = `${ bottomFrameSize }px`;
|
|
302
|
+
if ( iframeWindowInnerHeight > contentHeight * _scale ) {
|
|
303
|
+
iframeDocument.body.style.minHeight = `${ Math.floor(
|
|
304
|
+
( iframeWindowInnerHeight - 2 * frameSize ) / _scale
|
|
305
|
+
) }px`;
|
|
306
|
+
}
|
|
307
|
+
|
|
291
308
|
return () => {
|
|
309
|
+
iframeDocument.body.classList.remove( 'is-zoomed-out' );
|
|
292
310
|
iframeDocument.documentElement.style.transform = '';
|
|
293
311
|
iframeDocument.documentElement.style.marginTop = '';
|
|
294
312
|
iframeDocument.documentElement.style.marginBottom = '';
|
|
313
|
+
iframeDocument.body.style.minHeight = '';
|
|
295
314
|
};
|
|
296
315
|
}
|
|
297
|
-
}, [
|
|
316
|
+
}, [
|
|
317
|
+
scale,
|
|
318
|
+
frameSize,
|
|
319
|
+
iframeDocument,
|
|
320
|
+
contentHeight,
|
|
321
|
+
iframeWindowInnerHeight,
|
|
322
|
+
contentWidth,
|
|
323
|
+
] );
|
|
298
324
|
|
|
299
325
|
// Make sure to not render the before and after focusable div elements in view
|
|
300
326
|
// mode. They're only needed to capture focus in edit mode.
|
|
@@ -14,16 +14,11 @@ import { usePatternCategories } from '../block-patterns-tab/use-pattern-categori
|
|
|
14
14
|
|
|
15
15
|
function PatternsExplorer( { initialCategory, rootClientId } ) {
|
|
16
16
|
const [ searchValue, setSearchValue ] = useState( '' );
|
|
17
|
-
const [ patternSourceFilter, setPatternSourceFilter ] = useState( 'all' );
|
|
18
|
-
|
|
19
17
|
const [ selectedCategory, setSelectedCategory ] = useState(
|
|
20
18
|
initialCategory?.name
|
|
21
19
|
);
|
|
22
20
|
|
|
23
|
-
const patternCategories = usePatternCategories(
|
|
24
|
-
rootClientId,
|
|
25
|
-
patternSourceFilter
|
|
26
|
-
);
|
|
21
|
+
const patternCategories = usePatternCategories( rootClientId );
|
|
27
22
|
|
|
28
23
|
return (
|
|
29
24
|
<div className="block-editor-block-patterns-explorer">
|
|
@@ -33,14 +28,12 @@ function PatternsExplorer( { initialCategory, rootClientId } ) {
|
|
|
33
28
|
onClickCategory={ setSelectedCategory }
|
|
34
29
|
searchValue={ searchValue }
|
|
35
30
|
setSearchValue={ setSearchValue }
|
|
36
|
-
patternSourceFilter={ patternSourceFilter }
|
|
37
|
-
setPatternSourceFilter={ setPatternSourceFilter }
|
|
38
31
|
/>
|
|
39
32
|
<PatternList
|
|
40
33
|
searchValue={ searchValue }
|
|
41
34
|
selectedCategory={ selectedCategory }
|
|
42
35
|
patternCategories={ patternCategories }
|
|
43
|
-
|
|
36
|
+
rootClientId={ rootClientId }
|
|
44
37
|
/>
|
|
45
38
|
</div>
|
|
46
39
|
);
|
|
@@ -47,10 +47,16 @@ function PatternsListHeader( { filterValue, filteredBlockPatternsLength } ) {
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
function PatternList( {
|
|
50
|
+
function PatternList( {
|
|
51
|
+
searchValue,
|
|
52
|
+
selectedCategory,
|
|
53
|
+
patternCategories,
|
|
54
|
+
rootClientId,
|
|
55
|
+
} ) {
|
|
51
56
|
const container = useRef();
|
|
52
57
|
const debouncedSpeak = useDebounce( speak, 500 );
|
|
53
58
|
const [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {
|
|
59
|
+
rootClientId,
|
|
54
60
|
shouldFocusBlock: true,
|
|
55
61
|
} );
|
|
56
62
|
const [ patterns, , onClickPattern ] = usePatternsState(
|
|
@@ -10,6 +10,7 @@ import { focus } from '@wordpress/dom';
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { PatternCategoryPreviews } from './pattern-category-previews';
|
|
13
|
+
import { useZoomOut } from '../../../hooks/use-zoom-out';
|
|
13
14
|
|
|
14
15
|
export function PatternCategoryPreviewPanel( {
|
|
15
16
|
rootClientId,
|
|
@@ -29,6 +30,10 @@ export function PatternCategoryPreviewPanel( {
|
|
|
29
30
|
return () => clearTimeout( timeout );
|
|
30
31
|
}, [ category ] );
|
|
31
32
|
|
|
33
|
+
// Move to zoom out mode when this component is mounted
|
|
34
|
+
// and back to the previous mode when unmounted.
|
|
35
|
+
useZoomOut();
|
|
36
|
+
|
|
32
37
|
return (
|
|
33
38
|
<div
|
|
34
39
|
ref={ container }
|
|
@@ -21,6 +21,7 @@ function InserterLibrary(
|
|
|
21
21
|
showMostUsedBlocks = false,
|
|
22
22
|
__experimentalInsertionIndex,
|
|
23
23
|
__experimentalFilterValue,
|
|
24
|
+
__experimentalOnPatternCategorySelection,
|
|
24
25
|
onSelect = noop,
|
|
25
26
|
shouldFocusBlock = false,
|
|
26
27
|
},
|
|
@@ -48,6 +49,9 @@ function InserterLibrary(
|
|
|
48
49
|
showMostUsedBlocks={ showMostUsedBlocks }
|
|
49
50
|
__experimentalInsertionIndex={ __experimentalInsertionIndex }
|
|
50
51
|
__experimentalFilterValue={ __experimentalFilterValue }
|
|
52
|
+
__experimentalOnPatternCategorySelection={
|
|
53
|
+
__experimentalOnPatternCategorySelection
|
|
54
|
+
}
|
|
51
55
|
shouldFocusBlock={ shouldFocusBlock }
|
|
52
56
|
ref={ ref }
|
|
53
57
|
/>
|
|
@@ -34,6 +34,7 @@ import useInsertionPoint from './hooks/use-insertion-point';
|
|
|
34
34
|
import InserterTabs from './tabs';
|
|
35
35
|
import { store as blockEditorStore } from '../../store';
|
|
36
36
|
|
|
37
|
+
const NOOP = () => {};
|
|
37
38
|
function InserterMenu(
|
|
38
39
|
{
|
|
39
40
|
rootClientId,
|
|
@@ -45,6 +46,7 @@ function InserterMenu(
|
|
|
45
46
|
showMostUsedBlocks,
|
|
46
47
|
__experimentalFilterValue = '',
|
|
47
48
|
shouldFocusBlock = true,
|
|
49
|
+
__experimentalOnPatternCategorySelection = NOOP,
|
|
48
50
|
},
|
|
49
51
|
ref
|
|
50
52
|
) {
|
|
@@ -66,13 +68,10 @@ function InserterMenu(
|
|
|
66
68
|
insertionIndex: __experimentalInsertionIndex,
|
|
67
69
|
shouldFocusBlock,
|
|
68
70
|
} );
|
|
69
|
-
const {
|
|
71
|
+
const { showPatterns } = useSelect(
|
|
70
72
|
( select ) => {
|
|
71
|
-
const { hasAllowedPatterns
|
|
72
|
-
select( blockEditorStore )
|
|
73
|
-
);
|
|
73
|
+
const { hasAllowedPatterns } = unlock( select( blockEditorStore ) );
|
|
74
74
|
return {
|
|
75
|
-
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
|
|
76
75
|
showPatterns: hasAllowedPatterns( destinationRootClientId ),
|
|
77
76
|
};
|
|
78
77
|
},
|
|
@@ -80,8 +79,7 @@ function InserterMenu(
|
|
|
80
79
|
);
|
|
81
80
|
|
|
82
81
|
const mediaCategories = useMediaCategories( destinationRootClientId );
|
|
83
|
-
const showMedia = mediaCategories.length > 0
|
|
84
|
-
const showBlocks = ! isZoomOutMode;
|
|
82
|
+
const showMedia = mediaCategories.length > 0;
|
|
85
83
|
|
|
86
84
|
const onInsert = useCallback(
|
|
87
85
|
( blocks, meta, shouldForceFocusBlock ) => {
|
|
@@ -114,12 +112,17 @@ function InserterMenu(
|
|
|
114
112
|
[ onToggleInsertionPoint ]
|
|
115
113
|
);
|
|
116
114
|
|
|
115
|
+
const isZoomedOutViewExperimentEnabled =
|
|
116
|
+
window?.__experimentalEnableZoomedOutView;
|
|
117
117
|
const onClickPatternCategory = useCallback(
|
|
118
118
|
( patternCategory, filter ) => {
|
|
119
119
|
setSelectedPatternCategory( patternCategory );
|
|
120
120
|
setPatternFilter( filter );
|
|
121
|
+
if ( isZoomedOutViewExperimentEnabled ) {
|
|
122
|
+
__experimentalOnPatternCategorySelection();
|
|
123
|
+
}
|
|
121
124
|
},
|
|
122
|
-
[ setSelectedPatternCategory ]
|
|
125
|
+
[ setSelectedPatternCategory, __experimentalOnPatternCategorySelection ]
|
|
123
126
|
);
|
|
124
127
|
|
|
125
128
|
const blocksTab = useMemo(
|
|
@@ -253,21 +256,19 @@ function InserterMenu(
|
|
|
253
256
|
__experimentalInsertionIndex
|
|
254
257
|
}
|
|
255
258
|
showBlockDirectory
|
|
256
|
-
showBlocks={ showBlocks }
|
|
257
259
|
shouldFocusBlock={ shouldFocusBlock }
|
|
258
260
|
/>
|
|
259
261
|
</div>
|
|
260
262
|
) }
|
|
261
263
|
{ showAsTabs && (
|
|
262
264
|
<InserterTabs
|
|
263
|
-
showBlocks={ showBlocks }
|
|
264
265
|
showPatterns={ showPatterns }
|
|
265
266
|
showMedia={ showMedia }
|
|
266
267
|
onSelect={ handleSetSelectedTab }
|
|
267
268
|
tabsContents={ inserterTabsContents }
|
|
268
269
|
/>
|
|
269
270
|
) }
|
|
270
|
-
{ ! delayedFilterValue && ! showAsTabs &&
|
|
271
|
+
{ ! delayedFilterValue && ! showAsTabs && (
|
|
271
272
|
<div className="block-editor-inserter__no-tab-container">
|
|
272
273
|
{ blocksTab }
|
|
273
274
|
</div>
|
|
@@ -12,6 +12,17 @@ const defaultGetKeywords = ( item ) => item.keywords || [];
|
|
|
12
12
|
const defaultGetCategory = ( item ) => item.category;
|
|
13
13
|
const defaultGetCollection = () => null;
|
|
14
14
|
|
|
15
|
+
// Normalization regexes
|
|
16
|
+
const splitRegexp = [
|
|
17
|
+
/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu, // One lowercase or digit, followed by one uppercase.
|
|
18
|
+
/([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu, // One uppercase followed by one uppercase and one lowercase.
|
|
19
|
+
];
|
|
20
|
+
const stripRegexp = /(\p{C}|\p{P}|\p{S})+/giu; // Anything that's not a punctuation, symbol or control/format character.
|
|
21
|
+
|
|
22
|
+
// Normalization cache
|
|
23
|
+
const extractedWords = new Map();
|
|
24
|
+
const normalizedStrings = new Map();
|
|
25
|
+
|
|
15
26
|
/**
|
|
16
27
|
* Extracts words from an input string.
|
|
17
28
|
*
|
|
@@ -19,16 +30,21 @@ const defaultGetCollection = () => null;
|
|
|
19
30
|
*
|
|
20
31
|
* @return {Array} Words, extracted from the input string.
|
|
21
32
|
*/
|
|
22
|
-
function extractWords( input = '' ) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
export function extractWords( input = '' ) {
|
|
34
|
+
if ( extractedWords.has( input ) ) {
|
|
35
|
+
return extractedWords.get( input );
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const result = noCase( input, {
|
|
39
|
+
splitRegexp,
|
|
40
|
+
stripRegexp,
|
|
29
41
|
} )
|
|
30
42
|
.split( ' ' )
|
|
31
43
|
.filter( Boolean );
|
|
44
|
+
|
|
45
|
+
extractedWords.set( input, result );
|
|
46
|
+
|
|
47
|
+
return result;
|
|
32
48
|
}
|
|
33
49
|
|
|
34
50
|
/**
|
|
@@ -38,20 +54,26 @@ function extractWords( input = '' ) {
|
|
|
38
54
|
*
|
|
39
55
|
* @return {string} The normalized search input.
|
|
40
56
|
*/
|
|
41
|
-
function
|
|
57
|
+
export function normalizeString( input = '' ) {
|
|
58
|
+
if ( normalizedStrings.has( input ) ) {
|
|
59
|
+
return normalizedStrings.get( input );
|
|
60
|
+
}
|
|
61
|
+
|
|
42
62
|
// Disregard diacritics.
|
|
43
63
|
// Input: "média"
|
|
44
|
-
|
|
64
|
+
let result = removeAccents( input );
|
|
45
65
|
|
|
46
66
|
// Accommodate leading slash, matching autocomplete expectations.
|
|
47
67
|
// Input: "/media"
|
|
48
|
-
|
|
68
|
+
result = result.replace( /^\//, '' );
|
|
49
69
|
|
|
50
70
|
// Lowercase.
|
|
51
71
|
// Input: "MEDIA"
|
|
52
|
-
|
|
72
|
+
result = result.toLowerCase();
|
|
73
|
+
|
|
74
|
+
normalizedStrings.set( input, result );
|
|
53
75
|
|
|
54
|
-
return
|
|
76
|
+
return result;
|
|
55
77
|
}
|
|
56
78
|
|
|
57
79
|
/**
|
|
@@ -62,7 +84,7 @@ function normalizeSearchInput( input = '' ) {
|
|
|
62
84
|
* @return {string[]} The normalized list of search terms.
|
|
63
85
|
*/
|
|
64
86
|
export const getNormalizedSearchTerms = ( input = '' ) => {
|
|
65
|
-
return extractWords(
|
|
87
|
+
return extractWords( normalizeString( input ) );
|
|
66
88
|
};
|
|
67
89
|
|
|
68
90
|
const removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => {
|
|
@@ -148,8 +170,8 @@ export function getItemSearchRank( item, searchTerm, config = {} ) {
|
|
|
148
170
|
const category = getCategory( item );
|
|
149
171
|
const collection = getCollection( item );
|
|
150
172
|
|
|
151
|
-
const normalizedSearchInput =
|
|
152
|
-
const normalizedTitle =
|
|
173
|
+
const normalizedSearchInput = normalizeString( searchTerm );
|
|
174
|
+
const normalizedTitle = normalizeString( title );
|
|
153
175
|
|
|
154
176
|
let rank = 0;
|
|
155
177
|
|
|
@@ -50,7 +50,6 @@ function InserterSearchResults( {
|
|
|
50
50
|
shouldFocusBlock = true,
|
|
51
51
|
prioritizePatterns,
|
|
52
52
|
selectBlockOnInsert,
|
|
53
|
-
showBlocks = true,
|
|
54
53
|
} ) {
|
|
55
54
|
const debouncedSpeak = useDebounce( speak, 500 );
|
|
56
55
|
|
|
@@ -168,7 +167,7 @@ function InserterSearchResults( {
|
|
|
168
167
|
const hasItems =
|
|
169
168
|
filteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0;
|
|
170
169
|
|
|
171
|
-
const blocksUI =
|
|
170
|
+
const blocksUI = !! filteredBlockTypes.length && (
|
|
172
171
|
<InserterPanel
|
|
173
172
|
title={ <VisuallyHidden>{ __( 'Blocks' ) }</VisuallyHidden> }
|
|
174
173
|
>
|
|
@@ -22,7 +22,6 @@ $block-inserter-tabs-height: 44px;
|
|
|
22
22
|
flex-direction: column;
|
|
23
23
|
height: 100%;
|
|
24
24
|
gap: $grid-unit-20;
|
|
25
|
-
overflow-y: hidden;
|
|
26
25
|
|
|
27
26
|
&.show-as-tabs {
|
|
28
27
|
gap: 0;
|
|
@@ -142,6 +141,8 @@ $block-inserter-tabs-height: 44px;
|
|
|
142
141
|
.block-editor-inserter__no-tab-container {
|
|
143
142
|
overflow-y: auto;
|
|
144
143
|
flex-grow: 1;
|
|
144
|
+
// Fixes the editor canvas scrolling on search results https://github.com/WordPress/gutenberg/issues/56811
|
|
145
|
+
position: relative;
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
.block-editor-inserter__panel-header {
|
|
@@ -318,17 +319,6 @@ $block-inserter-tabs-height: 44px;
|
|
|
318
319
|
}
|
|
319
320
|
}
|
|
320
321
|
|
|
321
|
-
.block-editor-block-patterns-list__list-item {
|
|
322
|
-
.block-editor-block-preview__container {
|
|
323
|
-
box-shadow: 0 15px 25px rgb(0 0 0 / 7%);
|
|
324
|
-
}
|
|
325
|
-
&:hover {
|
|
326
|
-
.block-editor-block-preview__container {
|
|
327
|
-
box-shadow: 0 0 0 2px $gray-900, 0 15px 25px rgb(0 0 0 / 7%);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
322
|
.block-editor-inserter__patterns-category-panel {
|
|
333
323
|
padding: 0 $grid-unit-20;
|
|
334
324
|
display: flex;
|
|
@@ -776,4 +766,8 @@ $block-inserter-tabs-height: 44px;
|
|
|
776
766
|
.block-editor-inserter__patterns-category-dialog {
|
|
777
767
|
position: static;
|
|
778
768
|
}
|
|
769
|
+
|
|
770
|
+
.block-editor-inserter__media-dialog {
|
|
771
|
+
position: static;
|
|
772
|
+
}
|
|
779
773
|
}
|
|
@@ -29,14 +29,13 @@ const mediaTab = {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
function InserterTabs( {
|
|
32
|
-
showBlocks = true,
|
|
33
32
|
showPatterns = false,
|
|
34
33
|
showMedia = false,
|
|
35
34
|
onSelect,
|
|
36
35
|
tabsContents,
|
|
37
36
|
} ) {
|
|
38
37
|
const tabs = [
|
|
39
|
-
|
|
38
|
+
blocksTab,
|
|
40
39
|
showPatterns && patternsTab,
|
|
41
40
|
showMedia && mediaTab,
|
|
42
41
|
].filter( Boolean );
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { PanelBody } from '@wordpress/components';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import groups from '../inspector-controls/groups';
|
|
11
|
+
|
|
12
|
+
export default function AdvancedControls( props ) {
|
|
13
|
+
const Slot = groups.advanced?.Slot;
|
|
14
|
+
if ( ! Slot ) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Slot { ...props }>
|
|
20
|
+
{ ( fills ) => {
|
|
21
|
+
if ( ! fills.length ) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<PanelBody title={ __( 'Advanced' ) }>{ fills }</PanelBody>
|
|
27
|
+
);
|
|
28
|
+
} }
|
|
29
|
+
</Slot>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -132,6 +132,17 @@ function KeyboardShortcutsRegister() {
|
|
|
132
132
|
character: 'y',
|
|
133
133
|
},
|
|
134
134
|
} );
|
|
135
|
+
|
|
136
|
+
// List view shortcuts.
|
|
137
|
+
registerShortcut( {
|
|
138
|
+
name: 'core/block-editor/collapse-list-view',
|
|
139
|
+
category: 'list-view',
|
|
140
|
+
description: __( 'Collapse all other items.' ),
|
|
141
|
+
keyCombination: {
|
|
142
|
+
modifier: 'alt',
|
|
143
|
+
character: 'l',
|
|
144
|
+
},
|
|
145
|
+
} );
|
|
135
146
|
}, [ registerShortcut ] );
|
|
136
147
|
|
|
137
148
|
return null;
|
|
@@ -93,11 +93,6 @@ $block-editor-link-control-number-of-actions: 1;
|
|
|
93
93
|
position: absolute;
|
|
94
94
|
right: 19px; // specific to place the button properly.
|
|
95
95
|
top: 3px;
|
|
96
|
-
|
|
97
|
-
svg {
|
|
98
|
-
position: relative;
|
|
99
|
-
top: -2px; // the icon itself is not centered within the bounds; this centers it.
|
|
100
|
-
}
|
|
101
96
|
}
|
|
102
97
|
|
|
103
98
|
.block-editor-link-control__search-actions {
|