@wordpress/block-editor 13.4.0 → 14.0.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 +11 -0
- package/README.md +11 -1
- package/build/components/block-breadcrumb/index.js +3 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-draggable/index.js +2 -2
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-refs.js +24 -32
- package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build/components/block-mover/index.js +1 -2
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-popover/cover.js +1 -1
- package/build/components/block-popover/cover.js.map +1 -1
- package/build/components/block-popover/inbetween.js +2 -2
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +2 -2
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +1 -2
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +1 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +15 -16
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +0 -1
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/child-layout-control/index.js +3 -1
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/dimensions-tool/scale-tool.js +1 -0
- package/build/components/dimensions-tool/scale-tool.js.map +1 -1
- package/build/components/font-family/index.js +12 -0
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +55 -51
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +1 -0
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/theme-file-uri-utils.js +0 -59
- package/build/components/global-styles/theme-file-uri-utils.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +0 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +58 -39
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +96 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +30 -26
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-item-resizer.js +14 -15
- package/build/components/grid/grid-item-resizer.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 +56 -20
- package/build/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build/components/iframe/index.js +4 -8
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +29 -2
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/menu.js +2 -2
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/line-height-control/index.js +0 -15
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +0 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/media-replace-flow/index.js +3 -1
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/resolution-tool/index.js +1 -0
- package/build/components/resolution-tool/index.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +4 -2
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -6
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/button.js +0 -1
- package/build/components/url-input/button.js.map +1 -1
- package/build/components/url-input/index.js +1 -11
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/link-editor.js +0 -1
- package/build/components/url-popover/link-editor.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +30 -4
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +3 -6
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +1 -3
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +2 -1
- package/build/components/use-settings/index.js.map +1 -1
- package/build/hooks/block-bindings.js +248 -36
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/block-hooks.js +1 -0
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js +2 -2
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/contrast-checker.js +6 -6
- package/build/hooks/contrast-checker.js.map +1 -1
- package/build/hooks/duotone.js +3 -3
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +7 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/line-height.js +0 -1
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +1 -1
- package/build/hooks/spacing-visualizer.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +4 -0
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-zoom-out.js +1 -1
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/hooks/utils.js +20 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/private-apis.js +0 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +9 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +4 -4
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-editor-region.js +1 -1
- package/build/utils/get-editor-region.js.map +1 -1
- package/build/utils/get-px-from-css-unit.js +1 -1
- package/build/utils/get-px-from-css-unit.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +4 -2
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-draggable/index.js +3 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-refs.js +24 -34
- package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -2
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-popover/cover.js +1 -1
- package/build-module/components/block-popover/cover.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +1 -1
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -1
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +1 -2
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +1 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +16 -17
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +0 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +3 -1
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/dimensions-tool/scale-tool.js +1 -0
- package/build-module/components/dimensions-tool/scale-tool.js.map +1 -1
- package/build-module/components/font-family/index.js +11 -0
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +55 -51
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +1 -0
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/theme-file-uri-utils.js +0 -58
- package/build-module/components/global-styles/theme-file-uri-utils.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +0 -1
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +57 -38
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +92 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +30 -26
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-item-resizer.js +14 -15
- package/build-module/components/grid/grid-item-resizer.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 +56 -20
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build-module/components/iframe/index.js +4 -8
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +30 -3
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/menu.js +2 -2
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/line-height-control/index.js +0 -14
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +0 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +3 -1
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/resolution-tool/index.js +1 -0
- package/build-module/components/resolution-tool/index.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +5 -3
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -6
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/button.js +0 -1
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +1 -11
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +0 -1
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +30 -4
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +3 -6
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +1 -3
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +2 -1
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/hooks/block-bindings.js +253 -40
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/block-hooks.js +1 -0
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +3 -3
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/contrast-checker.js +7 -7
- package/build-module/hooks/contrast-checker.js.map +1 -1
- package/build-module/hooks/duotone.js +4 -4
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +2 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/line-height.js +0 -1
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +1 -1
- package/build-module/hooks/spacing-visualizer.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +3 -0
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +1 -1
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/hooks/utils.js +19 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/private-apis.js +1 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +9 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +4 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-editor-region.js +1 -1
- package/build-module/utils/get-editor-region.js.map +1 -1
- package/build-module/utils/get-px-from-css-unit.js +1 -1
- package/build-module/utils/get-px-from-css-unit.js.map +1 -1
- package/build-style/content-rtl.css +5 -12
- package/build-style/content.css +5 -12
- package/build-style/default-editor-styles-rtl.css +3 -0
- package/build-style/default-editor-styles.css +3 -0
- package/build-style/style-rtl.css +88 -46
- package/build-style/style.css +88 -46
- package/package.json +31 -31
- package/src/autocompleters/style.scss +4 -0
- package/src/components/block-breadcrumb/index.js +4 -2
- package/src/components/block-canvas/style.scss +1 -0
- package/src/components/block-draggable/index.js +3 -3
- package/src/components/block-list/use-block-props/use-block-refs.js +27 -43
- package/src/components/block-mover/index.js +5 -2
- package/src/components/block-popover/cover.js +1 -1
- package/src/components/block-popover/inbetween.js +1 -1
- package/src/components/block-popover/index.js +1 -1
- package/src/components/block-tools/block-selection-button.js +1 -2
- package/src/components/block-tools/index.js +5 -6
- package/src/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/src/components/block-tools/zoom-out-mode-inserters.js +14 -18
- package/src/components/block-tools/zoom-out-toolbar.js +0 -1
- package/src/components/button-block-appender/content.scss +1 -1
- package/src/components/child-layout-control/index.js +2 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +2 -2
- package/src/components/colors-gradients/test/control.js +3 -2
- package/src/components/dimensions-tool/scale-tool.js +1 -0
- package/src/components/font-family/README.md +8 -0
- package/src/components/font-family/index.js +16 -0
- package/src/components/font-family/stories/index.story.js +54 -0
- package/src/components/global-styles/background-panel.js +69 -61
- package/src/components/global-styles/image-settings-panel.js +1 -0
- package/src/components/global-styles/style.scss +0 -10
- package/src/components/global-styles/test/theme-file-uri-utils.js +1 -26
- package/src/components/global-styles/test/use-global-styles-output.js +49 -4
- package/src/components/global-styles/test/utils.js +120 -0
- package/src/components/global-styles/theme-file-uri-utils.js +0 -59
- package/src/components/global-styles/typography-panel.js +0 -1
- package/src/components/global-styles/use-global-styles-output.js +67 -48
- package/src/components/global-styles/utils.js +112 -0
- package/src/components/grid/grid-item-movers.js +46 -44
- package/src/components/grid/grid-item-resizer.js +11 -17
- package/src/components/grid/grid-visualizer.js +1 -1
- package/src/components/grid/style.scss +60 -10
- package/src/components/grid/use-grid-layout-sync.js +68 -14
- package/src/components/iframe/content.scss +2 -2
- package/src/components/iframe/index.js +3 -7
- package/src/components/inserter/category-tabs/index.js +35 -2
- package/src/components/inserter/menu.js +2 -2
- package/src/components/inserter/style.scss +16 -11
- package/src/components/inspector-controls/README.md +5 -0
- package/src/components/line-height-control/README.md +0 -8
- package/src/components/line-height-control/index.js +1 -21
- package/src/components/line-height-control/stories/index.story.js +0 -1
- package/src/components/line-height-control/test/index.js +1 -7
- package/src/components/link-control/search-input.js +0 -1
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +3 -1
- package/src/components/resolution-tool/index.js +1 -0
- package/src/components/responsive-block-control/test/index.js +5 -1
- package/src/components/skip-to-selected-block/index.js +5 -3
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -6
- package/src/components/tabbed-sidebar/style.scss +1 -19
- package/src/components/url-input/README.md +0 -5
- package/src/components/url-input/button.js +0 -1
- package/src/components/url-input/index.js +1 -15
- package/src/components/url-popover/link-editor.js +0 -1
- package/src/components/use-block-drop-zone/index.js +66 -14
- package/src/components/use-on-block-drop/index.js +1 -9
- package/src/components/use-resize-canvas/index.js +1 -3
- package/src/components/use-settings/index.js +2 -1
- package/src/hooks/block-bindings.js +303 -52
- package/src/hooks/block-bindings.scss +13 -2
- package/src/hooks/block-hooks.js +1 -0
- package/src/hooks/block-hooks.scss +1 -0
- package/src/hooks/block-style-variation.js +3 -3
- package/src/hooks/contrast-checker.js +7 -7
- package/src/hooks/duotone.js +4 -4
- package/src/hooks/index.js +2 -1
- package/src/hooks/line-height.js +0 -1
- package/src/hooks/spacing-visualizer.js +1 -1
- package/src/hooks/use-bindings-attributes.js +4 -0
- package/src/hooks/use-editor-wrapper-styles.native.scss +1 -0
- package/src/hooks/use-zoom-out.js +1 -1
- package/src/hooks/utils.js +14 -1
- package/src/index.js +1 -0
- package/src/private-apis.js +1 -2
- package/src/store/actions.js +13 -5
- package/src/store/selectors.js +4 -4
- package/src/style.scss +1 -1
- package/src/utils/get-editor-region.js +1 -1
- package/src/utils/get-px-from-css-unit.js +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -30
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -23
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -25
|
@@ -10,6 +10,7 @@ import { usePrevious } from '@wordpress/compose';
|
|
|
10
10
|
*/
|
|
11
11
|
import { store as blockEditorStore } from '../../store';
|
|
12
12
|
import { GridRect } from './utils';
|
|
13
|
+
import { setImmutably } from '../../utils/object';
|
|
13
14
|
export function useGridLayoutSync({
|
|
14
15
|
clientId: gridClientId
|
|
15
16
|
}) {
|
|
@@ -31,7 +32,8 @@ export function useGridLayoutSync({
|
|
|
31
32
|
};
|
|
32
33
|
}, [gridClientId]);
|
|
33
34
|
const {
|
|
34
|
-
getBlockAttributes
|
|
35
|
+
getBlockAttributes,
|
|
36
|
+
getBlockRootClientId
|
|
35
37
|
} = useSelect(blockEditorStore);
|
|
36
38
|
const {
|
|
37
39
|
updateBlockAttributes,
|
|
@@ -39,6 +41,8 @@ export function useGridLayoutSync({
|
|
|
39
41
|
} = useDispatch(blockEditorStore);
|
|
40
42
|
const selectedBlockRect = useMemo(() => selectedBlockLayout ? new GridRect(selectedBlockLayout) : null, [selectedBlockLayout]);
|
|
41
43
|
const previouslySelectedBlockRect = usePrevious(selectedBlockRect);
|
|
44
|
+
const previousIsManualPlacement = usePrevious(gridLayout.isManualPlacement);
|
|
45
|
+
const previousBlockOrder = usePrevious(blockOrder);
|
|
42
46
|
useEffect(() => {
|
|
43
47
|
const updates = {};
|
|
44
48
|
if (gridLayout.isManualPlacement) {
|
|
@@ -106,24 +110,56 @@ export function useGridLayoutSync({
|
|
|
106
110
|
}
|
|
107
111
|
};
|
|
108
112
|
}
|
|
113
|
+
|
|
114
|
+
// Unset grid layout attributes for blocks removed from the grid.
|
|
115
|
+
for (const clientId of previousBlockOrder !== null && previousBlockOrder !== void 0 ? previousBlockOrder : []) {
|
|
116
|
+
if (!blockOrder.includes(clientId)) {
|
|
117
|
+
var _attributes$style$lay2;
|
|
118
|
+
const rootClientId = getBlockRootClientId(clientId);
|
|
119
|
+
|
|
120
|
+
// Block was removed from the editor, so nothing to do.
|
|
121
|
+
if (rootClientId === null) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Check if the block is being moved to another grid.
|
|
126
|
+
// If so, do nothing and let the new grid parent handle
|
|
127
|
+
// the attributes.
|
|
128
|
+
const rootAttributes = getBlockAttributes(rootClientId);
|
|
129
|
+
if (rootAttributes?.layout?.type === 'grid') {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const attributes = getBlockAttributes(clientId);
|
|
133
|
+
const {
|
|
134
|
+
columnStart,
|
|
135
|
+
rowStart,
|
|
136
|
+
columnSpan,
|
|
137
|
+
rowSpan,
|
|
138
|
+
...layout
|
|
139
|
+
} = (_attributes$style$lay2 = attributes.style?.layout) !== null && _attributes$style$lay2 !== void 0 ? _attributes$style$lay2 : {};
|
|
140
|
+
if (columnStart || rowStart || columnSpan || rowSpan) {
|
|
141
|
+
const hasEmptyLayoutAttribute = Object.keys(layout).length === 0;
|
|
142
|
+
updates[clientId] = setImmutably(attributes, ['style', 'layout'], hasEmptyLayoutAttribute ? undefined : layout);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
109
146
|
} else {
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
147
|
+
// Remove all of the columnStart and rowStart values
|
|
148
|
+
// when switching from manual to auto mode,
|
|
149
|
+
if (previousIsManualPlacement === true) {
|
|
150
|
+
for (const clientId of blockOrder) {
|
|
151
|
+
var _attributes$style$lay3;
|
|
152
|
+
const attributes = getBlockAttributes(clientId);
|
|
153
|
+
const {
|
|
154
|
+
columnStart,
|
|
155
|
+
rowStart,
|
|
156
|
+
...layout
|
|
157
|
+
} = (_attributes$style$lay3 = attributes.style?.layout) !== null && _attributes$style$lay3 !== void 0 ? _attributes$style$lay3 : {};
|
|
158
|
+
// Only update attributes if columnStart or rowStart are set.
|
|
159
|
+
if (columnStart || rowStart) {
|
|
160
|
+
const hasEmptyLayoutAttribute = Object.keys(layout).length === 0;
|
|
161
|
+
updates[clientId] = setImmutably(attributes, ['style', 'layout'], hasEmptyLayoutAttribute ? undefined : layout);
|
|
162
|
+
}
|
|
127
163
|
}
|
|
128
164
|
}
|
|
129
165
|
|
|
@@ -143,9 +179,9 @@ export function useGridLayoutSync({
|
|
|
143
179
|
}
|
|
144
180
|
}, [
|
|
145
181
|
// Actual deps to sync:
|
|
146
|
-
gridClientId, gridLayout, blockOrder, previouslySelectedBlockRect,
|
|
182
|
+
gridClientId, gridLayout, previousBlockOrder, blockOrder, previouslySelectedBlockRect, previousIsManualPlacement,
|
|
147
183
|
// These won't change, but the linter thinks they might:
|
|
148
|
-
__unstableMarkNextChangeAsNotPersistent, getBlockAttributes, updateBlockAttributes]);
|
|
184
|
+
__unstableMarkNextChangeAsNotPersistent, getBlockAttributes, getBlockRootClientId, updateBlockAttributes]);
|
|
149
185
|
}
|
|
150
186
|
|
|
151
187
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useSelect","useEffect","useMemo","usePrevious","store","blockEditorStore","GridRect","useGridLayoutSync","clientId","gridClientId","gridLayout","blockOrder","selectedBlockLayout","select","_getBlockAttributes$l","getBlockAttributes","getBlockOrder","selectedBlock","getSelectedBlock","layout","attributes","style","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","selectedBlockRect","previouslySelectedBlockRect","updates","isManualPlacement","occupiedRects","_getBlockAttributes$s","columnStart","rowStart","columnSpan","rowSpan","push","_attributes$style$lay","newColumnStart","newRowStart","placeBlock","columnCount","columnEnd","rowEnd","bottomMostRow","Math","max","map","r","rowCount","_attributes$style$lay2","undefined","Object","keys","length","gridColumnCount","blockColumnSpan","blockRowSpan","startColumn","startRow","row","column","candidateRect","some","intersectsRect"],"sources":["@wordpress/block-editor/src/components/grid/use-grid-layout-sync.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { GridRect } from './utils';\n\nexport function useGridLayoutSync( { clientId: gridClientId } ) {\n\tconst { gridLayout, blockOrder, selectedBlockLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getBlockOrder } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst selectedBlock = select( blockEditorStore ).getSelectedBlock();\n\t\t\treturn {\n\t\t\t\tgridLayout: getBlockAttributes( gridClientId ).layout ?? {},\n\t\t\t\tblockOrder: getBlockOrder( gridClientId ),\n\t\t\t\tselectedBlockLayout: selectedBlock?.attributes.style?.layout,\n\t\t\t};\n\t\t},\n\t\t[ gridClientId ]\n\t);\n\n\tconst { getBlockAttributes } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst selectedBlockRect = useMemo(\n\t\t() =>\n\t\t\tselectedBlockLayout ? new GridRect( selectedBlockLayout ) : null,\n\t\t[ selectedBlockLayout ]\n\t);\n\n\tconst previouslySelectedBlockRect = usePrevious( selectedBlockRect );\n\n\tuseEffect( () => {\n\t\tconst updates = {};\n\n\t\tif ( gridLayout.isManualPlacement ) {\n\t\t\tconst occupiedRects = [];\n\n\t\t\t// Respect the position of blocks that already have a columnStart and rowStart value.\n\t\t\tfor ( const clientId of blockOrder ) {\n\t\t\t\tconst {\n\t\t\t\t\tcolumnStart,\n\t\t\t\t\trowStart,\n\t\t\t\t\tcolumnSpan = 1,\n\t\t\t\t\trowSpan = 1,\n\t\t\t\t} = getBlockAttributes( clientId ).style?.layout ?? {};\n\t\t\t\tif ( ! columnStart || ! rowStart ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\toccupiedRects.push(\n\t\t\t\t\tnew GridRect( {\n\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\trowStart,\n\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\trowSpan,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// When in manual mode, ensure that every block has a columnStart and rowStart value.\n\t\t\tfor ( const clientId of blockOrder ) {\n\t\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\t\tconst {\n\t\t\t\t\tcolumnStart,\n\t\t\t\t\trowStart,\n\t\t\t\t\tcolumnSpan = 1,\n\t\t\t\t\trowSpan = 1,\n\t\t\t\t} = attributes.style?.layout ?? {};\n\t\t\t\tif ( columnStart && rowStart ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst [ newColumnStart, newRowStart ] = placeBlock(\n\t\t\t\t\toccupiedRects,\n\t\t\t\t\tgridLayout.columnCount,\n\t\t\t\t\tcolumnSpan,\n\t\t\t\t\trowSpan,\n\t\t\t\t\tpreviouslySelectedBlockRect?.columnEnd,\n\t\t\t\t\tpreviouslySelectedBlockRect?.rowEnd\n\t\t\t\t);\n\t\t\t\toccupiedRects.push(\n\t\t\t\t\tnew GridRect( {\n\t\t\t\t\t\tcolumnStart: newColumnStart,\n\t\t\t\t\t\trowStart: newRowStart,\n\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\trowSpan,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t\tupdates[ clientId ] = {\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\t...attributes.style,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t...attributes.style?.layout,\n\t\t\t\t\t\t\tcolumnStart: newColumnStart,\n\t\t\t\t\t\t\trowStart: newRowStart,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Ensure there's enough rows to fit all blocks.\n\t\t\tconst bottomMostRow = Math.max(\n\t\t\t\t...occupiedRects.map( ( r ) => r.rowEnd )\n\t\t\t);\n\t\t\tif (\n\t\t\t\t! gridLayout.rowCount ||\n\t\t\t\tgridLayout.rowCount < bottomMostRow\n\t\t\t) {\n\t\t\t\tupdates[ gridClientId ] = {\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...gridLayout,\n\t\t\t\t\t\trowCount: bottomMostRow,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t} else {\n\t\t\t// When in auto mode, remove all of the columnStart and rowStart values.\n\t\t\tfor ( const clientId of blockOrder ) {\n\t\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\t\tconst { columnStart, rowStart, ...layout } =\n\t\t\t\t\tattributes.style?.layout ?? {};\n\t\t\t\t// Only update attributes if columnStart or rowStart are set.\n\t\t\t\tif ( columnStart || rowStart ) {\n\t\t\t\t\tupdates[ clientId ] = {\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...attributes.style,\n\t\t\t\t\t\t\tlayout,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove row styles in auto mode\n\t\t\tif ( gridLayout.rowCount ) {\n\t\t\t\tupdates[ gridClientId ] = {\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...gridLayout,\n\t\t\t\t\t\trowCount: undefined,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tif ( Object.keys( updates ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes(\n\t\t\t\tObject.keys( updates ),\n\t\t\t\tupdates,\n\t\t\t\t/* uniqueByBlock: */ true\n\t\t\t);\n\t\t}\n\t}, [\n\t\t// Actual deps to sync:\n\t\tgridClientId,\n\t\tgridLayout,\n\t\tblockOrder,\n\t\tpreviouslySelectedBlockRect,\n\t\t// These won't change, but the linter thinks they might:\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tgetBlockAttributes,\n\t\tupdateBlockAttributes,\n\t] );\n}\n\n/**\n * @param {GridRect[]} occupiedRects\n * @param {number} gridColumnCount\n * @param {number} blockColumnSpan\n * @param {number} blockRowSpan\n * @param {number?} startColumn\n * @param {number?} startRow\n */\nfunction placeBlock(\n\toccupiedRects,\n\tgridColumnCount,\n\tblockColumnSpan,\n\tblockRowSpan,\n\tstartColumn = 1,\n\tstartRow = 1\n) {\n\tfor ( let row = startRow; ; row++ ) {\n\t\tfor (\n\t\t\tlet column = row === startRow ? startColumn : 1;\n\t\t\tcolumn <= gridColumnCount;\n\t\t\tcolumn++\n\t\t) {\n\t\t\tconst candidateRect = new GridRect( {\n\t\t\t\tcolumnStart: column,\n\t\t\t\trowStart: row,\n\t\t\t\tcolumnSpan: blockColumnSpan,\n\t\t\t\trowSpan: blockRowSpan,\n\t\t\t} );\n\t\t\tif (\n\t\t\t\t! occupiedRects.some( ( r ) =>\n\t\t\t\t\tr.intersectsRect( candidateRect )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn [ column, row ];\n\t\t\t}\n\t\t}\n\t}\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,SAAS,EAAEC,OAAO,QAAQ,oBAAoB;AACvD,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAA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MACzCD,qBAAqB,CACpB4B,MAAM,CAACC,IAAI,CAAEzB,OAAQ,CAAC,EACtBA,OAAO,EACP,oBAAqB,IACtB,CAAC;IACF;EACD,CAAC,EAAE;EACF;EACAjB,YAAY,EACZC,UAAU,EACVC,UAAU,EACVc,2BAA2B;EAC3B;EACAF,uCAAuC,EACvCR,kBAAkB,EAClBO,qBAAqB,CACpB,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASgB,UAAUA,CAClBV,aAAa,EACbyB,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,WAAW,GAAG,CAAC,EACfC,QAAQ,GAAG,CAAC,EACX;EACD,KAAM,IAAIC,GAAG,GAAGD,QAAQ,GAAIC,GAAG,EAAE,EAAG;IACnC,KACC,IAAIC,MAAM,GAAGD,GAAG,KAAKD,QAAQ,GAAGD,WAAW,GAAG,CAAC,EAC/CG,MAAM,IAAIN,eAAe,EACzBM,MAAM,EAAE,EACP;MACD,MAAMC,aAAa,GAAG,IAAItD,QAAQ,CAAE;QACnCwB,WAAW,EAAE6B,MAAM;QACnB5B,QAAQ,EAAE2B,GAAG;QACb1B,UAAU,EAAEsB,eAAe;QAC3BrB,OAAO,EAAEsB;MACV,CAAE,CAAC;MACH,IACC,CAAE3B,aAAa,CAACiC,IAAI,CAAIf,CAAC,IACxBA,CAAC,CAACgB,cAAc,CAAEF,aAAc,CACjC,CAAC,EACA;QACD,OAAO,CAAED,MAAM,EAAED,GAAG,CAAE;MACvB;IACD;EACD;AACD","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useDispatch","useSelect","useEffect","useMemo","usePrevious","store","blockEditorStore","GridRect","setImmutably","useGridLayoutSync","clientId","gridClientId","gridLayout","blockOrder","selectedBlockLayout","select","_getBlockAttributes$l","getBlockAttributes","getBlockOrder","selectedBlock","getSelectedBlock","layout","attributes","style","getBlockRootClientId","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","selectedBlockRect","previouslySelectedBlockRect","previousIsManualPlacement","isManualPlacement","previousBlockOrder","updates","occupiedRects","_getBlockAttributes$s","columnStart","rowStart","columnSpan","rowSpan","push","_attributes$style$lay","newColumnStart","newRowStart","placeBlock","columnCount","columnEnd","rowEnd","bottomMostRow","Math","max","map","r","rowCount","includes","_attributes$style$lay2","rootClientId","rootAttributes","type","hasEmptyLayoutAttribute","Object","keys","length","undefined","_attributes$style$lay3","gridColumnCount","blockColumnSpan","blockRowSpan","startColumn","startRow","row","column","candidateRect","some","intersectsRect"],"sources":["@wordpress/block-editor/src/components/grid/use-grid-layout-sync.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { GridRect } from './utils';\nimport { setImmutably } from '../../utils/object';\n\nexport function useGridLayoutSync( { clientId: gridClientId } ) {\n\tconst { gridLayout, blockOrder, selectedBlockLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getBlockOrder } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst selectedBlock = select( blockEditorStore ).getSelectedBlock();\n\t\t\treturn {\n\t\t\t\tgridLayout: getBlockAttributes( gridClientId ).layout ?? {},\n\t\t\t\tblockOrder: getBlockOrder( gridClientId ),\n\t\t\t\tselectedBlockLayout: selectedBlock?.attributes.style?.layout,\n\t\t\t};\n\t\t},\n\t\t[ gridClientId ]\n\t);\n\n\tconst { getBlockAttributes, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst selectedBlockRect = useMemo(\n\t\t() =>\n\t\t\tselectedBlockLayout ? new GridRect( selectedBlockLayout ) : null,\n\t\t[ selectedBlockLayout ]\n\t);\n\n\tconst previouslySelectedBlockRect = usePrevious( selectedBlockRect );\n\tconst previousIsManualPlacement = usePrevious(\n\t\tgridLayout.isManualPlacement\n\t);\n\tconst previousBlockOrder = usePrevious( blockOrder );\n\n\tuseEffect( () => {\n\t\tconst updates = {};\n\n\t\tif ( gridLayout.isManualPlacement ) {\n\t\t\tconst occupiedRects = [];\n\n\t\t\t// Respect the position of blocks that already have a columnStart and rowStart value.\n\t\t\tfor ( const clientId of blockOrder ) {\n\t\t\t\tconst {\n\t\t\t\t\tcolumnStart,\n\t\t\t\t\trowStart,\n\t\t\t\t\tcolumnSpan = 1,\n\t\t\t\t\trowSpan = 1,\n\t\t\t\t} = getBlockAttributes( clientId ).style?.layout ?? {};\n\t\t\t\tif ( ! columnStart || ! rowStart ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\toccupiedRects.push(\n\t\t\t\t\tnew GridRect( {\n\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\trowStart,\n\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\trowSpan,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// When in manual mode, ensure that every block has a columnStart and rowStart value.\n\t\t\tfor ( const clientId of blockOrder ) {\n\t\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\t\tconst {\n\t\t\t\t\tcolumnStart,\n\t\t\t\t\trowStart,\n\t\t\t\t\tcolumnSpan = 1,\n\t\t\t\t\trowSpan = 1,\n\t\t\t\t} = attributes.style?.layout ?? {};\n\t\t\t\tif ( columnStart && rowStart ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst [ newColumnStart, newRowStart ] = placeBlock(\n\t\t\t\t\toccupiedRects,\n\t\t\t\t\tgridLayout.columnCount,\n\t\t\t\t\tcolumnSpan,\n\t\t\t\t\trowSpan,\n\t\t\t\t\tpreviouslySelectedBlockRect?.columnEnd,\n\t\t\t\t\tpreviouslySelectedBlockRect?.rowEnd\n\t\t\t\t);\n\t\t\t\toccupiedRects.push(\n\t\t\t\t\tnew GridRect( {\n\t\t\t\t\t\tcolumnStart: newColumnStart,\n\t\t\t\t\t\trowStart: newRowStart,\n\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\trowSpan,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t\tupdates[ clientId ] = {\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\t...attributes.style,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t...attributes.style?.layout,\n\t\t\t\t\t\t\tcolumnStart: newColumnStart,\n\t\t\t\t\t\t\trowStart: newRowStart,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Ensure there's enough rows to fit all blocks.\n\t\t\tconst bottomMostRow = Math.max(\n\t\t\t\t...occupiedRects.map( ( r ) => r.rowEnd )\n\t\t\t);\n\t\t\tif (\n\t\t\t\t! gridLayout.rowCount ||\n\t\t\t\tgridLayout.rowCount < bottomMostRow\n\t\t\t) {\n\t\t\t\tupdates[ gridClientId ] = {\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...gridLayout,\n\t\t\t\t\t\trowCount: bottomMostRow,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Unset grid layout attributes for blocks removed from the grid.\n\t\t\tfor ( const clientId of previousBlockOrder ?? [] ) {\n\t\t\t\tif ( ! blockOrder.includes( clientId ) ) {\n\t\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t\t\t// Block was removed from the editor, so nothing to do.\n\t\t\t\t\tif ( rootClientId === null ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check if the block is being moved to another grid.\n\t\t\t\t\t// If so, do nothing and let the new grid parent handle\n\t\t\t\t\t// the attributes.\n\t\t\t\t\tconst rootAttributes = getBlockAttributes( rootClientId );\n\t\t\t\t\tif ( rootAttributes?.layout?.type === 'grid' ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\t\t\tconst {\n\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\trowStart,\n\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t...layout\n\t\t\t\t\t} = attributes.style?.layout ?? {};\n\n\t\t\t\t\tif ( columnStart || rowStart || columnSpan || rowSpan ) {\n\t\t\t\t\t\tconst hasEmptyLayoutAttribute =\n\t\t\t\t\t\t\tObject.keys( layout ).length === 0;\n\n\t\t\t\t\t\tupdates[ clientId ] = setImmutably(\n\t\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t\t[ 'style', 'layout' ],\n\t\t\t\t\t\t\thasEmptyLayoutAttribute ? undefined : layout\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Remove all of the columnStart and rowStart values\n\t\t\t// when switching from manual to auto mode,\n\t\t\tif ( previousIsManualPlacement === true ) {\n\t\t\t\tfor ( const clientId of blockOrder ) {\n\t\t\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\t\t\tconst { columnStart, rowStart, ...layout } =\n\t\t\t\t\t\tattributes.style?.layout ?? {};\n\t\t\t\t\t// Only update attributes if columnStart or rowStart are set.\n\t\t\t\t\tif ( columnStart || rowStart ) {\n\t\t\t\t\t\tconst hasEmptyLayoutAttribute =\n\t\t\t\t\t\t\tObject.keys( layout ).length === 0;\n\n\t\t\t\t\t\tupdates[ clientId ] = setImmutably(\n\t\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t\t[ 'style', 'layout' ],\n\t\t\t\t\t\t\thasEmptyLayoutAttribute ? undefined : layout\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove row styles in auto mode\n\t\t\tif ( gridLayout.rowCount ) {\n\t\t\t\tupdates[ gridClientId ] = {\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...gridLayout,\n\t\t\t\t\t\trowCount: undefined,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tif ( Object.keys( updates ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes(\n\t\t\t\tObject.keys( updates ),\n\t\t\t\tupdates,\n\t\t\t\t/* uniqueByBlock: */ true\n\t\t\t);\n\t\t}\n\t}, [\n\t\t// Actual deps to sync:\n\t\tgridClientId,\n\t\tgridLayout,\n\t\tpreviousBlockOrder,\n\t\tblockOrder,\n\t\tpreviouslySelectedBlockRect,\n\t\tpreviousIsManualPlacement,\n\t\t// These won't change, but the linter thinks they might:\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tgetBlockAttributes,\n\t\tgetBlockRootClientId,\n\t\tupdateBlockAttributes,\n\t] );\n}\n\n/**\n * @param {GridRect[]} occupiedRects\n * @param {number} gridColumnCount\n * @param {number} blockColumnSpan\n * @param {number} blockRowSpan\n * @param {number?} startColumn\n * @param {number?} startRow\n */\nfunction placeBlock(\n\toccupiedRects,\n\tgridColumnCount,\n\tblockColumnSpan,\n\tblockRowSpan,\n\tstartColumn = 1,\n\tstartRow = 1\n) {\n\tfor ( let row = startRow; ; row++ ) {\n\t\tfor (\n\t\t\tlet column = row === startRow ? startColumn : 1;\n\t\t\tcolumn <= gridColumnCount;\n\t\t\tcolumn++\n\t\t) {\n\t\t\tconst candidateRect = new GridRect( {\n\t\t\t\tcolumnStart: column,\n\t\t\t\trowStart: row,\n\t\t\t\tcolumnSpan: blockColumnSpan,\n\t\t\t\trowSpan: blockRowSpan,\n\t\t\t} );\n\t\t\tif (\n\t\t\t\t! occupiedRects.some( ( r ) =>\n\t\t\t\t\tr.intersectsRect( candidateRect )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn [ column, row ];\n\t\t\t}\n\t\t}\n\t}\n}\n"],"mappings":"AAAA;AACA;AACA;AACA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c,CAAEF,aAAc,CACjC,CAAC,EACA;QACD,OAAO,CAAED,MAAM,EAAED,GAAG,CAAE;MACvB;IACD;EACD;AACD","ignoreList":[]}
|
|
@@ -202,10 +202,8 @@ function Iframe({
|
|
|
202
202
|
}, []);
|
|
203
203
|
const isZoomedOut = scale !== 1;
|
|
204
204
|
useEffect(() => {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
}, [containerWidth, isZoomedOut]);
|
|
205
|
+
prevContainerWidth.current = containerWidth;
|
|
206
|
+
}, [containerWidth]);
|
|
209
207
|
const disabledRef = useDisabled({
|
|
210
208
|
isDisabled: !readonly
|
|
211
209
|
});
|
|
@@ -255,7 +253,7 @@ function Iframe({
|
|
|
255
253
|
return;
|
|
256
254
|
}
|
|
257
255
|
iframeDocument.documentElement.classList.add('is-zoomed-out');
|
|
258
|
-
const maxWidth =
|
|
256
|
+
const maxWidth = 750;
|
|
259
257
|
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scale', scale === 'default' ? Math.min(containerWidth, maxWidth) / prevContainerWidth.current : scale);
|
|
260
258
|
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-frame-size', typeof frameSize === 'number' ? `${frameSize}px` : frameSize);
|
|
261
259
|
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-content-height', `${contentHeight}px`);
|
|
@@ -280,10 +278,8 @@ function Iframe({
|
|
|
280
278
|
children: [shouldRenderFocusCaptureElements && before, /*#__PURE__*/_jsx("iframe", {
|
|
281
279
|
...props,
|
|
282
280
|
style: {
|
|
283
|
-
border: 0,
|
|
284
281
|
...props.style,
|
|
285
|
-
height: props.style?.height
|
|
286
|
-
transition: 'all .3s'
|
|
282
|
+
height: props.style?.height
|
|
287
283
|
},
|
|
288
284
|
ref: useMergeRefs([ref, setRef]),
|
|
289
285
|
tabIndex: tabIndex
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useState","createPortal","forwardRef","useMemo","useEffect","useRef","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","getCompatibilityStyles","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","readonly","forwardedRef","ref","title","props","resolvedAssets","isPreviewMode","select","getSettings","settings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","prevContainerWidth","bodyClasses","setBodyClasses","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","containerResizeListener","width","containerWidth","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","classList","add","Array","from","body","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","iframeWindowInnerHeight","setIframeWindowInnerHeight","iframeResizeRef","nodeWindow","innerHeight","onResize","windowInnerWidth","setWindowInnerWidth","windowResizeRef","innerWidth","isZoomedOut","current","disabledRef","isDisabled","bodyRef","src","cleanup","_src","URL","createObjectURL","Blob","revokeObjectURL","maxWidth","style","setProperty","Math","min","remove","removeProperty","shouldRenderFocusCaptureElements","iframe","border","transition","onKeyDown","currentTarget","target","stopPropagation","nativeEvent","KeyboardEvent","className","document","IframeIfReady","isInitialised","__internalIsInitialized"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst settings = getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst prevContainerWidth = useRef();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst [ containerResizeListener, { width: containerWidth } ] =\n\t\tuseResizeObserver();\n\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tdocumentElement.classList.add( 'block-editor-iframe__html' );\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst [ iframeWindowInnerHeight, setIframeWindowInnerHeight ] = useState();\n\n\tconst iframeResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\tconst onResize = () => {\n\t\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst [ windowInnerWidth, setWindowInnerWidth ] = useState();\n\n\tconst windowResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\tconst onResize = () => {\n\t\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst isZoomedOut = scale !== 1;\n\n\tuseEffect( () => {\n\t\tif ( ! isZoomedOut ) {\n\t\t\tprevContainerWidth.current = containerWidth;\n\t\t}\n\t}, [ containerWidth, isZoomedOut ] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t\t// Avoid resize listeners when not needed, these will trigger\n\t\t// unnecessary re-renders when animating the iframe width, or when\n\t\t// expanding preview iframes.\n\t\tisZoomedOut ? iframeResizeRef : null,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>\n\t\t\thtml{\n\t\t\t\theight: auto !important;\n\t\t\t\tmin-height: 100%;\n\t\t\t}\n\t\t\t/* Lowest specificity to not override global styles */\n\t\t\t:where(body) {\n\t\t\t\tmargin: 0;\n\t\t\t\t/* Default background color in case zoom out mode background\n\t\t\t\tcolors the html element */\n\t\t\t\tbackground-color: white;\n\t\t\t}\n\t\t</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\tuseEffect( () => {\n\t\tif ( ! iframeDocument || ! isZoomedOut ) {\n\t\t\treturn;\n\t\t}\n\n\t\tiframeDocument.documentElement.classList.add( 'is-zoomed-out' );\n\n\t\tconst maxWidth = 800;\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-scale',\n\t\t\tscale === 'default'\n\t\t\t\t? Math.min( containerWidth, maxWidth ) /\n\t\t\t\t\t\tprevContainerWidth.current\n\t\t\t\t: scale\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size',\n\t\t\ttypeof frameSize === 'number' ? `${ frameSize }px` : frameSize\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-content-height',\n\t\t\t`${ contentHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height',\n\t\t\t`${ iframeWindowInnerHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-container-width',\n\t\t\t`${ containerWidth }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width',\n\t\t\t`${ prevContainerWidth.current }px`\n\t\t);\n\n\t\treturn () => {\n\t\t\tiframeDocument.documentElement.classList.remove( 'is-zoomed-out' );\n\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-content-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width'\n\t\t\t);\n\t\t};\n\t}, [\n\t\tscale,\n\t\tframeSize,\n\t\tiframeDocument,\n\t\tiframeWindowInnerHeight,\n\t\tcontentHeight,\n\t\tcontainerWidth,\n\t\twindowInnerWidth,\n\t\tisZoomedOut,\n\t] );\n\n\t// Make sure to not render the before and after focusable div elements in view\n\t// mode. They're only needed to capture focus in edit mode.\n\tconst shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;\n\n\tconst iframe = (\n\t\t<>\n\t\t\t{ shouldRenderFocusCaptureElements && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\tborder: 0,\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: props.style?.height,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ title }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We should only stop propagation of the React event,\n\t\t\t\t\t\t// the native event should further bubble inside the\n\t\t\t\t\t\t// iframe to the document and window.\n\t\t\t\t\t\t// Alternatively, we could consider redispatching the\n\t\t\t\t\t\t// native event in the iframe.\n\t\t\t\t\t\tconst { stopPropagation } = event.nativeEvent;\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = () => {};\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = stopPropagation;\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ shouldRenderFocusCaptureElements && after }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-iframe__container\" ref={ windowResizeRef }>\n\t\t\t{ containerResizeListener }\n\t\t\t<div\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-iframe__scale-container',\n\t\t\t\t\tisZoomedOut && 'is-zoomed-out'\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ containerWidth }px`,\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ prevContainerWidth.current }px`,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframe }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,OAAO,EACPC,SAAS,EACTC,MAAM,QACA,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,iBAAiB,EACjBC,YAAY,EACZC,YAAY,EACZC,WAAW,QACL,oBAAoB;AAC3B,SAASC,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;AACpF,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,sBAAsB,QAAQ,4BAA4B;AACnE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAExD,SAASC,WAAWA,CAAEC,KAAK,EAAEC,WAAW,EAAEC,KAAK,EAAG;EACjD,MAAMC,IAAI,GAAG,CAAC,CAAC;EAEf,KAAM,MAAMC,GAAG,IAAIJ,KAAK,EAAG;IAC1BG,IAAI,CAAEC,GAAG,CAAE,GAAGJ,KAAK,CAAEI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gC,IAAI3D,KAAK;EAAA,CAC1C,CACF;EAED,oBACCnE,KAAA;IAAKwI,SAAS,EAAC,gCAAgC;IAACxF,GAAG,EAAGyD,eAAiB;IAAA/D,QAAA,GACpE6B,uBAAuB,eACzBzE,IAAA;MACC0I,SAAS,EAAG/J,IAAI,CACf,sCAAsC,EACtCkI,WAAW,IAAI,eAChB,CAAG;MACHa,KAAK,EAAG;QACP,mDAAmD,EAClDb,WAAW,IAAK,GAAGlC,cAAgB,IAAG;QACvC,wDAAwD,EACvDkC,WAAW,IAAK,GAAG9C,kBAAkB,CAAC+C,OAAS;MACjD,CAAG;MAAAlE,QAAA,EAEDqF;IAAM,CACJ,CAAC;EAAA,CACF,CAAC;AAER;AAEA,SAASW,aAAaA,CAAExF,KAAK,EAAEF,GAAG,EAAG;EACpC,MAAM2F,aAAa,GAAGpJ,SAAS,CAC5B8D,MAAM,IACPA,MAAM,CAAEzD,gBAAiB,CAAC,CAAC0D,WAAW,CAAC,CAAC,CAACsF,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,oBAAO7I,IAAA,CAAC0C,MAAM;IAAA,GAAMU,KAAK;IAAGH,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAEA,eAAepE,UAAU,CAAE8J,aAAc,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useState","createPortal","forwardRef","useMemo","useEffect","useRef","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","getCompatibilityStyles","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","readonly","forwardedRef","ref","title","props","resolvedAssets","isPreviewMode","select","getSettings","settings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","prevContainerWidth","bodyClasses","setBodyClasses","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","containerResizeListener","width","containerWidth","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","classList","add","Array","from","body","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","iframeWindowInnerHeight","setIframeWindowInnerHeight","iframeResizeRef","nodeWindow","innerHeight","onResize","windowInnerWidth","setWindowInnerWidth","windowResizeRef","innerWidth","isZoomedOut","current","disabledRef","isDisabled","bodyRef","src","cleanup","_src","URL","createObjectURL","Blob","revokeObjectURL","maxWidth","style","setProperty","Math","min","remove","removeProperty","shouldRenderFocusCaptureElements","iframe","onKeyDown","currentTarget","target","stopPropagation","nativeEvent","KeyboardEvent","className","document","IframeIfReady","isInitialised","__internalIsInitialized"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst settings = getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst prevContainerWidth = useRef();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst [ containerResizeListener, { width: containerWidth } ] =\n\t\tuseResizeObserver();\n\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tdocumentElement.classList.add( 'block-editor-iframe__html' );\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst [ iframeWindowInnerHeight, setIframeWindowInnerHeight ] = useState();\n\n\tconst iframeResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\tconst onResize = () => {\n\t\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst [ windowInnerWidth, setWindowInnerWidth ] = useState();\n\n\tconst windowResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\tconst onResize = () => {\n\t\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst isZoomedOut = scale !== 1;\n\n\tuseEffect( () => {\n\t\tprevContainerWidth.current = containerWidth;\n\t}, [ containerWidth ] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t\t// Avoid resize listeners when not needed, these will trigger\n\t\t// unnecessary re-renders when animating the iframe width, or when\n\t\t// expanding preview iframes.\n\t\tisZoomedOut ? iframeResizeRef : null,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>\n\t\t\thtml{\n\t\t\t\theight: auto !important;\n\t\t\t\tmin-height: 100%;\n\t\t\t}\n\t\t\t/* Lowest specificity to not override global styles */\n\t\t\t:where(body) {\n\t\t\t\tmargin: 0;\n\t\t\t\t/* Default background color in case zoom out mode background\n\t\t\t\tcolors the html element */\n\t\t\t\tbackground-color: white;\n\t\t\t}\n\t\t</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\tuseEffect( () => {\n\t\tif ( ! iframeDocument || ! isZoomedOut ) {\n\t\t\treturn;\n\t\t}\n\n\t\tiframeDocument.documentElement.classList.add( 'is-zoomed-out' );\n\n\t\tconst maxWidth = 750;\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-scale',\n\t\t\tscale === 'default'\n\t\t\t\t? Math.min( containerWidth, maxWidth ) /\n\t\t\t\t\t\tprevContainerWidth.current\n\t\t\t\t: scale\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size',\n\t\t\ttypeof frameSize === 'number' ? `${ frameSize }px` : frameSize\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-content-height',\n\t\t\t`${ contentHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height',\n\t\t\t`${ iframeWindowInnerHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-container-width',\n\t\t\t`${ containerWidth }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width',\n\t\t\t`${ prevContainerWidth.current }px`\n\t\t);\n\n\t\treturn () => {\n\t\t\tiframeDocument.documentElement.classList.remove( 'is-zoomed-out' );\n\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-content-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width'\n\t\t\t);\n\t\t};\n\t}, [\n\t\tscale,\n\t\tframeSize,\n\t\tiframeDocument,\n\t\tiframeWindowInnerHeight,\n\t\tcontentHeight,\n\t\tcontainerWidth,\n\t\twindowInnerWidth,\n\t\tisZoomedOut,\n\t] );\n\n\t// Make sure to not render the before and after focusable div elements in view\n\t// mode. They're only needed to capture focus in edit mode.\n\tconst shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;\n\n\tconst iframe = (\n\t\t<>\n\t\t\t{ shouldRenderFocusCaptureElements && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: props.style?.height,\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ title }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We should only stop propagation of the React event,\n\t\t\t\t\t\t// the native event should further bubble inside the\n\t\t\t\t\t\t// iframe to the document and window.\n\t\t\t\t\t\t// Alternatively, we could consider redispatching the\n\t\t\t\t\t\t// native event in the iframe.\n\t\t\t\t\t\tconst { stopPropagation } = event.nativeEvent;\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = () => {};\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = stopPropagation;\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ shouldRenderFocusCaptureElements && after }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-iframe__container\" ref={ windowResizeRef }>\n\t\t\t{ containerResizeListener }\n\t\t\t<div\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-iframe__scale-container',\n\t\t\t\t\tisZoomedOut && 'is-zoomed-out'\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ containerWidth }px`,\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ prevContainerWidth.current }px`,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframe }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":"AAAA;AACA;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J,SAAS,CAC5B8D,MAAM,IACPA,MAAM,CAAEzD,gBAAiB,CAAC,CAAC0D,WAAW,CAAC,CAAC,CAACoF,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,oBAAO3I,IAAA,CAAC0C,MAAM;IAAA,GAAMU,KAAK;IAAGH,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAEA,eAAepE,UAAU,CAAE4J,aAAc,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { usePrevious, useReducedMotion } from '@wordpress/compose';
|
|
4
5
|
import { isRTL } from '@wordpress/i18n';
|
|
5
|
-
import { __experimentalHStack as HStack, FlexBlock, privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
6
|
+
import { __experimentalHStack as HStack, FlexBlock, privateApis as componentsPrivateApis, __unstableMotion as motion } from '@wordpress/components';
|
|
6
7
|
import { Icon, chevronRight, chevronLeft } from '@wordpress/icons';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -20,6 +21,15 @@ function CategoryTabs({
|
|
|
20
21
|
onSelectCategory,
|
|
21
22
|
children
|
|
22
23
|
}) {
|
|
24
|
+
// Copied from InterfaceSkeleton.
|
|
25
|
+
const ANIMATION_DURATION = 0.25;
|
|
26
|
+
const disableMotion = useReducedMotion();
|
|
27
|
+
const defaultTransition = {
|
|
28
|
+
type: 'tween',
|
|
29
|
+
duration: disableMotion ? 0 : ANIMATION_DURATION,
|
|
30
|
+
ease: [0.6, 0, 0.4, 1]
|
|
31
|
+
};
|
|
32
|
+
const previousSelectedCategory = usePrevious(selectedCategory);
|
|
23
33
|
return /*#__PURE__*/_jsxs(Tabs, {
|
|
24
34
|
className: "block-editor-inserter__category-tabs",
|
|
25
35
|
selectOnMove: false,
|
|
@@ -47,8 +57,25 @@ function CategoryTabs({
|
|
|
47
57
|
}), categories.map(category => /*#__PURE__*/_jsx(Tabs.TabPanel, {
|
|
48
58
|
tabId: category.name,
|
|
49
59
|
focusable: false,
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
children: /*#__PURE__*/_jsx(motion.div, {
|
|
61
|
+
className: "block-editor-inserter__category-panel",
|
|
62
|
+
initial: !previousSelectedCategory ? 'closed' : 'open',
|
|
63
|
+
animate: "open",
|
|
64
|
+
variants: {
|
|
65
|
+
open: {
|
|
66
|
+
transform: 'translateX( 0 )',
|
|
67
|
+
transitionEnd: {
|
|
68
|
+
zIndex: '1'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
closed: {
|
|
72
|
+
transform: 'translateX( -100% )',
|
|
73
|
+
zIndex: '-1'
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
transition: defaultTransition,
|
|
77
|
+
children: children
|
|
78
|
+
})
|
|
52
79
|
}, category.name))]
|
|
53
80
|
});
|
|
54
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isRTL","__experimentalHStack","HStack","FlexBlock","privateApis","componentsPrivateApis","Icon","chevronRight","chevronLeft","unlock","jsx","_jsx","jsxs","_jsxs","Tabs","CategoryTabs","categories","selectedCategory","onSelectCategory","children","className","selectOnMove","selectedTabId","name","orientation","onSelect","categoryId","find","category","TabList","map","Tab","tabId","label","undefined","icon","TabPanel","focusable"],"sources":["@wordpress/block-editor/src/components/inserter/category-tabs/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { isRTL } from '@wordpress/i18n';\nimport {\n\t__experimentalHStack as HStack,\n\tFlexBlock,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { Icon, chevronRight, chevronLeft } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction CategoryTabs( {\n\tcategories,\n\tselectedCategory,\n\tonSelectCategory,\n\tchildren,\n} ) {\n\treturn (\n\t\t<Tabs\n\t\t\tclassName=\"block-editor-inserter__category-tabs\"\n\t\t\tselectOnMove={ false }\n\t\t\tselectedTabId={ selectedCategory ? selectedCategory.name : null }\n\t\t\torientation=\"vertical\"\n\t\t\tonSelect={ ( categoryId ) => {\n\t\t\t\t// Pass the full category object\n\t\t\t\tonSelectCategory(\n\t\t\t\t\tcategories.find(\n\t\t\t\t\t\t( category ) => category.name === categoryId\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} }\n\t\t>\n\t\t\t<Tabs.TabList className=\"block-editor-inserter__category-tablist\">\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\tkey={ category.name }\n\t\t\t\t\t\ttabId={ category.name }\n\t\t\t\t\t\tclassName=\"block-editor-inserter__category-tab\"\n\t\t\t\t\t\taria-label={ category.label }\n\t\t\t\t\t\taria-current={\n\t\t\t\t\t\t\tcategory === selectedCategory ? 'true' : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack>\n\t\t\t\t\t\t\t<FlexBlock>{ category.label }</FlexBlock>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ isRTL() ? chevronLeft : chevronRight }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t) ) }\n\t\t\t</Tabs.TabList>\n\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\tkey={ category.name }\n\t\t\t\t\ttabId={ category.name }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t\tclassName=\"block-editor-inserter__category-panel\"\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t) ) }\n\t\t</Tabs>\n\t);\n}\n\nexport default CategoryTabs;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,iBAAiB;AACvC,SACCC,oBAAoB,IAAIC,MAAM,EAC9BC,SAAS,EACTC,WAAW,IAAIC,qBAAqB,
|
|
1
|
+
{"version":3,"names":["usePrevious","useReducedMotion","isRTL","__experimentalHStack","HStack","FlexBlock","privateApis","componentsPrivateApis","__unstableMotion","motion","Icon","chevronRight","chevronLeft","unlock","jsx","_jsx","jsxs","_jsxs","Tabs","CategoryTabs","categories","selectedCategory","onSelectCategory","children","ANIMATION_DURATION","disableMotion","defaultTransition","type","duration","ease","previousSelectedCategory","className","selectOnMove","selectedTabId","name","orientation","onSelect","categoryId","find","category","TabList","map","Tab","tabId","label","undefined","icon","TabPanel","focusable","div","initial","animate","variants","open","transform","transitionEnd","zIndex","closed","transition"],"sources":["@wordpress/block-editor/src/components/inserter/category-tabs/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious, useReducedMotion } from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\nimport {\n\t__experimentalHStack as HStack,\n\tFlexBlock,\n\tprivateApis as componentsPrivateApis,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { Icon, chevronRight, chevronLeft } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction CategoryTabs( {\n\tcategories,\n\tselectedCategory,\n\tonSelectCategory,\n\tchildren,\n} ) {\n\t// Copied from InterfaceSkeleton.\n\tconst ANIMATION_DURATION = 0.25;\n\tconst disableMotion = useReducedMotion();\n\tconst defaultTransition = {\n\t\ttype: 'tween',\n\t\tduration: disableMotion ? 0 : ANIMATION_DURATION,\n\t\tease: [ 0.6, 0, 0.4, 1 ],\n\t};\n\n\tconst previousSelectedCategory = usePrevious( selectedCategory );\n\n\treturn (\n\t\t<Tabs\n\t\t\tclassName=\"block-editor-inserter__category-tabs\"\n\t\t\tselectOnMove={ false }\n\t\t\tselectedTabId={ selectedCategory ? selectedCategory.name : null }\n\t\t\torientation=\"vertical\"\n\t\t\tonSelect={ ( categoryId ) => {\n\t\t\t\t// Pass the full category object\n\t\t\t\tonSelectCategory(\n\t\t\t\t\tcategories.find(\n\t\t\t\t\t\t( category ) => category.name === categoryId\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} }\n\t\t>\n\t\t\t<Tabs.TabList className=\"block-editor-inserter__category-tablist\">\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\tkey={ category.name }\n\t\t\t\t\t\ttabId={ category.name }\n\t\t\t\t\t\tclassName=\"block-editor-inserter__category-tab\"\n\t\t\t\t\t\taria-label={ category.label }\n\t\t\t\t\t\taria-current={\n\t\t\t\t\t\t\tcategory === selectedCategory ? 'true' : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack>\n\t\t\t\t\t\t\t<FlexBlock>{ category.label }</FlexBlock>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ isRTL() ? chevronLeft : chevronRight }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t) ) }\n\t\t\t</Tabs.TabList>\n\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\tkey={ category.name }\n\t\t\t\t\ttabId={ category.name }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"block-editor-inserter__category-panel\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\t! previousSelectedCategory ? 'closed' : 'open'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate=\"open\"\n\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\topen: {\n\t\t\t\t\t\t\t\ttransform: 'translateX( 0 )',\n\t\t\t\t\t\t\t\ttransitionEnd: {\n\t\t\t\t\t\t\t\t\tzIndex: '1',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tclosed: {\n\t\t\t\t\t\t\t\ttransform: 'translateX( -100% )',\n\t\t\t\t\t\t\t\tzIndex: '-1',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={ defaultTransition }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</motion.div>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t) ) }\n\t\t</Tabs>\n\t);\n}\n\nexport default CategoryTabs;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,gBAAgB,QAAQ,oBAAoB;AAClE,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SACCC,oBAAoB,IAAIC,MAAM,EAC9BC,SAAS,EACTC,WAAW,IAAIC,qBAAqB,EACpCC,gBAAgB,IAAIC,MAAM,QACpB,uBAAuB;AAC9B,SAASC,IAAI,EAAEC,YAAY,EAAEC,WAAW,QAAQ,kBAAkB;;AAElE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE9C,MAAM;EAAEC;AAAK,CAAC,GAAGL,MAAM,CAAEN,qBAAsB,CAAC;AAEhD,SAASY,YAAYA,CAAE;EACtBC,UAAU;EACVC,gBAAgB;EAChBC,gBAAgB;EAChBC;AACD,CAAC,EAAG;EACH;EACA,MAAMC,kBAAkB,GAAG,IAAI;EAC/B,MAAMC,aAAa,GAAGxB,gBAAgB,CAAC,CAAC;EACxC,MAAMyB,iBAAiB,GAAG;IACzBC,IAAI,EAAE,OAAO;IACbC,QAAQ,EAAEH,aAAa,GAAG,CAAC,GAAGD,kBAAkB;IAChDK,IAAI,EAAE,CAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;EACvB,CAAC;EAED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CAACwC,GAAG;QACVlB,SAAS,EAAC,uCAAuC;QACjDmB,OAAO,EACN,CAAEpB,wBAAwB,GAAG,QAAQ,GAAG,MACxC;QACDqB,OAAO,EAAC,MAAM;QACdC,QAAQ,EAAG;UACVC,IAAI,EAAE;YACLC,SAAS,EAAE,iBAAiB;YAC5BC,aAAa,EAAE;cACdC,MAAM,EAAE;YACT;UACD,CAAC;UACDC,MAAM,EAAE;YACPH,SAAS,EAAE,qBAAqB;YAChCE,MAAM,EAAE;UACT;QACD,CAAG;QACHE,UAAU,EAAGhC,iBAAmB;QAAAH,QAAA,EAE9BA;MAAQ,CACC;IAAC,GAzBPgB,QAAQ,CAACL,IA0BD,CACd,CAAC;EAAA,CACE,CAAC;AAET;AAEA,eAAef,YAAY","ignoreList":[]}
|
|
@@ -19,7 +19,7 @@ import Tips from './tips';
|
|
|
19
19
|
import InserterPreviewPanel from './preview-panel';
|
|
20
20
|
import BlockTypesTab from './block-types-tab';
|
|
21
21
|
import BlockPatternsTab from './block-patterns-tab';
|
|
22
|
-
import {
|
|
22
|
+
import { PatternCategoryPreviews } from './block-patterns-tab/pattern-category-previews';
|
|
23
23
|
import { MediaTab, MediaCategoryPanel } from './media-tab';
|
|
24
24
|
import InserterSearchResults from './search-results';
|
|
25
25
|
import useInsertionPoint from './hooks/use-insertion-point';
|
|
@@ -152,7 +152,7 @@ function InserterMenu({
|
|
|
152
152
|
onInsert: onInsertPattern,
|
|
153
153
|
onSelectCategory: onClickPatternCategory,
|
|
154
154
|
selectedCategory: selectedPatternCategory,
|
|
155
|
-
children: showPatternPanel && /*#__PURE__*/_jsx(
|
|
155
|
+
children: showPatternPanel && /*#__PURE__*/_jsx(PatternCategoryPreviews, {
|
|
156
156
|
rootClientId: destinationRootClientId,
|
|
157
157
|
onInsert: onInsertPattern,
|
|
158
158
|
onHover: onHoverPattern,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","forwardRef","useState","useCallback","useMemo","useRef","useLayoutEffect","VisuallyHidden","SearchControl","Popover","__","useDebouncedInput","useSelect","Tips","InserterPreviewPanel","BlockTypesTab","BlockPatternsTab","PatternCategoryPreviewPanel","MediaTab","MediaCategoryPanel","InserterSearchResults","useInsertionPoint","store","blockEditorStore","TabbedSidebar","useZoomOut","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","NOOP","InserterMenu","rootClientId","clientId","isAppender","__experimentalInsertionIndex","onSelect","showInserterHelpPanel","showMostUsedBlocks","__experimentalFilterValue","shouldFocusBlock","onPatternCategorySelection","onClose","__experimentalInitialTab","__experimentalInitialCategory","ref","isZoomOutMode","select","__unstableGetEditorMode","filterValue","setFilterValue","delayedFilterValue","hoveredItem","setHoveredItem","selectedPatternCategory","setSelectedPatternCategory","patternFilter","setPatternFilter","selectedMediaCategory","setSelectedMediaCategory","selectedTab","setSelectedTab","destinationRootClientId","onInsertBlocks","onToggleInsertionPoint","insertionIndex","blockTypesTabRef","onInsert","blocks","meta","shouldForceFocusBlock","_rootClientId","window","requestAnimationFrame","current","contains","ownerDocument","activeElement","querySelector","focus","onInsertPattern","patternName","onHover","item","onHoverPattern","onClickPatternCategory","patternCategory","filter","showPatternPanel","showMediaPanel","showZoomOut","__experimentalEnableZoomedOutPatternsTab","inserterSearch","children","__nextHasNoMarginBottom","className","onChange","value","label","placeholder","showBlockDirectory","prioritizePatterns","blocksTab","as","patternsTab","onSelectCategory","selectedCategory","category","showTitlesAsTooltip","mediaTab","handleSetSelectedTab","tabsRef","closeButtonLabel","tabs","name","title","panel","placement","offset","focusOnMount","animate","PrivateInserterMenu","PublicInserterMenu","props"],"sources":["@wordpress/block-editor/src/components/inserter/menu.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tforwardRef,\n\tuseState,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { VisuallyHidden, SearchControl, Popover } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDebouncedInput } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport Tips from './tips';\nimport InserterPreviewPanel from './preview-panel';\nimport BlockTypesTab from './block-types-tab';\nimport BlockPatternsTab from './block-patterns-tab';\nimport { PatternCategoryPreviewPanel } from './block-patterns-tab/pattern-category-preview-panel';\nimport { MediaTab, MediaCategoryPanel } from './media-tab';\nimport InserterSearchResults from './search-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport { store as blockEditorStore } from '../../store';\nimport TabbedSidebar from '../tabbed-sidebar';\nimport { useZoomOut } from '../../hooks/use-zoom-out';\n\nconst NOOP = () => {};\nfunction InserterMenu(\n\t{\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\t__experimentalInsertionIndex,\n\t\tonSelect,\n\t\tshowInserterHelpPanel,\n\t\tshowMostUsedBlocks,\n\t\t__experimentalFilterValue = '',\n\t\tshouldFocusBlock = true,\n\t\tonPatternCategorySelection,\n\t\tonClose,\n\t\t__experimentalInitialTab,\n\t\t__experimentalInitialCategory,\n\t},\n\tref\n) {\n\tconst isZoomOutMode = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',\n\t\t[]\n\t);\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( __experimentalFilterValue );\n\tconst [ hoveredItem, setHoveredItem ] = useState( null );\n\tconst [ selectedPatternCategory, setSelectedPatternCategory ] = useState(\n\t\t__experimentalInitialCategory\n\t);\n\tconst [ patternFilter, setPatternFilter ] = useState( 'all' );\n\tconst [ selectedMediaCategory, setSelectedMediaCategory ] =\n\t\tuseState( null );\n\tconst [ selectedTab, setSelectedTab ] = useState(\n\t\t__experimentalInitialTab\n\t);\n\n\tconst [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] =\n\t\tuseInsertionPoint( {\n\t\t\trootClientId,\n\t\t\tclientId,\n\t\t\tisAppender,\n\t\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\t\tshouldFocusBlock,\n\t\t} );\n\tconst blockTypesTabRef = useRef();\n\n\tconst onInsert = useCallback(\n\t\t( blocks, meta, shouldForceFocusBlock, _rootClientId ) => {\n\t\t\tonInsertBlocks(\n\t\t\t\tblocks,\n\t\t\t\tmeta,\n\t\t\t\tshouldForceFocusBlock,\n\t\t\t\t_rootClientId\n\t\t\t);\n\t\t\tonSelect( blocks );\n\n\t\t\t// Check for focus loss due to filtering blocks by selected block type\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\tif (\n\t\t\t\t\t! shouldFocusBlock &&\n\t\t\t\t\t! blockTypesTabRef?.current.contains(\n\t\t\t\t\t\tref.current.ownerDocument.activeElement\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\t// There has been a focus loss, so focus the first button in the block types tab\n\t\t\t\t\tblockTypesTabRef?.current.querySelector( 'button' ).focus();\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\t[ onInsertBlocks, onSelect, shouldFocusBlock ]\n\t);\n\n\tconst onInsertPattern = useCallback(\n\t\t( blocks, patternName ) => {\n\t\t\tonInsertBlocks( blocks, { patternName } );\n\t\t\tonSelect();\n\t\t},\n\t\t[ onInsertBlocks, onSelect ]\n\t);\n\n\tconst onHover = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( item );\n\t\t\tsetHoveredItem( item );\n\t\t},\n\t\t[ onToggleInsertionPoint, setHoveredItem ]\n\t);\n\n\tconst onHoverPattern = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( !! item );\n\t\t},\n\t\t[ onToggleInsertionPoint ]\n\t);\n\n\tconst onClickPatternCategory = useCallback(\n\t\t( patternCategory, filter ) => {\n\t\t\tsetSelectedPatternCategory( patternCategory );\n\t\t\tsetPatternFilter( filter );\n\t\t\tonPatternCategorySelection?.();\n\t\t},\n\t\t[ setSelectedPatternCategory, onPatternCategorySelection ]\n\t);\n\n\tconst showPatternPanel =\n\t\tselectedTab === 'patterns' &&\n\t\t! delayedFilterValue &&\n\t\t!! selectedPatternCategory;\n\n\tconst showMediaPanel = selectedTab === 'media' && !! selectedMediaCategory;\n\n\tconst showZoomOut =\n\t\tshowPatternPanel && !! window.__experimentalEnableZoomedOutPatternsTab;\n\n\tuseZoomOut( showZoomOut );\n\n\tconst inserterSearch = useMemo( () => {\n\t\tif ( selectedTab === 'media' ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<SearchControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tclassName=\"block-editor-inserter__search\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tif ( hoveredItem ) {\n\t\t\t\t\t\t\tsetHoveredItem( null );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetFilterValue( value );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tlabel={ __( 'Search for blocks and patterns' ) }\n\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t/>\n\t\t\t\t{ !! delayedFilterValue && (\n\t\t\t\t\t<InserterSearchResults\n\t\t\t\t\t\tfilterValue={ delayedFilterValue }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tonHoverPattern={ onHoverPattern }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisAppender={ isAppender }\n\t\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\t\t__experimentalInsertionIndex\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshowBlockDirectory\n\t\t\t\t\t\tshouldFocusBlock={ shouldFocusBlock }\n\t\t\t\t\t\tprioritizePatterns={ selectedTab === 'patterns' }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [\n\t\tselectedTab,\n\t\thoveredItem,\n\t\tsetHoveredItem,\n\t\tsetFilterValue,\n\t\tfilterValue,\n\t\tdelayedFilterValue,\n\t\tonSelect,\n\t\tonHover,\n\t\tonHoverPattern,\n\t\tshouldFocusBlock,\n\t\tclientId,\n\t\trootClientId,\n\t\t__experimentalInsertionIndex,\n\t\tisAppender,\n\t] );\n\n\tconst blocksTab = useMemo( () => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-inserter__block-list\">\n\t\t\t\t\t<BlockTypesTab\n\t\t\t\t\t\tref={ blockTypesTabRef }\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ showInserterHelpPanel && (\n\t\t\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t\t\t<VisuallyHidden as=\"h2\">\n\t\t\t\t\t\t\t{ __( 'A tip for using the block editor' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t<Tips />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsert,\n\t\tonHover,\n\t\tshowMostUsedBlocks,\n\t\tshowInserterHelpPanel,\n\t] );\n\n\tconst patternsTab = useMemo( () => {\n\t\treturn (\n\t\t\t<BlockPatternsTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\tonSelectCategory={ onClickPatternCategory }\n\t\t\t\tselectedCategory={ selectedPatternCategory }\n\t\t\t>\n\t\t\t\t{ showPatternPanel && (\n\t\t\t\t\t<PatternCategoryPreviewPanel\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\t\t\tonHover={ onHoverPattern }\n\t\t\t\t\t\tcategory={ selectedPatternCategory }\n\t\t\t\t\t\tpatternFilter={ patternFilter }\n\t\t\t\t\t\tshowTitlesAsTooltip\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockPatternsTab>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonHoverPattern,\n\t\tonInsertPattern,\n\t\tonClickPatternCategory,\n\t\tpatternFilter,\n\t\tselectedPatternCategory,\n\t\tshowPatternPanel,\n\t] );\n\n\tconst mediaTab = useMemo( () => {\n\t\treturn (\n\t\t\t<MediaTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tselectedCategory={ selectedMediaCategory }\n\t\t\t\tonSelectCategory={ setSelectedMediaCategory }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t>\n\t\t\t\t{ showMediaPanel && (\n\t\t\t\t\t<MediaCategoryPanel\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tcategory={ selectedMediaCategory }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</MediaTab>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsert,\n\t\tselectedMediaCategory,\n\t\tsetSelectedMediaCategory,\n\t\tshowMediaPanel,\n\t] );\n\n\tconst handleSetSelectedTab = ( value ) => {\n\t\t// If no longer on patterns tab remove the category setting.\n\t\tif ( value !== 'patterns' ) {\n\t\t\tsetSelectedPatternCategory( null );\n\t\t}\n\t\tsetSelectedTab( value );\n\t};\n\n\t// Focus first active tab, if any\n\tconst tabsRef = useRef();\n\tuseLayoutEffect( () => {\n\t\tif ( tabsRef.current ) {\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\ttabsRef.current\n\t\t\t\t\t.querySelector( '[role=\"tab\"][aria-selected=\"true\"]' )\n\t\t\t\t\t?.focus();\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'block-editor-inserter__menu', {\n\t\t\t\t'show-panel': showPatternPanel || showMediaPanel,\n\t\t\t\t'is-zoom-out': isZoomOutMode,\n\t\t\t} ) }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t<div className=\"block-editor-inserter__main-area\">\n\t\t\t\t<TabbedSidebar\n\t\t\t\t\tref={ tabsRef }\n\t\t\t\t\tonSelect={ handleSetSelectedTab }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\tselectedTab={ selectedTab }\n\t\t\t\t\tcloseButtonLabel={ __( 'Close block inserter' ) }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'blocks',\n\t\t\t\t\t\t\ttitle: __( 'Blocks' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ selectedTab === 'blocks' &&\n\t\t\t\t\t\t\t\t\t\t! delayedFilterValue &&\n\t\t\t\t\t\t\t\t\t\tblocksTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'patterns',\n\t\t\t\t\t\t\ttitle: __( 'Patterns' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ selectedTab === 'patterns' &&\n\t\t\t\t\t\t\t\t\t\t! delayedFilterValue &&\n\t\t\t\t\t\t\t\t\t\tpatternsTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'media',\n\t\t\t\t\t\t\ttitle: __( 'Media' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ mediaTab }\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/>\n\t\t\t</div>\n\t\t\t{ showInserterHelpPanel && hoveredItem && (\n\t\t\t\t<Popover\n\t\t\t\t\tclassName=\"block-editor-inserter__preview-container__popover\"\n\t\t\t\t\tplacement=\"right-start\"\n\t\t\t\t\toffset={ 16 }\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\tanimate={ false }\n\t\t\t\t>\n\t\t\t\t\t<InserterPreviewPanel item={ hoveredItem } />\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport const PrivateInserterMenu = forwardRef( InserterMenu );\n\nfunction PublicInserterMenu( props, ref ) {\n\treturn (\n\t\t<PrivateInserterMenu\n\t\t\t{ ...props }\n\t\t\tonPatternCategorySelection={ NOOP }\n\t\t\tref={ ref }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( PublicInserterMenu );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,UAAU,EACVC,QAAQ,EACRC,WAAW,EACXC,OAAO,EACPC,MAAM,EACNC,eAAe,QACT,oBAAoB;AAC3B,SAASC,cAAc,EAAEC,aAAa,EAAEC,OAAO,QAAQ,uBAAuB;AAC9E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,oBAAoB,MAAM,iBAAiB;AAClD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,SAASC,2BAA2B,QAAQ,qDAAqD;AACjG,SAASC,QAAQ,EAAEC,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c,EACdhC,WAAW,KAAK,UAAU,IAC3B,CAAET,kBAAkB,IACpBqD,WAAW;UAAA,CACX;QAEJ,CAAC,EACD;UACCU,IAAI,EAAE,OAAO;UACbC,KAAK,EAAE3G,EAAE,CAAE,OAAQ,CAAC;UACpB4G,KAAK,eACJvF,KAAA,CAAAF,SAAA;YAAAkE,QAAA,GACGD,cAAc,EACdiB,QAAQ;UAAA,CACT;QAEJ,CAAC;MACC,CACH;IAAC,CACE,CAAC,EACJxE,qBAAqB,IAAIe,WAAW,iBACrC3B,IAAA,CAAClB,OAAO;MACPwF,SAAS,EAAC,mDAAmD;MAC7DsB,SAAS,EAAC,aAAa;MACvBC,MAAM,EAAG,EAAI;MACbC,YAAY,EAAG,KAAO;MACtBC,OAAO,EAAG,KAAO;MAAA3B,QAAA,eAEjBpE,IAAA,CAACb,oBAAoB;QAACuE,IAAI,EAAG/B;MAAa,CAAE;IAAC,CACrC,CACT;EAAA,CACG,CAAC;AAER;AAEA,OAAO,MAAMqE,mBAAmB,GAAG1H,UAAU,CAAEgC,YAAa,CAAC;AAE7D,SAAS2F,kBAAkBA,CAAEC,KAAK,EAAE9E,GAAG,EAAG;EACzC,oBACCpB,IAAA,CAACgG,mBAAmB;IAAA,GACdE,KAAK;IACVlF,0BAA0B,EAAGX,IAAM;IACnCe,GAAG,EAAGA;EAAK,CACX,CAAC;AAEJ;AAEA,eAAe9C,UAAU,CAAE2H,kBAAmB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","forwardRef","useState","useCallback","useMemo","useRef","useLayoutEffect","VisuallyHidden","SearchControl","Popover","__","useDebouncedInput","useSelect","Tips","InserterPreviewPanel","BlockTypesTab","BlockPatternsTab","PatternCategoryPreviews","MediaTab","MediaCategoryPanel","InserterSearchResults","useInsertionPoint","store","blockEditorStore","TabbedSidebar","useZoomOut","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","NOOP","InserterMenu","rootClientId","clientId","isAppender","__experimentalInsertionIndex","onSelect","showInserterHelpPanel","showMostUsedBlocks","__experimentalFilterValue","shouldFocusBlock","onPatternCategorySelection","onClose","__experimentalInitialTab","__experimentalInitialCategory","ref","isZoomOutMode","select","__unstableGetEditorMode","filterValue","setFilterValue","delayedFilterValue","hoveredItem","setHoveredItem","selectedPatternCategory","setSelectedPatternCategory","patternFilter","setPatternFilter","selectedMediaCategory","setSelectedMediaCategory","selectedTab","setSelectedTab","destinationRootClientId","onInsertBlocks","onToggleInsertionPoint","insertionIndex","blockTypesTabRef","onInsert","blocks","meta","shouldForceFocusBlock","_rootClientId","window","requestAnimationFrame","current","contains","ownerDocument","activeElement","querySelector","focus","onInsertPattern","patternName","onHover","item","onHoverPattern","onClickPatternCategory","patternCategory","filter","showPatternPanel","showMediaPanel","showZoomOut","__experimentalEnableZoomedOutPatternsTab","inserterSearch","children","__nextHasNoMarginBottom","className","onChange","value","label","placeholder","showBlockDirectory","prioritizePatterns","blocksTab","as","patternsTab","onSelectCategory","selectedCategory","category","showTitlesAsTooltip","mediaTab","handleSetSelectedTab","tabsRef","closeButtonLabel","tabs","name","title","panel","placement","offset","focusOnMount","animate","PrivateInserterMenu","PublicInserterMenu","props"],"sources":["@wordpress/block-editor/src/components/inserter/menu.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tforwardRef,\n\tuseState,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { VisuallyHidden, SearchControl, Popover } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDebouncedInput } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport Tips from './tips';\nimport InserterPreviewPanel from './preview-panel';\nimport BlockTypesTab from './block-types-tab';\nimport BlockPatternsTab from './block-patterns-tab';\nimport { PatternCategoryPreviews } from './block-patterns-tab/pattern-category-previews';\nimport { MediaTab, MediaCategoryPanel } from './media-tab';\nimport InserterSearchResults from './search-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport { store as blockEditorStore } from '../../store';\nimport TabbedSidebar from '../tabbed-sidebar';\nimport { useZoomOut } from '../../hooks/use-zoom-out';\n\nconst NOOP = () => {};\nfunction InserterMenu(\n\t{\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\t__experimentalInsertionIndex,\n\t\tonSelect,\n\t\tshowInserterHelpPanel,\n\t\tshowMostUsedBlocks,\n\t\t__experimentalFilterValue = '',\n\t\tshouldFocusBlock = true,\n\t\tonPatternCategorySelection,\n\t\tonClose,\n\t\t__experimentalInitialTab,\n\t\t__experimentalInitialCategory,\n\t},\n\tref\n) {\n\tconst isZoomOutMode = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',\n\t\t[]\n\t);\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( __experimentalFilterValue );\n\tconst [ hoveredItem, setHoveredItem ] = useState( null );\n\tconst [ selectedPatternCategory, setSelectedPatternCategory ] = useState(\n\t\t__experimentalInitialCategory\n\t);\n\tconst [ patternFilter, setPatternFilter ] = useState( 'all' );\n\tconst [ selectedMediaCategory, setSelectedMediaCategory ] =\n\t\tuseState( null );\n\tconst [ selectedTab, setSelectedTab ] = useState(\n\t\t__experimentalInitialTab\n\t);\n\n\tconst [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] =\n\t\tuseInsertionPoint( {\n\t\t\trootClientId,\n\t\t\tclientId,\n\t\t\tisAppender,\n\t\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\t\tshouldFocusBlock,\n\t\t} );\n\tconst blockTypesTabRef = useRef();\n\n\tconst onInsert = useCallback(\n\t\t( blocks, meta, shouldForceFocusBlock, _rootClientId ) => {\n\t\t\tonInsertBlocks(\n\t\t\t\tblocks,\n\t\t\t\tmeta,\n\t\t\t\tshouldForceFocusBlock,\n\t\t\t\t_rootClientId\n\t\t\t);\n\t\t\tonSelect( blocks );\n\n\t\t\t// Check for focus loss due to filtering blocks by selected block type\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\tif (\n\t\t\t\t\t! shouldFocusBlock &&\n\t\t\t\t\t! blockTypesTabRef?.current.contains(\n\t\t\t\t\t\tref.current.ownerDocument.activeElement\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\t// There has been a focus loss, so focus the first button in the block types tab\n\t\t\t\t\tblockTypesTabRef?.current.querySelector( 'button' ).focus();\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\t[ onInsertBlocks, onSelect, shouldFocusBlock ]\n\t);\n\n\tconst onInsertPattern = useCallback(\n\t\t( blocks, patternName ) => {\n\t\t\tonInsertBlocks( blocks, { patternName } );\n\t\t\tonSelect();\n\t\t},\n\t\t[ onInsertBlocks, onSelect ]\n\t);\n\n\tconst onHover = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( item );\n\t\t\tsetHoveredItem( item );\n\t\t},\n\t\t[ onToggleInsertionPoint, setHoveredItem ]\n\t);\n\n\tconst onHoverPattern = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( !! item );\n\t\t},\n\t\t[ onToggleInsertionPoint ]\n\t);\n\n\tconst onClickPatternCategory = useCallback(\n\t\t( patternCategory, filter ) => {\n\t\t\tsetSelectedPatternCategory( patternCategory );\n\t\t\tsetPatternFilter( filter );\n\t\t\tonPatternCategorySelection?.();\n\t\t},\n\t\t[ setSelectedPatternCategory, onPatternCategorySelection ]\n\t);\n\n\tconst showPatternPanel =\n\t\tselectedTab === 'patterns' &&\n\t\t! delayedFilterValue &&\n\t\t!! selectedPatternCategory;\n\n\tconst showMediaPanel = selectedTab === 'media' && !! selectedMediaCategory;\n\n\tconst showZoomOut =\n\t\tshowPatternPanel && !! window.__experimentalEnableZoomedOutPatternsTab;\n\n\tuseZoomOut( showZoomOut );\n\n\tconst inserterSearch = useMemo( () => {\n\t\tif ( selectedTab === 'media' ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<SearchControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tclassName=\"block-editor-inserter__search\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tif ( hoveredItem ) {\n\t\t\t\t\t\t\tsetHoveredItem( null );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetFilterValue( value );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tlabel={ __( 'Search for blocks and patterns' ) }\n\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t/>\n\t\t\t\t{ !! delayedFilterValue && (\n\t\t\t\t\t<InserterSearchResults\n\t\t\t\t\t\tfilterValue={ delayedFilterValue }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tonHoverPattern={ onHoverPattern }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisAppender={ isAppender }\n\t\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\t\t__experimentalInsertionIndex\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshowBlockDirectory\n\t\t\t\t\t\tshouldFocusBlock={ shouldFocusBlock }\n\t\t\t\t\t\tprioritizePatterns={ selectedTab === 'patterns' }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [\n\t\tselectedTab,\n\t\thoveredItem,\n\t\tsetHoveredItem,\n\t\tsetFilterValue,\n\t\tfilterValue,\n\t\tdelayedFilterValue,\n\t\tonSelect,\n\t\tonHover,\n\t\tonHoverPattern,\n\t\tshouldFocusBlock,\n\t\tclientId,\n\t\trootClientId,\n\t\t__experimentalInsertionIndex,\n\t\tisAppender,\n\t] );\n\n\tconst blocksTab = useMemo( () => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-inserter__block-list\">\n\t\t\t\t\t<BlockTypesTab\n\t\t\t\t\t\tref={ blockTypesTabRef }\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ showInserterHelpPanel && (\n\t\t\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t\t\t<VisuallyHidden as=\"h2\">\n\t\t\t\t\t\t\t{ __( 'A tip for using the block editor' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t<Tips />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsert,\n\t\tonHover,\n\t\tshowMostUsedBlocks,\n\t\tshowInserterHelpPanel,\n\t] );\n\n\tconst patternsTab = useMemo( () => {\n\t\treturn (\n\t\t\t<BlockPatternsTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\tonSelectCategory={ onClickPatternCategory }\n\t\t\t\tselectedCategory={ selectedPatternCategory }\n\t\t\t>\n\t\t\t\t{ showPatternPanel && (\n\t\t\t\t\t<PatternCategoryPreviews\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\t\t\tonHover={ onHoverPattern }\n\t\t\t\t\t\tcategory={ selectedPatternCategory }\n\t\t\t\t\t\tpatternFilter={ patternFilter }\n\t\t\t\t\t\tshowTitlesAsTooltip\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockPatternsTab>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonHoverPattern,\n\t\tonInsertPattern,\n\t\tonClickPatternCategory,\n\t\tpatternFilter,\n\t\tselectedPatternCategory,\n\t\tshowPatternPanel,\n\t] );\n\n\tconst mediaTab = useMemo( () => {\n\t\treturn (\n\t\t\t<MediaTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tselectedCategory={ selectedMediaCategory }\n\t\t\t\tonSelectCategory={ setSelectedMediaCategory }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t>\n\t\t\t\t{ showMediaPanel && (\n\t\t\t\t\t<MediaCategoryPanel\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tcategory={ selectedMediaCategory }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</MediaTab>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsert,\n\t\tselectedMediaCategory,\n\t\tsetSelectedMediaCategory,\n\t\tshowMediaPanel,\n\t] );\n\n\tconst handleSetSelectedTab = ( value ) => {\n\t\t// If no longer on patterns tab remove the category setting.\n\t\tif ( value !== 'patterns' ) {\n\t\t\tsetSelectedPatternCategory( null );\n\t\t}\n\t\tsetSelectedTab( value );\n\t};\n\n\t// Focus first active tab, if any\n\tconst tabsRef = useRef();\n\tuseLayoutEffect( () => {\n\t\tif ( tabsRef.current ) {\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\ttabsRef.current\n\t\t\t\t\t.querySelector( '[role=\"tab\"][aria-selected=\"true\"]' )\n\t\t\t\t\t?.focus();\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'block-editor-inserter__menu', {\n\t\t\t\t'show-panel': showPatternPanel || showMediaPanel,\n\t\t\t\t'is-zoom-out': isZoomOutMode,\n\t\t\t} ) }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t<div className=\"block-editor-inserter__main-area\">\n\t\t\t\t<TabbedSidebar\n\t\t\t\t\tref={ tabsRef }\n\t\t\t\t\tonSelect={ handleSetSelectedTab }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\tselectedTab={ selectedTab }\n\t\t\t\t\tcloseButtonLabel={ __( 'Close block inserter' ) }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'blocks',\n\t\t\t\t\t\t\ttitle: __( 'Blocks' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ selectedTab === 'blocks' &&\n\t\t\t\t\t\t\t\t\t\t! delayedFilterValue &&\n\t\t\t\t\t\t\t\t\t\tblocksTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'patterns',\n\t\t\t\t\t\t\ttitle: __( 'Patterns' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ selectedTab === 'patterns' &&\n\t\t\t\t\t\t\t\t\t\t! delayedFilterValue &&\n\t\t\t\t\t\t\t\t\t\tpatternsTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'media',\n\t\t\t\t\t\t\ttitle: __( 'Media' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ mediaTab }\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/>\n\t\t\t</div>\n\t\t\t{ showInserterHelpPanel && hoveredItem && (\n\t\t\t\t<Popover\n\t\t\t\t\tclassName=\"block-editor-inserter__preview-container__popover\"\n\t\t\t\t\tplacement=\"right-start\"\n\t\t\t\t\toffset={ 16 }\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\tanimate={ false }\n\t\t\t\t>\n\t\t\t\t\t<InserterPreviewPanel item={ hoveredItem } />\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport const PrivateInserterMenu = forwardRef( InserterMenu );\n\nfunction PublicInserterMenu( props, ref ) {\n\treturn (\n\t\t<PrivateInserterMenu\n\t\t\t{ ...props }\n\t\t\tonPatternCategorySelection={ NOOP }\n\t\t\tref={ ref }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( PublicInserterMenu );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,UAAU,EACVC,QAAQ,EACRC,WAAW,EACXC,OAAO,EACPC,MAAM,EACNC,eAAe,QACT,oBAAoB;AAC3B,SAASC,cAAc,EAAEC,aAAa,EAAEC,OAAO,QAAQ,uBAAuB;AAC9E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,oBAAoB,MAAM,iBAAiB;AAClD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,SAASC,uBAAuB,QAAQ,gDAAgD;AACxF,SAASC,QAAQ,EAAEC,kBAAkB,QAAQ,aAAa;AAC1D,OAAOC,qBAAqB,MAAM,kBAAkB;AACpD,OAAOC,iBAAiB,MAAM,6BAA6B;AAC3D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SAASC,UAAU,QAAQ,0BAA0B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;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IAAC,CACE,CAAC,EACJxE,qBAAqB,IAAIe,WAAW,iBACrC3B,IAAA,CAAClB,OAAO;MACPwF,SAAS,EAAC,mDAAmD;MAC7DsB,SAAS,EAAC,aAAa;MACvBC,MAAM,EAAG,EAAI;MACbC,YAAY,EAAG,KAAO;MACtBC,OAAO,EAAG,KAAO;MAAA3B,QAAA,eAEjBpE,IAAA,CAACb,oBAAoB;QAACuE,IAAI,EAAG/B;MAAa,CAAE;IAAC,CACrC,CACT;EAAA,CACG,CAAC;AAER;AAEA,OAAO,MAAMqE,mBAAmB,GAAG1H,UAAU,CAAEgC,YAAa,CAAC;AAE7D,SAAS2F,kBAAkBA,CAAEC,KAAK,EAAE9E,GAAG,EAAG;EACzC,oBACCpB,IAAA,CAACgG,mBAAmB;IAAA,GACdE,KAAK;IACVlF,0BAA0B,EAAGX,IAAM;IACnCe,GAAG,EAAGA;EAAK,CACX,CAAC;AAEJ;AAEA,eAAe9C,UAAU,CAAE2H,kBAAmB,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import deprecated from '@wordpress/deprecated';
|
|
5
4
|
import { __ } from '@wordpress/i18n';
|
|
6
5
|
import { __experimentalNumberControl as NumberControl } from '@wordpress/components';
|
|
7
6
|
|
|
@@ -13,8 +12,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
12
|
const LineHeightControl = ({
|
|
14
13
|
value: lineHeight,
|
|
15
14
|
onChange,
|
|
16
|
-
/** Start opting into the new margin-free styles that will become the default in a future version. */
|
|
17
|
-
__nextHasNoMarginBottom = false,
|
|
18
15
|
__unstableInputWidth = '60px',
|
|
19
16
|
...otherProps
|
|
20
17
|
}) => {
|
|
@@ -68,16 +65,6 @@ const LineHeightControl = ({
|
|
|
68
65
|
};
|
|
69
66
|
};
|
|
70
67
|
const value = isDefined ? lineHeight : RESET_VALUE;
|
|
71
|
-
if (!__nextHasNoMarginBottom) {
|
|
72
|
-
deprecated('Bottom margin styles for wp.blockEditor.LineHeightControl', {
|
|
73
|
-
since: '6.0',
|
|
74
|
-
version: '6.4',
|
|
75
|
-
hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version'
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
const deprecatedStyles = __nextHasNoMarginBottom ? undefined : {
|
|
79
|
-
marginBottom: 24
|
|
80
|
-
};
|
|
81
68
|
const handleOnChange = (nextValue, {
|
|
82
69
|
event
|
|
83
70
|
}) => {
|
|
@@ -93,7 +80,6 @@ const LineHeightControl = ({
|
|
|
93
80
|
};
|
|
94
81
|
return /*#__PURE__*/_jsx("div", {
|
|
95
82
|
className: "block-editor-line-height-control",
|
|
96
|
-
style: deprecatedStyles,
|
|
97
83
|
children: /*#__PURE__*/_jsx(NumberControl, {
|
|
98
84
|
...otherProps,
|
|
99
85
|
__unstableInputWidth: __unstableInputWidth,
|