@wordpress/block-editor 13.3.0 → 13.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +0 -4
- package/build/components/alignment-control/ui.js +2 -2
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +1 -1
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +1 -1
- package/build/components/block-alignment-control/ui.native.js.map +1 -1
- package/build/components/block-inspector/index.js +6 -3
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +3 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-refs.js +9 -2
- package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +25 -9
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -2
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/modal.js +2 -0
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -0
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-switcher/index.js +1 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +11 -12
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/preview-block-popover.js +20 -17
- package/build/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +5 -2
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +7 -8
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserter-button.js +45 -0
- package/build/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
- package/build/components/block-tools/zoom-out-mode-inserters.js +27 -27
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +2 -1
- package/build/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/date-format-picker/index.js +2 -11
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +7 -4
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +2 -7
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +8 -1
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +5 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +26 -43
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +78 -7
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +24 -5
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +89 -44
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +1 -1
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/use-grid-layout-sync.js +40 -28
- package/build/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build/components/index.js +1 -9
- package/build/components/index.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/patterns-filter.js +20 -23
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js +1 -0
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +20 -3
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +10 -3
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/settings-tab.js +1 -2
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build/components/list-view/block-select-button.js +2 -6
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +2 -2
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/utils.js +3 -1
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +1 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +3 -3
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/hooks/grid-visualizer.js +5 -8
- package/build/hooks/grid-visualizer.js.map +1 -1
- package/build/hooks/layout-child.js +9 -2
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +3 -7
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +81 -50
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/layouts/constrained.js +6 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +2 -0
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +0 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +18 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +19 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +2 -2
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +1 -1
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +1 -1
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -3
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +3 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-refs.js +11 -4
- package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +26 -9
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +3 -2
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/modal.js +2 -0
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +2 -0
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +1 -1
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +12 -13
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/preview-block-popover.js +20 -17
- package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +5 -2
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +7 -8
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js +37 -0
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +28 -28
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +2 -1
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +4 -12
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +7 -4
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +3 -6
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +8 -1
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +5 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +27 -44
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +76 -7
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +24 -5
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +92 -46
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +1 -1
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/use-grid-layout-sync.js +41 -29
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build-module/components/index.js +0 -5
- package/build-module/components/index.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/patterns-filter.js +20 -23
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -0
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +20 -3
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +10 -3
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -2
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +3 -7
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +2 -2
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/utils.js +3 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +5 -8
- package/build-module/hooks/grid-visualizer.js.map +1 -1
- package/build-module/hooks/layout-child.js +9 -2
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +3 -7
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +81 -51
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/layouts/constrained.js +6 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +2 -0
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +0 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +15 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +18 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +10 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/content-rtl.css +6 -6
- package/build-style/content.css +6 -6
- package/build-style/style-rtl.css +167 -103
- package/build-style/style.css +167 -103
- package/build-types/components/block-context/index.d.ts +2 -2
- package/build-types/components/block-context/index.d.ts.map +1 -1
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +31 -31
- package/src/components/alignment-control/ui.js +2 -2
- package/src/components/block-alignment-control/ui.js +1 -1
- package/src/components/block-alignment-control/ui.native.js +1 -1
- package/src/components/block-context/README.md +4 -4
- package/src/components/block-inspector/index.js +8 -4
- package/src/components/block-list/content.scss +2 -16
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-block-props/use-block-refs.js +19 -3
- package/src/components/block-list/use-block-props/use-is-hovered.js +26 -11
- package/src/components/block-list/use-in-between-inserter.js +5 -1
- package/src/components/block-lock/modal.js +10 -2
- package/src/components/block-lock/style.scss +4 -8
- package/src/components/block-patterns-paging/style.scss +0 -23
- package/src/components/block-removal-warning-modal/index.js +10 -2
- package/src/components/block-switcher/index.js +1 -1
- package/src/components/block-switcher/pattern-transformations-menu.js +17 -15
- package/src/components/block-switcher/preview-block-popover.js +20 -14
- package/src/components/block-switcher/style.scss +8 -17
- package/src/components/block-toolbar/shuffle.js +8 -1
- package/src/components/block-tools/style.scss +8 -0
- package/src/components/block-tools/use-show-block-tools.js +12 -9
- package/src/components/block-tools/zoom-out-mode-inserter-button.js +47 -0
- package/src/components/block-tools/zoom-out-mode-inserters.js +43 -33
- package/src/components/block-tools/zoom-out-popover.js +1 -0
- package/src/components/block-tools/zoom-out-toolbar.js +1 -1
- package/src/components/date-format-picker/index.js +2 -11
- package/src/components/default-block-appender/index.js +11 -4
- package/src/components/font-appearance-control/index.js +1 -5
- package/src/components/global-styles/background-panel.js +21 -1
- package/src/components/global-styles/hooks.js +5 -1
- package/src/components/global-styles/style.scss +12 -0
- package/src/components/global-styles/test/typography-utils.js +325 -0
- package/src/components/global-styles/test/use-global-styles-output.js +3 -1
- package/src/components/global-styles/typography-panel.js +36 -44
- package/src/components/global-styles/typography-utils.js +103 -7
- package/src/components/global-styles/use-global-styles-output.js +22 -2
- package/src/components/grid/grid-item-movers.js +139 -69
- package/src/components/grid/grid-visualizer.js +1 -1
- package/src/components/grid/style.scss +114 -0
- package/src/components/grid/use-grid-layout-sync.js +66 -27
- package/src/components/iframe/content.scss +1 -1
- package/src/components/index.js +0 -5
- package/src/components/inner-blocks/index.js +4 -1
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +40 -44
- package/src/components/inserter/media-tab/media-panel.js +1 -0
- package/src/components/inserter/menu.js +1 -1
- package/src/components/inserter/preview-panel.js +27 -4
- package/src/components/inserter/style.scss +57 -43
- package/src/components/inserter-draggable-blocks/index.js +11 -3
- package/src/components/inspector-controls-tabs/settings-tab.js +0 -2
- package/src/components/inspector-controls-tabs/style.scss +0 -21
- package/src/components/list-view/block-select-button.js +3 -13
- package/src/components/list-view/block.js +10 -3
- package/src/components/list-view/style.scss +2 -1
- package/src/components/list-view/utils.js +13 -2
- package/src/components/rich-text/format-toolbar/index.js +1 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -1
- package/src/components/url-popover/image-url-input-ui.js +3 -3
- package/src/components/url-popover/style.scss +1 -0
- package/src/hooks/grid-visualizer.js +5 -7
- package/src/hooks/layout-child.js +12 -3
- package/src/hooks/position.js +3 -13
- package/src/hooks/use-bindings-attributes.js +89 -59
- package/src/layouts/constrained.js +10 -2
- package/src/layouts/grid.js +2 -0
- package/src/private-apis.js +0 -6
- package/src/store/actions.js +15 -0
- package/src/store/reducer.js +18 -0
- package/src/store/selectors.js +10 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +0 -71
- package/build/components/inserter/reusable-block-rename-hint.js.map +0 -1
- package/build/components/inspector-controls-tabs/settings-tab-hint.js +0 -53
- package/build/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +0 -64
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +0 -1
- package/build-module/components/inspector-controls-tabs/settings-tab-hint.js +0 -47
- package/build-module/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
- package/src/components/inserter/reusable-block-rename-hint.js +0 -69
- package/src/components/inspector-controls-tabs/settings-tab-hint.js +0 -52
|
@@ -7,10 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _data = require("@wordpress/data");
|
|
9
9
|
var _element = require("@wordpress/element");
|
|
10
|
-
var _components = require("@wordpress/components");
|
|
11
|
-
var _icons = require("@wordpress/icons");
|
|
12
|
-
var _i18n = require("@wordpress/i18n");
|
|
13
10
|
var _inbetween = _interopRequireDefault(require("../block-popover/inbetween"));
|
|
11
|
+
var _zoomOutModeInserterButton = _interopRequireDefault(require("./zoom-out-mode-inserter-button"));
|
|
14
12
|
var _store = require("../../store");
|
|
15
13
|
var _lockUnlock = require("../../lock-unlock");
|
|
16
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -25,16 +23,20 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
25
23
|
function ZoomOutModeInserters() {
|
|
26
24
|
const [isReady, setIsReady] = (0, _element.useState)(false);
|
|
27
25
|
const {
|
|
26
|
+
hasSelection,
|
|
28
27
|
blockOrder,
|
|
29
|
-
sectionRootClientId,
|
|
30
28
|
insertionPoint,
|
|
31
29
|
setInserterIsOpened,
|
|
32
|
-
|
|
30
|
+
sectionRootClientId,
|
|
31
|
+
selectedBlockClientId,
|
|
32
|
+
hoveredBlockClientId
|
|
33
33
|
} = (0, _data.useSelect)(select => {
|
|
34
34
|
const {
|
|
35
35
|
getSettings,
|
|
36
36
|
getBlockOrder,
|
|
37
|
-
getSelectionStart
|
|
37
|
+
getSelectionStart,
|
|
38
|
+
getSelectedBlockClientId,
|
|
39
|
+
getHoveredBlockClientId
|
|
38
40
|
} = select(_store.store);
|
|
39
41
|
const {
|
|
40
42
|
sectionRootClientId: root
|
|
@@ -51,18 +53,11 @@ function ZoomOutModeInserters() {
|
|
|
51
53
|
blockOrder: getBlockOrder(root),
|
|
52
54
|
insertionPoint: (0, _lockUnlock.unlock)(editor).getInsertionPoint(),
|
|
53
55
|
sectionRootClientId: root,
|
|
54
|
-
setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened
|
|
56
|
+
setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened,
|
|
57
|
+
selectedBlockClientId: getSelectedBlockClientId(),
|
|
58
|
+
hoveredBlockClientId: getHoveredBlockClientId()
|
|
55
59
|
};
|
|
56
60
|
}, []);
|
|
57
|
-
const isMounted = (0, _element.useRef)(false);
|
|
58
|
-
(0, _element.useEffect)(() => {
|
|
59
|
-
if (!isMounted.current) {
|
|
60
|
-
isMounted.current = true;
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
// reset insertion point when the block order changes
|
|
64
|
-
setInserterIsOpened(true);
|
|
65
|
-
}, [blockOrder, setInserterIsOpened]);
|
|
66
61
|
|
|
67
62
|
// Defer the initial rendering to avoid the jumps due to the animation.
|
|
68
63
|
(0, _element.useEffect)(() => {
|
|
@@ -73,14 +68,23 @@ function ZoomOutModeInserters() {
|
|
|
73
68
|
clearTimeout(timeout);
|
|
74
69
|
};
|
|
75
70
|
}, []);
|
|
76
|
-
if (!isReady
|
|
71
|
+
if (!isReady) {
|
|
77
72
|
return null;
|
|
78
73
|
}
|
|
79
74
|
return [undefined, ...blockOrder].map((clientId, index) => {
|
|
75
|
+
const shouldRenderInserter = insertionPoint.insertionIndex !== index;
|
|
76
|
+
const shouldRenderInsertionPoint = insertionPoint.insertionIndex === index;
|
|
77
|
+
if (!shouldRenderInserter && !shouldRenderInsertionPoint) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const previousClientId = clientId;
|
|
81
|
+
const nextClientId = blockOrder[index];
|
|
82
|
+
const isSelected = hasSelection && (selectedBlockClientId === previousClientId || selectedBlockClientId === nextClientId);
|
|
83
|
+
const isHovered = hoveredBlockClientId === previousClientId || hoveredBlockClientId === nextClientId;
|
|
80
84
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_inbetween.default, {
|
|
81
|
-
previousClientId:
|
|
82
|
-
nextClientId:
|
|
83
|
-
children: [
|
|
85
|
+
previousClientId: previousClientId,
|
|
86
|
+
nextClientId: nextClientId,
|
|
87
|
+
children: [shouldRenderInsertionPoint && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
84
88
|
style: {
|
|
85
89
|
borderRadius: '0',
|
|
86
90
|
height: '12px',
|
|
@@ -89,11 +93,8 @@ function ZoomOutModeInserters() {
|
|
|
89
93
|
width: '100%'
|
|
90
94
|
},
|
|
91
95
|
className: "block-editor-block-list__insertion-point-indicator"
|
|
92
|
-
}),
|
|
93
|
-
|
|
94
|
-
icon: _icons.plus,
|
|
95
|
-
size: "compact",
|
|
96
|
-
className: "block-editor-button-pattern-inserter__button",
|
|
96
|
+
}), shouldRenderInserter && /*#__PURE__*/(0, _jsxRuntime.jsx)(_zoomOutModeInserterButton.default, {
|
|
97
|
+
isVisible: isSelected || isHovered,
|
|
97
98
|
onClick: () => {
|
|
98
99
|
setInserterIsOpened({
|
|
99
100
|
rootClientId: sectionRootClientId,
|
|
@@ -101,8 +102,7 @@ function ZoomOutModeInserters() {
|
|
|
101
102
|
tab: 'patterns',
|
|
102
103
|
category: 'all'
|
|
103
104
|
});
|
|
104
|
-
}
|
|
105
|
-
label: (0, _i18n._x)('Add pattern', 'Generic label for pattern inserter button')
|
|
105
|
+
}
|
|
106
106
|
})]
|
|
107
107
|
}, index);
|
|
108
108
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_element","
|
|
1
|
+
{"version":3,"names":["_data","require","_element","_inbetween","_interopRequireDefault","_zoomOutModeInserterButton","_store","_lockUnlock","_jsxRuntime","ZoomOutModeInserters","isReady","setIsReady","useState","hasSelection","blockOrder","insertionPoint","setInserterIsOpened","sectionRootClientId","selectedBlockClientId","hoveredBlockClientId","useSelect","select","getSettings","getBlockOrder","getSelectionStart","getSelectedBlockClientId","getHoveredBlockClientId","blockEditorStore","root","unlock","editor","clientId","getInsertionPoint","__experimentalSetIsInserterOpened","useEffect","timeout","setTimeout","clearTimeout","undefined","map","index","shouldRenderInserter","insertionIndex","shouldRenderInsertionPoint","previousClientId","nextClientId","isSelected","isHovered","jsxs","default","children","jsx","style","borderRadius","height","opacity","transform","width","className","isVisible","onClick","rootClientId","tab","category","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-mode-inserters.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverInbetween from '../block-popover/inbetween';\nimport ZoomOutModeInserterButton from './zoom-out-mode-inserter-button';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction ZoomOutModeInserters() {\n\tconst [ isReady, setIsReady ] = useState( false );\n\tconst {\n\t\thasSelection,\n\t\tblockOrder,\n\t\tinsertionPoint,\n\t\tsetInserterIsOpened,\n\t\tsectionRootClientId,\n\t\tselectedBlockClientId,\n\t\thoveredBlockClientId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSettings,\n\t\t\tgetBlockOrder,\n\t\t\tgetSelectionStart,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetHoveredBlockClientId,\n\t\t} = select( blockEditorStore );\n\t\tconst { sectionRootClientId: root } = unlock( getSettings() );\n\t\t// To do: move ZoomOutModeInserters to core/editor.\n\t\t// Or we perhaps we should move the insertion point state to the\n\t\t// block-editor store. I'm not sure what it was ever moved to the editor\n\t\t// store, because all the inserter components all live in the\n\t\t// block-editor package.\n\t\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\t\tconst editor = select( 'core/editor' );\n\t\treturn {\n\t\t\thasSelection: !! getSelectionStart().clientId,\n\t\t\tblockOrder: getBlockOrder( root ),\n\t\t\tinsertionPoint: unlock( editor ).getInsertionPoint(),\n\t\t\tsectionRootClientId: root,\n\t\t\tsetInserterIsOpened:\n\t\t\t\tgetSettings().__experimentalSetIsInserterOpened,\n\t\t\tselectedBlockClientId: getSelectedBlockClientId(),\n\t\t\thoveredBlockClientId: getHoveredBlockClientId(),\n\t\t};\n\t}, [] );\n\n\t// Defer the initial rendering to avoid the jumps due to the animation.\n\tuseEffect( () => {\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetIsReady( true );\n\t\t}, 500 );\n\t\treturn () => {\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [] );\n\n\tif ( ! isReady ) {\n\t\treturn null;\n\t}\n\n\treturn [ undefined, ...blockOrder ].map( ( clientId, index ) => {\n\t\tconst shouldRenderInserter = insertionPoint.insertionIndex !== index;\n\n\t\tconst shouldRenderInsertionPoint =\n\t\t\tinsertionPoint.insertionIndex === index;\n\n\t\tif ( ! shouldRenderInserter && ! shouldRenderInsertionPoint ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst previousClientId = clientId;\n\t\tconst nextClientId = blockOrder[ index ];\n\n\t\tconst isSelected =\n\t\t\thasSelection &&\n\t\t\t( selectedBlockClientId === previousClientId ||\n\t\t\t\tselectedBlockClientId === nextClientId );\n\n\t\tconst isHovered =\n\t\t\thoveredBlockClientId === previousClientId ||\n\t\t\thoveredBlockClientId === nextClientId;\n\n\t\treturn (\n\t\t\t<BlockPopoverInbetween\n\t\t\t\tkey={ index }\n\t\t\t\tpreviousClientId={ previousClientId }\n\t\t\t\tnextClientId={ nextClientId }\n\t\t\t>\n\t\t\t\t{ shouldRenderInsertionPoint && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\tborderRadius: '0',\n\t\t\t\t\t\t\theight: '12px',\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateY(-50%)',\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ shouldRenderInserter && (\n\t\t\t\t\t<ZoomOutModeInserterButton\n\t\t\t\t\t\tisVisible={ isSelected || isHovered }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetInserterIsOpened( {\n\t\t\t\t\t\t\t\trootClientId: sectionRootClientId,\n\t\t\t\t\t\t\t\tinsertionIndex: index,\n\t\t\t\t\t\t\t\ttab: 'patterns',\n\t\t\t\t\t\t\t\tcategory: 'all',\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) }\n\t\t\t</BlockPopoverInbetween>\n\t\t);\n\t} );\n}\n\nexport default ZoomOutModeInserters;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AAZ3C;AACA;AACA;;AAIA;AACA;AACA;;AAMA,SAASQ,oBAAoBA,CAAA,EAAG;EAC/B,MAAM,CAAEC,OAAO,EAAEC,UAAU,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACjD,MAAM;IACLC,YAAY;IACZC,UAAU;IACVC,cAAc;IACdC,mBAAmB;IACnBC,mBAAmB;IACnBC,qBAAqB;IACrBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5B,MAAM;MACLC,WAAW;MACXC,aAAa;MACbC,iBAAiB;MACjBC,wBAAwB;MACxBC;IACD,CAAC,GAAGL,MAAM,CAAEM,YAAiB,CAAC;IAC9B,MAAM;MAAEV,mBAAmB,E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AG/B,UAAU,CAAE0B,KAAK,CAAE;IAExC,MAAMM,UAAU,GACfjC,YAAY,KACVK,qBAAqB,KAAK0B,gBAAgB,IAC3C1B,qBAAqB,KAAK2B,YAAY,CAAE;IAE1C,MAAME,SAAS,GACd5B,oBAAoB,KAAKyB,gBAAgB,IACzCzB,oBAAoB,KAAK0B,YAAY;IAEtC,oBACC,IAAArC,WAAA,CAAAwC,IAAA,EAAC7C,UAAA,CAAA8C,OAAqB;MAErBL,gBAAgB,EAAGA,gBAAkB;MACrCC,YAAY,EAAGA,YAAc;MAAAK,QAAA,GAE3BP,0BAA0B,iBAC3B,IAAAnC,WAAA,CAAA2C,GAAA;QACCC,KAAK,EAAG;UACPC,YAAY,EAAE,GAAG;UACjBC,MAAM,EAAE,MAAM;UACdC,OAAO,EAAE,CAAC;UACVC,SAAS,EAAE,kBAAkB;UAC7BC,KAAK,EAAE;QACR,CAAG;QACHC,SAAS,EAAC;MAAoD,CAC9D,CACD,EACCjB,oBAAoB,iBACrB,IAAAjC,WAAA,CAAA2C,GAAA,EAAC9C,0BAAA,CAAA4C,OAAyB;QACzBU,SAAS,EAAGb,UAAU,IAAIC,SAAW;QACrCa,OAAO,EAAGA,CAAA,KAAM;UACf5C,mBAAmB,CAAE;YACpB6C,YAAY,EAAE5C,mBAAmB;YACjCyB,cAAc,EAAEF,KAAK;YACrBsB,GAAG,EAAE,UAAU;YACfC,QAAQ,EAAE;UACX,CAAE,CAAC;QACJ;MAAG,CACH,CACD;IAAA,GA5BKvB,KA6BgB,CAAC;EAE1B,CAAE,CAAC;AACJ;AAAC,IAAAwB,QAAA,GAAAC,OAAA,CAAAhB,OAAA,GAEcxC,oBAAoB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockPopover","_useBlockToolbarPopoverProps","_useSelectedBlockToolProps","_zoomOutToolbar","_jsxRuntime","ZoomOutPopover","clientId","__unstableContentRef","capturingClientId","isInsertionPointVisible","lastClientId","rootClientId","useSelectedBlockToolProps","popoverProps","useBlockToolbarPopoverProps","contentElement","current","props","placement","flip","jsx","default","bottomClientId","className","clsx","resize","children"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-popover.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport useSelectedBlockToolProps from './use-selected-block-tool-props';\nimport ZoomOutToolbar from './zoom-out-toolbar';\n\nexport default function ZoomOutPopover( { clientId, __unstableContentRef } ) {\n\tconst {\n\t\tcapturingClientId,\n\t\tisInsertionPointVisible,\n\t\tlastClientId,\n\t\trootClientId,\n\t} = useSelectedBlockToolProps( clientId );\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\t// Override some of the popover props for the zoom-out toolbar.\n\tconst props = {\n\t\t...popoverProps,\n\t\tplacement: 'left-start',\n\t\tflip: false,\n\t};\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ capturingClientId || clientId }\n\t\t\tbottomClientId={ lastClientId }\n\t\t\tclassName={ clsx( 'zoom-out-toolbar-popover', {\n\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t} ) }\n\t\t\tresize={ false }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<ZoomOutToolbar\n\t\t\t\tclientId={ clientId }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t/>\n\t\t</BlockPopover>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,4BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,0BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAgD,IAAAK,WAAA,GAAAL,OAAA;AAVhD;AACA;AACA;;AAEA;AACA;AACA;;AAMe,SAASM,cAAcA,CAAE;EAAEC,QAAQ;EAAEC;AAAqB,CAAC,EAAG;EAC5E,MAAM;IACLC,iBAAiB;IACjBC,uBAAuB;IACvBC,YAAY;IACZC;EACD,CAAC,GAAG,IAAAC,kCAAyB,EAAEN,QAAS,CAAC;EAEzC,MAAMO,YAAY,GAAG,IAAAC,oCAA2B,EAAE;IACjDC,cAAc,EAAER,oBAAoB,EAAES,OAAO;IAC7CV;EACD,CAAE,CAAC;;EAEH;EACA,MAAMW,KAAK,GAAG;IACb,GAAGJ,YAAY;IACfK,SAAS,EAAE,YAAY;IACvBC,IAAI,EAAE;
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockPopover","_useBlockToolbarPopoverProps","_useSelectedBlockToolProps","_zoomOutToolbar","_jsxRuntime","ZoomOutPopover","clientId","__unstableContentRef","capturingClientId","isInsertionPointVisible","lastClientId","rootClientId","useSelectedBlockToolProps","popoverProps","useBlockToolbarPopoverProps","contentElement","current","props","placement","flip","shift","jsx","default","bottomClientId","className","clsx","resize","children"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-popover.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport useSelectedBlockToolProps from './use-selected-block-tool-props';\nimport ZoomOutToolbar from './zoom-out-toolbar';\n\nexport default function ZoomOutPopover( { clientId, __unstableContentRef } ) {\n\tconst {\n\t\tcapturingClientId,\n\t\tisInsertionPointVisible,\n\t\tlastClientId,\n\t\trootClientId,\n\t} = useSelectedBlockToolProps( clientId );\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\t// Override some of the popover props for the zoom-out toolbar.\n\tconst props = {\n\t\t...popoverProps,\n\t\tplacement: 'left-start',\n\t\tflip: false,\n\t\tshift: true,\n\t};\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ capturingClientId || clientId }\n\t\t\tbottomClientId={ lastClientId }\n\t\t\tclassName={ clsx( 'zoom-out-toolbar-popover', {\n\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t} ) }\n\t\t\tresize={ false }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<ZoomOutToolbar\n\t\t\t\tclientId={ clientId }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t/>\n\t\t</BlockPopover>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,4BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,0BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAgD,IAAAK,WAAA,GAAAL,OAAA;AAVhD;AACA;AACA;;AAEA;AACA;AACA;;AAMe,SAASM,cAAcA,CAAE;EAAEC,QAAQ;EAAEC;AAAqB,CAAC,EAAG;EAC5E,MAAM;IACLC,iBAAiB;IACjBC,uBAAuB;IACvBC,YAAY;IACZC;EACD,CAAC,GAAG,IAAAC,kCAAyB,EAAEN,QAAS,CAAC;EAEzC,MAAMO,YAAY,GAAG,IAAAC,oCAA2B,EAAE;IACjDC,cAAc,EAAER,oBAAoB,EAAES,OAAO;IAC7CV;EACD,CAAE,CAAC;;EAEH;EACA,MAAMW,KAAK,GAAG;IACb,GAAGJ,YAAY;IACfK,SAAS,EAAE,YAAY;IACvBC,IAAI,EAAE,KAAK;IACXC,KAAK,EAAE;EACR,CAAC;EAED,oBACC,IAAAhB,WAAA,CAAAiB,GAAA,EAACrB,aAAA,CAAAsB,OAAY;IACZhB,QAAQ,EAAGE,iBAAiB,IAAIF,QAAU;IAC1CiB,cAAc,EAAGb,YAAc;IAC/Bc,SAAS,EAAG,IAAAC,aAAI,EAAE,0BAA0B,EAAE;MAC7C,4BAA4B,EAAEhB;IAC/B,CAAE,CAAG;IACLiB,MAAM,EAAG,KAAO;IAAA,GACXT,KAAK;IAAAU,QAAA,eAEV,IAAAvB,WAAA,CAAAiB,GAAA,EAAClB,eAAA,CAAAmB,OAAc;MACdhB,QAAQ,EAAGA,QAAU;MACrBK,YAAY,EAAGA;IAAc,CAC7B;EAAC,CACW,CAAC;AAEjB","ignoreList":[]}
|
|
@@ -128,7 +128,7 @@ function ZoomOutToolbar({
|
|
|
128
128
|
}), canRemove && !isBlockTemplatePart && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
|
|
129
129
|
className: "zoom-out-toolbar-button",
|
|
130
130
|
icon: _icons.trash,
|
|
131
|
-
label:
|
|
131
|
+
label: (0, _i18n.__)('Delete'),
|
|
132
132
|
onClick: () => {
|
|
133
133
|
removeBlock(clientId);
|
|
134
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_icons","_components","_data","_blocks","_i18n","_store","_blockDraggable","_blockMover","_shuffle","_navigableToolbar","_jsxRuntime","ZoomOutToolbar","clientId","rootClientId","selected","useSelect","select","getBlock","hasBlockMovingClientId","getNextBlockClientId","getPreviousBlockClientId","canRemoveBlock","canMoveBlock","blockEditorStore","getBlockType","blocksStore","name","blockType","isBlockTemplatePart","isNextBlockTemplatePart","nextClientId","nextName","nextBlockType","isPrevBlockTemplatePart","prevClientId","prevName","prevBlockType","blockMovingMode","canRemove","canMove","removeBlock","useDispatch","classNames","clsx","showBlockDraggable","jsxs","default","className","__","variant","orientation","children","jsx","clientIds","draggableProps","Button","icon","dragHandle","label","iconSize","size","tabIndex","hideDragHandle","isBlockMoverUpButtonDisabled","isBlockMoverDownButtonDisabled","as","ToolbarButton","trash","onClick"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-toolbar.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { dragHandle, trash } from '@wordpress/icons';\nimport { Button, ToolbarButton } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport BlockDraggable from '../block-draggable';\nimport BlockMover from '../block-mover';\nimport Shuffle from '../block-toolbar/shuffle';\nimport NavigableToolbar from '../navigable-toolbar';\n\nexport default function ZoomOutToolbar( { clientId, rootClientId } ) {\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlock,\n\t\t\t\thasBlockMovingClientId,\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tcanRemoveBlock,\n\t\t\t\tcanMoveBlock,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockType } = select( blocksStore );\n\t\t\tconst { name } = getBlock( clientId );\n\t\t\tconst blockType = getBlockType( name );\n\t\t\tconst isBlockTemplatePart =\n\t\t\t\tblockType?.name === 'core/template-part';\n\n\t\t\tlet isNextBlockTemplatePart = false;\n\t\t\tconst nextClientId = getNextBlockClientId();\n\t\t\tif ( nextClientId ) {\n\t\t\t\tconst { name: nextName } = getBlock( nextClientId );\n\t\t\t\tconst nextBlockType = getBlockType( nextName );\n\t\t\t\tisNextBlockTemplatePart =\n\t\t\t\t\tnextBlockType?.name === 'core/template-part';\n\t\t\t}\n\n\t\t\tlet isPrevBlockTemplatePart = false;\n\t\t\tconst prevClientId = getPreviousBlockClientId();\n\t\t\tif ( prevClientId ) {\n\t\t\t\tconst { name: prevName } = getBlock( prevClientId );\n\t\t\t\tconst prevBlockType = getBlockType( prevName );\n\t\t\t\tisPrevBlockTemplatePart =\n\t\t\t\t\tprevBlockType?.name === 'core/template-part';\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tblockMovingMode: hasBlockMovingClientId(),\n\t\t\t\tisBlockTemplatePart,\n\t\t\t\tisNextBlockTemplatePart,\n\t\t\t\tisPrevBlockTemplatePart,\n\t\t\t\tcanRemove: canRemoveBlock( clientId, rootClientId ),\n\t\t\t\tcanMove: canMoveBlock( clientId, rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId, rootClientId ]\n\t);\n\n\tconst {\n\t\tblockMovingMode,\n\t\tisBlockTemplatePart,\n\t\tisNextBlockTemplatePart,\n\t\tisPrevBlockTemplatePart,\n\t\tcanRemove,\n\t\tcanMove,\n\t} = selected;\n\n\tconst { removeBlock } = useDispatch( blockEditorStore );\n\n\tconst classNames = clsx( 'zoom-out-toolbar', {\n\t\t'is-block-moving-mode': !! blockMovingMode,\n\t} );\n\n\tconst showBlockDraggable = canMove && ! isBlockTemplatePart;\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName={ classNames }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant=\"unstyled\"\n\t\t\torientation=\"vertical\"\n\t\t>\n\t\t\t{ showBlockDraggable && (\n\t\t\t\t<BlockDraggable clientIds={ [ clientId ] }>\n\t\t\t\t\t{ ( draggableProps ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ dragHandle }\n\t\t\t\t\t\t\tclassName=\"block-selection-button_drag-handle zoom-out-toolbar-button\"\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tlabel={ __( 'Drag' ) }\n\t\t\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t// Should not be able to tab to drag handle as this\n\t\t\t\t\t\t\t// button can only be used with a pointer device.\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t{ ...draggableProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockDraggable>\n\t\t\t) }\n\t\t\t{ ! isBlockTemplatePart && (\n\t\t\t\t<BlockMover\n\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\thideDragHandle\n\t\t\t\t\tisBlockMoverUpButtonDisabled={ isPrevBlockTemplatePart }\n\t\t\t\t\tisBlockMoverDownButtonDisabled={ isNextBlockTemplatePart }\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canMove && canRemove && (\n\t\t\t\t<Shuffle clientId={ clientId } as={ ToolbarButton } />\n\t\t\t) }\n\t\t\t{ canRemove && ! isBlockTemplatePart && (\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tclassName=\"zoom-out-toolbar-button\"\n\t\t\t\t\ticon={ trash }\n\t\t\t\t\tlabel
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_icons","_components","_data","_blocks","_i18n","_store","_blockDraggable","_blockMover","_shuffle","_navigableToolbar","_jsxRuntime","ZoomOutToolbar","clientId","rootClientId","selected","useSelect","select","getBlock","hasBlockMovingClientId","getNextBlockClientId","getPreviousBlockClientId","canRemoveBlock","canMoveBlock","blockEditorStore","getBlockType","blocksStore","name","blockType","isBlockTemplatePart","isNextBlockTemplatePart","nextClientId","nextName","nextBlockType","isPrevBlockTemplatePart","prevClientId","prevName","prevBlockType","blockMovingMode","canRemove","canMove","removeBlock","useDispatch","classNames","clsx","showBlockDraggable","jsxs","default","className","__","variant","orientation","children","jsx","clientIds","draggableProps","Button","icon","dragHandle","label","iconSize","size","tabIndex","hideDragHandle","isBlockMoverUpButtonDisabled","isBlockMoverDownButtonDisabled","as","ToolbarButton","trash","onClick"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-toolbar.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { dragHandle, trash } from '@wordpress/icons';\nimport { Button, ToolbarButton } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport BlockDraggable from '../block-draggable';\nimport BlockMover from '../block-mover';\nimport Shuffle from '../block-toolbar/shuffle';\nimport NavigableToolbar from '../navigable-toolbar';\n\nexport default function ZoomOutToolbar( { clientId, rootClientId } ) {\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlock,\n\t\t\t\thasBlockMovingClientId,\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tcanRemoveBlock,\n\t\t\t\tcanMoveBlock,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockType } = select( blocksStore );\n\t\t\tconst { name } = getBlock( clientId );\n\t\t\tconst blockType = getBlockType( name );\n\t\t\tconst isBlockTemplatePart =\n\t\t\t\tblockType?.name === 'core/template-part';\n\n\t\t\tlet isNextBlockTemplatePart = false;\n\t\t\tconst nextClientId = getNextBlockClientId();\n\t\t\tif ( nextClientId ) {\n\t\t\t\tconst { name: nextName } = getBlock( nextClientId );\n\t\t\t\tconst nextBlockType = getBlockType( nextName );\n\t\t\t\tisNextBlockTemplatePart =\n\t\t\t\t\tnextBlockType?.name === 'core/template-part';\n\t\t\t}\n\n\t\t\tlet isPrevBlockTemplatePart = false;\n\t\t\tconst prevClientId = getPreviousBlockClientId();\n\t\t\tif ( prevClientId ) {\n\t\t\t\tconst { name: prevName } = getBlock( prevClientId );\n\t\t\t\tconst prevBlockType = getBlockType( prevName );\n\t\t\t\tisPrevBlockTemplatePart =\n\t\t\t\t\tprevBlockType?.name === 'core/template-part';\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tblockMovingMode: hasBlockMovingClientId(),\n\t\t\t\tisBlockTemplatePart,\n\t\t\t\tisNextBlockTemplatePart,\n\t\t\t\tisPrevBlockTemplatePart,\n\t\t\t\tcanRemove: canRemoveBlock( clientId, rootClientId ),\n\t\t\t\tcanMove: canMoveBlock( clientId, rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId, rootClientId ]\n\t);\n\n\tconst {\n\t\tblockMovingMode,\n\t\tisBlockTemplatePart,\n\t\tisNextBlockTemplatePart,\n\t\tisPrevBlockTemplatePart,\n\t\tcanRemove,\n\t\tcanMove,\n\t} = selected;\n\n\tconst { removeBlock } = useDispatch( blockEditorStore );\n\n\tconst classNames = clsx( 'zoom-out-toolbar', {\n\t\t'is-block-moving-mode': !! blockMovingMode,\n\t} );\n\n\tconst showBlockDraggable = canMove && ! isBlockTemplatePart;\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName={ classNames }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant=\"unstyled\"\n\t\t\torientation=\"vertical\"\n\t\t>\n\t\t\t{ showBlockDraggable && (\n\t\t\t\t<BlockDraggable clientIds={ [ clientId ] }>\n\t\t\t\t\t{ ( draggableProps ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ dragHandle }\n\t\t\t\t\t\t\tclassName=\"block-selection-button_drag-handle zoom-out-toolbar-button\"\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tlabel={ __( 'Drag' ) }\n\t\t\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t// Should not be able to tab to drag handle as this\n\t\t\t\t\t\t\t// button can only be used with a pointer device.\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t{ ...draggableProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockDraggable>\n\t\t\t) }\n\t\t\t{ ! isBlockTemplatePart && (\n\t\t\t\t<BlockMover\n\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\thideDragHandle\n\t\t\t\t\tisBlockMoverUpButtonDisabled={ isPrevBlockTemplatePart }\n\t\t\t\t\tisBlockMoverDownButtonDisabled={ isNextBlockTemplatePart }\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canMove && canRemove && (\n\t\t\t\t<Shuffle clientId={ clientId } as={ ToolbarButton } />\n\t\t\t) }\n\t\t\t{ canRemove && ! isBlockTemplatePart && (\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tclassName=\"zoom-out-toolbar-button\"\n\t\t\t\t\ticon={ trash }\n\t\t\t\t\tlabel={ __( 'Delete' ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tremoveBlock( clientId );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</NavigableToolbar>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,WAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,QAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,iBAAA,GAAAX,sBAAA,CAAAC,OAAA;AAAoD,IAAAW,WAAA,GAAAX,OAAA;AArBpD;A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,EACC,CAAE1B,mBAAmB,iBACtB,IAAAlB,WAAA,CAAA0C,GAAA,EAAC7C,WAAA,CAAAuC,OAAU;MACVO,SAAS,EAAG,CAAEzC,QAAQ,CAAI;MAC1BkD,cAAc;MACdC,4BAA4B,EAAG9B,uBAAyB;MACxD+B,8BAA8B,EAAGnC,uBAAyB;MAC1D8B,QAAQ,EAAG,EAAI;MACfC,IAAI,EAAC;IAAS,CACd,CACD,EACCrB,OAAO,IAAID,SAAS,iBACrB,IAAA5B,WAAA,CAAA0C,GAAA,EAAC5C,QAAA,CAAAsC,OAAO;MAAClC,QAAQ,EAAGA,QAAU;MAACqD,EAAE,EAAGC;IAAe,CAAE,CACrD,EACC5B,SAAS,IAAI,CAAEV,mBAAmB,iBACnC,IAAAlB,WAAA,CAAA0C,GAAA,EAACnD,WAAA,CAAAiE,aAAa;MACbnB,SAAS,EAAC,yBAAyB;MACnCS,IAAI,EAAGW,YAAO;MACdT,KAAK,EAAG,IAAAV,QAAE,EAAE,QAAS,CAAG;MACxBoB,OAAO,EAAGA,CAAA,KAAM;QACf5B,WAAW,CAAE5B,QAAS,CAAC;MACxB;IAAG,CACH,CACD;EAAA,CACgB,CAAC;AAErB","ignoreList":[]}
|
|
@@ -8,20 +8,11 @@ var _i18n = require("@wordpress/i18n");
|
|
|
8
8
|
var _date = require("@wordpress/date");
|
|
9
9
|
var _element = require("@wordpress/element");
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
12
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
12
|
/**
|
|
14
13
|
* WordPress dependencies
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const {
|
|
22
|
-
CustomSelectControlV2Legacy: CustomSelectControl
|
|
23
|
-
} = (0, _lockUnlock.unlock)(_components.privateApis);
|
|
24
|
-
|
|
25
16
|
// So that we illustrate the different formats in the dropdown properly, show a date that is
|
|
26
17
|
// somwhat recent, has a day greater than 12, and a month with more than three letters.
|
|
27
18
|
const exampleDate = new Date();
|
|
@@ -109,11 +100,11 @@ function NonDefaultControls({
|
|
|
109
100
|
key: 'custom',
|
|
110
101
|
name: (0, _i18n.__)('Custom'),
|
|
111
102
|
className: 'block-editor-date-format-picker__custom-format-select-control__custom-option',
|
|
112
|
-
|
|
103
|
+
hint: (0, _i18n.__)('Enter your own date format')
|
|
113
104
|
};
|
|
114
105
|
const [isCustom, setIsCustom] = (0, _element.useState)(() => !!format && !suggestedOptions.some(option => option.format === format));
|
|
115
106
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
116
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CustomSelectControl, {
|
|
107
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CustomSelectControl, {
|
|
117
108
|
label: (0, _i18n.__)('Choose a format'),
|
|
118
109
|
options: [...suggestedOptions, customOption],
|
|
119
110
|
value: isCustom ? customOption : (_suggestedOptions$fin = suggestedOptions.find(option => option.format === format)) !== null && _suggestedOptions$fin !== void 0 ? _suggestedOptions$fin : customOption,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_date","_element","_components","_lockUnlock","_jsxRuntime","CustomSelectControlV2Legacy","CustomSelectControl","unlock","componentsPrivateApis","exampleDate","Date","setDate","setMonth","getMonth","DateFormatPicker","format","defaultFormat","onChange","jsxs","className","children","jsx","VisuallyHidden","as","__","ToggleControl","__nextHasNoMarginBottom","label","help","dateI18n","checked","NonDefaultControls","_suggestedOptions$fin","suggestedFormats","Set","_x","suggestedOptions","map","suggestedFormat","index","key","name","humanTimeDiff","customOption","__experimentalHint","isCustom","setIsCustom","useState","some","option","__experimentalVStack","options","value","find","selectedItem","TextControl","hideLabelFromVision","createInterpolateElement","Link","ExternalLink","href"],"sources":["@wordpress/block-editor/src/components/date-format-picker/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { dateI18n, humanTimeDiff } from '@wordpress/date';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport {\n\tTextControl,\n\tExternalLink,\n\tVisuallyHidden,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(\n\tcomponentsPrivateApis\n);\n\n// So that we illustrate the different formats in the dropdown properly, show a date that is\n// somwhat recent, has a day greater than 12, and a month with more than three letters.\nconst exampleDate = new Date();\nexampleDate.setDate( 20 );\nexampleDate.setMonth( exampleDate.getMonth() - 3 );\nif ( exampleDate.getMonth() === 4 ) {\n\t// May has three letters, so use March.\n\texampleDate.setMonth( 3 );\n}\n\n/**\n * The `DateFormatPicker` component renders controls that let the user choose a\n * _date format_. That is, how they want their dates to be formatted.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md\n *\n * @param {Object} props\n * @param {string|null} props.format The selected date\n * format. If\n * `null`,\n * _Default_ is\n * selected.\n * @param {string} props.defaultFormat The date format that\n * will be used if the\n * user selects\n * 'Default'.\n * @param {( format: string|null ) => void} props.onChange Called when a\n * selection is\n * made. If `null`,\n * _Default_ is\n * selected.\n */\nexport default function DateFormatPicker( {\n\tformat,\n\tdefaultFormat,\n\tonChange,\n} ) {\n\treturn (\n\t\t<fieldset className=\"block-editor-date-format-picker\">\n\t\t\t<VisuallyHidden as=\"legend\">{ __( 'Date format' ) }</VisuallyHidden>\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Default format' ) }\n\t\t\t\thelp={ `${ __( 'Example:' ) } ${ dateI18n(\n\t\t\t\t\tdefaultFormat,\n\t\t\t\t\texampleDate\n\t\t\t\t) }` }\n\t\t\t\tchecked={ ! format }\n\t\t\t\tonChange={ ( checked ) =>\n\t\t\t\t\tonChange( checked ? null : defaultFormat )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ format && (\n\t\t\t\t<NonDefaultControls format={ format } onChange={ onChange } />\n\t\t\t) }\n\t\t</fieldset>\n\t);\n}\n\nfunction NonDefaultControls( { format, onChange } ) {\n\t// Suggest a short format, medium format, long format, and a standardised\n\t// (YYYY-MM-DD) format. The short, medium, and long formats are localised as\n\t// different languages have different ways of writing these. For example, 'F\n\t// j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April\n\t// 2022) in German (de). The resultant array is de-duplicated as some\n\t// languages will use the same format string for short, medium, and long\n\t// formats.\n\tconst suggestedFormats = [\n\t\t...new Set( [\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t'Y-m-d',\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y', 'short date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y g:i A', 'short date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y', 'medium date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y g:i A', 'medium date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'F j, Y', 'long date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j', 'short date format without the year' ),\n\t\t] ),\n\t];\n\n\tconst suggestedOptions = [\n\t\t...suggestedFormats.map( ( suggestedFormat, index ) => ( {\n\t\t\tkey: `suggested-${ index }`,\n\t\t\tname: dateI18n( suggestedFormat, exampleDate ),\n\t\t\tformat: suggestedFormat,\n\t\t} ) ),\n\t\t{\n\t\t\tkey: 'human-diff',\n\t\t\tname: humanTimeDiff( exampleDate ),\n\t\t\tformat: 'human-diff',\n\t\t},\n\t];\n\n\tconst customOption = {\n\t\tkey: 'custom',\n\t\tname: __( 'Custom' ),\n\t\tclassName:\n\t\t\t'block-editor-date-format-picker__custom-format-select-control__custom-option',\n\t\t__experimentalHint: __( 'Enter your own date format' ),\n\t};\n\n\tconst [ isCustom, setIsCustom ] = useState(\n\t\t() =>\n\t\t\t!! format &&\n\t\t\t! suggestedOptions.some( ( option ) => option.format === format )\n\t);\n\n\treturn (\n\t\t<VStack>\n\t\t\t<CustomSelectControl\n\t\t\t\tlabel={ __( 'Choose a format' ) }\n\t\t\t\toptions={ [ ...suggestedOptions, customOption ] }\n\t\t\t\tvalue={\n\t\t\t\t\tisCustom\n\t\t\t\t\t\t? customOption\n\t\t\t\t\t\t: suggestedOptions.find(\n\t\t\t\t\t\t\t\t( option ) => option.format === format\n\t\t\t\t\t\t ) ?? customOption\n\t\t\t\t}\n\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\tif ( selectedItem === customOption ) {\n\t\t\t\t\t\tsetIsCustom( true );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetIsCustom( false );\n\t\t\t\t\t\tonChange( selectedItem.format );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isCustom && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Custom format' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Enter a date or time <Link>format string</Link>.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/customize-date-and-time-format/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\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EqC,YAAY,CAACvC,MAAO,CAAC;QAChC;MACD;IAAG,CACH,CAAC,EACA8B,QAAQ,iBACT,IAAAzC,WAAA,CAAAiB,GAAA,EAACnB,WAAA,CAAAqD,WAAW;MACX7B,uBAAuB;MACvBC,KAAK,EAAG,IAAAH,QAAE,EAAE,eAAgB,CAAG;MAC/BgC,mBAAmB;MACnB5B,IAAI,EAAG,IAAA6B,iCAAwB,EAC9B,IAAAjC,QAAE,EACD,kDACD,CAAC,EACD;QACCkC,IAAI,eACH,IAAAtD,WAAA,CAAAiB,GAAA,EAACnB,WAAA,CAAAyD,YAAY;UACZC,IAAI,EAAG,IAAApC,QAAE,EACR,6EACD;QAAG,CACH;MAEH,CACD,CAAG;MACH4B,KAAK,EAAGrC,MAAQ;MAChBE,QAAQ,EAAKmC,KAAK,IAAMnC,QAAQ,CAAEmC,KAAM;IAAG,CAC3C,CACD;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_date","_element","_components","_jsxRuntime","exampleDate","Date","setDate","setMonth","getMonth","DateFormatPicker","format","defaultFormat","onChange","jsxs","className","children","jsx","VisuallyHidden","as","__","ToggleControl","__nextHasNoMarginBottom","label","help","dateI18n","checked","NonDefaultControls","_suggestedOptions$fin","suggestedFormats","Set","_x","suggestedOptions","map","suggestedFormat","index","key","name","humanTimeDiff","customOption","hint","isCustom","setIsCustom","useState","some","option","__experimentalVStack","CustomSelectControl","options","value","find","selectedItem","TextControl","hideLabelFromVision","createInterpolateElement","Link","ExternalLink","href"],"sources":["@wordpress/block-editor/src/components/date-format-picker/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { dateI18n, humanTimeDiff } from '@wordpress/date';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport {\n\tTextControl,\n\tExternalLink,\n\tVisuallyHidden,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n\tCustomSelectControl,\n} from '@wordpress/components';\n\n// So that we illustrate the different formats in the dropdown properly, show a date that is\n// somwhat recent, has a day greater than 12, and a month with more than three letters.\nconst exampleDate = new Date();\nexampleDate.setDate( 20 );\nexampleDate.setMonth( exampleDate.getMonth() - 3 );\nif ( exampleDate.getMonth() === 4 ) {\n\t// May has three letters, so use March.\n\texampleDate.setMonth( 3 );\n}\n\n/**\n * The `DateFormatPicker` component renders controls that let the user choose a\n * _date format_. That is, how they want their dates to be formatted.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md\n *\n * @param {Object} props\n * @param {string|null} props.format The selected date\n * format. If\n * `null`,\n * _Default_ is\n * selected.\n * @param {string} props.defaultFormat The date format that\n * will be used if the\n * user selects\n * 'Default'.\n * @param {( format: string|null ) => void} props.onChange Called when a\n * selection is\n * made. If `null`,\n * _Default_ is\n * selected.\n */\nexport default function DateFormatPicker( {\n\tformat,\n\tdefaultFormat,\n\tonChange,\n} ) {\n\treturn (\n\t\t<fieldset className=\"block-editor-date-format-picker\">\n\t\t\t<VisuallyHidden as=\"legend\">{ __( 'Date format' ) }</VisuallyHidden>\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Default format' ) }\n\t\t\t\thelp={ `${ __( 'Example:' ) } ${ dateI18n(\n\t\t\t\t\tdefaultFormat,\n\t\t\t\t\texampleDate\n\t\t\t\t) }` }\n\t\t\t\tchecked={ ! format }\n\t\t\t\tonChange={ ( checked ) =>\n\t\t\t\t\tonChange( checked ? null : defaultFormat )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ format && (\n\t\t\t\t<NonDefaultControls format={ format } onChange={ onChange } />\n\t\t\t) }\n\t\t</fieldset>\n\t);\n}\n\nfunction NonDefaultControls( { format, onChange } ) {\n\t// Suggest a short format, medium format, long format, and a standardised\n\t// (YYYY-MM-DD) format. The short, medium, and long formats are localised as\n\t// different languages have different ways of writing these. For example, 'F\n\t// j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April\n\t// 2022) in German (de). The resultant array is de-duplicated as some\n\t// languages will use the same format string for short, medium, and long\n\t// formats.\n\tconst suggestedFormats = [\n\t\t...new Set( [\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t'Y-m-d',\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y', 'short date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y g:i A', 'short date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y', 'medium date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y g:i A', 'medium date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'F j, Y', 'long date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j', 'short date format without the year' ),\n\t\t] ),\n\t];\n\n\tconst suggestedOptions = [\n\t\t...suggestedFormats.map( ( suggestedFormat, index ) => ( {\n\t\t\tkey: `suggested-${ index }`,\n\t\t\tname: dateI18n( suggestedFormat, exampleDate ),\n\t\t\tformat: suggestedFormat,\n\t\t} ) ),\n\t\t{\n\t\t\tkey: 'human-diff',\n\t\t\tname: humanTimeDiff( exampleDate ),\n\t\t\tformat: 'human-diff',\n\t\t},\n\t];\n\n\tconst customOption = {\n\t\tkey: 'custom',\n\t\tname: __( 'Custom' ),\n\t\tclassName:\n\t\t\t'block-editor-date-format-picker__custom-format-select-control__custom-option',\n\t\thint: __( 'Enter your own date format' ),\n\t};\n\n\tconst [ isCustom, setIsCustom ] = useState(\n\t\t() =>\n\t\t\t!! format &&\n\t\t\t! suggestedOptions.some( ( option ) => option.format === format )\n\t);\n\n\treturn (\n\t\t<VStack>\n\t\t\t<CustomSelectControl\n\t\t\t\tlabel={ __( 'Choose a format' ) }\n\t\t\t\toptions={ [ ...suggestedOptions, customOption ] }\n\t\t\t\tvalue={\n\t\t\t\t\tisCustom\n\t\t\t\t\t\t? customOption\n\t\t\t\t\t\t: suggestedOptions.find(\n\t\t\t\t\t\t\t\t( option ) => option.format === format\n\t\t\t\t\t\t ) ?? customOption\n\t\t\t\t}\n\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\tif ( selectedItem === customOption ) {\n\t\t\t\t\t\tsetIsCustom( true );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetIsCustom( false );\n\t\t\t\t\t\tonChange( selectedItem.format );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isCustom && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Custom format' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Enter a date or time <Link>format string</Link>.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/customize-date-and-time-format/'\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}\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ format }\n\t\t\t\t\tonChange={ ( value ) => onChange( value ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAO+B,IAAAI,WAAA,GAAAJ,OAAA;AAb/B;AACA;AACA;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AQ,CAAEoC,KAAM;IAAG,CAC3C,CACD;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
|
|
@@ -37,12 +37,14 @@ function DefaultBlockAppender({
|
|
|
37
37
|
const {
|
|
38
38
|
showPrompt,
|
|
39
39
|
isLocked,
|
|
40
|
-
placeholder
|
|
40
|
+
placeholder,
|
|
41
|
+
isManualGrid
|
|
41
42
|
} = (0, _data.useSelect)(select => {
|
|
42
43
|
const {
|
|
43
44
|
getBlockCount,
|
|
44
45
|
getSettings,
|
|
45
|
-
getTemplateLock
|
|
46
|
+
getTemplateLock,
|
|
47
|
+
getBlockAttributes
|
|
46
48
|
} = select(_store.store);
|
|
47
49
|
const isEmpty = !getBlockCount(rootClientId);
|
|
48
50
|
const {
|
|
@@ -51,14 +53,15 @@ function DefaultBlockAppender({
|
|
|
51
53
|
return {
|
|
52
54
|
showPrompt: isEmpty,
|
|
53
55
|
isLocked: !!getTemplateLock(rootClientId),
|
|
54
|
-
placeholder: bodyPlaceholder
|
|
56
|
+
placeholder: bodyPlaceholder,
|
|
57
|
+
isManualGrid: getBlockAttributes(rootClientId)?.layout?.isManualPlacement
|
|
55
58
|
};
|
|
56
59
|
}, [rootClientId]);
|
|
57
60
|
const {
|
|
58
61
|
insertDefaultBlock,
|
|
59
62
|
startTyping
|
|
60
63
|
} = (0, _data.useDispatch)(_store.store);
|
|
61
|
-
if (isLocked) {
|
|
64
|
+
if (isLocked || isManualGrid) {
|
|
62
65
|
return null;
|
|
63
66
|
}
|
|
64
67
|
const value = (0, _htmlEntities.decodeEntities)(placeholder) || (0, _i18n.__)('Type / to choose a block');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_htmlEntities","_data","_keycodes","_inserter","_store","_jsxRuntime","ZWNBSP","exports","DefaultBlockAppender","rootClientId","showPrompt","isLocked","placeholder","useSelect","select","getBlockCount","getSettings","getTemplateLock","blockEditorStore","isEmpty","bodyPlaceholder","insertDefaultBlock","startTyping","useDispatch","value","decodeEntities","__","onAppend","undefined","jsxs","className","clsx","children","jsx","tabIndex","role","onKeyDown","event","ENTER","keyCode","SPACE","onClick","onFocus","default","position","isAppender","__experimentalIsQuick"],"sources":["@wordpress/block-editor/src/components/default-block-appender/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Zero width non-breaking space, used as padding for the paragraph when it is\n * empty.\n */\nexport const ZWNBSP = '\\ufeff';\n\nexport default function DefaultBlockAppender( { rootClientId } ) {\n\tconst { showPrompt, isLocked, placeholder } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_htmlEntities","_data","_keycodes","_inserter","_store","_jsxRuntime","ZWNBSP","exports","DefaultBlockAppender","rootClientId","showPrompt","isLocked","placeholder","isManualGrid","useSelect","select","getBlockCount","getSettings","getTemplateLock","getBlockAttributes","blockEditorStore","isEmpty","bodyPlaceholder","layout","isManualPlacement","insertDefaultBlock","startTyping","useDispatch","value","decodeEntities","__","onAppend","undefined","jsxs","className","clsx","children","jsx","tabIndex","role","onKeyDown","event","ENTER","keyCode","SPACE","onClick","onFocus","default","position","isAppender","__experimentalIsQuick"],"sources":["@wordpress/block-editor/src/components/default-block-appender/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Zero width non-breaking space, used as padding for the paragraph when it is\n * empty.\n */\nexport const ZWNBSP = '\\ufeff';\n\nexport default function DefaultBlockAppender( { rootClientId } ) {\n\tconst { showPrompt, isLocked, placeholder, isManualGrid } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetSettings,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockAttributes,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst isEmpty = ! getBlockCount( rootClientId );\n\t\t\tconst { bodyPlaceholder } = getSettings();\n\n\t\t\treturn {\n\t\t\t\tshowPrompt: isEmpty,\n\t\t\t\tisLocked: !! getTemplateLock( rootClientId ),\n\t\t\t\tplaceholder: bodyPlaceholder,\n\t\t\t\tisManualGrid:\n\t\t\t\t\tgetBlockAttributes( rootClientId )?.layout\n\t\t\t\t\t\t?.isManualPlacement,\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tconst { insertDefaultBlock, startTyping } = useDispatch( blockEditorStore );\n\n\tif ( isLocked || isManualGrid ) {\n\t\treturn null;\n\t}\n\n\tconst value =\n\t\tdecodeEntities( placeholder ) || __( 'Type / to choose a block' );\n\n\tconst onAppend = () => {\n\t\tinsertDefaultBlock( undefined, rootClientId );\n\t\tstartTyping();\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tdata-root-client-id={ rootClientId || '' }\n\t\t\tclassName={ clsx( 'block-editor-default-block-appender', {\n\t\t\t\t'has-visible-prompt': showPrompt,\n\t\t\t} ) }\n\t\t>\n\t\t\t<p\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\t// We want this element to be styled as a paragraph by themes.\n\t\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n\t\t\t\trole=\"button\"\n\t\t\t\taria-label={ __( 'Add default block' ) }\n\t\t\t\t// A wrapping container for this one already has the wp-block className.\n\t\t\t\tclassName=\"block-editor-default-block-appender__content\"\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( ENTER === event.keyCode || SPACE === event.keyCode ) {\n\t\t\t\t\t\tonAppend();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tonClick={ () => onAppend() }\n\t\t\t\tonFocus={ () => {\n\t\t\t\t\tif ( showPrompt ) {\n\t\t\t\t\t\tonAppend();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ showPrompt ? value : ZWNBSP }\n\t\t\t</p>\n\t\t\t<Inserter\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\tposition=\"bottom right\"\n\t\t\t\tisAppender\n\t\t\t\t__experimentalIsQuick\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,SAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAAwD,IAAAO,WAAA,GAAAP,OAAA;AAjBxD;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACO,MAAMQ,MAAM,GAAAC,OAAA,CAAAD,MAAA,GAAG,QAAQ;AAEf,SAASE,oBAAoBA,CAAE;EAAEC;AAAa,CAAC,EAAG;EAChE,MAAM;IAAEC,UAAU;IAAEC,QAAQ;IAAEC,WAAW;IAAEC;EAAa,CAAC,GAAG,IAAAC,eAAS,EAClEC,MAAM,IAAM;IACb,MAAM;MACLC,aAAa;MACbC,WAAW;MACXC,eAAe;MACfC;IACD,CAAC,GAAGJ,MAAM,CAAEK,YAAiB,CAAC;IAE9B,MAAMC,OAAO,GAAG,CA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G;MACHc,OAAO,EAAGA,CAAA,KAAMd,QAAQ,CAAC,CAAG;MAC5Be,OAAO,EAAGA,CAAA,KAAM;QACf,IAAKpC,UAAU,EAAG;UACjBqB,QAAQ,CAAC,CAAC;QACX;MACD,CAAG;MAAAK,QAAA,EAED1B,UAAU,GAAGkB,KAAK,GAAGtB;IAAM,CAC3B,CAAC,eACJ,IAAAD,WAAA,CAAAgC,GAAA,EAAClC,SAAA,CAAA4C,OAAQ;MACRtC,YAAY,EAAGA,YAAc;MAC7BuC,QAAQ,EAAC,cAAc;MACvBC,UAAU;MACVC,qBAAqB;IAAA,CACrB,CAAC;EAAA,CACE,CAAC;AAER","ignoreList":[]}
|
|
@@ -8,7 +8,6 @@ var _components = require("@wordpress/components");
|
|
|
8
8
|
var _element = require("@wordpress/element");
|
|
9
9
|
var _i18n = require("@wordpress/i18n");
|
|
10
10
|
var _getFontStylesAndWeights = require("../../utils/get-font-styles-and-weights");
|
|
11
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
12
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
12
|
/**
|
|
14
13
|
* WordPress dependencies
|
|
@@ -18,9 +17,6 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
18
17
|
* Internal dependencies
|
|
19
18
|
*/
|
|
20
19
|
|
|
21
|
-
const {
|
|
22
|
-
CustomSelectControlV2Legacy: CustomSelectControl
|
|
23
|
-
} = (0, _lockUnlock.unlock)(_components.privateApis);
|
|
24
20
|
/**
|
|
25
21
|
* Adjusts font appearance field label in case either font styles or weights
|
|
26
22
|
* are disabled.
|
|
@@ -28,8 +24,7 @@ const {
|
|
|
28
24
|
* @param {boolean} hasFontStyles Whether font styles are enabled and present.
|
|
29
25
|
* @param {boolean} hasFontWeights Whether font weights are enabled and present.
|
|
30
26
|
* @return {string} A label representing what font appearance is being edited.
|
|
31
|
-
*/
|
|
32
|
-
const getFontAppearanceLabel = (hasFontStyles, hasFontWeights) => {
|
|
27
|
+
*/const getFontAppearanceLabel = (hasFontStyles, hasFontWeights) => {
|
|
33
28
|
if (!hasFontStyles) {
|
|
34
29
|
return (0, _i18n.__)('Font weight');
|
|
35
30
|
}
|
|
@@ -155,7 +150,7 @@ function FontAppearanceControl(props) {
|
|
|
155
150
|
// translators: %s: Currently selected font appearance.
|
|
156
151
|
(0, _i18n.__)('Currently selected font appearance: %s'), currentSelection.name);
|
|
157
152
|
};
|
|
158
|
-
return hasStylesOrWeights && /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomSelectControl, {
|
|
153
|
+
return hasStylesOrWeights && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CustomSelectControl, {
|
|
159
154
|
...otherProps,
|
|
160
155
|
className: "components-font-appearance-control",
|
|
161
156
|
label: label,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_element","_i18n","_getFontStylesAndWeights","
|
|
1
|
+
{"version":3,"names":["_components","require","_element","_i18n","_getFontStylesAndWeights","_jsxRuntime","getFontAppearanceLabel","hasFontStyles","hasFontWeights","__","FontAppearanceControl","props","onChange","fontFamilyFaces","value","fontStyle","fontWeight","otherProps","hasStylesOrWeights","label","defaultOption","key","name","style","undefined","fontStyles","fontWeights","combinedStyleAndWeightOptions","getFontStylesAndWeights","combineOptions","combinedOptions","push","styleOptions","forEach","weightOptions","selectOptions","useMemo","options","currentSelection","find","option","getDescribedBy","sprintf","jsx","CustomSelectControl","className","describedBy","selectedItem"],"sources":["@wordpress/block-editor/src/components/font-appearance-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights';\n\n/**\n * Adjusts font appearance field label in case either font styles or weights\n * are disabled.\n *\n * @param {boolean} hasFontStyles Whether font styles are enabled and present.\n * @param {boolean} hasFontWeights Whether font weights are enabled and present.\n * @return {string} A label representing what font appearance is being edited.\n */\nconst getFontAppearanceLabel = ( hasFontStyles, hasFontWeights ) => {\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\n\treturn __( 'Appearance' );\n};\n\n/**\n * Control to display font style and weight options of the active font.\n *\n * @param {Object} props Component props.\n *\n * @return {Element} Font appearance control.\n */\nexport default function FontAppearanceControl( props ) {\n\tconst {\n\t\tonChange,\n\t\thasFontStyles = true,\n\t\thasFontWeights = true,\n\t\tfontFamilyFaces,\n\t\tvalue: { fontStyle, fontWeight },\n\t\t...otherProps\n\t} = props;\n\tconst hasStylesOrWeights = hasFontStyles || hasFontWeights;\n\tconst label = getFontAppearanceLabel( hasFontStyles, hasFontWeights );\n\tconst defaultOption = {\n\t\tkey: 'default',\n\t\tname: __( 'Default' ),\n\t\tstyle: { fontStyle: undefined, fontWeight: undefined },\n\t};\n\tconst { fontStyles, fontWeights, combinedStyleAndWeightOptions } =\n\t\tgetFontStylesAndWeights( fontFamilyFaces );\n\n\t// Generates select options for combined font styles and weights.\n\tconst combineOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tif ( combinedStyleAndWeightOptions ) {\n\t\t\tcombinedOptions.push( ...combinedStyleAndWeightOptions );\n\t\t}\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font styles only.\n\tconst styleOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tfontStyles.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: value, fontWeight: undefined },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font weights only.\n\tconst weightOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tfontWeights.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: undefined, fontWeight: value },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Map font styles and weights to select options.\n\tconst selectOptions = useMemo( () => {\n\t\t// Display combined available font style and weight options.\n\t\tif ( hasFontStyles && hasFontWeights ) {\n\t\t\treturn combineOptions();\n\t\t}\n\n\t\t// Display only font style options or font weight options.\n\t\treturn hasFontStyles ? styleOptions() : weightOptions();\n\t}, [\n\t\tprops.options,\n\t\tfontStyles,\n\t\tfontWeights,\n\t\tcombinedStyleAndWeightOptions,\n\t] );\n\n\t// Find current selection by comparing font style & weight against options,\n\t// and fall back to the Default option if there is no matching option.\n\tconst currentSelection =\n\t\tselectOptions.find(\n\t\t\t( option ) =>\n\t\t\t\toption.style.fontStyle === fontStyle &&\n\t\t\t\toption.style.fontWeight === fontWeight\n\t\t) || selectOptions[ 0 ];\n\n\t// Adjusts screen reader description based on styles or weights.\n\tconst getDescribedBy = () => {\n\t\tif ( ! currentSelection ) {\n\t\t\treturn __( 'No selected font appearance' );\n\t\t}\n\n\t\tif ( ! hasFontStyles ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font weight.\n\t\t\t\t__( 'Currently selected font weight: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasFontWeights ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font style.\n\t\t\t\t__( 'Currently selected font style: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\treturn sprintf(\n\t\t\t// translators: %s: Currently selected font appearance.\n\t\t\t__( 'Currently selected font appearance: %s' ),\n\t\t\tcurrentSelection.name\n\t\t);\n\t};\n\n\treturn (\n\t\thasStylesOrWeights && (\n\t\t\t<CustomSelectControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tclassName=\"components-font-appearance-control\"\n\t\t\t\tlabel={ label }\n\t\t\t\tdescribedBy={ getDescribedBy() }\n\t\t\t\toptions={ selectOptions }\n\t\t\t\tvalue={ currentSelection }\n\t\t\t\tonChange={ ( { selectedItem } ) =>\n\t\t\t\t\tonChange( selectedItem.style )\n\t\t\t\t}\n\t\t\t/>\n\t\t)\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,wBAAA,GAAAH,OAAA;AAAkF,IAAAI,WAAA,GAAAJ,OAAA;AAVlF;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMK,sBAAsB,GAAGA,CAAEC,aAAa,EAAEC,cAAc,KAAM;EACnE,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAAE,QAAE,EAAE,aAAc,CAAC;EAC3B;EAEA,IAAK,CAAED,cAAc,EAAG;IACvB,OAAO,IAAAC,QAAE,EAAE,YAAa,CAAC;EAC1B;EAEA,OAAO,IAAAA,QAAE,EAAE,YAAa,CAAC;AAC1B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,qBAAqBA,CAAEC,KAAK,EAAG;EACtD,MAAM;IACLC,QAAQ;IACRL,aAAa,GAAG,IAAI;IACpBC,cAAc,GAAG,IAAI;IACrBK,eAAe;IACfC,KAAK,EAAE;MAAEC,SAAS;MAAEC;IAAW,CAAC;IAChC,GAAGC;EACJ,CAAC,GAAGN,KAAK;EACT,MAAMO,kBAAkB,GAAGX,aAAa,IAAIC,cAAc;EAC1D,MAAMW,KAAK,GAAGb,sBAAsB,CAAEC,aAAa,EAAEC,cAAe,CAAC;EACrE,MAAMY,aAAa,GAAG;IACrBC,GAAG,EAAE,SAAS;IACdC,IAAI,EAAE,IAAAb,QAAE,EAAE,SAAU,CAAC;IACrBc,KAAK,EAAE;MAAER,SAAS,EAA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AAEmC;IAAa,CAAC,KAC5BnC,QAAQ,CAAEmC,YAAY,CAACxB,KAAM;EAC7B,CACD,CACD;AAEH","ignoreList":[]}
|
|
@@ -359,6 +359,7 @@ function BackgroundSizeControls({
|
|
|
359
359
|
const repeatValue = style?.background?.backgroundRepeat || inheritedValue?.background?.backgroundRepeat;
|
|
360
360
|
const imageValue = style?.background?.backgroundImage?.url || inheritedValue?.background?.backgroundImage?.url;
|
|
361
361
|
const positionValue = style?.background?.backgroundPosition || inheritedValue?.background?.backgroundPosition;
|
|
362
|
+
const attachmentValue = style?.background?.backgroundAttachment || inheritedValue?.background?.backgroundAttachment;
|
|
362
363
|
|
|
363
364
|
/*
|
|
364
365
|
* An `undefined` value is replaced with any supplied
|
|
@@ -418,8 +419,9 @@ function BackgroundSizeControls({
|
|
|
418
419
|
onChange((0, _object.setImmutably)(style, ['background', 'backgroundPosition'], coordsToBackgroundPosition(next)));
|
|
419
420
|
};
|
|
420
421
|
const toggleIsRepeated = () => onChange((0, _object.setImmutably)(style, ['background', 'backgroundRepeat'], repeatCheckedValue === true ? 'no-repeat' : 'repeat'));
|
|
422
|
+
const toggleScrollWithPage = () => onChange((0, _object.setImmutably)(style, ['background', 'backgroundAttachment'], attachmentValue === 'fixed' ? 'scroll' : 'fixed'));
|
|
421
423
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
422
|
-
spacing:
|
|
424
|
+
spacing: 4,
|
|
423
425
|
className: "single-column",
|
|
424
426
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FocalPointPicker, {
|
|
425
427
|
__next40pxDefaultSize: true,
|
|
@@ -428,6 +430,11 @@ function BackgroundSizeControls({
|
|
|
428
430
|
url: (0, _themeFileUriUtils.getResolvedThemeFilePath)(imageValue, themeFileURIs),
|
|
429
431
|
value: backgroundPositionToCoords(positionValue),
|
|
430
432
|
onChange: updateBackgroundPosition
|
|
433
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
434
|
+
label: (0, _i18n.__)('Fixed background'),
|
|
435
|
+
checked: attachmentValue === 'fixed',
|
|
436
|
+
onChange: toggleScrollWithPage,
|
|
437
|
+
help: (0, _i18n.__)('Whether your image should scroll with the page or stay fixed in place.')
|
|
431
438
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToggleGroupControl, {
|
|
432
439
|
size: "__unstable-large",
|
|
433
440
|
label: (0, _i18n.__)('Size'),
|