@wordpress/block-editor 13.1.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 +21 -17
- package/README.md +1 -2
- package/build/components/block-breadcrumb/index.js +12 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-lock/modal.js +67 -67
- package/build/components/block-lock/modal.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 +12 -6
- 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 +4 -1
- 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 +193 -127
- 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 +25 -9
- 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 +94 -0
- package/build/components/grid/grid-item-movers.js.map +1 -0
- package/build/components/{grid-visualizer → grid}/grid-item-resizer.js +18 -56
- package/build/components/grid/grid-item-resizer.js.map +1 -0
- package/build/components/grid/grid-visualizer.js +305 -0
- package/build/components/grid/grid-visualizer.js.map +1 -0
- package/build/components/{grid-visualizer → grid}/index.js +14 -0
- package/build/components/grid/index.js.map +1 -0
- package/build/components/grid/use-get-number-of-blocks-before-cell.js +40 -0
- package/build/components/grid/use-get-number-of-blocks-before-cell.js.map +1 -0
- package/build/components/grid/use-grid-layout-sync.js +169 -0
- package/build/components/grid/use-grid-layout-sync.js.map +1 -0
- package/build/components/grid/utils.js +145 -0
- package/build/components/grid/utils.js.map +1 -0
- package/build/components/image-editor/aspect-ratio-dropdown.js +0 -1
- package/build/components/image-editor/aspect-ratio-dropdown.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/rich-text/event-listeners/input-rules.js +1 -0
- package/build/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build/components/rich-text/index.native.js +10 -4
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +14 -0
- package/build/components/rich-text/native/index.native.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 +195 -11
- 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 +65 -40
- 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 +5 -2
- 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 +92 -76
- package/build/layouts/grid.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +6 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +17 -1
- package/build/store/actions.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/modal.js +67 -67
- package/build-module/components/block-lock/modal.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 +12 -6
- 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 +4 -1
- 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 +194 -128
- 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 +25 -9
- 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 +87 -0
- package/build-module/components/grid/grid-item-movers.js.map +1 -0
- package/build-module/components/{grid-visualizer → grid}/grid-item-resizer.js +13 -51
- package/build-module/components/grid/grid-item-resizer.js.map +1 -0
- package/build-module/components/grid/grid-visualizer.js +297 -0
- package/build-module/components/grid/grid-visualizer.js.map +1 -0
- package/build-module/components/grid/index.js +5 -0
- package/build-module/components/grid/index.js.map +1 -0
- package/build-module/components/grid/use-get-number-of-blocks-before-cell.js +33 -0
- package/build-module/components/grid/use-get-number-of-blocks-before-cell.js.map +1 -0
- package/build-module/components/grid/use-grid-layout-sync.js +162 -0
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -0
- package/build-module/components/grid/utils.js +131 -0
- package/build-module/components/grid/utils.js.map +1 -0
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +0 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.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/rich-text/event-listeners/input-rules.js +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +11 -5
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +14 -0
- package/build-module/components/rich-text/native/index.native.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 +193 -11
- 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 +63 -38
- 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 +5 -2
- 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 +92 -76
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.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/actions.js +17 -1
- package/build-module/store/actions.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 +238 -106
- package/build-style/style.css +238 -106
- package/package.json +32 -32
- package/src/components/block-breadcrumb/index.js +16 -1
- package/src/components/block-lock/modal.js +95 -82
- package/src/components/block-lock/style.scss +11 -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 +37 -24
- 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 +4 -1
- 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 +243 -160
- 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/test/use-global-styles-output.js +38 -3
- 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 +25 -9
- package/src/components/global-styles/utils.js +17 -6
- package/src/components/grid/grid-item-movers.js +112 -0
- package/src/components/{grid-visualizer → grid}/grid-item-resizer.js +15 -52
- package/src/components/grid/grid-visualizer.js +384 -0
- package/src/components/grid/index.js +4 -0
- package/src/components/grid/style.scss +98 -0
- package/src/components/grid/use-get-number-of-blocks-before-cell.js +30 -0
- package/src/components/grid/use-grid-layout-sync.js +170 -0
- package/src/components/grid/utils.js +178 -0
- package/src/components/iframe/content.scss +1 -0
- package/src/components/image-editor/aspect-ratio-dropdown.js +0 -1
- package/src/components/inner-blocks/index.js +4 -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/rich-text/event-listeners/input-rules.js +1 -1
- package/src/components/rich-text/index.native.js +10 -8
- package/src/components/rich-text/native/index.native.js +17 -0
- 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 +226 -9
- 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 +75 -39
- 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 +5 -1
- package/src/layouts/constrained.js +43 -2
- package/src/layouts/grid.js +175 -88
- package/src/lock-unlock.js +1 -1
- package/src/private-apis.js +12 -1
- package/src/store/actions.js +21 -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 +2 -2
- 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/build/components/grid-visualizer/grid-item-resizer.js.map +0 -1
- package/build/components/grid-visualizer/grid-visualizer.js +0 -92
- package/build/components/grid-visualizer/grid-visualizer.js.map +0 -1
- package/build/components/grid-visualizer/index.js.map +0 -1
- package/build/components/grid-visualizer/utils.js +0 -10
- package/build/components/grid-visualizer/utils.js.map +0 -1
- package/build-module/components/grid-visualizer/grid-item-resizer.js.map +0 -1
- package/build-module/components/grid-visualizer/grid-visualizer.js +0 -84
- package/build-module/components/grid-visualizer/grid-visualizer.js.map +0 -1
- package/build-module/components/grid-visualizer/index.js +0 -3
- package/build-module/components/grid-visualizer/index.js.map +0 -1
- package/build-module/components/grid-visualizer/utils.js +0 -4
- package/build-module/components/grid-visualizer/utils.js.map +0 -1
- package/src/components/grid-visualizer/grid-visualizer.js +0 -101
- package/src/components/grid-visualizer/index.js +0 -2
- package/src/components/grid-visualizer/style.scss +0 -34
- package/src/components/grid-visualizer/utils.js +0 -5
- package/src/hooks/position.scss +0 -18
- /package/src/components/font-sizes/{README.MD → README.md} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 13.3.0 (2024-07-10)
|
|
6
|
+
|
|
7
|
+
## 13.2.0 (2024-06-26)
|
|
8
|
+
|
|
5
9
|
## 13.1.0 (2024-06-15)
|
|
6
10
|
|
|
7
11
|
## 13.0.0 (2024-05-31)
|
|
@@ -80,7 +84,7 @@
|
|
|
80
84
|
|
|
81
85
|
- Add `HeadingLevelDropdown` component for selecting H1-H6 and paragraph HTML tags from the block toolbar.
|
|
82
86
|
|
|
83
|
-
### Bug
|
|
87
|
+
### Bug Fixes
|
|
84
88
|
|
|
85
89
|
- Fluid typography: custom font-sizes should use max viewport width ([#51516](https://github.com/WordPress/gutenberg/pull/51516)).
|
|
86
90
|
|
|
@@ -108,13 +112,13 @@
|
|
|
108
112
|
|
|
109
113
|
## 11.5.0 (2023-03-01)
|
|
110
114
|
|
|
111
|
-
### Bug
|
|
115
|
+
### Bug Fixes
|
|
112
116
|
|
|
113
117
|
- `SpacingSizesControl`: fix white dot on thumb ([#48574](https://github.com/WordPress/gutenberg/pull/48574)).
|
|
114
118
|
|
|
115
119
|
## 11.4.0 (2023-02-15)
|
|
116
120
|
|
|
117
|
-
### Bug
|
|
121
|
+
### Bug Fixes
|
|
118
122
|
|
|
119
123
|
- `LinkControl`: fix scrollbar displayed on toggle link settings ([#47986](https://github.com/WordPress/gutenberg/pull/47986)).
|
|
120
124
|
|
|
@@ -122,7 +126,7 @@
|
|
|
122
126
|
|
|
123
127
|
## 11.2.0 (2023-01-11)
|
|
124
128
|
|
|
125
|
-
### Bug
|
|
129
|
+
### Bug Fixes
|
|
126
130
|
|
|
127
131
|
- `BlockInspector`: Fix browser warning error when block is not selected ([#46875](https://github.com/WordPress/gutenberg/pull/46875)).
|
|
128
132
|
- Move component styles needed for iframes to content styles ([#47103](https://github.com/WordPress/gutenberg/pull/47103)).
|
|
@@ -143,33 +147,33 @@
|
|
|
143
147
|
- Fluid typography: add configurable fluid typography settings for minimum font size to theme.json ([#42489](https://github.com/WordPress/gutenberg/pull/42489)).
|
|
144
148
|
- `URLInput`: Add `__nextHasNoMarginBottom` prop for opting into the new margin-free styles ([46692](https://github.com/WordPress/gutenberg/pull/46692)).
|
|
145
149
|
|
|
146
|
-
### Bug
|
|
150
|
+
### Bug Fixes
|
|
147
151
|
|
|
148
152
|
- `SpacingSizesControl`: Change ARIA role from `region` to `group` to avoid unwanted ARIA landmark regions ([#46530](https://github.com/WordPress/gutenberg/pull/46530)).
|
|
149
153
|
- `FocalPointPicker`: Fix layout misalignment when placed in the `BlockInspector` ([#46631](https://github.com/WordPress/gutenberg/pull/46631)).
|
|
150
154
|
|
|
151
155
|
## 10.5.0 (2022-11-16)
|
|
152
156
|
|
|
153
|
-
###
|
|
157
|
+
### Enhancements
|
|
154
158
|
|
|
155
159
|
- `BlockLockModal`: Move Icon component out of CheckboxControl label ([#45535](https://github.com/WordPress/gutenberg/pull/45535))
|
|
156
160
|
- Fluid typography: adjust font size min and max rules ([#45536](https://github.com/WordPress/gutenberg/pull/45536)).
|
|
157
161
|
|
|
158
162
|
## 10.4.0 (2022-11-02)
|
|
159
163
|
|
|
160
|
-
### Bug
|
|
164
|
+
### Bug Fixes
|
|
161
165
|
|
|
162
166
|
- `InserterListItem`: Fix dragging and dropping in Firefox. ([#44631](https://github.com/WordPress/gutenberg/pull/44631))
|
|
163
167
|
|
|
164
168
|
## 10.3.0 (2022-10-19)
|
|
165
169
|
|
|
166
|
-
### Bug
|
|
170
|
+
### Bug Fixes
|
|
167
171
|
|
|
168
172
|
- `FontSizePicker`: Update fluid utils so that only string, floats and integers are treated as valid font sizes for the purposes of fluid typography ([#44847](https://github.com/WordPress/gutenberg/pull/44847))
|
|
169
173
|
- `getTypographyClassesAndStyles()`: Ensure that font sizes are transformed into fluid values if fluid typography is activated ([#44852](https://github.com/WordPress/gutenberg/pull/44852))
|
|
170
174
|
- `BlockPopover`: Ensure that padding and margin visualizers display in correct position even when scrolling past block. ([#44998](https://github.com/WordPress/gutenberg/pull/44998))
|
|
171
175
|
|
|
172
|
-
### New
|
|
176
|
+
### New Features
|
|
173
177
|
|
|
174
178
|
- You can now drop files/blocks/HTML on unmodified default blocks to transform them into corresponding blocks ([#44647](https://github.com/WordPress/gutenberg/pull/44647)).
|
|
175
179
|
|
|
@@ -179,7 +183,7 @@
|
|
|
179
183
|
|
|
180
184
|
## 10.0.0 (2022-09-13)
|
|
181
185
|
|
|
182
|
-
### Breaking
|
|
186
|
+
### Breaking Changes
|
|
183
187
|
|
|
184
188
|
- `FontSizePicker`: Deprecate bottom margin style. Add a `__nextHasNoMarginBottom` prop to start opting into the margin-free styles that will become the default in a future version, currently scheduled to be WordPress 6.4 ([#43870](https://github.com/WordPress/gutenberg/pull/43870)).
|
|
185
189
|
|
|
@@ -195,7 +199,7 @@
|
|
|
195
199
|
|
|
196
200
|
## 9.3.0 (2022-06-15)
|
|
197
201
|
|
|
198
|
-
### Bug
|
|
202
|
+
### Bug Fixes
|
|
199
203
|
|
|
200
204
|
- Fix focus trap on certain `input` elements when navigating within a block with the left/right arrow keys ([#41538](https://github.com/WordPress/gutenberg/pull/41538)).
|
|
201
205
|
|
|
@@ -205,7 +209,7 @@
|
|
|
205
209
|
|
|
206
210
|
## 9.0.0 (2022-05-04)
|
|
207
211
|
|
|
208
|
-
### Breaking
|
|
212
|
+
### Breaking Changes
|
|
209
213
|
|
|
210
214
|
- `BlockNavigationDropdown` is now deprecated. Use the `Dropdown` component from the `@wordpress/components` package and the `ListView` component from this package ([#40777](https://github.com/WordPress/gutenberg/pull/40777)).
|
|
211
215
|
- `ListView` no longer accepts the `__experimentalFeatures`, `__experimentalPersistentListViewFeatures`, `__experimentalHideContainerBlockActions`, and `showNestedBlocks` props. Passing additional undocumented props through to `ListView` is also now disallowed. ([#40777](https://github.com/WordPress/gutenberg/pull/40777)).
|
|
@@ -226,7 +230,7 @@
|
|
|
226
230
|
|
|
227
231
|
## 8.1.1 (2022-02-10)
|
|
228
232
|
|
|
229
|
-
### Bug
|
|
233
|
+
### Bug Fixes
|
|
230
234
|
|
|
231
235
|
- Removed unused `@wordpress/block-serialization-default-parser`, `css-mediaquery`, `memize` and `redux-multi` dependencies ([#38388](https://github.com/WordPress/gutenberg/pull/38388)).
|
|
232
236
|
|
|
@@ -243,13 +247,13 @@
|
|
|
243
247
|
- Avoid re-rendering all List View items on block focus [#35706](https://github.com/WordPress/gutenberg/pull/35706). When List View is open Block focus time is 4 times faster in large posts.
|
|
244
248
|
- Render fixed number of items in List View [#35706](https://github.com/WordPress/gutenberg/pull/35230). Opening List View is 13 times faster in large posts.
|
|
245
249
|
|
|
246
|
-
### Breaking
|
|
250
|
+
### Breaking Changes
|
|
247
251
|
|
|
248
252
|
- List View no longer supports the `showOnlyCurrentHierarchy` flag [#35706](https://github.com/WordPress/gutenberg/pull/35706). To display a subset of blocks, use the `blocks` parameter instead.
|
|
249
253
|
|
|
250
254
|
## 7.0.0 (2021-07-29)
|
|
251
255
|
|
|
252
|
-
### Breaking
|
|
256
|
+
### Breaking Changes
|
|
253
257
|
|
|
254
258
|
- Upgraded React components to work with v17.0 ([#29118](https://github.com/WordPress/gutenberg/pull/29118)). There are no new features in React v17.0 as explained in the [blog post](https://reactjs.org/blog/2020/10/20/react-v17.html).
|
|
255
259
|
|
|
@@ -274,7 +278,7 @@
|
|
|
274
278
|
|
|
275
279
|
## 5.2.0 (2020-12-17)
|
|
276
280
|
|
|
277
|
-
### New
|
|
281
|
+
### New Features
|
|
278
282
|
|
|
279
283
|
- Added a store definition `store` for the block editor namespace to use with `@wordpress/data` API ([#26655](https://github.com/WordPress/gutenberg/pull/26655)).
|
|
280
284
|
|
|
@@ -303,7 +307,7 @@
|
|
|
303
307
|
|
|
304
308
|
- Added a `label` prop to `URLInput`. This allows the label to be set without needing to wrap the `URLInput` in a `BaseControl`.
|
|
305
309
|
|
|
306
|
-
###
|
|
310
|
+
### Deprecations
|
|
307
311
|
|
|
308
312
|
- `dropZoneUIOnly` prop in `MediaPlaceholder` component has been deprecated in favor of `disableMediaButtons` prop.
|
|
309
313
|
|
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ In this example, we're instantiating a block editor. A block editor is composed
|
|
|
45
45
|
|
|
46
46
|
Inside `BlockEditorProvider`, you can nest any of the available `@wordpress/block-editor` UI components to build the UI of your editor.
|
|
47
47
|
|
|
48
|
-
In the example above we're rendering the `BlockList` to show and edit the block list. For instance we could add a custom sidebar and use the `BlockInspector` component to be able to edit the advanced settings for the currently selected block. (See the [API](#
|
|
48
|
+
In the example above we're rendering the `BlockList` to show and edit the block list. For instance we could add a custom sidebar and use the `BlockInspector` component to be able to edit the advanced settings for the currently selected block. (See the [API](#api) for the list of all the available components).
|
|
49
49
|
|
|
50
50
|
The `BlockTools` component is used to render the toolbar for a selected block.
|
|
51
51
|
|
|
@@ -780,7 +780,6 @@ _Properties_
|
|
|
780
780
|
- _\_\_experimentalBlockDirectory_ `boolean`: Whether the user has enabled the Block Directory
|
|
781
781
|
- _\_\_experimentalBlockPatterns_ `Array`: Array of objects representing the block patterns
|
|
782
782
|
- _\_\_experimentalBlockPatternCategories_ `Array`: Array of objects representing the block pattern categories
|
|
783
|
-
- _\_\_unstableGalleryWithImageBlocks_ `boolean`: Whether the user has enabled the refactored gallery block which uses InnerBlocks
|
|
784
783
|
|
|
785
784
|
### SkipToSelectedBlock
|
|
786
785
|
|
|
@@ -12,6 +12,8 @@ var _icons = require("@wordpress/icons");
|
|
|
12
12
|
var _blockTitle = _interopRequireDefault(require("../block-title"));
|
|
13
13
|
var _store = require("../../store");
|
|
14
14
|
var _lockUnlock = require("../../lock-unlock");
|
|
15
|
+
var _useBlockRefs = require("../block-list/use-block-props/use-block-refs");
|
|
16
|
+
var _getEditorRegion = _interopRequireDefault(require("../../utils/get-editor-region"));
|
|
15
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
18
|
/**
|
|
17
19
|
* WordPress dependencies
|
|
@@ -53,6 +55,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
53
55
|
}, []);
|
|
54
56
|
const rootLabel = rootLabelText || (0, _i18n.__)('Document');
|
|
55
57
|
|
|
58
|
+
// We don't care about this specific ref, but this is a way
|
|
59
|
+
// to get a ref within the editor canvas so we can focus it later.
|
|
60
|
+
const blockRef = (0, _useBlockRefs.__unstableUseBlockRef)(clientId);
|
|
61
|
+
|
|
56
62
|
/*
|
|
57
63
|
* Disable reason: The `list` ARIA role is redundant but
|
|
58
64
|
* Safari+VoiceOver won't announce the list otherwise.
|
|
@@ -68,7 +74,12 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
68
74
|
children: [hasSelection && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
69
75
|
className: "block-editor-block-breadcrumb__button",
|
|
70
76
|
variant: "tertiary",
|
|
71
|
-
onClick:
|
|
77
|
+
onClick: () => {
|
|
78
|
+
// Find the block editor wrapper for the selected block
|
|
79
|
+
const blockEditor = blockRef.current?.closest('.editor-styles-wrapper');
|
|
80
|
+
clearSelectedBlock();
|
|
81
|
+
(0, _getEditorRegion.default)(blockEditor)?.focus();
|
|
82
|
+
},
|
|
72
83
|
children: rootLabel
|
|
73
84
|
}), !hasSelection && rootLabel, !!clientId && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
|
|
74
85
|
icon: _icons.chevronRightSmall,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_i18n","_icons","_blockTitle","_interopRequireDefault","_store","_lockUnlock","_jsxRuntime","BlockBreadcrumb","rootLabelText","selectBlock","clearSelectedBlock","useDispatch","blockEditorStore","clientId","parents","hasSelection","useSelect","select","getSelectionStart","getSelectedBlockClientId","getEnabledBlockParents","unlock","selectedBlockClientId","rootLabel","__","jsxs","className","role","children","undefined","jsx","Button","variant","onClick","Icon","icon","chevronRightSmall","map","parentClientId","default","maximumLength","_default","exports"],"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":["_components","require","_data","_i18n","_icons","_blockTitle","_interopRequireDefault","_store","_lockUnlock","_useBlockRefs","_getEditorRegion","_jsxRuntime","BlockBreadcrumb","rootLabelText","selectBlock","clearSelectedBlock","useDispatch","blockEditorStore","clientId","parents","hasSelection","useSelect","select","getSelectionStart","getSelectedBlockClientId","getEnabledBlockParents","unlock","selectedBlockClientId","rootLabel","__","blockRef","useBlockRef","jsxs","className","role","children","undefined","jsx","Button","variant","onClick","blockEditor","current","closest","getEditorRegion","focus","Icon","icon","chevronRightSmall","map","parentClientId","default","maximumLength","_default","exports"],"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":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OA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A;MACCJ,SAAS,EAAC,wCAAwC;MAClD,gBAAa,MAAM;MAAAE,QAAA,eAEnB,IAAAxB,WAAA,CAAA0B,GAAA,EAAChC,WAAA,CAAA8C,OAAU;QAACjC,QAAQ,EAAGA,QAAU;QAACkC,aAAa,EAAG;MAAI,CAAE;IAAC,CACtD,CACJ;EAAA,CACE;EACJ;AAEF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEcvC,eAAe","ignoreList":[]}
|
|
@@ -9,7 +9,6 @@ var _i18n = require("@wordpress/i18n");
|
|
|
9
9
|
var _element = require("@wordpress/element");
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
11
|
var _icons = require("@wordpress/icons");
|
|
12
|
-
var _compose = require("@wordpress/compose");
|
|
13
12
|
var _data = require("@wordpress/data");
|
|
14
13
|
var _blocks = require("@wordpress/blocks");
|
|
15
14
|
var _useBlockLock = _interopRequireDefault(require("./use-block-lock"));
|
|
@@ -73,7 +72,6 @@ function BlockLockModal({
|
|
|
73
72
|
updateBlockAttributes
|
|
74
73
|
} = (0, _data.useDispatch)(_store.store);
|
|
75
74
|
const blockInformation = (0, _useBlockDisplayInformation.default)(clientId);
|
|
76
|
-
const instanceId = (0, _compose.useInstanceId)(BlockLockModal, 'block-editor-block-lock-modal__options-title');
|
|
77
75
|
(0, _element.useEffect)(() => {
|
|
78
76
|
setLock({
|
|
79
77
|
move: !canMove,
|
|
@@ -85,14 +83,12 @@ function BlockLockModal({
|
|
|
85
83
|
}, [canEdit, canMove, canRemove, allowsEditLocking]);
|
|
86
84
|
const isAllChecked = Object.values(lock).every(Boolean);
|
|
87
85
|
const isMixed = Object.values(lock).some(Boolean) && !isAllChecked;
|
|
88
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
86
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Modal, {
|
|
89
87
|
title: (0, _i18n.sprintf)( /* translators: %s: Name of the block. */
|
|
90
88
|
(0, _i18n.__)('Lock %s'), blockInformation.title),
|
|
91
89
|
overlayClassName: "block-editor-block-lock-modal",
|
|
92
90
|
onRequestClose: onClose,
|
|
93
|
-
children:
|
|
94
|
-
children: (0, _i18n.__)('Choose specific attributes to restrict or lock all available options.')
|
|
95
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("form", {
|
|
91
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("form", {
|
|
96
92
|
onSubmit: event => {
|
|
97
93
|
event.preventDefault();
|
|
98
94
|
updateBlockAttributes([clientId], {
|
|
@@ -101,71 +97,75 @@ function BlockLockModal({
|
|
|
101
97
|
});
|
|
102
98
|
onClose();
|
|
103
99
|
},
|
|
104
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("
|
|
105
|
-
role: "group",
|
|
106
|
-
"aria-labelledby": instanceId,
|
|
100
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("fieldset", {
|
|
107
101
|
className: "block-editor-block-lock-modal__options",
|
|
108
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
id: instanceId,
|
|
113
|
-
children: (0, _i18n.__)('Lock all')
|
|
114
|
-
}),
|
|
115
|
-
checked: isAllChecked,
|
|
116
|
-
indeterminate: isMixed,
|
|
117
|
-
onChange: newValue => setLock({
|
|
118
|
-
move: newValue,
|
|
119
|
-
remove: newValue,
|
|
120
|
-
...(allowsEditLocking ? {
|
|
121
|
-
edit: newValue
|
|
122
|
-
} : {})
|
|
123
|
-
})
|
|
124
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
102
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("legend", {
|
|
103
|
+
children: (0, _i18n.__)('Choose specific attributes to restrict or lock all available options.')
|
|
104
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
105
|
+
role: "list",
|
|
125
106
|
className: "block-editor-block-lock-modal__checklist",
|
|
126
|
-
children:
|
|
127
|
-
className: "block-editor-block-lock-modal__checklist-item",
|
|
128
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
|
|
129
|
-
__nextHasNoMarginBottom: true,
|
|
130
|
-
label: (0, _i18n.__)('Restrict editing'),
|
|
131
|
-
checked: !!lock.edit,
|
|
132
|
-
onChange: edit => setLock(prevLock => ({
|
|
133
|
-
...prevLock,
|
|
134
|
-
edit
|
|
135
|
-
}))
|
|
136
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
137
|
-
className: "block-editor-block-lock-modal__lock-icon",
|
|
138
|
-
icon: lock.edit ? _icons.lock : _icons.unlock
|
|
139
|
-
})]
|
|
140
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
141
|
-
className: "block-editor-block-lock-modal__checklist-item",
|
|
107
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
142
108
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
|
|
143
109
|
__nextHasNoMarginBottom: true,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
110
|
+
className: "block-editor-block-lock-modal__options-all",
|
|
111
|
+
label: (0, _i18n.__)('Lock all'),
|
|
112
|
+
checked: isAllChecked,
|
|
113
|
+
indeterminate: isMixed,
|
|
114
|
+
onChange: newValue => setLock({
|
|
115
|
+
move: newValue,
|
|
116
|
+
remove: newValue,
|
|
117
|
+
...(allowsEditLocking ? {
|
|
118
|
+
edit: newValue
|
|
119
|
+
} : {})
|
|
120
|
+
})
|
|
121
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
122
|
+
role: "list",
|
|
123
|
+
className: "block-editor-block-lock-modal__checklist",
|
|
124
|
+
children: [allowsEditLocking && /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
125
|
+
className: "block-editor-block-lock-modal__checklist-item",
|
|
126
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
|
|
127
|
+
__nextHasNoMarginBottom: true,
|
|
128
|
+
label: (0, _i18n.__)('Restrict editing'),
|
|
129
|
+
checked: !!lock.edit,
|
|
130
|
+
onChange: edit => setLock(prevLock => ({
|
|
131
|
+
...prevLock,
|
|
132
|
+
edit
|
|
133
|
+
}))
|
|
134
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
135
|
+
className: "block-editor-block-lock-modal__lock-icon",
|
|
136
|
+
icon: lock.edit ? _icons.lock : _icons.unlock
|
|
137
|
+
})]
|
|
138
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
139
|
+
className: "block-editor-block-lock-modal__checklist-item",
|
|
140
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
|
|
141
|
+
__nextHasNoMarginBottom: true,
|
|
142
|
+
label: (0, _i18n.__)('Disable movement'),
|
|
143
|
+
checked: lock.move,
|
|
144
|
+
onChange: move => setLock(prevLock => ({
|
|
145
|
+
...prevLock,
|
|
146
|
+
move
|
|
147
|
+
}))
|
|
148
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
149
|
+
className: "block-editor-block-lock-modal__lock-icon",
|
|
150
|
+
icon: lock.move ? _icons.lock : _icons.unlock
|
|
151
|
+
})]
|
|
152
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
153
|
+
className: "block-editor-block-lock-modal__checklist-item",
|
|
154
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
|
|
155
|
+
__nextHasNoMarginBottom: true,
|
|
156
|
+
label: (0, _i18n.__)('Prevent removal'),
|
|
157
|
+
checked: lock.remove,
|
|
158
|
+
onChange: remove => setLock(prevLock => ({
|
|
159
|
+
...prevLock,
|
|
160
|
+
remove
|
|
161
|
+
}))
|
|
162
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
163
|
+
className: "block-editor-block-lock-modal__lock-icon",
|
|
164
|
+
icon: lock.remove ? _icons.lock : _icons.unlock
|
|
165
|
+
})]
|
|
166
|
+
})]
|
|
153
167
|
})]
|
|
154
|
-
})
|
|
155
|
-
className: "block-editor-block-lock-modal__checklist-item",
|
|
156
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
|
|
157
|
-
__nextHasNoMarginBottom: true,
|
|
158
|
-
label: (0, _i18n.__)('Prevent removal'),
|
|
159
|
-
checked: lock.remove,
|
|
160
|
-
onChange: remove => setLock(prevLock => ({
|
|
161
|
-
...prevLock,
|
|
162
|
-
remove
|
|
163
|
-
}))
|
|
164
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
165
|
-
className: "block-editor-block-lock-modal__lock-icon",
|
|
166
|
-
icon: lock.remove ? _icons.lock : _icons.unlock
|
|
167
|
-
})]
|
|
168
|
-
})]
|
|
168
|
+
})
|
|
169
169
|
}), hasTemplateLock && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
170
170
|
__nextHasNoMarginBottom: true,
|
|
171
171
|
className: "block-editor-block-lock-modal__template-lock",
|
|
@@ -192,7 +192,7 @@ function BlockLockModal({
|
|
|
192
192
|
})
|
|
193
193
|
})]
|
|
194
194
|
})]
|
|
195
|
-
})
|
|
195
|
+
})
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
//# sourceMappingURL=modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_element","_components","_icons","_compose","_data","_blocks","_useBlockLock","_interopRequireDefault","_useBlockDisplayInformation","_store","_jsxRuntime","ALLOWS_EDIT_LOCKING","getTemplateLockValue","lock","remove","move","BlockLockModal","clientId","onClose","setLock","useState","canEdit","canMove","canRemove","useBlockLock","allowsEditLocking","templateLock","hasTemplateLock","useSelect","select","getBlockName","getBlockAttributes","blockEditorStore","blockName","blockType","getBlockType","includes","attributes","applyTemplateLock","setApplyTemplateLock","updateBlockAttributes","useDispatch","blockInformation","useBlockDisplayInformation","instanceId","useInstanceId","useEffect","edit","isAllChecked","Object","values","every","Boolean","isMixed","some","jsxs","Modal","title","sprintf","__","overlayClassName","onRequestClose","children","jsx","onSubmit","event","preventDefault","undefined","role","className","CheckboxControl","__nextHasNoMarginBottom","label","id","checked","indeterminate","onChange","newValue","prevLock","Icon","icon","lockIcon","unlockIcon","ToggleControl","disabled","Flex","justify","expanded","FlexItem","Button","variant","onClick","type"],"sources":["@wordpress/block-editor/src/components/block-lock/modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tCheckboxControl,\n\tFlex,\n\tFlexItem,\n\tIcon,\n\tModal,\n\tToggleControl,\n} from '@wordpress/components';\nimport { lock as lockIcon, unlock as unlockIcon } from '@wordpress/icons';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport useBlockLock from './use-block-lock';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { store as blockEditorStore } from '../../store';\n\n// Entity based blocks which allow edit locking\nconst ALLOWS_EDIT_LOCKING = [ 'core/block', 'core/navigation' ];\n\nfunction getTemplateLockValue( lock ) {\n\t// Prevents all operations.\n\tif ( lock.remove && lock.move ) {\n\t\treturn 'all';\n\t}\n\n\t// Prevents inserting or removing blocks, but allows moving existing blocks.\n\tif ( lock.remove && ! lock.move ) {\n\t\treturn 'insert';\n\t}\n\n\treturn false;\n}\n\nexport default function BlockLockModal( { clientId, onClose } ) {\n\tconst [ lock, setLock ] = useState( { move: false, remove: false } );\n\tconst { canEdit, canMove, canRemove } = useBlockLock( clientId );\n\tconst { allowsEditLocking, templateLock, hasTemplateLock } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\n\t\t\treturn {\n\t\t\t\tallowsEditLocking: ALLOWS_EDIT_LOCKING.includes( blockName ),\n\t\t\t\ttemplateLock: getBlockAttributes( clientId )?.templateLock,\n\t\t\t\thasTemplateLock: !! blockType?.attributes?.templateLock,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst [ applyTemplateLock, setApplyTemplateLock ] = useState(\n\t\t!! templateLock\n\t);\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst instanceId = useInstanceId(\n\t\tBlockLockModal,\n\t\t'block-editor-block-lock-modal__options-title'\n\t);\n\n\tuseEffect( () => {\n\t\tsetLock( {\n\t\t\tmove: ! canMove,\n\t\t\tremove: ! canRemove,\n\t\t\t...( allowsEditLocking ? { edit: ! canEdit } : {} ),\n\t\t} );\n\t}, [ canEdit, canMove, canRemove, allowsEditLocking ] );\n\n\tconst isAllChecked = Object.values( lock ).every( Boolean );\n\tconst isMixed = Object.values( lock ).some( Boolean ) && ! isAllChecked;\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ sprintf(\n\t\t\t\t/* translators: %s: Name of the block. */\n\t\t\t\t__( 'Lock %s' ),\n\t\t\t\tblockInformation.title\n\t\t\t) }\n\t\t\toverlayClassName=\"block-editor-block-lock-modal\"\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Choose specific attributes to restrict or lock all available options.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tupdateBlockAttributes( [ clientId ], {\n\t\t\t\t\t\tlock,\n\t\t\t\t\t\ttemplateLock: applyTemplateLock\n\t\t\t\t\t\t\t? getTemplateLockValue( lock )\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} );\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\trole=\"group\"\n\t\t\t\t\taria-labelledby={ instanceId }\n\t\t\t\t\tclassName=\"block-editor-block-lock-modal__options\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__options-title\"\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t<span id={ instanceId }>{ __( 'Lock all' ) }</span>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchecked={ isAllChecked }\n\t\t\t\t\t\tindeterminate={ isMixed }\n\t\t\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\t\t\tsetLock( {\n\t\t\t\t\t\t\t\tmove: newValue,\n\t\t\t\t\t\t\t\tremove: newValue,\n\t\t\t\t\t\t\t\t...( allowsEditLocking\n\t\t\t\t\t\t\t\t\t? { edit: newValue }\n\t\t\t\t\t\t\t\t\t: {} ),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<ul className=\"block-editor-block-lock-modal__checklist\">\n\t\t\t\t\t\t{ allowsEditLocking && (\n\t\t\t\t\t\t\t<li className=\"block-editor-block-lock-modal__checklist-item\">\n\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Restrict editing' ) }\n\t\t\t\t\t\t\t\t\tchecked={ !! lock.edit }\n\t\t\t\t\t\t\t\t\tonChange={ ( edit ) =>\n\t\t\t\t\t\t\t\t\t\tsetLock( ( prevLock ) => ( {\n\t\t\t\t\t\t\t\t\t\t\t...prevLock,\n\t\t\t\t\t\t\t\t\t\t\tedit,\n\t\t\t\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__lock-icon\"\n\t\t\t\t\t\t\t\t\ticon={ lock.edit ? lockIcon : unlockIcon }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<li className=\"block-editor-block-lock-modal__checklist-item\">\n\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Disable movement' ) }\n\t\t\t\t\t\t\t\tchecked={ lock.move }\n\t\t\t\t\t\t\t\tonChange={ ( move ) =>\n\t\t\t\t\t\t\t\t\tsetLock( ( prevLock ) => ( {\n\t\t\t\t\t\t\t\t\t\t...prevLock,\n\t\t\t\t\t\t\t\t\t\tmove,\n\t\t\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__lock-icon\"\n\t\t\t\t\t\t\t\ticon={ lock.move ? lockIcon : unlockIcon }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li className=\"block-editor-block-lock-modal__checklist-item\">\n\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Prevent removal' ) }\n\t\t\t\t\t\t\t\tchecked={ lock.remove }\n\t\t\t\t\t\t\t\tonChange={ ( remove ) =>\n\t\t\t\t\t\t\t\t\tsetLock( ( prevLock ) => ( {\n\t\t\t\t\t\t\t\t\t\t...prevLock,\n\t\t\t\t\t\t\t\t\t\tremove,\n\t\t\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__lock-icon\"\n\t\t\t\t\t\t\t\ticon={ lock.remove ? lockIcon : unlockIcon }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t\t{ hasTemplateLock && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__template-lock\"\n\t\t\t\t\t\t\tlabel={ __( 'Apply to all blocks inside' ) }\n\t\t\t\t\t\t\tchecked={ applyTemplateLock }\n\t\t\t\t\t\t\tdisabled={ lock.move && ! lock.remove }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetApplyTemplateLock( ! applyTemplateLock )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<Flex\n\t\t\t\t\tclassName=\"block-editor-block-lock-modal__actions\"\n\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\texpanded={ false }\n\t\t\t\t>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;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ACR,IAAApD,WAAA,CAAAqD,GAAA,EAAC9D,WAAA,CAAAwF,MAAM;YAACC,OAAO,EAAC,UAAU;YAACC,OAAO,EAAGzE,OAAS;YAAA4C,QAAA,EAC3C,IAAAH,QAAE,EAAE,QAAS;UAAC,CACT;QAAC,CACA,CAAC,eACX,IAAAjD,WAAA,CAAAqD,GAAA,EAAC9D,WAAA,CAAAuF,QAAQ;UAAA1B,QAAA,eACR,IAAApD,WAAA,CAAAqD,GAAA,EAAC9D,WAAA,CAAAwF,MAAM;YAACC,OAAO,EAAC,SAAS;YAACE,IAAI,EAAC,QAAQ;YAAA9B,QAAA,EACpC,IAAAH,QAAE,EAAE,OAAQ;UAAC,CACR;QAAC,CACA,CAAC;MAAA,CACN,CAAC;IAAA,CACF,CAAC;EAAA,CACD,CAAC;AAEV","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_components","_icons","_data","_blocks","_useBlockLock","_interopRequireDefault","_useBlockDisplayInformation","_store","_jsxRuntime","ALLOWS_EDIT_LOCKING","getTemplateLockValue","lock","remove","move","BlockLockModal","clientId","onClose","setLock","useState","canEdit","canMove","canRemove","useBlockLock","allowsEditLocking","templateLock","hasTemplateLock","useSelect","select","getBlockName","getBlockAttributes","blockEditorStore","blockName","blockType","getBlockType","includes","attributes","applyTemplateLock","setApplyTemplateLock","updateBlockAttributes","useDispatch","blockInformation","useBlockDisplayInformation","useEffect","edit","isAllChecked","Object","values","every","Boolean","isMixed","some","jsx","Modal","title","sprintf","__","overlayClassName","onRequestClose","children","jsxs","onSubmit","event","preventDefault","undefined","className","role","CheckboxControl","__nextHasNoMarginBottom","label","checked","indeterminate","onChange","newValue","prevLock","Icon","icon","lockIcon","unlockIcon","ToggleControl","disabled","Flex","justify","expanded","FlexItem","Button","variant","onClick","type"],"sources":["@wordpress/block-editor/src/components/block-lock/modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tCheckboxControl,\n\tFlex,\n\tFlexItem,\n\tIcon,\n\tModal,\n\tToggleControl,\n} from '@wordpress/components';\nimport { lock as lockIcon, unlock as unlockIcon } from '@wordpress/icons';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport useBlockLock from './use-block-lock';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { store as blockEditorStore } from '../../store';\n\n// Entity based blocks which allow edit locking\nconst ALLOWS_EDIT_LOCKING = [ 'core/block', 'core/navigation' ];\n\nfunction getTemplateLockValue( lock ) {\n\t// Prevents all operations.\n\tif ( lock.remove && lock.move ) {\n\t\treturn 'all';\n\t}\n\n\t// Prevents inserting or removing blocks, but allows moving existing blocks.\n\tif ( lock.remove && ! lock.move ) {\n\t\treturn 'insert';\n\t}\n\n\treturn false;\n}\n\nexport default function BlockLockModal( { clientId, onClose } ) {\n\tconst [ lock, setLock ] = useState( { move: false, remove: false } );\n\tconst { canEdit, canMove, canRemove } = useBlockLock( clientId );\n\tconst { allowsEditLocking, templateLock, hasTemplateLock } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\n\t\t\treturn {\n\t\t\t\tallowsEditLocking: ALLOWS_EDIT_LOCKING.includes( blockName ),\n\t\t\t\ttemplateLock: getBlockAttributes( clientId )?.templateLock,\n\t\t\t\thasTemplateLock: !! blockType?.attributes?.templateLock,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst [ applyTemplateLock, setApplyTemplateLock ] = useState(\n\t\t!! templateLock\n\t);\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\n\tuseEffect( () => {\n\t\tsetLock( {\n\t\t\tmove: ! canMove,\n\t\t\tremove: ! canRemove,\n\t\t\t...( allowsEditLocking ? { edit: ! canEdit } : {} ),\n\t\t} );\n\t}, [ canEdit, canMove, canRemove, allowsEditLocking ] );\n\n\tconst isAllChecked = Object.values( lock ).every( Boolean );\n\tconst isMixed = Object.values( lock ).some( Boolean ) && ! isAllChecked;\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ sprintf(\n\t\t\t\t/* translators: %s: Name of the block. */\n\t\t\t\t__( 'Lock %s' ),\n\t\t\t\tblockInformation.title\n\t\t\t) }\n\t\t\toverlayClassName=\"block-editor-block-lock-modal\"\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tupdateBlockAttributes( [ clientId ], {\n\t\t\t\t\t\tlock,\n\t\t\t\t\t\ttemplateLock: applyTemplateLock\n\t\t\t\t\t\t\t? getTemplateLockValue( lock )\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} );\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<fieldset className=\"block-editor-block-lock-modal__options\">\n\t\t\t\t\t<legend>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Choose specific attributes to restrict or lock all available options.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</legend>\n\t\t\t\t\t{ /*\n\t\t\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t\t\t */\n\t\t\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t<ul\n\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__checklist\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__options-all\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Lock all' ) }\n\t\t\t\t\t\t\t\tchecked={ isAllChecked }\n\t\t\t\t\t\t\t\tindeterminate={ isMixed }\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) =>\n\t\t\t\t\t\t\t\t\tsetLock( {\n\t\t\t\t\t\t\t\t\t\tmove: newValue,\n\t\t\t\t\t\t\t\t\t\tremove: newValue,\n\t\t\t\t\t\t\t\t\t\t...( allowsEditLocking\n\t\t\t\t\t\t\t\t\t\t\t? { edit: newValue }\n\t\t\t\t\t\t\t\t\t\t\t: {} ),\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ul\n\t\t\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__checklist\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ allowsEditLocking && (\n\t\t\t\t\t\t\t\t\t<li className=\"block-editor-block-lock-modal__checklist-item\">\n\t\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Restrict editing' ) }\n\t\t\t\t\t\t\t\t\t\t\tchecked={ !! lock.edit }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( edit ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetLock( ( prevLock ) => ( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t...prevLock,\n\t\t\t\t\t\t\t\t\t\t\t\t\tedit,\n\t\t\t\t\t\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__lock-icon\"\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tlock.edit\n\t\t\t\t\t\t\t\t\t\t\t\t\t? lockIcon\n\t\t\t\t\t\t\t\t\t\t\t\t\t: unlockIcon\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<li className=\"block-editor-block-lock-modal__checklist-item\">\n\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Disable movement' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ lock.move }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( move ) =>\n\t\t\t\t\t\t\t\t\t\t\tsetLock( ( prevLock ) => ( {\n\t\t\t\t\t\t\t\t\t\t\t\t...prevLock,\n\t\t\t\t\t\t\t\t\t\t\t\tmove,\n\t\t\t\t\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__lock-icon\"\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tlock.move ? lockIcon : unlockIcon\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t<li className=\"block-editor-block-lock-modal__checklist-item\">\n\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Prevent removal' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ lock.remove }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( remove ) =>\n\t\t\t\t\t\t\t\t\t\t\tsetLock( ( prevLock ) => ( {\n\t\t\t\t\t\t\t\t\t\t\t\t...prevLock,\n\t\t\t\t\t\t\t\t\t\t\t\tremove,\n\t\t\t\t\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__lock-icon\"\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tlock.remove ? lockIcon : unlockIcon\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t\t\t{ hasTemplateLock && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tclassName=\"block-editor-block-lock-modal__template-lock\"\n\t\t\t\t\t\t\tlabel={ __( 'Apply to all blocks inside' ) }\n\t\t\t\t\t\t\tchecked={ applyTemplateLock }\n\t\t\t\t\t\t\tdisabled={ lock.move && ! lock.remove }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetApplyTemplateLock( ! applyTemplateLock )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</fieldset>\n\t\t\t\t<Flex\n\t\t\t\t\tclassName=\"block-editor-block-lock-modal__actions\"\n\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\texpanded={ false }\n\t\t\t\t>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\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CAAAmD,IAAA,EAAC3D,WAAA,CAAAgF,IAAI;QACJhB,SAAS,EAAC,wCAAwC;QAClDiB,OAAO,EAAC,UAAU;QAClBC,QAAQ,EAAG,KAAO;QAAAxB,QAAA,gBAElB,IAAAlD,WAAA,CAAA2C,GAAA,EAACnD,WAAA,CAAAmF,QAAQ;UAAAzB,QAAA,eACR,IAAAlD,WAAA,CAAA2C,GAAA,EAACnD,WAAA,CAAAoF,MAAM;YAACC,OAAO,EAAC,UAAU;YAACC,OAAO,EAAGtE,OAAS;YAAA0C,QAAA,EAC3C,IAAAH,QAAE,EAAE,QAAS;UAAC,CACT;QAAC,CACA,CAAC,eACX,IAAA/C,WAAA,CAAA2C,GAAA,EAACnD,WAAA,CAAAmF,QAAQ;UAAAzB,QAAA,eACR,IAAAlD,WAAA,CAAA2C,GAAA,EAACnD,WAAA,CAAAoF,MAAM;YAACC,OAAO,EAAC,SAAS;YAACE,IAAI,EAAC,QAAQ;YAAA7B,QAAA,EACpC,IAAAH,QAAE,EAAE,OAAQ;UAAC,CACR;QAAC,CACA,CAAC;MAAA,CACN,CAAC;IAAA,CACF;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
|
|
@@ -51,7 +51,6 @@ function BlockLockToolbar({
|
|
|
51
51
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarGroup, {
|
|
52
52
|
className: "block-editor-block-lock-toolbar",
|
|
53
53
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
|
|
54
|
-
accessibleWhenDisabled: true,
|
|
55
54
|
disabled: !canLock,
|
|
56
55
|
icon: isLocked ? _icons.lock : _icons.unlock,
|
|
57
56
|
label: label,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_element","_icons","_modal","_interopRequireDefault","_useBlockLock","_jsxRuntime","BlockLockToolbar","clientId","canLock","isLocked","useBlockLock","isModalOpen","toggleModal","useReducer","isActive","hasLockButtonShown","useRef","useEffect","current","label","__","jsxs","Fragment","children","jsx","ToolbarGroup","className","ToolbarButton","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_element","_icons","_modal","_interopRequireDefault","_useBlockLock","_jsxRuntime","BlockLockToolbar","clientId","canLock","isLocked","useBlockLock","isModalOpen","toggleModal","useReducer","isActive","hasLockButtonShown","useRef","useEffect","current","label","__","jsxs","Fragment","children","jsx","ToolbarGroup","className","ToolbarButton","disabled","icon","lock","unlock","onClick","default","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\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,aAAA,GAAAD,sBAAA,CAAAL,OAAA;AAA4C,IAAAO,WAAA,GAAAP,OAAA;AAZ5C;AACA;AACA;;AAMA;AACA;AACA;;AAIe,SAASQ,gBAAgBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACxD,MAAM;IAAEC,OAAO;IAAEC;EAAS,CAAC,GAAG,IAAAC,qBAAY,EAAEH,QAAS,CAAC;EAEtD,MAAM,CAAEI,WAAW,EAAEC,WAAW,CAAE,GAAG,IAAAC,mBAAU,EAC5CC,QAAQ,IAAM,CAAEA,QAAQ,EAC1B,KACD,CAAC;EAED,MAAMC,kBAAkB,GAAG,IAAAC,eAAM,EAAE,KAAM,CAAC;;EAE1C;EACA;EACA;EACA;EACA;EACA,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKR,QAAQ,EAAG;MACfM,kBAAkB,CAACG,OAAO,GAAG,IAAI;IAClC;EACD,CAAC,EAAE,CAAET,QAAQ,CAAG,CAAC;EAEjB,IAAK,CAAEA,QAAQ,IAAI,CAAEM,kBAAkB,CAACG,OAAO,EAAG;IACjD,OAAO,IAAI;EACZ;EAEA,IAAIC,KAAK,GAAGV,QAAQ,GAAG,IAAAW,QAAE,EAAE,QAAS,CAAC,GAAG,IAAAA,QAAE,EAAE,MAAO,CAAC;EAEpD,IAAK,CAAEZ,OAAO,IAAIC,QAAQ,EAAG;IAC5BU,KAAK,GAAG,IAAAC,QAAE,EAAE,QAAS,CAAC;EACvB;EAEA,oBACC,IAAAf,WAAA,CAAAgB,IAAA,EAAAhB,WAAA,CAAAiB,QAAA;IAAAC,QAAA,gBACC,IAAAlB,WAAA,CAAAmB,GAAA,EAACzB,WAAA,CAAA0B,YAAY;MAACC,SAAS,EAAC,iCAAiC;MAAAH,QAAA,eACxD,IAAAlB,WAAA,CAAAmB,GAAA,EAACzB,WAAA,CAAA4B,aAAa;QACbC,QAAQ,EAAG,CAAEpB,OAAS;QACtBqB,IAAI,EAAGpB,QAAQ,GAAGqB,WAAI,GAAGC,aAAQ;QACjCZ,KAAK,EAAGA,KAAO;QACfa,OAAO,EAAGpB,WAAa;QACvB,iBAAgBD,WAAa;QAC7B,iBAAc;MAAQ,CACtB;IAAC,CACW,CAAC,EACbA,WAAW,iBACZ,IAAAN,WAAA,CAAAmB,GAAA,EAACtB,MAAA,CAAA+B,OAAc;MAAC1B,QAAQ,EAAGA,QAAU;MAAC2B,OAAO,EAAGtB;IAAa,CAAE,CAC/D;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -127,7 +127,7 @@ const BlockMoverButton = (0, _element.forwardRef)(({
|
|
|
127
127
|
...props,
|
|
128
128
|
onClick: isDisabled ? null : onClick,
|
|
129
129
|
disabled: isDisabled,
|
|
130
|
-
|
|
130
|
+
accessibleWhenDisabled: true
|
|
131
131
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.VisuallyHidden, {
|
|
132
132
|
id: descriptionId,
|
|
133
133
|
children: (0, _moverDescription.getBlockMoverDescription)(blocksCount, blockType && blockType.title, firstIndex, isFirst, isLast, direction === 'up' ? -1 : 1, orientation)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blocks","_components","_compose","_data","_element","_i18n","_icons","_moverDescription","_store","_jsxRuntime","getArrowIcon","direction","orientation","isRTL","chevronRight","chevronLeft","chevronUp","chevronDown","getMovementDirectionLabel","moveDirection","__","BlockMoverButton","forwardRef","clientIds","moverOrientation","props","ref","instanceId","useInstanceId","normalizedClientIds","Array","isArray","blocksCount","length","disabled","blockType","isDisabled","rootClientId","isFirst","isLast","firstIndex","useSelect","select","getBlockIndex","getBlockRootClientId","getBlockOrder","getBlock","getBlockListSettings","blockEditorStore","firstClientId","blockRootClientId","firstBlockIndex","lastBlockIndex","blockOrder","block","isFirstBlock","isLastBlock","blockListOrientation","getBlockType","name","moveBlocksDown","moveBlocksUp","useDispatch","moverFunction","onClick","event","descriptionId","jsxs","Fragment","children","jsx","Button","className","clsx","icon","label","__experimentalIsFocusable","VisuallyHidden","id","getBlockMoverDescription","title","BlockMoverUpButton","exports","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\treturn <BlockMoverButton direction=\"down\" ref={ ref } { ...props } />;\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AAMA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAAwD,IAAAU,WAAA,GAAAV,OAAA;AAzBxD;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAUA,MAAMW,YAAY,GAAGA,CAAEC,SAAS,EAAEC,WAAW,KAAM;EAClD,IAAKD,SAAS,KAAK,IAAI,EAAG;IACzB,IAAKC,WAAW,KAAK,YAAY,EAAG;MACnC,OAAO,IAAAC,WAAK,EAAC,CAAC,GAAGC,mBAAY,GAAGC,kBAAW;IAC5C;IACA,OAAOC,gBAAS;EACjB,CAAC,MAAM,IAAKL,SAAS,KAAK,MAAM,EA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CAAC;AAEM,MAAMqE,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,IAAA3D,mBAAU,EAAE,CAAEG,KAAK,EAAEC,GAAG,KAAM;EAC/D,oBAAO,IAAAjB,WAAA,CAAA6D,GAAA,EAACjD,gBAAgB;IAACV,SAAS,EAAC,IAAI;IAACe,GAAG,EAAGA,GAAK;IAAA,GAAMD;EAAK,CAAI,CAAC;AACpE,CAAE,CAAC;AAEI,MAAM0D,oBAAoB,GAAAD,OAAA,CAAAC,oBAAA,GAAG,IAAA7D,mBAAU,EAAE,CAAEG,KAAK,EAAEC,GAAG,KAAM;EACjE,oBAAO,IAAAjB,WAAA,CAAA6D,GAAA,EAACjD,gBAAgB;IAACV,SAAS,EAAC,MAAM;IAACe,GAAG,EAAGA,GAAK;IAAA,GAAMD;EAAK,CAAI,CAAC;AACtE,CAAE,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blocks","_components","_compose","_data","_element","_i18n","_icons","_moverDescription","_store","_jsxRuntime","getArrowIcon","direction","orientation","isRTL","chevronRight","chevronLeft","chevronUp","chevronDown","getMovementDirectionLabel","moveDirection","__","BlockMoverButton","forwardRef","clientIds","moverOrientation","props","ref","instanceId","useInstanceId","normalizedClientIds","Array","isArray","blocksCount","length","disabled","blockType","isDisabled","rootClientId","isFirst","isLast","firstIndex","useSelect","select","getBlockIndex","getBlockRootClientId","getBlockOrder","getBlock","getBlockListSettings","blockEditorStore","firstClientId","blockRootClientId","firstBlockIndex","lastBlockIndex","blockOrder","block","isFirstBlock","isLastBlock","blockListOrientation","getBlockType","name","moveBlocksDown","moveBlocksUp","useDispatch","moverFunction","onClick","event","descriptionId","jsxs","Fragment","children","jsx","Button","className","clsx","icon","label","accessibleWhenDisabled","VisuallyHidden","id","getBlockMoverDescription","title","BlockMoverUpButton","exports","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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAA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