@wordpress/block-editor 13.2.0 → 13.3.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 +2 -0
- package/README.md +0 -1
- package/build/components/block-breadcrumb/index.js +12 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-lock/toolbar.js +0 -1
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/button.js +1 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +1 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +5 -7
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +20 -17
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-rename/modal.js +4 -12
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +1 -0
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +7 -58
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +9 -2
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build/components/block-tools/index.js +14 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +4 -2
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +57 -0
- package/build/components/block-tools/zoom-out-popover.js.map +1 -0
- package/build/components/block-tools/zoom-out-toolbar.js +138 -0
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -0
- package/build/components/button-block-appender/index.js +3 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +26 -18
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +10 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/dimensions-tool/index.js +6 -4
- package/build/components/dimensions-tool/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +26 -61
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +178 -116
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- 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 +2 -1
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +2 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +8 -0
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +2 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +50 -12
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +50 -0
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +23 -8
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +17 -7
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +11 -14
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-item-resizer.js +2 -2
- package/build/components/grid/grid-item-resizer.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +116 -36
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/use-grid-layout-sync.js +29 -22
- package/build/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build/components/inner-blocks/index.js +1 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build/components/inserter/menu.js +26 -4
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +2 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/link-control/link-preview.js +1 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/media-placeholder/index.js +19 -23
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +3 -1
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/tabbed-sidebar/index.js +66 -0
- package/build/components/tabbed-sidebar/index.js.map +1 -0
- package/build/components/url-popover/index.js +3 -0
- package/build/components/url-popover/index.js.map +1 -1
- package/build/hooks/background.js +26 -4
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +11 -17
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js +169 -4
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/duotone.js +16 -11
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/grid-visualizer.js +65 -0
- package/build/hooks/grid-visualizer.js.map +1 -0
- package/build/hooks/index.js +15 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +39 -22
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +2 -9
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +16 -6
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/utils.js +2 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +44 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +90 -51
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +6 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/defaults.js +0 -2
- package/build/store/defaults.js.map +1 -1
- package/build/store/defaults.native.js +0 -3
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/utils/format-font-style.js +45 -0
- package/build/utils/format-font-style.js.map +1 -0
- package/build/utils/format-font-weight.js +68 -0
- package/build/utils/format-font-weight.js.map +1 -0
- package/build/utils/get-editor-region.js +34 -0
- package/build/utils/get-editor-region.js.map +1 -0
- package/build/utils/get-font-styles-and-weights.js +167 -0
- package/build/utils/get-font-styles-and-weights.js.map +1 -0
- package/build/utils/pasting.js +5 -13
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +12 -1
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +0 -1
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/button.js +1 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +5 -7
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +20 -17
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +5 -13
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +1 -0
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +10 -61
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +9 -2
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build-module/components/block-tools/index.js +14 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +4 -2
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +48 -0
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -0
- package/build-module/components/block-tools/zoom-out-toolbar.js +131 -0
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -0
- package/build-module/components/button-block-appender/index.js +3 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +27 -19
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +11 -3
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/dimensions-tool/index.js +6 -4
- package/build-module/components/dimensions-tool/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +28 -63
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +181 -119
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +3 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +3 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +8 -0
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +3 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +52 -14
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +48 -0
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +23 -8
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +15 -6
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +11 -14
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-item-resizer.js +2 -2
- package/build-module/components/grid/grid-item-resizer.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +117 -37
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/use-grid-layout-sync.js +29 -22
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +1 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +26 -4
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -2
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +1 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +19 -23
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +3 -1
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +60 -0
- package/build-module/components/tabbed-sidebar/index.js.map +1 -0
- package/build-module/components/url-popover/index.js +3 -0
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/hooks/background.js +26 -4
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +11 -17
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +168 -4
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/duotone.js +16 -11
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +64 -0
- package/build-module/hooks/grid-visualizer.js.map +1 -0
- package/build-module/hooks/index.js +3 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +39 -22
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +2 -9
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +16 -6
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/utils.js +2 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +44 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +90 -51
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +8 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/defaults.js +0 -2
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/defaults.native.js +0 -3
- package/build-module/store/defaults.native.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/utils/format-font-style.js +39 -0
- package/build-module/utils/format-font-style.js.map +1 -0
- package/build-module/utils/format-font-weight.js +62 -0
- package/build-module/utils/format-font-weight.js.map +1 -0
- package/build-module/utils/get-editor-region.js +28 -0
- package/build-module/utils/get-editor-region.js.map +1 -0
- package/build-module/utils/get-font-styles-and-weights.js +160 -0
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -0
- package/build-module/utils/pasting.js +5 -13
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +1 -0
- package/build-style/content.css +1 -0
- package/build-style/style-rtl.css +207 -96
- package/build-style/style.css +207 -96
- package/package.json +32 -32
- package/src/components/block-breadcrumb/index.js +16 -1
- package/src/components/block-lock/toolbar.js +0 -1
- package/src/components/block-mover/button.js +1 -1
- package/src/components/block-mover/index.js +1 -1
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/src/components/block-patterns-paging/index.js +8 -11
- package/src/components/block-patterns-paging/style.scss +18 -0
- package/src/components/block-quick-navigation/index.js +21 -28
- package/src/components/block-rename/modal.js +2 -8
- package/src/components/block-switcher/test/index.js +6 -6
- package/src/components/block-toolbar/shuffle.js +1 -0
- package/src/components/block-toolbar/style.scss +1 -11
- package/src/components/block-tools/block-selection-button.js +11 -83
- package/src/components/block-tools/block-toolbar-breadcrumb.js +9 -4
- package/src/components/block-tools/index.js +21 -1
- package/src/components/block-tools/style.scss +15 -0
- package/src/components/block-tools/use-show-block-tools.js +14 -6
- package/src/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/src/components/block-tools/zoom-out-popover.js +49 -0
- package/src/components/block-tools/zoom-out-toolbar.js +140 -0
- package/src/components/button-block-appender/index.js +2 -1
- package/src/components/child-layout-control/index.js +41 -23
- package/src/components/date-format-picker/index.js +10 -1
- package/src/components/date-format-picker/style.scss +0 -9
- package/src/components/dimensions-tool/index.js +97 -89
- package/src/components/font-appearance-control/index.js +29 -83
- package/src/components/font-appearance-control/style.scss +3 -5
- package/src/components/global-styles/background-panel.js +249 -170
- package/src/components/global-styles/border-panel.js +3 -2
- package/src/components/global-styles/color-panel.js +3 -2
- package/src/components/global-styles/dimensions-panel.js +3 -2
- package/src/components/global-styles/filters-panel.js +3 -2
- package/src/components/global-styles/hooks.js +9 -0
- package/src/components/global-styles/image-settings-panel.js +3 -2
- package/src/components/global-styles/style.scss +105 -20
- package/src/components/global-styles/test/typography-utils.js +269 -0
- package/src/components/global-styles/typography-panel.js +49 -12
- package/src/components/global-styles/typography-utils.js +63 -0
- package/src/components/global-styles/use-global-styles-output.js +23 -8
- package/src/components/global-styles/utils.js +17 -6
- package/src/components/grid/grid-item-movers.js +11 -27
- package/src/components/grid/grid-item-resizer.js +3 -2
- package/src/components/grid/grid-visualizer.js +171 -54
- package/src/components/grid/style.scss +43 -8
- package/src/components/grid/use-grid-layout-sync.js +31 -28
- package/src/components/iframe/content.scss +1 -0
- package/src/components/inner-blocks/index.js +2 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -16
- package/src/components/inserter/menu.js +47 -13
- package/src/components/inserter/quick-inserter.js +6 -1
- package/src/components/inserter/style.scss +1 -49
- package/src/components/inspector-controls/block-support-tools-panel.js +3 -3
- package/src/components/link-control/link-preview.js +1 -1
- package/src/components/media-placeholder/index.js +22 -32
- package/src/components/navigable-toolbar/index.js +3 -1
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +6 -1
- package/src/components/tabbed-sidebar/README.md +76 -0
- package/src/components/tabbed-sidebar/index.js +70 -0
- package/src/components/tabbed-sidebar/style.scss +53 -0
- package/src/components/url-popover/index.js +3 -0
- package/src/hooks/background.js +25 -10
- package/src/hooks/block-hooks.js +9 -16
- package/src/hooks/block-style-variation.js +202 -3
- package/src/hooks/duotone.js +16 -12
- package/src/hooks/grid-visualizer.js +64 -0
- package/src/hooks/index.js +3 -0
- package/src/hooks/layout-child.js +53 -37
- package/src/hooks/position.js +3 -10
- package/src/hooks/test/get-variation-styles-with-ref-values.js +91 -0
- package/src/hooks/use-bindings-attributes.js +18 -4
- package/src/hooks/utils.js +2 -0
- package/src/layouts/constrained.js +43 -2
- package/src/layouts/grid.js +146 -51
- package/src/private-apis.js +12 -1
- package/src/store/defaults.js +0 -2
- package/src/store/defaults.native.js +0 -3
- package/src/store/private-keys.js +1 -0
- package/src/style.scss +1 -1
- package/src/utils/format-font-style.js +40 -0
- package/src/utils/format-font-weight.js +63 -0
- package/src/utils/get-editor-region.js +31 -0
- package/src/utils/get-font-styles-and-weights.js +191 -0
- package/src/utils/pasting.js +5 -12
- package/src/utils/test/format-font-style.js +34 -0
- package/src/utils/test/format-font-weight.js +66 -0
- package/src/utils/test/get-font-styles-and-weights.js +513 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/hooks/position.scss +0 -18
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getFontStylesAndWeights = getFontStylesAndWeights;
|
|
7
|
+
var _i18n = require("@wordpress/i18n");
|
|
8
|
+
var _formatFontStyle = require("./format-font-style");
|
|
9
|
+
var _formatFontWeight = require("./format-font-weight");
|
|
10
|
+
/**
|
|
11
|
+
* WordPress dependencies
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const FONT_STYLES = [{
|
|
19
|
+
name: (0, _i18n._x)('Regular', 'font style'),
|
|
20
|
+
value: 'normal'
|
|
21
|
+
}, {
|
|
22
|
+
name: (0, _i18n._x)('Italic', 'font style'),
|
|
23
|
+
value: 'italic'
|
|
24
|
+
}];
|
|
25
|
+
const FONT_WEIGHTS = [{
|
|
26
|
+
name: (0, _i18n._x)('Thin', 'font weight'),
|
|
27
|
+
value: '100'
|
|
28
|
+
}, {
|
|
29
|
+
name: (0, _i18n._x)('Extra Light', 'font weight'),
|
|
30
|
+
value: '200'
|
|
31
|
+
}, {
|
|
32
|
+
name: (0, _i18n._x)('Light', 'font weight'),
|
|
33
|
+
value: '300'
|
|
34
|
+
}, {
|
|
35
|
+
name: (0, _i18n._x)('Regular', 'font weight'),
|
|
36
|
+
value: '400'
|
|
37
|
+
}, {
|
|
38
|
+
name: (0, _i18n._x)('Medium', 'font weight'),
|
|
39
|
+
value: '500'
|
|
40
|
+
}, {
|
|
41
|
+
name: (0, _i18n._x)('Semi Bold', 'font weight'),
|
|
42
|
+
value: '600'
|
|
43
|
+
}, {
|
|
44
|
+
name: (0, _i18n._x)('Bold', 'font weight'),
|
|
45
|
+
value: '700'
|
|
46
|
+
}, {
|
|
47
|
+
name: (0, _i18n._x)('Extra Bold', 'font weight'),
|
|
48
|
+
value: '800'
|
|
49
|
+
}, {
|
|
50
|
+
name: (0, _i18n._x)('Black', 'font weight'),
|
|
51
|
+
value: '900'
|
|
52
|
+
}, {
|
|
53
|
+
name: (0, _i18n._x)('Extra Black', 'font weight'),
|
|
54
|
+
value: '1000'
|
|
55
|
+
}];
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Builds a list of font style and weight options based on font family faces.
|
|
59
|
+
* Defaults to the standard font styles and weights if no font family faces are provided.
|
|
60
|
+
*
|
|
61
|
+
* @param {Array} fontFamilyFaces font family faces array
|
|
62
|
+
* @return {Object} new object with combined and separated font style and weight properties
|
|
63
|
+
*/
|
|
64
|
+
function getFontStylesAndWeights(fontFamilyFaces) {
|
|
65
|
+
let fontStyles = [];
|
|
66
|
+
let fontWeights = [];
|
|
67
|
+
const combinedStyleAndWeightOptions = [];
|
|
68
|
+
const isSystemFont = !fontFamilyFaces || fontFamilyFaces?.length === 0;
|
|
69
|
+
let isVariableFont = false;
|
|
70
|
+
fontFamilyFaces?.forEach(face => {
|
|
71
|
+
// Check for variable font by looking for a space in the font weight value. e.g. "100 900"
|
|
72
|
+
if (/\s/.test(face.fontWeight.trim())) {
|
|
73
|
+
isVariableFont = true;
|
|
74
|
+
|
|
75
|
+
// Find font weight start and end values.
|
|
76
|
+
let [startValue, endValue] = face.fontWeight.split(' ');
|
|
77
|
+
startValue = parseInt(startValue.slice(0, 1));
|
|
78
|
+
if (endValue === '1000') {
|
|
79
|
+
endValue = 10;
|
|
80
|
+
} else {
|
|
81
|
+
endValue = parseInt(endValue.slice(0, 1));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Create font weight options for available variable weights.
|
|
85
|
+
for (let i = startValue; i <= endValue; i++) {
|
|
86
|
+
const fontWeightValue = `${i.toString()}00`;
|
|
87
|
+
if (!fontWeights.some(weight => weight.value === fontWeightValue)) {
|
|
88
|
+
fontWeights.push((0, _formatFontWeight.formatFontWeight)(fontWeightValue));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Format font style and weight values.
|
|
94
|
+
const fontWeight = (0, _formatFontWeight.formatFontWeight)(face.fontWeight);
|
|
95
|
+
const fontStyle = (0, _formatFontStyle.formatFontStyle)(face.fontStyle);
|
|
96
|
+
|
|
97
|
+
// Create font style and font weight lists without duplicates.
|
|
98
|
+
if (fontStyle) {
|
|
99
|
+
if (!fontStyles.some(style => style.value === fontStyle.value)) {
|
|
100
|
+
fontStyles.push(fontStyle);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (fontWeight) {
|
|
104
|
+
if (!fontWeights.some(weight => weight.value === fontWeight.value)) {
|
|
105
|
+
if (!isVariableFont) {
|
|
106
|
+
fontWeights.push(fontWeight);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// If there is no font weight of 600 or above, then include faux bold as an option.
|
|
113
|
+
if (!fontWeights.some(weight => weight.value >= '600')) {
|
|
114
|
+
fontWeights.push({
|
|
115
|
+
name: (0, _i18n._x)('Bold', 'font weight'),
|
|
116
|
+
value: '700'
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// If there is no italic font style, then include faux italic as an option.
|
|
121
|
+
if (!fontStyles.some(style => style.value === 'italic')) {
|
|
122
|
+
fontStyles.push({
|
|
123
|
+
name: (0, _i18n._x)('Italic', 'font style'),
|
|
124
|
+
value: 'italic'
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Use default font styles and weights for system fonts.
|
|
129
|
+
if (isSystemFont) {
|
|
130
|
+
fontStyles = FONT_STYLES;
|
|
131
|
+
fontWeights = FONT_WEIGHTS;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Use default styles and weights if there are no available styles or weights from the provided font faces.
|
|
135
|
+
fontStyles = fontStyles.length === 0 ? FONT_STYLES : fontStyles;
|
|
136
|
+
fontWeights = fontWeights.length === 0 ? FONT_WEIGHTS : fontWeights;
|
|
137
|
+
|
|
138
|
+
// Generate combined font style and weight options for available fonts.
|
|
139
|
+
fontStyles.forEach(({
|
|
140
|
+
name: styleName,
|
|
141
|
+
value: styleValue
|
|
142
|
+
}) => {
|
|
143
|
+
fontWeights.forEach(({
|
|
144
|
+
name: weightName,
|
|
145
|
+
value: weightValue
|
|
146
|
+
}) => {
|
|
147
|
+
const optionName = styleValue === 'normal' ? weightName : (0, _i18n.sprintf)( /* translators: 1: Font weight name. 2: Font style name. */
|
|
148
|
+
(0, _i18n.__)('%1$s %2$s'), weightName, styleName);
|
|
149
|
+
combinedStyleAndWeightOptions.push({
|
|
150
|
+
key: `${styleValue}-${weightValue}`,
|
|
151
|
+
name: optionName,
|
|
152
|
+
style: {
|
|
153
|
+
fontStyle: styleValue,
|
|
154
|
+
fontWeight: weightValue
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
return {
|
|
160
|
+
fontStyles,
|
|
161
|
+
fontWeights,
|
|
162
|
+
combinedStyleAndWeightOptions,
|
|
163
|
+
isSystemFont,
|
|
164
|
+
isVariableFont
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=get-font-styles-and-weights.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","_formatFontStyle","_formatFontWeight","FONT_STYLES","name","_x","value","FONT_WEIGHTS","getFontStylesAndWeights","fontFamilyFaces","fontStyles","fontWeights","combinedStyleAndWeightOptions","isSystemFont","length","isVariableFont","forEach","face","test","fontWeight","trim","startValue","endValue","split","parseInt","slice","i","fontWeightValue","toString","some","weight","push","formatFontWeight","fontStyle","formatFontStyle","style","styleName","styleValue","weightName","weightValue","optionName","sprintf","__","key"],"sources":["@wordpress/block-editor/src/utils/get-font-styles-and-weights.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { formatFontStyle } from './format-font-style';\nimport { formatFontWeight } from './format-font-weight';\n\nconst FONT_STYLES = [\n\t{\n\t\tname: _x( 'Regular', 'font style' ),\n\t\tvalue: 'normal',\n\t},\n\t{\n\t\tname: _x( 'Italic', 'font style' ),\n\t\tvalue: 'italic',\n\t},\n];\n\nconst FONT_WEIGHTS = [\n\t{\n\t\tname: _x( 'Thin', 'font weight' ),\n\t\tvalue: '100',\n\t},\n\t{\n\t\tname: _x( 'Extra Light', 'font weight' ),\n\t\tvalue: '200',\n\t},\n\t{\n\t\tname: _x( 'Light', 'font weight' ),\n\t\tvalue: '300',\n\t},\n\t{\n\t\tname: _x( 'Regular', 'font weight' ),\n\t\tvalue: '400',\n\t},\n\t{\n\t\tname: _x( 'Medium', 'font weight' ),\n\t\tvalue: '500',\n\t},\n\t{\n\t\tname: _x( 'Semi Bold', 'font weight' ),\n\t\tvalue: '600',\n\t},\n\t{\n\t\tname: _x( 'Bold', 'font weight' ),\n\t\tvalue: '700',\n\t},\n\t{\n\t\tname: _x( 'Extra Bold', 'font weight' ),\n\t\tvalue: '800',\n\t},\n\t{\n\t\tname: _x( 'Black', 'font weight' ),\n\t\tvalue: '900',\n\t},\n\t{\n\t\tname: _x( 'Extra Black', 'font weight' ),\n\t\tvalue: '1000',\n\t},\n];\n\n/**\n * Builds a list of font style and weight options based on font family faces.\n * Defaults to the standard font styles and weights if no font family faces are provided.\n *\n * @param {Array} fontFamilyFaces font family faces array\n * @return {Object} new object with combined and separated font style and weight properties\n */\nexport function getFontStylesAndWeights( fontFamilyFaces ) {\n\tlet fontStyles = [];\n\tlet fontWeights = [];\n\tconst combinedStyleAndWeightOptions = [];\n\tconst isSystemFont = ! fontFamilyFaces || fontFamilyFaces?.length === 0;\n\tlet isVariableFont = false;\n\n\tfontFamilyFaces?.forEach( ( face ) => {\n\t\t// Check for variable font by looking for a space in the font weight value. e.g. \"100 900\"\n\t\tif ( /\\s/.test( face.fontWeight.trim() ) ) {\n\t\t\tisVariableFont = true;\n\n\t\t\t// Find font weight start and end values.\n\t\t\tlet [ startValue, endValue ] = face.fontWeight.split( ' ' );\n\t\t\tstartValue = parseInt( startValue.slice( 0, 1 ) );\n\t\t\tif ( endValue === '1000' ) {\n\t\t\t\tendValue = 10;\n\t\t\t} else {\n\t\t\t\tendValue = parseInt( endValue.slice( 0, 1 ) );\n\t\t\t}\n\n\t\t\t// Create font weight options for available variable weights.\n\t\t\tfor ( let i = startValue; i <= endValue; i++ ) {\n\t\t\t\tconst fontWeightValue = `${ i.toString() }00`;\n\t\t\t\tif (\n\t\t\t\t\t! fontWeights.some(\n\t\t\t\t\t\t( weight ) => weight.value === fontWeightValue\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tfontWeights.push( formatFontWeight( fontWeightValue ) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Format font style and weight values.\n\t\tconst fontWeight = formatFontWeight( face.fontWeight );\n\t\tconst fontStyle = formatFontStyle( face.fontStyle );\n\n\t\t// Create font style and font weight lists without duplicates.\n\t\tif ( fontStyle ) {\n\t\t\tif (\n\t\t\t\t! fontStyles.some(\n\t\t\t\t\t( style ) => style.value === fontStyle.value\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tfontStyles.push( fontStyle );\n\t\t\t}\n\t\t}\n\t\tif ( fontWeight ) {\n\t\t\tif (\n\t\t\t\t! fontWeights.some(\n\t\t\t\t\t( weight ) => weight.value === fontWeight.value\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tif ( ! isVariableFont ) {\n\t\t\t\t\tfontWeights.push( fontWeight );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} );\n\n\t// If there is no font weight of 600 or above, then include faux bold as an option.\n\tif ( ! fontWeights.some( ( weight ) => weight.value >= '600' ) ) {\n\t\tfontWeights.push( {\n\t\t\tname: _x( 'Bold', 'font weight' ),\n\t\t\tvalue: '700',\n\t\t} );\n\t}\n\n\t// If there is no italic font style, then include faux italic as an option.\n\tif ( ! fontStyles.some( ( style ) => style.value === 'italic' ) ) {\n\t\tfontStyles.push( {\n\t\t\tname: _x( 'Italic', 'font style' ),\n\t\t\tvalue: 'italic',\n\t\t} );\n\t}\n\n\t// Use default font styles and weights for system fonts.\n\tif ( isSystemFont ) {\n\t\tfontStyles = FONT_STYLES;\n\t\tfontWeights = FONT_WEIGHTS;\n\t}\n\n\t// Use default styles and weights if there are no available styles or weights from the provided font faces.\n\tfontStyles = fontStyles.length === 0 ? FONT_STYLES : fontStyles;\n\tfontWeights = fontWeights.length === 0 ? FONT_WEIGHTS : fontWeights;\n\n\t// Generate combined font style and weight options for available fonts.\n\tfontStyles.forEach( ( { name: styleName, value: styleValue } ) => {\n\t\tfontWeights.forEach( ( { name: weightName, value: weightValue } ) => {\n\t\t\tconst optionName =\n\t\t\t\tstyleValue === 'normal'\n\t\t\t\t\t? weightName\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t/* translators: 1: Font weight name. 2: Font style name. */\n\t\t\t\t\t\t\t__( '%1$s %2$s' ),\n\t\t\t\t\t\t\tweightName,\n\t\t\t\t\t\t\tstyleName\n\t\t\t\t\t );\n\n\t\t\tcombinedStyleAndWeightOptions.push( {\n\t\t\t\tkey: `${ styleValue }-${ weightValue }`,\n\t\t\t\tname: optionName,\n\t\t\t\tstyle: {\n\t\t\t\t\tfontStyle: styleValue,\n\t\t\t\t\tfontWeight: weightValue,\n\t\t\t\t},\n\t\t\t} );\n\t\t} );\n\t} );\n\n\treturn {\n\t\tfontStyles,\n\t\tfont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KAAK,EAAE;IACR,CAAE,CAAC;EACJ;;EAEA;EACA,IAAKO,YAAY,EAAG;IACnBH,UAAU,GAAGP,WAAW;IACxBQ,WAAW,GAAGJ,YAAY;EAC3B;;EAEA;EACAG,UAAU,GAAGA,UAAU,CAACI,MAAM,KAAK,CAAC,GAAGX,WAAW,GAAGO,UAAU;EAC/DC,WAAW,GAAGA,WAAW,CAACG,MAAM,KAAK,CAAC,GAAGP,YAAY,GAAGI,WAAW;;EAEnE;EACAD,UAAU,CAACM,OAAO,CAAE,CAAE;IAAEZ,IAAI,EAAEgC,SAAS;IAAE9B,KAAK,EAAE+B;EAAW,CAAC,KAAM;IACjE1B,WAAW,CAACK,OAAO,CAAE,CAAE;MAAEZ,IAAI,EAAEkC,UAAU;MAAEhC,KAAK,EAAEiC;IAAY,CAAC,KAAM;MACpE,MAAMC,UAAU,GACfH,UAAU,KAAK,QAAQ,GACpBC,UAAU,GACV,IAAAG,aAAO,GACP;MACA,IAAAC,QAAE,EAAE,WAAY,CAAC,EACjBJ,UAAU,EACVF,SACA,CAAC;MAELxB,6BAA6B,CAACmB,IAAI,CAAE;QACnCY,GAAG,EAAG,GAAGN,UAAY,IAAIE,WAAa,EAAC;QACvCnC,IAAI,EAAEoC,UAAU;QAChBL,KAAK,EAAE;UACNF,SAAS,EAAEI,UAAU;UACrBlB,UAAU,EAAEoB;QACb;MACD,CAAE,CAAC;IACJ,CAAE,CAAC;EACJ,CAAE,CAAC;EAEH,OAAO;IACN7B,UAAU;IACVC,WAAW;IACXC,6BAA6B;IAC7BC,YAAY;IACZE;EACD,CAAC;AACF","ignoreList":[]}
|
package/build/utils/pasting.js
CHANGED
|
@@ -55,22 +55,14 @@ function getPasteEventData({
|
|
|
55
55
|
}) {
|
|
56
56
|
let plainText = '';
|
|
57
57
|
let html = '';
|
|
58
|
-
|
|
59
|
-
// IE11 only supports `Text` as an argument for `getData` and will
|
|
60
|
-
// otherwise throw an invalid argument error, so we try the standard
|
|
61
|
-
// arguments first, then fallback to `Text` if they fail.
|
|
62
58
|
try {
|
|
63
59
|
plainText = clipboardData.getData('text/plain');
|
|
64
60
|
html = clipboardData.getData('text/html');
|
|
65
|
-
} catch (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// don't support clipboardData at all, so allow default
|
|
71
|
-
// behaviour.
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
61
|
+
} catch (error) {
|
|
62
|
+
// Some browsers like UC Browser paste plain text by default and
|
|
63
|
+
// don't support clipboardData at all, so allow default
|
|
64
|
+
// behaviour.
|
|
65
|
+
return;
|
|
74
66
|
}
|
|
75
67
|
|
|
76
68
|
// Remove Windows-specific metadata appended within copied HTML text.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dom","require","removeWindowsFragments","html","startStr","startIdx","indexOf","substring","length","endStr","endIdx","removeCharsetMetaTag","metaTag","startsWith","slice","getPasteEventData","clipboardData","plainText","getData","
|
|
1
|
+
{"version":3,"names":["_dom","require","removeWindowsFragments","html","startStr","startIdx","indexOf","substring","length","endStr","endIdx","removeCharsetMetaTag","metaTag","startsWith","slice","getPasteEventData","clipboardData","plainText","getData","error","files","getFilesFromDataTransfer","shouldDismissPastedFiles","type","IMAGE_TAG","match","IMG_WITH_LOCAL_SRC"],"sources":["@wordpress/block-editor/src/utils/pasting.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\n/**\n * Normalizes a given string of HTML to remove the Windows-specific \"Fragment\"\n * comments and any preceding and trailing content.\n *\n * @param {string} html the html to be normalized\n * @return {string} the normalized html\n */\nfunction removeWindowsFragments( html ) {\n\tconst startStr = '<!--StartFragment-->';\n\tconst startIdx = html.indexOf( startStr );\n\tif ( startIdx > -1 ) {\n\t\thtml = html.substring( startIdx + startStr.length );\n\t} else {\n\t\t// No point looking for EndFragment\n\t\treturn html;\n\t}\n\n\tconst endStr = '<!--EndFragment-->';\n\tconst endIdx = html.indexOf( endStr );\n\tif ( endIdx > -1 ) {\n\t\thtml = html.substring( 0, endIdx );\n\t}\n\n\treturn html;\n}\n\n/**\n * Removes the charset meta tag inserted by Chromium.\n * See:\n * - https://github.com/WordPress/gutenberg/issues/33585\n * - https://bugs.chromium.org/p/chromium/issues/detail?id=1264616#c4\n *\n * @param {string} html the html to be stripped of the meta tag.\n * @return {string} the cleaned html\n */\nfunction removeCharsetMetaTag( html ) {\n\tconst metaTag = `<meta charset='utf-8'>`;\n\n\tif ( html.startsWith( metaTag ) ) {\n\t\treturn html.slice( metaTag.length );\n\t}\n\n\treturn html;\n}\n\nexport function getPasteEventData( { clipboardData } ) {\n\tlet plainText = '';\n\tlet html = '';\n\n\ttry {\n\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\thtml = clipboardData.getData( 'text/html' );\n\t} catch ( error ) {\n\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t// don't support clipboardData at all, so allow default\n\t\t// behaviour.\n\t\treturn;\n\t}\n\n\t// Remove Windows-specific metadata appended within copied HTML text.\n\thtml = removeWindowsFragments( html );\n\n\t// Strip meta tag.\n\thtml = removeCharsetMetaTag( html );\n\n\tconst files = getFilesFromDataTransfer( clipboardData );\n\n\tif ( files.length && ! shouldDismissPastedFiles( files, html ) ) {\n\t\treturn { files };\n\t}\n\n\treturn { html, plainText, files: [] };\n}\n\n/**\n * Given a collection of DataTransfer files and HTML and plain text strings,\n * determine whether the files are to be dismissed in favor of the HTML.\n *\n * Certain office-type programs, like Microsoft Word or Apple Numbers,\n * will, upon copy, generate a screenshot of the content being copied and\n * attach it to the clipboard alongside the actual rich text that the user\n * sought to copy. In those cases, we should let Gutenberg handle the rich text\n * content and not the screenshot, since this allows Gutenberg to insert\n * meaningful blocks, like paragraphs, lists or even tables.\n *\n * @param {File[]} files File objects obtained from a paste event\n * @param {string} html HTML content obtained from a paste event\n * @return {boolean} True if the files should be dismissed\n */\nexport function shouldDismissPastedFiles( files, html /*, plainText */ ) {\n\t// The question is only relevant when there is actual HTML content and when\n\t// there is exactly one image file.\n\tif (\n\t\thtml &&\n\t\tfiles?.length === 1 &&\n\t\tfiles[ 0 ].type.indexOf( 'image/' ) === 0\n\t) {\n\t\t// A single <img> tag found in the HTML source suggests that the\n\t\t// content being pasted revolves around an image. Sometimes there are\n\t\t// other elements found, like <figure>, but we assume that the user's\n\t\t// intention is to paste the actual image file.\n\t\tconst IMAGE_TAG = /<\\s*img\\b/gi;\n\t\tif ( html.match( IMAGE_TAG )?.length !== 1 ) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Even when there is exactly one <img> tag in the HTML payload, we\n\t\t// choose to weed out local images, i.e. those whose source starts with\n\t\t// \"file://\". These payloads occur in specific configurations, such as\n\t\t// when copying an entire document from Microsoft Word, that contains\n\t\t// text and exactly one image, and pasting that content using Google\n\t\t// Chrome.\n\t\tconst IMG_WITH_LOCAL_SRC = /<\\s*img\\b[^>]*\\bsrc=\"file:\\/\\//i;\n\t\tif ( html.match( IMG_WITH_LOCAL_SRC ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,sBAAsBA,CAAEC,IAAI,EAAG;EACvC,MAAMC,QAAQ,GAAG,sBAAsB;EACvC,MAAMC,QAAQ,GAAGF,IAAI,CAACG,OAAO,CAAEF,QAAS,CAAC;EACzC,IAAKC,QAAQ,GAAG,CAAC,CAAC,EAAG;IACpBF,IAAI,GAAGA,IAAI,CAACI,SAAS,CAAEF,QAAQ,GAAGD,QAAQ,CAACI,MAAO,CAAC;EACpD,CAAC,MAAM;IACN;IACA,OAAOL,IAAI;EACZ;EAEA,MAAMM,MAAM,GAAG,oBAAoB;EACnC,MAAMC,MAAM,GAAGP,IAAI,CAACG,OAAO,CAAEG,MAAO,CAAC;EACrC,IAAKC,MAAM,GAAG,CAAC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I,IACJiB,KAAK,EAAEZ,MAAM,KAAK,CAAC,IACnBY,KAAK,CAAE,CAAC,CAAE,CAACG,IAAI,CAACjB,OAAO,CAAE,QAAS,CAAC,KAAK,CAAC,EACxC;IACD;IACA;IACA;IACA;IACA,MAAMkB,SAAS,GAAG,aAAa;IAC/B,IAAKrB,IAAI,CAACsB,KAAK,CAAED,SAAU,CAAC,EAAEhB,MAAM,KAAK,CAAC,EAAG;MAC5C,OAAO,IAAI;IACZ;;IAEA;IACA;IACA;IACA;IACA;IACA;IACA,MAAMkB,kBAAkB,GAAG,iCAAiC;IAC5D,IAAKvB,IAAI,CAACsB,KAAK,CAAEC,kBAAmB,CAAC,EAAG;MACvC,OAAO,IAAI;IACZ;EACD;EAEA,OAAO,KAAK;AACb","ignoreList":[]}
|
|
@@ -12,6 +12,8 @@ import { chevronRightSmall, Icon } from '@wordpress/icons';
|
|
|
12
12
|
import BlockTitle from '../block-title';
|
|
13
13
|
import { store as blockEditorStore } from '../../store';
|
|
14
14
|
import { unlock } from '../../lock-unlock';
|
|
15
|
+
import { __unstableUseBlockRef as useBlockRef } from '../block-list/use-block-props/use-block-refs';
|
|
16
|
+
import getEditorRegion from '../../utils/get-editor-region';
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Block breadcrumb component, displaying the hierarchy of the current block selection as a breadcrumb.
|
|
@@ -48,6 +50,10 @@ function BlockBreadcrumb({
|
|
|
48
50
|
}, []);
|
|
49
51
|
const rootLabel = rootLabelText || __('Document');
|
|
50
52
|
|
|
53
|
+
// We don't care about this specific ref, but this is a way
|
|
54
|
+
// to get a ref within the editor canvas so we can focus it later.
|
|
55
|
+
const blockRef = useBlockRef(clientId);
|
|
56
|
+
|
|
51
57
|
/*
|
|
52
58
|
* Disable reason: The `list` ARIA role is redundant but
|
|
53
59
|
* Safari+VoiceOver won't announce the list otherwise.
|
|
@@ -63,7 +69,12 @@ function BlockBreadcrumb({
|
|
|
63
69
|
children: [hasSelection && /*#__PURE__*/_jsx(Button, {
|
|
64
70
|
className: "block-editor-block-breadcrumb__button",
|
|
65
71
|
variant: "tertiary",
|
|
66
|
-
onClick:
|
|
72
|
+
onClick: () => {
|
|
73
|
+
// Find the block editor wrapper for the selected block
|
|
74
|
+
const blockEditor = blockRef.current?.closest('.editor-styles-wrapper');
|
|
75
|
+
clearSelectedBlock();
|
|
76
|
+
getEditorRegion(blockEditor)?.focus();
|
|
77
|
+
},
|
|
67
78
|
children: rootLabel
|
|
68
79
|
}), !hasSelection && rootLabel, !!clientId && /*#__PURE__*/_jsx(Icon, {
|
|
69
80
|
icon: chevronRightSmall,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","useSelect","useDispatch","__","chevronRightSmall","Icon","BlockTitle","store","blockEditorStore","unlock","jsx","_jsx","jsxs","_jsxs","BlockBreadcrumb","rootLabelText","selectBlock","clearSelectedBlock","clientId","parents","hasSelection","select","getSelectionStart","getSelectedBlockClientId","getEnabledBlockParents","selectedBlockClientId","rootLabel","className","role","children","undefined","variant","onClick","icon","map","parentClientId","maximumLength"],"sources":["@wordpress/block-editor/src/components/block-breadcrumb/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { chevronRightSmall, Icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockTitle from '../block-title';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Block breadcrumb component, displaying the hierarchy of the current block selection as a breadcrumb.\n *\n * @param {Object} props Component props.\n * @param {string} props.rootLabelText Translated label for the root element of the breadcrumb trail.\n * @return {Element} Block Breadcrumb.\n */\nfunction BlockBreadcrumb( { rootLabelText } ) {\n\tconst { selectBlock, clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { clientId, parents, hasSelection } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectionStart,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetEnabledBlockParents,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tparents: getEnabledBlockParents( selectedBlockClientId ),\n\t\t\tclientId: selectedBlockClientId,\n\t\t\thasSelection: !! getSelectionStart().clientId,\n\t\t};\n\t}, [] );\n\tconst rootLabel = rootLabelText || __( 'Document' );\n\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\treturn (\n\t\t<ul\n\t\t\tclassName=\"block-editor-block-breadcrumb\"\n\t\t\trole=\"list\"\n\t\t\taria-label={ __( 'Block breadcrumb' ) }\n\t\t>\n\t\t\t<li\n\t\t\t\tclassName={\n\t\t\t\t\t! hasSelection\n\t\t\t\t\t\t? 'block-editor-block-breadcrumb__current'\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\taria-current={ ! hasSelection ? 'true' : undefined }\n\t\t\t>\n\t\t\t\t{ hasSelection && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"block-editor-block-breadcrumb__button\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={
|
|
1
|
+
{"version":3,"names":["Button","useSelect","useDispatch","__","chevronRightSmall","Icon","BlockTitle","store","blockEditorStore","unlock","__unstableUseBlockRef","useBlockRef","getEditorRegion","jsx","_jsx","jsxs","_jsxs","BlockBreadcrumb","rootLabelText","selectBlock","clearSelectedBlock","clientId","parents","hasSelection","select","getSelectionStart","getSelectedBlockClientId","getEnabledBlockParents","selectedBlockClientId","rootLabel","blockRef","className","role","children","undefined","variant","onClick","blockEditor","current","closest","focus","icon","map","parentClientId","maximumLength"],"sources":["@wordpress/block-editor/src/components/block-breadcrumb/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { chevronRightSmall, Icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockTitle from '../block-title';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { __unstableUseBlockRef as useBlockRef } from '../block-list/use-block-props/use-block-refs';\nimport getEditorRegion from '../../utils/get-editor-region';\n\n/**\n * Block breadcrumb component, displaying the hierarchy of the current block selection as a breadcrumb.\n *\n * @param {Object} props Component props.\n * @param {string} props.rootLabelText Translated label for the root element of the breadcrumb trail.\n * @return {Element} Block Breadcrumb.\n */\nfunction BlockBreadcrumb( { rootLabelText } ) {\n\tconst { selectBlock, clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { clientId, parents, hasSelection } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectionStart,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetEnabledBlockParents,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tparents: getEnabledBlockParents( selectedBlockClientId ),\n\t\t\tclientId: selectedBlockClientId,\n\t\t\thasSelection: !! getSelectionStart().clientId,\n\t\t};\n\t}, [] );\n\tconst rootLabel = rootLabelText || __( 'Document' );\n\n\t// We don't care about this specific ref, but this is a way\n\t// to get a ref within the editor canvas so we can focus it later.\n\tconst blockRef = useBlockRef( clientId );\n\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\treturn (\n\t\t<ul\n\t\t\tclassName=\"block-editor-block-breadcrumb\"\n\t\t\trole=\"list\"\n\t\t\taria-label={ __( 'Block breadcrumb' ) }\n\t\t>\n\t\t\t<li\n\t\t\t\tclassName={\n\t\t\t\t\t! hasSelection\n\t\t\t\t\t\t? 'block-editor-block-breadcrumb__current'\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\taria-current={ ! hasSelection ? 'true' : undefined }\n\t\t\t>\n\t\t\t\t{ hasSelection && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"block-editor-block-breadcrumb__button\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t// Find the block editor wrapper for the selected block\n\t\t\t\t\t\t\tconst blockEditor = blockRef.current?.closest(\n\t\t\t\t\t\t\t\t'.editor-styles-wrapper'\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tclearSelectedBlock();\n\n\t\t\t\t\t\t\tgetEditorRegion( blockEditor )?.focus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ rootLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t{ ! hasSelection && rootLabel }\n\t\t\t\t{ !! clientId && (\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ chevronRightSmall }\n\t\t\t\t\t\tclassName=\"block-editor-block-breadcrumb__separator\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</li>\n\n\t\t\t{ parents.map( ( parentClientId ) => (\n\t\t\t\t<li key={ parentClientId }>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"block-editor-block-breadcrumb__button\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => selectBlock( parentClientId ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockTitle\n\t\t\t\t\t\t\tclientId={ parentClientId }\n\t\t\t\t\t\t\tmaximumLength={ 35 }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ chevronRightSmall }\n\t\t\t\t\t\tclassName=\"block-editor-block-breadcrumb__separator\"\n\t\t\t\t\t/>\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t\t{ !! clientId && (\n\t\t\t\t<li\n\t\t\t\t\tclassName=\"block-editor-block-breadcrumb__current\"\n\t\t\t\t\taria-current=\"true\"\n\t\t\t\t>\n\t\t\t\t\t<BlockTitle clientId={ clientId } maximumLength={ 35 } />\n\t\t\t\t</li>\n\t\t\t) }\n\t\t</ul>\n\t\t/* eslint-enable jsx-a11y/no-redundant-roles */\n\t);\n}\n\nexport default BlockBreadcrumb;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,iBAAiB,EAAEC,IAAI,QAAQ,kBAAkB;;AAE1D;AACA;AACA;AACA,OAAOC,UAAU,MAAM,gBAAgB;AACvC,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,qBAAqB,IAAIC,WAAW,QAAQ,8CAA8C;AACnG,OAAOC,eAAe,MAAM,+BAA+B;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAOA,SAASC,eAAeA,CAAE;EAAEC;AAAc,CAAC,EAAG;EAC7C,MAAM;IAAEC,WAAW;IAAEC;EAAmB,CAAC,GAAGlB,WAAW,CAAEM,gBAAiB,CAAC;EAC3E,MAAM;IAAEa,QAAQ;IAAEC,OAAO;IAAEC;EAAa,CAAC,GAAGtB,SAAS,CAAIuB,MAAM,IAAM;IACpE,MAAM;MACLC,iBAAiB;MACjBC,wBAAwB;MACxBC;IACD,CAAC,GAAGlB,MAAM,CAAEe,MAAM,CAAEhB,gBAAiB,CAAE,CAAC;IACxC,MAAMoB,qBAAqB,GAAGF,wBAAwB,CAAC,CAAC;IACxD,OAAO;MACNJ,OAAO,EAAEK,sBAAsB,CAAEC,qBAAsB,CAAC;M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A,CAAA,KAAMjB,WAAW,CAAEwB,cAAe,CAAG;QAAAV,QAAA,eAE/CnB,IAAA,CAACR,UAAU;UACVe,QAAQ,EAAGsB,cAAgB;UAC3BC,aAAa,EAAG;QAAI,CACpB;MAAC,CACK,CAAC,eACT9B,IAAA,CAACT,IAAI;QACJoC,IAAI,EAAGrC,iBAAmB;QAC1B2B,SAAS,EAAC;MAA0C,CACpD,CAAC;IAAA,GAdOY,cAeN,CACH,CAAC,EACD,CAAC,CAAEtB,QAAQ,iBACZP,IAAA;MACCiB,SAAS,EAAC,wCAAwC;MAClD,gBAAa,MAAM;MAAAE,QAAA,eAEnBnB,IAAA,CAACR,UAAU;QAACe,QAAQ,EAAGA,QAAU;QAACuB,aAAa,EAAG;MAAI,CAAE;IAAC,CACtD,CACJ;EAAA,CACE;EACJ;AAEF;AAEA,eAAe3B,eAAe","ignoreList":[]}
|
|
@@ -45,7 +45,6 @@ export default function BlockLockToolbar({
|
|
|
45
45
|
children: [/*#__PURE__*/_jsx(ToolbarGroup, {
|
|
46
46
|
className: "block-editor-block-lock-toolbar",
|
|
47
47
|
children: /*#__PURE__*/_jsx(ToolbarButton, {
|
|
48
|
-
accessibleWhenDisabled: true,
|
|
49
48
|
disabled: !canLock,
|
|
50
49
|
icon: isLocked ? lock : unlock,
|
|
51
50
|
label: label,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","ToolbarButton","ToolbarGroup","useReducer","useRef","useEffect","lock","unlock","BlockLockModal","useBlockLock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","BlockLockToolbar","clientId","canLock","isLocked","isModalOpen","toggleModal","isActive","hasLockButtonShown","current","label","children","className","
|
|
1
|
+
{"version":3,"names":["__","ToolbarButton","ToolbarGroup","useReducer","useRef","useEffect","lock","unlock","BlockLockModal","useBlockLock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","BlockLockToolbar","clientId","canLock","isLocked","isModalOpen","toggleModal","isActive","hasLockButtonShown","current","label","children","className","disabled","icon","onClick","onClose"],"sources":["@wordpress/block-editor/src/components/block-lock/toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { useReducer, useRef, useEffect } from '@wordpress/element';\nimport { lock, unlock } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockLockModal from './modal';\nimport useBlockLock from './use-block-lock';\n\nexport default function BlockLockToolbar( { clientId } ) {\n\tconst { canLock, isLocked } = useBlockLock( clientId );\n\n\tconst [ isModalOpen, toggleModal ] = useReducer(\n\t\t( isActive ) => ! isActive,\n\t\tfalse\n\t);\n\n\tconst hasLockButtonShown = useRef( false );\n\n\t// If the block lock button has been shown, we don't want to remove it\n\t// from the toolbar until the toolbar is rendered again without it.\n\t// Removing it beforehand can cause focus loss issues, such as when\n\t// unlocking the block from the modal. It needs to return focus from\n\t// whence it came, and to do that, we need to leave the button in the toolbar.\n\tuseEffect( () => {\n\t\tif ( isLocked ) {\n\t\t\thasLockButtonShown.current = true;\n\t\t}\n\t}, [ isLocked ] );\n\n\tif ( ! isLocked && ! hasLockButtonShown.current ) {\n\t\treturn null;\n\t}\n\n\tlet label = isLocked ? __( 'Unlock' ) : __( 'Lock' );\n\n\tif ( ! canLock && isLocked ) {\n\t\tlabel = __( 'Locked' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarGroup className=\"block-editor-block-lock-toolbar\">\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tdisabled={ ! canLock }\n\t\t\t\t\ticon={ isLocked ? lock : unlock }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonClick={ toggleModal }\n\t\t\t\t\taria-expanded={ isModalOpen }\n\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<BlockLockModal clientId={ clientId } onClose={ toggleModal } />\n\t\t\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IAAA,CAACT,YAAY;MAACyB,SAAS,EAAC,iCAAiC;MAAAD,QAAA,eACxDf,IAAA,CAACV,aAAa;QACb2B,QAAQ,EAAG,CAAEV,OAAS;QACtBW,IAAI,EAAGV,QAAQ,GAAGb,IAAI,GAAGC,MAAQ;QACjCkB,KAAK,EAAGA,KAAO;QACfK,OAAO,EAAGT,WAAa;QACvB,iBAAgBD,WAAa;QAC7B,iBAAc;MAAQ,CACtB;IAAC,CACW,CAAC,EACbA,WAAW,iBACZT,IAAA,CAACH,cAAc;MAACS,QAAQ,EAAGA,QAAU;MAACc,OAAO,EAAGV;IAAa,CAAE,CAC/D;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -121,7 +121,7 @@ const BlockMoverButton = forwardRef(({
|
|
|
121
121
|
...props,
|
|
122
122
|
onClick: isDisabled ? null : onClick,
|
|
123
123
|
disabled: isDisabled,
|
|
124
|
-
|
|
124
|
+
accessibleWhenDisabled: true
|
|
125
125
|
}), /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
126
126
|
id: descriptionId,
|
|
127
127
|
children: getBlockMoverDescription(blocksCount, blockType && blockType.title, firstIndex, isFirst, isLast, direction === 'up' ? -1 : 1, orientation)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","getBlockType","Button","VisuallyHidden","useInstanceId","useSelect","useDispatch","forwardRef","__","isRTL","chevronLeft","chevronRight","chevronUp","chevronDown","getBlockMoverDescription","store","blockEditorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","getArrowIcon","direction","orientation","getMovementDirectionLabel","moveDirection","BlockMoverButton","clientIds","moverOrientation","props","ref","instanceId","normalizedClientIds","Array","isArray","blocksCount","length","disabled","blockType","isDisabled","rootClientId","isFirst","isLast","firstIndex","select","getBlockIndex","getBlockRootClientId","getBlockOrder","getBlock","getBlockListSettings","firstClientId","blockRootClientId","firstBlockIndex","lastBlockIndex","blockOrder","block","isFirstBlock","isLastBlock","blockListOrientation","name","moveBlocksDown","moveBlocksUp","moverFunction","onClick","event","descriptionId","children","className","icon","label","__experimentalIsFocusable","id","title","BlockMoverUpButton","BlockMoverDownButton"],"sources":["@wordpress/block-editor/src/components/block-mover/button.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\nimport { __, isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tchevronLeft,\n\tchevronRight,\n\tchevronUp,\n\tchevronDown,\n} from '@wordpress/icons';\nimport { getBlockMoverDescription } from './mover-description';\nimport { store as blockEditorStore } from '../../store';\n\nconst getArrowIcon = ( direction, orientation ) => {\n\tif ( direction === 'up' ) {\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\treturn isRTL() ? chevronRight : chevronLeft;\n\t\t}\n\t\treturn chevronUp;\n\t} else if ( direction === 'down' ) {\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\treturn isRTL() ? chevronLeft : chevronRight;\n\t\t}\n\t\treturn chevronDown;\n\t}\n\treturn null;\n};\n\nconst getMovementDirectionLabel = ( moveDirection, orientation ) => {\n\tif ( moveDirection === 'up' ) {\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\treturn isRTL() ? __( 'Move right' ) : __( 'Move left' );\n\t\t}\n\t\treturn __( 'Move up' );\n\t} else if ( moveDirection === 'down' ) {\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\treturn isRTL() ? __( 'Move left' ) : __( 'Move right' );\n\t\t}\n\t\treturn __( 'Move down' );\n\t}\n\treturn null;\n};\n\nconst BlockMoverButton = forwardRef(\n\t(\n\t\t{ clientIds, direction, orientation: moverOrientation, ...props },\n\t\tref\n\t) => {\n\t\tconst instanceId = useInstanceId( BlockMoverButton );\n\t\tconst normalizedClientIds = Array.isArray( clientIds )\n\t\t\t? clientIds\n\t\t\t: [ clientIds ];\n\t\tconst blocksCount = normalizedClientIds.length;\n\t\tconst { disabled } = props;\n\n\t\tconst {\n\t\t\tblockType,\n\t\t\tisDisabled,\n\t\t\trootClientId,\n\t\t\tisFirst,\n\t\t\tisLast,\n\t\t\tfirstIndex,\n\t\t\torientation = 'vertical',\n\t\t} = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockIndex,\n\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\tgetBlockOrder,\n\t\t\t\t\tgetBlock,\n\t\t\t\t\tgetBlockListSettings,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\tconst firstClientId = normalizedClientIds[ 0 ];\n\t\t\t\tconst blockRootClientId = getBlockRootClientId( firstClientId );\n\t\t\t\tconst firstBlockIndex = getBlockIndex( firstClientId );\n\t\t\t\tconst lastBlockIndex = getBlockIndex(\n\t\t\t\t\tnormalizedClientIds[ normalizedClientIds.length - 1 ]\n\t\t\t\t);\n\t\t\t\tconst blockOrder = getBlockOrder( blockRootClientId );\n\t\t\t\tconst block = getBlock( firstClientId );\n\t\t\t\tconst isFirstBlock = firstBlockIndex === 0;\n\t\t\t\tconst isLastBlock = lastBlockIndex === blockOrder.length - 1;\n\t\t\t\tconst { orientation: blockListOrientation } =\n\t\t\t\t\tgetBlockListSettings( blockRootClientId ) || {};\n\n\t\t\t\treturn {\n\t\t\t\t\tblockType: block ? getBlockType( block.name ) : null,\n\t\t\t\t\tisDisabled:\n\t\t\t\t\t\tdisabled ||\n\t\t\t\t\t\t( direction === 'up' ? isFirstBlock : isLastBlock ),\n\t\t\t\t\trootClientId: blockRootClientId,\n\t\t\t\t\tfirstIndex: firstBlockIndex,\n\t\t\t\t\tisFirst: isFirstBlock,\n\t\t\t\t\tisLast: isLastBlock,\n\t\t\t\t\torientation: moverOrientation || blockListOrientation,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientIds, direction ]\n\t\t);\n\n\t\tconst { moveBlocksDown, moveBlocksUp } =\n\t\t\tuseDispatch( blockEditorStore );\n\t\tconst moverFunction =\n\t\t\tdirection === 'up' ? moveBlocksUp : moveBlocksDown;\n\n\t\tconst onClick = ( event ) => {\n\t\t\tmoverFunction( clientIds, rootClientId );\n\t\t\tif ( props.onClick ) {\n\t\t\t\tprops.onClick( event );\n\t\t\t}\n\t\t};\n\n\t\tconst descriptionId = `block-editor-block-mover-button__description-${ instanceId }`;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Button\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'block-editor-block-mover-button',\n\t\t\t\t\t\t`is-${ direction }-button`\n\t\t\t\t\t) }\n\t\t\t\t\ticon={ getArrowIcon( direction, orientation ) }\n\t\t\t\t\tlabel={ getMovementDirectionLabel(\n\t\t\t\t\t\tdirection,\n\t\t\t\t\t\torientation\n\t\t\t\t\t) }\n\t\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tonClick={ isDisabled ? null : onClick }\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t/>\n\t\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t\t{ getBlockMoverDescription(\n\t\t\t\t\t\tblocksCount,\n\t\t\t\t\t\tblockType && blockType.title,\n\t\t\t\t\t\tfirstIndex,\n\t\t\t\t\t\tisFirst,\n\t\t\t\t\t\tisLast,\n\t\t\t\t\t\tdirection === 'up' ? -1 : 1,\n\t\t\t\t\t\torientation\n\t\t\t\t\t) }\n\t\t\t\t</VisuallyHidden>\n\t\t\t</>\n\t\t);\n\t}\n);\n\nexport const BlockMoverUpButton = forwardRef( ( props, ref ) => {\n\treturn <BlockMoverButton direction=\"up\" ref={ ref } { ...props } />;\n} );\n\nexport const BlockMoverDownButton = forwardRef( ( props, ref ) => {\n\tre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D,IAAA,CAAChB,MAAM;MACN8B,GAAG,EAAGA,GAAK;MACXqC,SAAS,EAAGrE,IAAI,CACf,iCAAiC,EAChC,MAAMwB,SAAW,SACnB,CAAG;MACH8C,IAAI,EAAG/C,YAAY,CAAEC,SAAS,EAAEC,WAAY,CAAG;MAC/C8C,KAAK,EAAG7C,yBAAyB,CAChCF,SAAS,EACTC,WACD,CAAG;MACH,oBAAmB0C,aAAe;MAAA,GAC7BpC,KAAK;MACVkC,OAAO,EAAGxB,UAAU,GAAG,IAAI,GAAGwB,OAAS;MACvC1B,QAAQ,EAAGE,UAAY;MACvB+B,yBAAyB;IAAA,CACzB,CAAC,eACFtD,IAAA,CAACf,cAAc;MAACsE,EAAE,EAAGN,aAAe;MAAAC,QAAA,EACjCtD,wBAAwB,CACzBuB,WAAW,EACXG,SAAS,IAAIA,SAAS,CAACkC,KAAK,EAC5B7B,UAAU,EACVF,OAAO,EACPC,MAAM,EACNpB,SAAS,KAAK,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,EAC3BC,WACD;IAAC,CACc,CAAC;EAAA,CAChB,CAAC;AAEL,CACD,CAAC;AAED,OAAO,MAAMkD,kBAAkB,GAAGpE,UAAU,CAAE,CAAEwB,KAAK,EAAEC,GAAG,KAAM;EAC/D,oBAAOd,IAAA,CAACU,gBAAgB;IAACJ,SAAS,EAAC,IAAI;IAACQ,GAAG,EAAGA,GAAK;IAAA,GAAMD;EAAK,CAAI,CAAC;AACpE,CAAE,CAAC;AAEH,OAAO,MAAM6C,oBAAoB,GAAGrE,UAAU,CAAE,CAAEwB,KAAK,EAAEC,GAAG,KAAM;EACjE,oBAAOd,IAAA,CAACU,gBAAgB;IAACJ,SAAS,EAAC,MAAM;IAACQ,GAAG,EAAGA,GAAK;IAAA,GAAMD;EAAK,CAAI,CAAC;AACtE,CAAE,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","getBlockType","Button","VisuallyHidden","useInstanceId","useSelect","useDispatch","forwardRef","__","isRTL","chevronLeft","chevronRight","chevronUp","chevronDown","getBlockMoverDescription","store","blockEditorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","getArrowIcon","direction","orientation","getMovementDirectionLabel","moveDirection","BlockMoverButton","clientIds","moverOrientation","props","ref","instanceId","normalizedClientIds","Array","isArray","blocksCount","length","disabled","blockType","isDisabled","rootClientId","isFirst","isLast","firstIndex","select","getBlockIndex","getBlockRootClientId","getBlockOrder","getBlock","getBlockListSettings","firstClientId","blockRootClientId","firstBlockIndex","lastBlockIndex","blockOrder","block","isFirstBlock","isLastBlock","blockListOrientation","name","moveBlocksDown","moveBlocksUp","moverFunction","onClick","event","descriptionId","children","className","icon","label","accessibleWhenDisabled","id","title","BlockMoverUpButton","BlockMoverDownButton"],"sources":["@wordpress/block-editor/src/components/block-mover/button.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\nimport { __, isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tchevronLeft,\n\tchevronRight,\n\tchevronUp,\n\tchevronDown,\n} from '@wordpress/icons';\nimport { getBlockMoverDescription } from './mover-description';\nimport { store as blockEditorStore } from '../../store';\n\nconst getArrowIcon = ( direction, orientation ) => {\n\tif ( direction === 'up' ) {\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\treturn isRTL() ? chevronRight : chevronLeft;\n\t\t}\n\t\treturn chevronUp;\n\t} else if ( direction === 'down' ) {\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\treturn isRTL() ? chevronLeft : chevronRight;\n\t\t}\n\t\treturn chevronDown;\n\t}\n\treturn null;\n};\n\nconst getMovementDirectionLabel = ( moveDirection, orientation ) => {\n\tif ( moveDirection === 'up' ) {\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\treturn isRTL() ? __( 'Move right' ) : __( 'Move left' );\n\t\t}\n\t\treturn __( 'Move up' );\n\t} else if ( moveDirection === 'down' ) {\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\treturn isRTL() ? __( 'Move left' ) : __( 'Move right' );\n\t\t}\n\t\treturn __( 'Move down' );\n\t}\n\treturn null;\n};\n\nconst BlockMoverButton = forwardRef(\n\t(\n\t\t{ clientIds, direction, orientation: moverOrientation, ...props },\n\t\tref\n\t) => {\n\t\tconst instanceId = useInstanceId( BlockMoverButton );\n\t\tconst normalizedClientIds = Array.isArray( clientIds )\n\t\t\t? clientIds\n\t\t\t: [ clientIds ];\n\t\tconst blocksCount = normalizedClientIds.length;\n\t\tconst { disabled } = props;\n\n\t\tconst {\n\t\t\tblockType,\n\t\t\tisDisabled,\n\t\t\trootClientId,\n\t\t\tisFirst,\n\t\t\tisLast,\n\t\t\tfirstIndex,\n\t\t\torientation = 'vertical',\n\t\t} = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockIndex,\n\t\t\t\t\tgetBlockRootClientId,\n\t\t\t\t\tgetBlockOrder,\n\t\t\t\t\tgetBlock,\n\t\t\t\t\tgetBlockListSettings,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\tconst firstClientId = normalizedClientIds[ 0 ];\n\t\t\t\tconst blockRootClientId = getBlockRootClientId( firstClientId );\n\t\t\t\tconst firstBlockIndex = getBlockIndex( firstClientId );\n\t\t\t\tconst lastBlockIndex = getBlockIndex(\n\t\t\t\t\tnormalizedClientIds[ normalizedClientIds.length - 1 ]\n\t\t\t\t);\n\t\t\t\tconst blockOrder = getBlockOrder( blockRootClientId );\n\t\t\t\tconst block = getBlock( firstClientId );\n\t\t\t\tconst isFirstBlock = firstBlockIndex === 0;\n\t\t\t\tconst isLastBlock = lastBlockIndex === blockOrder.length - 1;\n\t\t\t\tconst { orientation: blockListOrientation } =\n\t\t\t\t\tgetBlockListSettings( blockRootClientId ) || {};\n\n\t\t\t\treturn {\n\t\t\t\t\tblockType: block ? getBlockType( block.name ) : null,\n\t\t\t\t\tisDisabled:\n\t\t\t\t\t\tdisabled ||\n\t\t\t\t\t\t( direction === 'up' ? isFirstBlock : isLastBlock ),\n\t\t\t\t\trootClientId: blockRootClientId,\n\t\t\t\t\tfirstIndex: firstBlockIndex,\n\t\t\t\t\tisFirst: isFirstBlock,\n\t\t\t\t\tisLast: isLastBlock,\n\t\t\t\t\torientation: moverOrientation || blockListOrientation,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientIds, direction ]\n\t\t);\n\n\t\tconst { moveBlocksDown, moveBlocksUp } =\n\t\t\tuseDispatch( blockEditorStore );\n\t\tconst moverFunction =\n\t\t\tdirection === 'up' ? moveBlocksUp : moveBlocksDown;\n\n\t\tconst onClick = ( event ) => {\n\t\t\tmoverFunction( clientIds, rootClientId );\n\t\t\tif ( props.onClick ) {\n\t\t\t\tprops.onClick( event );\n\t\t\t}\n\t\t};\n\n\t\tconst descriptionId = `block-editor-block-mover-button__description-${ instanceId }`;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Button\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'block-editor-block-mover-button',\n\t\t\t\t\t\t`is-${ direction }-button`\n\t\t\t\t\t) }\n\t\t\t\t\ticon={ getArrowIcon( direction, orientation ) }\n\t\t\t\t\tlabel={ getMovementDirectionLabel(\n\t\t\t\t\t\tdirection,\n\t\t\t\t\t\torientation\n\t\t\t\t\t) }\n\t\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tonClick={ isDisabled ? null : onClick }\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t/>\n\t\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t\t{ getBlockMoverDescription(\n\t\t\t\t\t\tblocksCount,\n\t\t\t\t\t\tblockType && blockType.title,\n\t\t\t\t\t\tfirstIndex,\n\t\t\t\t\t\tisFirst,\n\t\t\t\t\t\tisLast,\n\t\t\t\t\t\tdirection === 'up' ? -1 : 1,\n\t\t\t\t\t\torientation\n\t\t\t\t\t) }\n\t\t\t\t</VisuallyHidden>\n\t\t\t</>\n\t\t);\n\t}\n);\n\nexport const BlockMoverUpButton = forwardRef( ( props, ref ) => {\n\treturn <BlockMoverButton direction=\"up\" ref={ ref } { ...props } />;\n} );\n\nexport const BlockMoverDownButton = forwardRef( ( props, ref ) => {\n\treturn <BlockMoverButton direction=\"down\" ref={ ref } { ...props } />;\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,MAAM,EAAEC,cAAc,QAAQ,uBAAuB;AAC9D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SACCC,WAAW,EACXC,YAAY,EACZC,SAAS,EACTC,WAAW,QACL,kBAAkB;AACzB,SAASC,wBAAwB,QAAQ,qBAAqB;AAC9D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAExD,MAAMC,YAAY,GAAGA,CAAEC,SAAS,EAAEC,WAAW,KAAM;EAClD,IAAKD,SAAS,KAAK,IAAI,EAAG;IACzB,IAAKC,WAAW,KAAK,YAAY,EAAG;MACnC,OAAOhB,KAAK,CAAC,CAAC,GAAGE,YAAY,GAAGD,WAAW;IAC5C;IACA,OAAOE,SAAS;EACjB,CAA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EAAGA,GAAK;IAAA,GAAMD;EAAK,CAAI,CAAC;AACpE,CAAE,CAAC;AAEH,OAAO,MAAM6C,oBAAoB,GAAGrE,UAAU,CAAE,CAAEwB,KAAK,EAAEC,GAAG,KAAM;EACjE,oBAAOd,IAAA,CAACU,gBAAgB;IAACJ,SAAS,EAAC,MAAM;IAACQ,GAAG,EAAGA,GAAK;IAAA,GAAMD;EAAK,CAAI,CAAC;AACtE,CAAE,CAAC","ignoreList":[]}
|
|
@@ -58,7 +58,7 @@ function BlockMover({
|
|
|
58
58
|
isFirst: firstIndex === 0,
|
|
59
59
|
isLast: lastIndex === blockOrder.length - 1,
|
|
60
60
|
orientation: getBlockListSettings(_rootClientId)?.orientation,
|
|
61
|
-
isManualGrid: layout.type === 'grid' &&
|
|
61
|
+
isManualGrid: layout.type === 'grid' && layout.isManualPlacement && window.__experimentalEnableGridInteractivity
|
|
62
62
|
};
|
|
63
63
|
}, [clientIds]);
|
|
64
64
|
if (!canMove || isFirst && isLast && !rootClientId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","dragHandle","ToolbarGroup","ToolbarItem","Button","useSelect","__","BlockDraggable","BlockMoverUpButton","BlockMoverDownButton","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","BlockMover","clientIds","hideDragHandle","isBlockMoverUpButtonDisabled","isBlockMoverDownButtonDisabled","canMove","rootClientId","isFirst","isLast","orientation","isManualGrid","select","_getBlockAttributes","getBlockIndex","getBlockListSettings","canMoveBlocks","getBlockOrder","getBlockRootClientId","getBlockAttributes","normalizedClientIds","Array","isArray","firstClientId","_rootClientId","firstIndex","lastIndex","length","blockOrder","layout","type","
|
|
1
|
+
{"version":3,"names":["clsx","dragHandle","ToolbarGroup","ToolbarItem","Button","useSelect","__","BlockDraggable","BlockMoverUpButton","BlockMoverDownButton","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","BlockMover","clientIds","hideDragHandle","isBlockMoverUpButtonDisabled","isBlockMoverDownButtonDisabled","canMove","rootClientId","isFirst","isLast","orientation","isManualGrid","select","_getBlockAttributes","getBlockIndex","getBlockListSettings","canMoveBlocks","getBlockOrder","getBlockRootClientId","getBlockAttributes","normalizedClientIds","Array","isArray","firstClientId","_rootClientId","firstIndex","lastIndex","length","blockOrder","layout","type","isManualPlacement","window","__experimentalEnableGridInteractivity","className","children","fadeWhenDisabled","draggableProps","icon","label","tabIndex","itemProps","disabled"],"sources":["@wordpress/block-editor/src/components/block-mover/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\n\nimport { dragHandle } from '@wordpress/icons';\nimport { ToolbarGroup, ToolbarItem, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockDraggable from '../block-draggable';\nimport { BlockMoverUpButton, BlockMoverDownButton } from './button';\nimport { store as blockEditorStore } from '../../store';\n\nfunction BlockMover( {\n\tclientIds,\n\thideDragHandle,\n\tisBlockMoverUpButtonDisabled,\n\tisBlockMoverDownButtonDisabled,\n} ) {\n\tconst {\n\t\tcanMove,\n\t\trootClientId,\n\t\tisFirst,\n\t\tisLast,\n\t\torientation,\n\t\tisManualGrid,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tcanMoveBlocks,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockAttributes,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst normalizedClientIds = Array.isArray( clientIds )\n\t\t\t\t? clientIds\n\t\t\t\t: [ clientIds ];\n\t\t\tconst firstClientId = normalizedClientIds[ 0 ];\n\t\t\tconst _rootClientId = getBlockRootClientId( firstClientId );\n\t\t\tconst firstIndex = getBlockIndex( firstClientId );\n\t\t\tconst lastIndex = getBlockIndex(\n\t\t\t\tnormalizedClientIds[ normalizedClientIds.length - 1 ]\n\t\t\t);\n\t\t\tconst blockOrder = getBlockOrder( _rootClientId );\n\t\t\tconst { layout = {} } = getBlockAttributes( _rootClientId ) ?? {};\n\n\t\t\treturn {\n\t\t\t\tcanMove: canMoveBlocks( clientIds ),\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisFirst: firstIndex === 0,\n\t\t\t\tisLast: lastIndex === blockOrder.length - 1,\n\t\t\t\torientation: getBlockListSettings( _rootClientId )?.orientation,\n\t\t\t\tisManualGrid:\n\t\t\t\t\tlayout.type === 'grid' &&\n\t\t\t\t\tlayout.isManualPlacement &&\n\t\t\t\t\twindow.__experimentalEnableGridInteractivity,\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tif ( ! canMove || ( isFirst && isLast && ! rootClientId ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ToolbarGroup\n\t\t\tclassName={ clsx( 'block-editor-block-mover', {\n\t\t\t\t'is-horizontal': orientation === 'horizontal',\n\t\t\t} ) }\n\t\t>\n\t\t\t{ ! hideDragHandle && (\n\t\t\t\t<BlockDraggable clientIds={ clientIds } fadeWhenDisabled>\n\t\t\t\t\t{ ( draggableProps ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ dragHandle }\n\t\t\t\t\t\t\tclassName=\"block-editor-block-mover__drag-handle\"\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tlabel={ __( 'Drag' ) }\n\t\t\t\t\t\t\t// Should not be able to tab to drag handle as this\n\t\t\t\t\t\t\t// button can only be used with a pointer device.\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t{ ...draggableProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockDraggable>\n\t\t\t) }\n\t\t\t{ ! isManualGrid && (\n\t\t\t\t<div className=\"block-editor-block-mover__move-button-container\">\n\t\t\t\t\t<ToolbarItem>\n\t\t\t\t\t\t{ ( itemProps ) => (\n\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\tdisabled={ isBlockMoverUpButtonDisabled }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t{ ...itemProps }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolbarItem>\n\t\t\t\t\t<ToolbarItem>\n\t\t\t\t\t\t{ ( itemProps ) => (\n\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\tdisabled={ isBlockMoverDownButtonDisabled }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t{ ...itemProps }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolbarItem>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</ToolbarGroup>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-mover/README.md\n */\nexport default BlockMover;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;;AAEA,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,YAAY,EAAEC,WAAW,EAAEC,MAAM,QAAQ,uBAAuB;AACzE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,SAASC,kBAAkB,EAAEC,oBAAoB,QAAQ,UAAU;AACnE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAExD,SAASC,UAAUA,CAAE;EACpBC,SAAS;EACTC,cAAc;EACdC,4BAA4B;EAC5BC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,OAAO;IACPC,YAAY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OAAO,IAAME,OAAO,IAAIC,MAAM,IAAI,CAAEF,YAAc,EAAG;IAC3D,OAAO,IAAI;EACZ;EAEA,oBACCP,KAAA,CAACb,YAAY;IACZ+C,SAAS,EAAGjD,IAAI,CAAE,0BAA0B,EAAE;MAC7C,eAAe,EAAEyB,WAAW,KAAK;IAClC,CAAE,CAAG;IAAAyB,QAAA,GAEH,CAAEhC,cAAc,iBACjBL,IAAA,CAACN,cAAc;MAACU,SAAS,EAAGA,SAAW;MAACkC,gBAAgB;MAAAD,QAAA,EACnDE,cAAc,iBACjBvC,IAAA,CAACT,MAAM;QACNiD,IAAI,EAAGpD,UAAY;QACnBgD,SAAS,EAAC,uCAAuC;QACjD,eAAY,MAAM;QAClBK,KAAK,EAAGhD,EAAE,CAAE,MAAO;QACnB;QACA;QAAA;QACAiD,QAAQ,EAAC,IAAI;QAAA,GACRH;MAAc,CACnB;IACD,CACc,CAChB,EACC,CAAE1B,YAAY,iBACfX,KAAA;MAAKkC,SAAS,EAAC,iDAAiD;MAAAC,QAAA,gBAC/DrC,IAAA,CAACV,WAAW;QAAA+C,QAAA,EACPM,SAAS,iBACZ3C,IAAA,CAACL,kBAAkB;UAClBiD,QAAQ,EAAGtC,4BAA8B;UACzCF,SAAS,EAAGA,SAAW;UAAA,GAClBuC;QAAS,CACd;MACD,CACW,CAAC,eACd3C,IAAA,CAACV,WAAW;QAAA+C,QAAA,EACPM,SAAS,iBACZ3C,IAAA,CAACJ,oBAAoB;UACpBgD,QAAQ,EAAGrC,8BAAgC;UAC3CH,SAAS,EAAGA,SAAW;UAAA,GAClBuC;QAAS,CACd;MACD,CACW,CAAC;IAAA,CACV,CACL;EAAA,CACY,CAAC;AAEjB;;AAEA;AACA;AACA;AACA,eAAexC,UAAU","ignoreList":[]}
|
|
@@ -33,13 +33,13 @@ const CarouselNavigation = ({
|
|
|
33
33
|
label: __('Previous pattern'),
|
|
34
34
|
onClick: handlePrevious,
|
|
35
35
|
disabled: activeSlide === 0,
|
|
36
|
-
|
|
36
|
+
accessibleWhenDisabled: true
|
|
37
37
|
}), /*#__PURE__*/_jsx(Button, {
|
|
38
38
|
icon: chevronRight,
|
|
39
39
|
label: __('Next pattern'),
|
|
40
40
|
onClick: handleNext,
|
|
41
41
|
disabled: activeSlide === totalSlides - 1,
|
|
42
|
-
|
|
42
|
+
accessibleWhenDisabled: true
|
|
43
43
|
})]
|
|
44
44
|
});
|
|
45
45
|
const SetupToolbar = ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","Button","chevronRight","chevronLeft","grid","stretchFullWidth","VIEWMODES","jsx","_jsx","jsxs","_jsxs","Actions","onBlockPatternSelect","className","children","variant","onClick","CarouselNavigation","handlePrevious","handleNext","activeSlide","totalSlides","icon","label","disabled","
|
|
1
|
+
{"version":3,"names":["__","Button","chevronRight","chevronLeft","grid","stretchFullWidth","VIEWMODES","jsx","_jsx","jsxs","_jsxs","Actions","onBlockPatternSelect","className","children","variant","onClick","CarouselNavigation","handlePrevious","handleNext","activeSlide","totalSlides","icon","label","disabled","accessibleWhenDisabled","SetupToolbar","viewMode","setViewMode","isCarouselView","carousel","displayControls","isPressed"],"sources":["@wordpress/block-editor/src/components/block-pattern-setup/setup-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport {\n\tchevronRight,\n\tchevronLeft,\n\tgrid,\n\tstretchFullWidth,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { VIEWMODES } from './constants';\n\nconst Actions = ( { onBlockPatternSelect } ) => (\n\t<div className=\"block-editor-block-pattern-setup__actions\">\n\t\t<Button variant=\"primary\" onClick={ onBlockPatternSelect }>\n\t\t\t{ __( 'Choose' ) }\n\t\t</Button>\n\t</div>\n);\n\nconst CarouselNavigation = ( {\n\thandlePrevious,\n\thandleNext,\n\tactiveSlide,\n\ttotalSlides,\n} ) => (\n\t<div className=\"block-editor-block-pattern-setup__navigation\">\n\t\t<Button\n\t\t\ticon={ chevronLeft }\n\t\t\tlabel={ __( 'Previous pattern' ) }\n\t\t\tonClick={ handlePrevious }\n\t\t\tdisabled={ activeSlide === 0 }\n\t\t\taccessibleWhenDisabled\n\t\t/>\n\t\t<Button\n\t\t\ticon={ chevronRight }\n\t\t\tlabel={ __( 'Next pattern' ) }\n\t\t\tonClick={ handleNext }\n\t\t\tdisabled={ activeSlide === totalSlides - 1 }\n\t\t\taccessibleWhenDisabled\n\t\t/>\n\t</div>\n);\n\nconst SetupToolbar = ( {\n\tviewMode,\n\tsetViewMode,\n\thandlePrevious,\n\thandleNext,\n\tactiveSlide,\n\ttotalSlides,\n\tonBlockPatternSelect,\n} ) => {\n\tconst isCarouselView = viewMode === VIEWMODES.carousel;\n\tconst displayControls = (\n\t\t<div className=\"block-editor-block-pattern-setup__display-controls\">\n\t\t\t<Button\n\t\t\t\ticon={ stretchFullWidth }\n\t\t\t\tlabel={ __( 'Carousel view' ) }\n\t\t\t\tonClick={ () => setViewMode( VIEWMODES.carousel ) }\n\t\t\t\tisPressed={ isCarouselView }\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\ticon={ grid }\n\t\t\t\tlabel={ __( 'Grid view' ) }\n\t\t\t\tonClick={ () => setViewMode( VIEWMODES.grid ) }\n\t\t\t\tisPressed={ viewMode === VIEWMODES.grid }\n\t\t\t/>\n\t\t</div>\n\t);\n\treturn (\n\t\t<div className=\"block-editor-block-pattern-setup__toolbar\">\n\t\t\t{ isCarouselView && (\n\t\t\t\t<CarouselNavigation\n\t\t\t\t\thandlePrevious={ handlePrevious }\n\t\t\t\t\thandleNext={ handleNext }\n\t\t\t\t\tactiveSlide={ activeSlide }\n\t\t\t\t\ttotalSlides={ totalSlides }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ displayControls }\n\t\t\t{ isCarouselView && (\n\t\t\t\t<Actions onBlockPatternSelect={ onBlockPatternSelect } />\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\nexport default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W;EACXT;AACD,CAAC,KAAM;EACN,MAAMiB,cAAc,GAAGF,QAAQ,KAAKrB,SAAS,CAACwB,QAAQ;EACtD,MAAMC,eAAe,gBACpBrB,KAAA;IAAKG,SAAS,EAAC,oDAAoD;IAAAC,QAAA,gBAClEN,IAAA,CAACP,MAAM;MACNqB,IAAI,EAAGjB,gBAAkB;MACzBkB,KAAK,EAAGvB,EAAE,CAAE,eAAgB,CAAG;MAC/BgB,OAAO,EAAGA,CAAA,KAAMY,WAAW,CAAEtB,SAAS,CAACwB,QAAS,CAAG;MACnDE,SAAS,EAAGH;IAAgB,CAC5B,CAAC,eACFrB,IAAA,CAACP,MAAM;MACNqB,IAAI,EAAGlB,IAAM;MACbmB,KAAK,EAAGvB,EAAE,CAAE,WAAY,CAAG;MAC3BgB,OAAO,EAAGA,CAAA,KAAMY,WAAW,CAAEtB,SAAS,CAACF,IAAK,CAAG;MAC/C4B,SAAS,EAAGL,QAAQ,KAAKrB,SAAS,CAACF;IAAM,CACzC,CAAC;EAAA,CACE,CACL;EACD,oBACCM,KAAA;IAAKG,SAAS,EAAC,2CAA2C;IAAAC,QAAA,GACvDe,cAAc,iBACfrB,IAAA,CAACS,kBAAkB;MAClBC,cAAc,EAAGA,cAAgB;MACjCC,UAAU,EAAGA,UAAY;MACzBC,WAAW,EAAGA,WAAa;MAC3BC,WAAW,EAAGA;IAAa,CAC3B,CACD,EACCU,eAAe,EACfF,cAAc,iBACfrB,IAAA,CAACG,OAAO;MAACC,oBAAoB,EAAGA;IAAsB,CAAE,CACxD;EAAA,CACG,CAAC;AAER,CAAC;AAED,eAAec,YAAY","ignoreList":[]}
|
|
@@ -15,9 +15,7 @@ export default function Pagination({
|
|
|
15
15
|
className: "block-editor-patterns__grid-pagination-wrapper",
|
|
16
16
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
17
17
|
variant: "muted",
|
|
18
|
-
children:
|
|
19
|
-
// translators: %s: Total number of patterns.
|
|
20
|
-
sprintf(
|
|
18
|
+
children: sprintf(
|
|
21
19
|
// translators: %s: Total number of patterns.
|
|
22
20
|
_n('%s item', '%s items', totalItems), totalItems)
|
|
23
21
|
}), numPages > 1 && /*#__PURE__*/_jsxs(HStack, {
|
|
@@ -34,7 +32,7 @@ export default function Pagination({
|
|
|
34
32
|
onClick: () => changePage(1),
|
|
35
33
|
disabled: currentPage === 1,
|
|
36
34
|
"aria-label": __('First page'),
|
|
37
|
-
|
|
35
|
+
accessibleWhenDisabled: true,
|
|
38
36
|
children: /*#__PURE__*/_jsx("span", {
|
|
39
37
|
children: "\xAB"
|
|
40
38
|
})
|
|
@@ -43,7 +41,7 @@ export default function Pagination({
|
|
|
43
41
|
onClick: () => changePage(currentPage - 1),
|
|
44
42
|
disabled: currentPage === 1,
|
|
45
43
|
"aria-label": __('Previous page'),
|
|
46
|
-
|
|
44
|
+
accessibleWhenDisabled: true,
|
|
47
45
|
children: /*#__PURE__*/_jsx("span", {
|
|
48
46
|
children: "\u2039"
|
|
49
47
|
})
|
|
@@ -62,7 +60,7 @@ export default function Pagination({
|
|
|
62
60
|
onClick: () => changePage(currentPage + 1),
|
|
63
61
|
disabled: currentPage === numPages,
|
|
64
62
|
"aria-label": __('Next page'),
|
|
65
|
-
|
|
63
|
+
accessibleWhenDisabled: true,
|
|
66
64
|
children: /*#__PURE__*/_jsx("span", {
|
|
67
65
|
children: "\u203A"
|
|
68
66
|
})
|
|
@@ -72,7 +70,7 @@ export default function Pagination({
|
|
|
72
70
|
disabled: currentPage === numPages,
|
|
73
71
|
"aria-label": __('Last page'),
|
|
74
72
|
size: "default",
|
|
75
|
-
|
|
73
|
+
accessibleWhenDisabled: true,
|
|
76
74
|
children: /*#__PURE__*/_jsx("span", {
|
|
77
75
|
children: "\xBB"
|
|
78
76
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalVStack","VStack","__experimentalHStack","HStack","__experimentalText","Text","Button","__","_x","_n","sprintf","jsx","_jsx","jsxs","_jsxs","Pagination","currentPage","numPages","changePage","totalItems","className","children","variant","expanded","spacing","justify","onClick","disabled","
|
|
1
|
+
{"version":3,"names":["__experimentalVStack","VStack","__experimentalHStack","HStack","__experimentalText","Text","Button","__","_x","_n","sprintf","jsx","_jsx","jsxs","_jsxs","Pagination","currentPage","numPages","changePage","totalItems","className","children","variant","expanded","spacing","justify","onClick","disabled","accessibleWhenDisabled","size"],"sources":["@wordpress/block-editor/src/components/block-patterns-paging/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n} ) {\n\treturn (\n\t\t<VStack className=\"block-editor-patterns__grid-pagination-wrapper\">\n\t\t\t<Text variant=\"muted\">\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\ttotalItems\n\t\t\t\t) }\n\t\t\t</Text>\n\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<HStack\n\t\t\t\t\texpanded={ false }\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-previous\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'First page' ) }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>«</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage - 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'Previous page' ) }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>‹</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %1$s: Current page number, %2$s: Total number of pages.\n\t\t\t\t\t\t\t_x( '%1$s of %2$s', 'paging' ),\n\t\t\t\t\t\t\tcurrentPage,\n\t\t\t\t\t\t\tnumPages\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-next\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage + 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Next page' ) }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>›</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( numPages ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Last page' ) }\n\t\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\t\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