@wordpress/block-editor 12.0.0 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/build/components/block-controls/slot.js +12 -4
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js +10 -1
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-draggable/index.js +11 -7
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js +15 -7
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-item-cell.native.js +15 -2
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +158 -195
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +57 -0
- package/build/components/block-list/block-outline.native.js.map +1 -0
- package/build/components/block-list/block.native.js +343 -299
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +202 -298
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/insertion-point.native.js +4 -2
- package/build/components/block-list/insertion-point.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +8 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +15 -4
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +17 -62
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +3 -8
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +86 -0
- package/build/components/global-styles/advanced-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +4 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +6 -6
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +1 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +24 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +1 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +27 -4
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +30 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +24 -8
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +5 -0
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/fill.js +1 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +1 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/slot.js +3 -6
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js +1 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/line-height-control/index.js +7 -2
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/use-internal-input-value.js +9 -8
- package/build/components/link-control/use-internal-input-value.js.map +1 -1
- package/build/components/list-view/block-contents.js +7 -2
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +2 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +4 -4
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/index.js +32 -18
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +163 -11
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.js +68 -7
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +2 -2
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +3 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build/components/preview-options/index.js +6 -1
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +1 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/hooks/align.js +1 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/border.js +1 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +8 -12
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/duotone.js +1 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.native.js +8 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +2 -2
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +1 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-editor-wrapper-styles.native.js +255 -0
- package/build/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build/hooks/use-typography-props.js +14 -10
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/index.native.js +31 -0
- package/build/index.native.js.map +1 -0
- package/build/utils/use-should-contextual-toolbar-show.js +16 -12
- package/build/utils/use-should-contextual-toolbar-show.js.map +1 -1
- package/build-module/components/block-controls/slot.js +11 -4
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js +9 -1
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-draggable/index.js +10 -6
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js +16 -8
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item-cell.native.js +13 -2
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +160 -190
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +44 -0
- package/build-module/components/block-list/block-outline.native.js.map +1 -0
- package/build-module/components/block-list/block.native.js +341 -298
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +203 -293
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/insertion-point.native.js +4 -2
- package/build-module/components/block-list/insertion-point.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +8 -9
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +13 -5
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +18 -62
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +3 -7
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +74 -0
- package/build-module/components/global-styles/advanced-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +5 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +6 -6
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +1 -1
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +25 -4
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +25 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +24 -8
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +4 -0
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +1 -1
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +1 -1
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +4 -7
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js +1 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/line-height-control/index.js +7 -2
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/use-internal-input-value.js +9 -8
- package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +7 -3
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +2 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +4 -4
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/index.js +32 -18
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +160 -11
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +66 -7
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +2 -2
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +3 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build-module/components/preview-options/index.js +7 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +1 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/hooks/align.js +1 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/border.js +1 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +8 -11
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/duotone.js +1 -1
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +2 -2
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +1 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +1 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-editor-wrapper-styles.native.js +242 -0
- package/build-module/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build-module/hooks/use-typography-props.js +14 -10
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/index.native.js +6 -0
- package/build-module/index.native.js.map +1 -0
- package/build-module/utils/use-should-contextual-toolbar-show.js +16 -12
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -1
- package/build-style/content-rtl.css +0 -1
- package/build-style/content.css +0 -1
- package/build-style/style-rtl.css +37 -13
- package/build-style/style.css +37 -13
- package/package.json +31 -31
- package/src/components/block-breadcrumb/style.scss +2 -1
- package/src/components/block-controls/slot.js +8 -4
- package/src/components/block-controls/slot.native.js +6 -1
- package/src/components/block-draggable/index.js +10 -6
- package/src/components/block-draggable/use-scroll-when-dragging.js +8 -2
- package/src/components/block-list/block-invalid-warning.native.js +17 -9
- package/src/components/block-list/block-list-item-cell.native.js +10 -1
- package/src/components/block-list/block-list-item.native.js +180 -208
- package/src/components/block-list/block-outline.native.js +58 -0
- package/src/components/block-list/block.native.js +564 -523
- package/src/components/block-list/content.scss +0 -1
- package/src/components/block-list/index.native.js +229 -298
- package/src/components/block-list/insertion-point.native.js +2 -2
- package/src/components/block-list/test/block-invalid-warning.native.js +48 -0
- package/src/components/block-list/test/index.native.js +205 -0
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -1
- package/src/components/block-pattern-setup/style.scss +1 -4
- package/src/components/block-patterns-list/style.scss +1 -4
- package/src/components/block-settings-menu/block-settings-dropdown.js +10 -17
- package/src/components/block-settings-menu-controls/index.js +24 -4
- package/src/components/block-styles/style.scss +4 -4
- package/src/components/block-tools/block-contextual-toolbar.js +28 -62
- package/src/components/block-tools/selected-block-popover.js +3 -5
- package/src/components/block-tools/style.scss +8 -0
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +16 -2
- package/src/components/global-styles/advanced-panel.js +82 -0
- package/src/components/global-styles/color-panel.js +6 -1
- package/src/components/global-styles/dimensions-panel.js +6 -6
- package/src/components/global-styles/hooks.js +1 -5
- package/src/components/global-styles/index.js +6 -1
- package/src/components/global-styles/style.scss +14 -0
- package/src/components/global-styles/test/utils.js +57 -1
- package/src/components/global-styles/typography-panel.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +21 -3
- package/src/components/global-styles/utils.js +27 -0
- package/src/components/image-editor/use-save-image.js +20 -9
- package/src/components/inserter-draggable-blocks/index.js +4 -0
- package/src/components/inspector-controls/fill.js +1 -1
- package/src/components/inspector-controls/fill.native.js +1 -1
- package/src/components/inspector-controls/slot.js +4 -9
- package/src/components/inspector-controls/slot.native.js +1 -1
- package/src/components/line-height-control/index.js +7 -2
- package/src/components/line-height-control/stories/index.js +1 -1
- package/src/components/link-control/test/index.js +42 -0
- package/src/components/link-control/use-internal-input-value.js +8 -7
- package/src/components/list-view/block-contents.js +26 -20
- package/src/components/list-view/block-select-button.js +5 -1
- package/src/components/list-view/block.js +5 -2
- package/src/components/list-view/index.js +26 -14
- package/src/components/list-view/style.scss +5 -2
- package/src/components/list-view/test/use-list-view-drop-zone.js +88 -12
- package/src/components/list-view/use-list-view-drop-zone.js +194 -11
- package/src/components/media-placeholder/index.js +74 -1
- package/src/components/multi-selection-inspector/index.js +2 -2
- package/src/components/off-canvas-editor/leaf-more-menu.js +2 -1
- package/src/components/preview-options/index.js +9 -2
- package/src/components/spacing-sizes-control/spacing-input-control.js +1 -0
- package/src/components/url-input/index.js +1 -2
- package/src/hooks/align.js +2 -1
- package/src/hooks/border.js +2 -1
- package/src/hooks/color.js +2 -1
- package/src/hooks/content-lock-ui.js +3 -15
- package/src/hooks/duotone.js +1 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.js +4 -2
- package/src/hooks/position.js +2 -1
- package/src/hooks/style.js +2 -1
- package/src/hooks/test/use-editor-wrapper-styles.native.js +282 -0
- package/src/hooks/test/use-typography-props.js +47 -2
- package/src/hooks/use-editor-wrapper-styles.native.js +250 -0
- package/src/hooks/use-editor-wrapper-styles.native.scss +11 -0
- package/src/hooks/use-typography-props.js +10 -11
- package/src/index.native.js +6 -0
- package/src/utils/use-should-contextual-toolbar-show.js +19 -9
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -5,30 +5,24 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _reactNative = require("react-native");
|
|
15
13
|
|
|
16
14
|
var _data = require("@wordpress/data");
|
|
17
15
|
|
|
18
|
-
var _compose = require("@wordpress/compose");
|
|
19
|
-
|
|
20
|
-
var _components = require("@wordpress/components");
|
|
21
|
-
|
|
22
16
|
var _block = _interopRequireDefault(require("./block"));
|
|
23
17
|
|
|
24
|
-
var _insertionPoint = _interopRequireDefault(require("./insertion-point"));
|
|
25
|
-
|
|
26
18
|
var _gridItem = _interopRequireDefault(require("./grid-item"));
|
|
27
19
|
|
|
28
|
-
var
|
|
20
|
+
var _insertionPoint = _interopRequireDefault(require("./insertion-point"));
|
|
29
21
|
|
|
30
22
|
var _store = require("../../store");
|
|
31
23
|
|
|
24
|
+
var _useEditorWrapperStyles = require("../../hooks/use-editor-wrapper-styles");
|
|
25
|
+
|
|
32
26
|
/**
|
|
33
27
|
* External dependencies
|
|
34
28
|
*/
|
|
@@ -40,201 +34,170 @@ var _store = require("../../store");
|
|
|
40
34
|
/**
|
|
41
35
|
* Internal dependencies
|
|
42
36
|
*/
|
|
43
|
-
const stretchStyle = {
|
|
44
|
-
flex: 1
|
|
45
|
-
};
|
|
46
37
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
38
|
+
/**
|
|
39
|
+
* BlockListItemContent component. Renders a block with an optional insertion point.
|
|
40
|
+
*
|
|
41
|
+
* @param {Object} props Component properties.
|
|
42
|
+
* @param {number} props.blockWidth The width of the block.
|
|
43
|
+
* @param {string} props.clientId The block client ID.
|
|
44
|
+
* @param {string} props.contentResizeMode The content resize mode, e.g "stretch".
|
|
45
|
+
* @param {Object} props.contentStyle Styles for the block content
|
|
46
|
+
* @param {Object} props.index Block item index
|
|
47
|
+
* @param {boolean} props.isStackedHorizontally Whether the block is stacked horizontally.
|
|
48
|
+
* @param {number} props.marginHorizontal The horizontal margin.
|
|
49
|
+
* @param {number} props.marginVertical The vertical margin.
|
|
50
|
+
* @param {Function} props.onAddBlock On add block callback.
|
|
51
|
+
* @param {Function} props.onDeleteBlock On delete block callback.
|
|
52
|
+
* @param {number} props.parentWidth The width of the parent block.
|
|
53
|
+
* @param {string} props.rootClientId The root client ID.
|
|
54
|
+
* @param {Function} props.shouldShowInnerBlockAppender Whether to show the inner block appender.
|
|
55
|
+
*
|
|
56
|
+
* @return {WPComponent} The rendered block list item content.
|
|
57
|
+
*/
|
|
58
|
+
function BlockListItemContent(_ref) {
|
|
59
|
+
let {
|
|
60
|
+
blockWidth,
|
|
61
|
+
clientId,
|
|
62
|
+
contentResizeMode,
|
|
63
|
+
contentStyle,
|
|
64
|
+
index,
|
|
65
|
+
isStackedHorizontally,
|
|
66
|
+
marginHorizontal,
|
|
67
|
+
marginVertical,
|
|
68
|
+
onAddBlock,
|
|
69
|
+
onDeleteBlock,
|
|
70
|
+
parentWidth,
|
|
71
|
+
rootClientId,
|
|
72
|
+
shouldShowInnerBlockAppender
|
|
73
|
+
} = _ref;
|
|
74
|
+
const {
|
|
75
|
+
blockAlignment,
|
|
76
|
+
blockName,
|
|
77
|
+
hasParents,
|
|
78
|
+
parentBlockAlignment,
|
|
79
|
+
parentBlockName,
|
|
80
|
+
shouldShowInsertionPointAfter,
|
|
81
|
+
shouldShowInsertionPointBefore
|
|
82
|
+
} = (0, _data.useSelect)(select => {
|
|
59
83
|
const {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const screenWidth = Math.floor(_reactNative.Dimensions.get('window').width);
|
|
79
|
-
|
|
80
|
-
if (isFullWidth(parentBlockAlignment) && !isWider(blockWidth, 'medium')) {
|
|
81
|
-
if (isContainerRelated(blockName) || isWider(screenWidth, 'mobile')) {
|
|
82
|
-
return marginHorizontal;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return marginHorizontal * 2;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (isContainerRelated(parentBlockName) && !isContainerRelated(blockName)) {
|
|
89
|
-
const isScreenWidthEqual = parentWidth === screenWidth;
|
|
90
|
-
|
|
91
|
-
if (isScreenWidthEqual || isWider(screenWidth, 'mobile')) {
|
|
92
|
-
return marginHorizontal;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return marginHorizontal;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
getContentStyles(readableContentViewStyle) {
|
|
84
|
+
getBlockAttributes,
|
|
85
|
+
getBlockInsertionPoint,
|
|
86
|
+
getBlockName,
|
|
87
|
+
getBlockOrder,
|
|
88
|
+
isBlockInsertionPointVisible
|
|
89
|
+
} = select(_store.store);
|
|
90
|
+
const blockClientIds = getBlockOrder(rootClientId);
|
|
91
|
+
const insertionPoint = getBlockInsertionPoint();
|
|
92
|
+
const insertionPointVisibleInCurrentRoot = !isStackedHorizontally && isBlockInsertionPointVisible() && insertionPoint.rootClientId === rootClientId;
|
|
93
|
+
const isListEmpty = blockClientIds.length === 0;
|
|
94
|
+
const isInsertionPointBeforeBlock = blockClientIds[insertionPoint.index] === clientId;
|
|
95
|
+
const isInsertionPointAtEnd = blockClientIds.length === insertionPoint.index;
|
|
96
|
+
const isBlockLastInList = blockClientIds[insertionPoint.index - 1] === clientId;
|
|
97
|
+
const showInsertionPointBefore = insertionPointVisibleInCurrentRoot && (isListEmpty || isInsertionPointBeforeBlock);
|
|
98
|
+
const showInsertionPointAfter = insertionPointVisibleInCurrentRoot && isInsertionPointAtEnd && isBlockLastInList;
|
|
99
|
+
const blockHasParents = !!rootClientId;
|
|
100
|
+
const name = getBlockName(clientId);
|
|
101
|
+
const parentName = getBlockName(rootClientId);
|
|
100
102
|
const {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
hasParents,
|
|
104
|
-
parentBlockName
|
|
105
|
-
} = this.props;
|
|
103
|
+
align
|
|
104
|
+
} = getBlockAttributes(clientId) || {};
|
|
106
105
|
const {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
106
|
+
align: parentBlockAlign
|
|
107
|
+
} = getBlockAttributes(rootClientId) || {};
|
|
108
|
+
return {
|
|
109
|
+
blockAlignment: align,
|
|
110
|
+
blockName: name,
|
|
111
|
+
hasParents: blockHasParents,
|
|
112
|
+
parentBlockAlignment: parentBlockAlign,
|
|
113
|
+
parentBlockName: parentName,
|
|
114
|
+
shouldShowInsertionPointAfter: showInsertionPointAfter,
|
|
115
|
+
shouldShowInsertionPointBefore: showInsertionPointBefore
|
|
116
|
+
};
|
|
117
|
+
}, [isStackedHorizontally, rootClientId, clientId]);
|
|
118
|
+
const [wrapperStyles, margin] = (0, _useEditorWrapperStyles.useEditorWrapperStyles)({
|
|
119
|
+
align: blockAlignment,
|
|
120
|
+
blockName,
|
|
121
|
+
blockWidth,
|
|
122
|
+
contentResizeMode,
|
|
123
|
+
hasParents,
|
|
124
|
+
marginHorizontal,
|
|
125
|
+
parentBlockAlignment,
|
|
126
|
+
parentBlockName,
|
|
127
|
+
parentWidth
|
|
128
|
+
});
|
|
129
|
+
const shouldShowBlockInsertionPointAfter = !shouldShowInnerBlockAppender() && shouldShowInsertionPointAfter;
|
|
130
|
+
return (0, _element.createElement)(_reactNative.View, {
|
|
131
|
+
style: wrapperStyles
|
|
132
|
+
}, shouldShowInsertionPointBefore && (0, _element.createElement)(_insertionPoint.default, {
|
|
133
|
+
testID: `block-insertion-point-before-row-${index + 1}`
|
|
134
|
+
}), (0, _element.createElement)(_block.default, {
|
|
135
|
+
blockWidth: blockWidth,
|
|
136
|
+
clientId: clientId,
|
|
137
|
+
contentStyle: contentStyle,
|
|
138
|
+
isStackedHorizontally: isStackedHorizontally,
|
|
139
|
+
marginHorizontal: margin,
|
|
140
|
+
marginVertical: marginVertical,
|
|
141
|
+
onAddBlock: onAddBlock,
|
|
142
|
+
parentBlockAlignment: parentBlockAlignment,
|
|
143
|
+
onDeleteBlock: onDeleteBlock,
|
|
144
|
+
parentWidth: parentWidth,
|
|
145
|
+
rootClientId: rootClientId
|
|
146
|
+
}), shouldShowBlockInsertionPointAfter && (0, _element.createElement)(_insertionPoint.default, {
|
|
147
|
+
testID: `block-insertion-point-after-row-${index + 1}`
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* BlockListItem component. Renders a block list item either as a grid item or as a standalone item.
|
|
152
|
+
*
|
|
153
|
+
* @param {Object} props Component properties.
|
|
154
|
+
* @param {boolean} props.isGridItem Whether the block is a grid item.
|
|
155
|
+
* @param {number} props.numOfColumns The number of columns for grid layout.
|
|
156
|
+
* @param {number} props.parentWidth The width of the parent block.
|
|
157
|
+
* @param {number} props.tileCount The total number of tiles in the grid.
|
|
158
|
+
* @param {number} props.tileIndex The index of the current tile in the grid.
|
|
159
|
+
* @param {number} props.blockWidth The width of the block.
|
|
160
|
+
* @param {string} props.clientId The block client ID.
|
|
161
|
+
* @param {string} props.contentResizeMode The content resize mode, e.g "stretch".
|
|
162
|
+
* @param {Object} props.contentStyle Styles for the block content
|
|
163
|
+
* @param {Object} props.index Block item index
|
|
164
|
+
* @param {boolean} props.isStackedHorizontally Whether the block is stacked horizontally.
|
|
165
|
+
* @param {number} props.marginHorizontal The horizontal margin.
|
|
166
|
+
* @param {number} props.marginVertical The vertical margin.
|
|
167
|
+
* @param {Function} props.onAddBlock On add block callback.
|
|
168
|
+
* @param {Function} props.onDeleteBlock On delete block callback.
|
|
169
|
+
* @param {string} props.rootClientId The root client ID.
|
|
170
|
+
* @param {Function} props.shouldShowInnerBlockAppender Whether to show the inner block appender.
|
|
171
|
+
*
|
|
172
|
+
* @return {WPComponent|null} The rendered block list item or null if the block width is not provided.
|
|
173
|
+
*/
|
|
116
174
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
blockWidth,
|
|
130
|
-
...restProps
|
|
131
|
-
} = this.props;
|
|
132
|
-
const readableContentViewStyle = contentResizeMode === 'stretch' && stretchStyle;
|
|
133
|
-
const {
|
|
134
|
-
isContainerRelated
|
|
135
|
-
} = _components.alignmentHelpers;
|
|
136
|
-
return (0, _element.createElement)(_components.ReadableContentView, {
|
|
137
|
-
align: blockAlignment,
|
|
138
|
-
style: [readableContentViewStyle, isContainerRelated(blockName) && parentWidth && {
|
|
139
|
-
maxWidth: parentWidth + 2 * marginHorizontal
|
|
140
|
-
}]
|
|
141
|
-
}, (0, _element.createElement)(_reactNative.View, {
|
|
142
|
-
style: this.getContentStyles(readableContentViewStyle),
|
|
143
|
-
pointerEvents: isReadOnly ? 'box-only' : 'auto'
|
|
144
|
-
}, shouldShowInsertionPointBefore && (0, _element.createElement)(_insertionPoint.default, null), (0, _element.createElement)(_block.default, (0, _extends2.default)({
|
|
145
|
-
key: clientId,
|
|
146
|
-
showTitle: false,
|
|
147
|
-
clientId: clientId,
|
|
148
|
-
parentWidth: parentWidth
|
|
149
|
-
}, restProps, {
|
|
150
|
-
marginHorizontal: this.getMarginHorizontal(),
|
|
151
|
-
blockWidth: blockWidth
|
|
152
|
-
})), !shouldShowInnerBlockAppender() && shouldShowInsertionPointAfter && (0, _element.createElement)(_insertionPoint.default, null)));
|
|
175
|
+
|
|
176
|
+
function BlockListItem(props) {
|
|
177
|
+
const {
|
|
178
|
+
isGridItem,
|
|
179
|
+
numOfColumns,
|
|
180
|
+
tileCount,
|
|
181
|
+
tileIndex,
|
|
182
|
+
...restProps
|
|
183
|
+
} = props;
|
|
184
|
+
|
|
185
|
+
if (!(props !== null && props !== void 0 && props.blockWidth)) {
|
|
186
|
+
return null;
|
|
153
187
|
}
|
|
154
188
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
parentWidth,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (!blockWidth) {
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (isGridItem) {
|
|
167
|
-
const {
|
|
168
|
-
numOfColumns,
|
|
169
|
-
tileCount,
|
|
170
|
-
tileIndex
|
|
171
|
-
} = this.props;
|
|
172
|
-
return (0, _element.createElement)(_gridItem.default, {
|
|
173
|
-
maxWidth: parentWidth,
|
|
174
|
-
numOfColumns: numOfColumns,
|
|
175
|
-
tileCount: tileCount,
|
|
176
|
-
index: tileIndex
|
|
177
|
-
}, this.renderContent());
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return this.renderContent();
|
|
189
|
+
if (isGridItem) {
|
|
190
|
+
return (0, _element.createElement)(_gridItem.default, {
|
|
191
|
+
maxWidth: props === null || props === void 0 ? void 0 : props.parentWidth,
|
|
192
|
+
numOfColumns: numOfColumns,
|
|
193
|
+
tileCount: tileCount,
|
|
194
|
+
index: tileIndex
|
|
195
|
+
}, (0, _element.createElement)(BlockListItemContent, restProps));
|
|
181
196
|
}
|
|
182
197
|
|
|
198
|
+
return (0, _element.createElement)(BlockListItemContent, restProps);
|
|
183
199
|
}
|
|
184
200
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
var _default = (0, _compose.compose)([(0, _data.withSelect)((select, _ref) => {
|
|
188
|
-
let {
|
|
189
|
-
rootClientId,
|
|
190
|
-
isStackedHorizontally,
|
|
191
|
-
clientId
|
|
192
|
-
} = _ref;
|
|
193
|
-
const {
|
|
194
|
-
getBlockOrder,
|
|
195
|
-
getBlockInsertionPoint,
|
|
196
|
-
isBlockInsertionPointVisible,
|
|
197
|
-
getSettings,
|
|
198
|
-
getBlockParents,
|
|
199
|
-
getBlock
|
|
200
|
-
} = select(_store.store);
|
|
201
|
-
const blockClientIds = getBlockOrder(rootClientId);
|
|
202
|
-
const insertionPoint = getBlockInsertionPoint();
|
|
203
|
-
const blockInsertionPointIsVisible = isBlockInsertionPointVisible();
|
|
204
|
-
const shouldShowInsertionPointBefore = !isStackedHorizontally && blockInsertionPointIsVisible && insertionPoint.rootClientId === rootClientId && ( // If list is empty, show the insertion point (via the default appender)
|
|
205
|
-
blockClientIds.length === 0 || // Or if the insertion point is right before the denoted block.
|
|
206
|
-
blockClientIds[insertionPoint.index] === clientId);
|
|
207
|
-
const shouldShowInsertionPointAfter = !isStackedHorizontally && blockInsertionPointIsVisible && insertionPoint.rootClientId === rootClientId && // If the insertion point is at the end of the list.
|
|
208
|
-
blockClientIds.length === insertionPoint.index && // And the denoted block is the last one on the list, show the indicator at the end of the block.
|
|
209
|
-
blockClientIds[insertionPoint.index - 1] === clientId;
|
|
210
|
-
const isReadOnly = getSettings().readOnly;
|
|
211
|
-
const {
|
|
212
|
-
attributes,
|
|
213
|
-
name
|
|
214
|
-
} = getBlock(clientId) || {};
|
|
215
|
-
const {
|
|
216
|
-
align
|
|
217
|
-
} = attributes || {};
|
|
218
|
-
const parents = getBlockParents(clientId, true);
|
|
219
|
-
const hasParents = !!parents.length;
|
|
220
|
-
const parentBlock = hasParents ? getBlock(parents[0]) : {};
|
|
221
|
-
const {
|
|
222
|
-
align: parentBlockAlignment
|
|
223
|
-
} = (parentBlock === null || parentBlock === void 0 ? void 0 : parentBlock.attributes) || {};
|
|
224
|
-
const {
|
|
225
|
-
name: parentBlockName
|
|
226
|
-
} = parentBlock || {};
|
|
227
|
-
return {
|
|
228
|
-
shouldShowInsertionPointBefore,
|
|
229
|
-
shouldShowInsertionPointAfter,
|
|
230
|
-
isReadOnly,
|
|
231
|
-
hasParents,
|
|
232
|
-
blockAlignment: align,
|
|
233
|
-
parentBlockAlignment,
|
|
234
|
-
blockName: name,
|
|
235
|
-
parentBlockName
|
|
236
|
-
};
|
|
237
|
-
})])(BlockListItem);
|
|
238
|
-
|
|
201
|
+
var _default = BlockListItem;
|
|
239
202
|
exports.default = _default;
|
|
240
203
|
//# sourceMappingURL=block-list-item.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block-list-item.native.js"],"names":["stretchStyle","flex","BlockListItem","Component","getMarginHorizontal","blockAlignment","marginHorizontal","parentBlockAlignment","hasParents","blockName","parentBlockName","parentWidth","blockWidth","props","isFullWidth","isWideWidth","isWider","isContainerRelated","alignmentHelpers","screenWidth","Math","floor","Dimensions","get","width","isScreenWidthEqual","getContentStyles","readableContentViewStyle","styles","fullAlignment","paddingHorizontal","fullAlignmentPadding","paddingLeft","renderContent","clientId","isReadOnly","shouldShowInsertionPointBefore","shouldShowInsertionPointAfter","contentResizeMode","shouldShowInnerBlockAppender","restProps","maxWidth","render","isGridItem","numOfColumns","tileCount","tileIndex","select","rootClientId","isStackedHorizontally","getBlockOrder","getBlockInsertionPoint","isBlockInsertionPointVisible","getSettings","getBlockParents","getBlock","blockEditorStore","blockClientIds","insertionPoint","blockInsertionPointIsVisible","length","index","readOnly","attributes","name","align","parents","parentBlock"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAQ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AW,WAAX,YAAAA,WAAW,CAAEJ,UAAb,KAA2B,EAD5B;AAEA,QAAM;AAAEC,IAAAA,IAAI,EAAEtD;AAAR,MAA4ByD,WAAW,IAAI,EAAjD;AAEA,SAAO;AACN/B,IAAAA,8BADM;AAENC,IAAAA,6BAFM;AAGNF,IAAAA,UAHM;AAIN3B,IAAAA,UAJM;AAKNH,IAAAA,cAAc,EAAE4D,KALV;AAMN1D,IAAAA,oBANM;AAONE,IAAAA,SAAS,EAAEuD,IAPL;AAQNtD,IAAAA;AARM,GAAP;AAUA,CArDF,CADuB,CAAT,EAwDVR,aAxDU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Dimensions } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { ReadableContentView, alignmentHelpers } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockListBlock from './block';\nimport BlockInsertionPoint from './insertion-point';\nimport Grid from './grid-item';\n\nimport styles from './block-list-item.native.scss';\nimport { store as blockEditorStore } from '../../store';\n\nconst stretchStyle = {\n\tflex: 1,\n};\n\nexport class BlockListItem extends Component {\n\tgetMarginHorizontal() {\n\t\tconst {\n\t\t\tblockAlignment,\n\t\t\tmarginHorizontal,\n\t\t\tparentBlockAlignment,\n\t\t\thasParents,\n\t\t\tblockName,\n\t\t\tparentBlockName,\n\t\t\tparentWidth,\n\t\t\tblockWidth,\n\t\t} = this.props;\n\t\tconst { isFullWidth, isWideWidth, isWider, isContainerRelated } =\n\t\t\talignmentHelpers;\n\n\t\tif ( isFullWidth( blockAlignment ) ) {\n\t\t\tif ( ! hasParents ) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn marginHorizontal;\n\t\t}\n\t\tif ( isWideWidth( blockAlignment ) ) {\n\t\t\treturn marginHorizontal;\n\t\t}\n\n\t\tconst screenWidth = Math.floor( Dimensions.get( 'window' ).width );\n\n\t\tif (\n\t\t\tisFullWidth( parentBlockAlignment ) &&\n\t\t\t! isWider( blockWidth, 'medium' )\n\t\t) {\n\t\t\tif (\n\t\t\t\tisContainerRelated( blockName ) ||\n\t\t\t\tisWider( screenWidth, 'mobile' )\n\t\t\t) {\n\t\t\t\treturn marginHorizontal;\n\t\t\t}\n\t\t\treturn marginHorizontal * 2;\n\t\t}\n\n\t\tif (\n\t\t\tisContainerRelated( parentBlockName ) &&\n\t\t\t! isContainerRelated( blockName )\n\t\t) {\n\t\t\tconst isScreenWidthEqual = parentWidth === screenWidth;\n\t\t\tif ( isScreenWidthEqual || isWider( screenWidth, 'mobile' ) ) {\n\t\t\t\treturn marginHorizontal;\n\t\t\t}\n\t\t}\n\n\t\treturn marginHorizontal;\n\t}\n\n\tgetContentStyles( readableContentViewStyle ) {\n\t\tconst { blockAlignment, blockName, hasParents, parentBlockName } =\n\t\t\tthis.props;\n\t\tconst { isFullWidth, isContainerRelated } = alignmentHelpers;\n\n\t\treturn [\n\t\t\treadableContentViewStyle,\n\t\t\tisFullWidth( blockAlignment ) &&\n\t\t\t\t! hasParents && {\n\t\t\t\t\twidth: styles.fullAlignment.width,\n\t\t\t\t},\n\t\t\t! blockAlignment &&\n\t\t\t\thasParents &&\n\t\t\t\t! isContainerRelated( parentBlockName ) &&\n\t\t\t\tisContainerRelated( blockName ) && {\n\t\t\t\t\tpaddingHorizontal: styles.fullAlignmentPadding.paddingLeft,\n\t\t\t\t},\n\t\t];\n\t}\n\n\trenderContent() {\n\t\tconst {\n\t\t\tblockAlignment,\n\t\t\tclientId,\n\t\t\tisReadOnly,\n\t\t\tshouldShowInsertionPointBefore,\n\t\t\tshouldShowInsertionPointAfter,\n\t\t\tcontentResizeMode,\n\t\t\tshouldShowInnerBlockAppender,\n\t\t\tparentWidth,\n\t\t\tmarginHorizontal,\n\t\t\tblockName,\n\t\t\tblockWidth,\n\t\t\t...restProps\n\t\t} = this.props;\n\n\t\tconst readableContentViewStyle =\n\t\t\tcontentResizeMode === 'stretch' && stretchStyle;\n\t\tconst { isContainerRelated } = alignmentHelpers;\n\n\t\treturn (\n\t\t\t<ReadableContentView\n\t\t\t\talign={ blockAlignment }\n\t\t\t\tstyle={ [\n\t\t\t\t\treadableContentViewStyle,\n\t\t\t\t\tisContainerRelated( blockName ) &&\n\t\t\t\t\t\tparentWidth && {\n\t\t\t\t\t\t\tmaxWidth: parentWidth + 2 * marginHorizontal,\n\t\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<View\n\t\t\t\t\tstyle={ this.getContentStyles( readableContentViewStyle ) }\n\t\t\t\t\tpointerEvents={ isReadOnly ? 'box-only' : 'auto' }\n\t\t\t\t>\n\t\t\t\t\t{ shouldShowInsertionPointBefore && (\n\t\t\t\t\t\t<BlockInsertionPoint />\n\t\t\t\t\t) }\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\tkey={ clientId }\n\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\t\t\t{ ...restProps }\n\t\t\t\t\t\tmarginHorizontal={ this.getMarginHorizontal() }\n\t\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! shouldShowInnerBlockAppender() &&\n\t\t\t\t\t\tshouldShowInsertionPointAfter && (\n\t\t\t\t\t\t\t<BlockInsertionPoint />\n\t\t\t\t\t\t) }\n\t\t\t\t</View>\n\t\t\t</ReadableContentView>\n\t\t);\n\t}\n\n\trender() {\n\t\tconst { parentWidth, blockWidth, isGridItem } = this.props;\n\n\t\tif ( ! blockWidth ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif ( isGridItem ) {\n\t\t\tconst { numOfColumns, tileCount, tileIndex } = this.props;\n\t\t\treturn (\n\t\t\t\t<Grid\n\t\t\t\t\tmaxWidth={ parentWidth }\n\t\t\t\t\tnumOfColumns={ numOfColumns }\n\t\t\t\t\ttileCount={ tileCount }\n\t\t\t\t\tindex={ tileIndex }\n\t\t\t\t>\n\t\t\t\t\t{ this.renderContent() }\n\t\t\t\t</Grid>\n\t\t\t);\n\t\t}\n\t\treturn this.renderContent();\n\t}\n}\n\nexport default compose( [\n\twithSelect(\n\t\t( select, { rootClientId, isStackedHorizontally, clientId } ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetSettings,\n\t\t\t\tgetBlockParents,\n\t\t\t\tgetBlock,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst blockClientIds = getBlockOrder( rootClientId );\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\tconst blockInsertionPointIsVisible = isBlockInsertionPointVisible();\n\t\t\tconst shouldShowInsertionPointBefore =\n\t\t\t\t! isStackedHorizontally &&\n\t\t\t\tblockInsertionPointIsVisible &&\n\t\t\t\tinsertionPoint.rootClientId === rootClientId &&\n\t\t\t\t// If list is empty, show the insertion point (via the default appender)\n\t\t\t\t( blockClientIds.length === 0 ||\n\t\t\t\t\t// Or if the insertion point is right before the denoted block.\n\t\t\t\t\tblockClientIds[ insertionPoint.index ] === clientId );\n\n\t\t\tconst shouldShowInsertionPointAfter =\n\t\t\t\t! isStackedHorizontally &&\n\t\t\t\tblockInsertionPointIsVisible &&\n\t\t\t\tinsertionPoint.rootClientId === rootClientId &&\n\t\t\t\t// If the insertion point is at the end of the list.\n\t\t\t\tblockClientIds.length === insertionPoint.index &&\n\t\t\t\t// And the denoted block is the last one on the list, show the indicator at the end of the block.\n\t\t\t\tblockClientIds[ insertionPoint.index - 1 ] === clientId;\n\n\t\t\tconst isReadOnly = getSettings().readOnly;\n\n\t\t\tconst { attributes, name } = getBlock( clientId ) || {};\n\t\t\tconst { align } = attributes || {};\n\t\t\tconst parents = getBlockParents( clientId, true );\n\t\t\tconst hasParents = !! parents.length;\n\t\t\tconst parentBlock = hasParents ? getBlock( parents[ 0 ] ) : {};\n\t\t\tconst { align: parentBlockAlignment } =\n\t\t\t\tparentBlock?.attributes || {};\n\t\t\tconst { name: parentBlockName } = parentBlock || {};\n\n\t\t\treturn {\n\t\t\t\tshouldShowInsertionPointBefore,\n\t\t\t\tshouldShowInsertionPointAfter,\n\t\t\t\tisReadOnly,\n\t\t\t\thasParents,\n\t\t\t\tblockAlignment: align,\n\t\t\t\tparentBlockAlignment,\n\t\t\t\tblockName: name,\n\t\t\t\tparentBlockName,\n\t\t\t};\n\t\t}\n\t),\n] )( BlockListItem );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block-list-item.native.js"],"names":["BlockListItemContent","blockWidth","clientId","contentResizeMode","contentStyle","index","isStackedHorizontally","marginHorizontal","marginVertical","onAddBlock","onDeleteBlock","parentWidth","rootClientId","shouldShowInnerBlockAppender","blockAlignment","blockName","hasParents","parentBlockAlignment","parentBlockName","shouldShowInsertionPointAfter","shouldShowInsertionPointBefore","select","getBlockAttributes","getBlockInsertionPoint","getBlockName","getBlockOrder","isBlockInsertionPointVisible","blockEditorStore","blockClientIds","insertionPoint","insertionPointVisibleInCurrentRoot","isListEmpty","length","isInsertionPointBeforeBlock","isInsertionPointAtEnd","isBlockLastInList","showInsertionPointBefore","showInsertionPointAfter","blockHasParents","name","parentName","align","parentBlockAlign","wrapperStyles","margin","shouldShowBlockInsertionPointAfter","BlockListItem","props","isGridItem","numOfColumns","tileCount","tileIndex","restProps"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,oBAAT,OAcI;AAAA,MAd2B;AAC9BC,IAAAA,UAD8B;AAE9BC,IAAAA,QAF8B;AAG9BC,IAAA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{ View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport Block from './block';\nimport Grid from './grid-item';\nimport BlockInsertionPoint from './insertion-point';\nimport { store as blockEditorStore } from '../../store';\nimport { useEditorWrapperStyles } from '../../hooks/use-editor-wrapper-styles';\n\n/**\n * BlockListItemContent component. Renders a block with an optional insertion point.\n *\n * @param {Object} props Component properties.\n * @param {number} props.blockWidth The width of the block.\n * @param {string} props.clientId The block client ID.\n * @param {string} props.contentResizeMode The content resize mode, e.g \"stretch\".\n * @param {Object} props.contentStyle Styles for the block content\n * @param {Object} props.index Block item index\n * @param {boolean} props.isStackedHorizontally Whether the block is stacked horizontally.\n * @param {number} props.marginHorizontal The horizontal margin.\n * @param {number} props.marginVertical The vertical margin.\n * @param {Function} props.onAddBlock On add block callback.\n * @param {Function} props.onDeleteBlock On delete block callback.\n * @param {number} props.parentWidth The width of the parent block.\n * @param {string} props.rootClientId The root client ID.\n * @param {Function} props.shouldShowInnerBlockAppender Whether to show the inner block appender.\n *\n * @return {WPComponent} The rendered block list item content.\n */\nfunction BlockListItemContent( {\n\tblockWidth,\n\tclientId,\n\tcontentResizeMode,\n\tcontentStyle,\n\tindex,\n\tisStackedHorizontally,\n\tmarginHorizontal,\n\tmarginVertical,\n\tonAddBlock,\n\tonDeleteBlock,\n\tparentWidth,\n\trootClientId,\n\tshouldShowInnerBlockAppender,\n} ) {\n\tconst {\n\t\tblockAlignment,\n\t\tblockName,\n\t\thasParents,\n\t\tparentBlockAlignment,\n\t\tparentBlockName,\n\t\tshouldShowInsertionPointAfter,\n\t\tshouldShowInsertionPointBefore,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst blockClientIds = getBlockOrder( rootClientId );\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\n\t\t\tconst insertionPointVisibleInCurrentRoot =\n\t\t\t\t! isStackedHorizontally &&\n\t\t\t\tisBlockInsertionPointVisible() &&\n\t\t\t\tinsertionPoint.rootClientId === rootClientId;\n\n\t\t\tconst isListEmpty = blockClientIds.length === 0;\n\t\t\tconst isInsertionPointBeforeBlock =\n\t\t\t\tblockClientIds[ insertionPoint.index ] === clientId;\n\t\t\tconst isInsertionPointAtEnd =\n\t\t\t\tblockClientIds.length === insertionPoint.index;\n\t\t\tconst isBlockLastInList =\n\t\t\t\tblockClientIds[ insertionPoint.index - 1 ] === clientId;\n\n\t\t\tconst showInsertionPointBefore =\n\t\t\t\tinsertionPointVisibleInCurrentRoot &&\n\t\t\t\t( isListEmpty || isInsertionPointBeforeBlock );\n\n\t\t\tconst showInsertionPointAfter =\n\t\t\t\tinsertionPointVisibleInCurrentRoot &&\n\t\t\t\tisInsertionPointAtEnd &&\n\t\t\t\tisBlockLastInList;\n\n\t\t\tconst blockHasParents = !! rootClientId;\n\t\t\tconst name = getBlockName( clientId );\n\t\t\tconst parentName = getBlockName( rootClientId );\n\t\t\tconst { align } = getBlockAttributes( clientId ) || {};\n\t\t\tconst { align: parentBlockAlign } =\n\t\t\t\tgetBlockAttributes( rootClientId ) || {};\n\n\t\t\treturn {\n\t\t\t\tblockAlignment: align,\n\t\t\t\tblockName: name,\n\t\t\t\thasParents: blockHasParents,\n\t\t\t\tparentBlockAlignment: parentBlockAlign,\n\t\t\t\tparentBlockName: parentName,\n\t\t\t\tshouldShowInsertionPointAfter: showInsertionPointAfter,\n\t\t\t\tshouldShowInsertionPointBefore: showInsertionPointBefore,\n\t\t\t};\n\t\t},\n\t\t[ isStackedHorizontally, rootClientId, clientId ]\n\t);\n\n\tconst [ wrapperStyles, margin ] = useEditorWrapperStyles( {\n\t\talign: blockAlignment,\n\t\tblockName,\n\t\tblockWidth,\n\t\tcontentResizeMode,\n\t\thasParents,\n\t\tmarginHorizontal,\n\t\tparentBlockAlignment,\n\t\tparentBlockName,\n\t\tparentWidth,\n\t} );\n\n\tconst shouldShowBlockInsertionPointAfter =\n\t\t! shouldShowInnerBlockAppender() && shouldShowInsertionPointAfter;\n\n\treturn (\n\t\t<View style={ wrapperStyles }>\n\t\t\t{ shouldShowInsertionPointBefore && (\n\t\t\t\t<BlockInsertionPoint\n\t\t\t\t\ttestID={ `block-insertion-point-before-row-${ index + 1 }` }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<Block\n\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tcontentStyle={ contentStyle }\n\t\t\t\tisStackedHorizontally={ isStackedHorizontally }\n\t\t\t\tmarginHorizontal={ margin }\n\t\t\t\tmarginVertical={ marginVertical }\n\t\t\t\tonAddBlock={ onAddBlock }\n\t\t\t\tparentBlockAlignment={ parentBlockAlignment }\n\t\t\t\tonDeleteBlock={ onDeleteBlock }\n\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t/>\n\t\t\t{ shouldShowBlockInsertionPointAfter && (\n\t\t\t\t<BlockInsertionPoint\n\t\t\t\t\ttestID={ `block-insertion-point-after-row-${ index + 1 }` }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</View>\n\t);\n}\n\n/**\n * BlockListItem component. Renders a block list item either as a grid item or as a standalone item.\n *\n * @param {Object} props Component properties.\n * @param {boolean} props.isGridItem Whether the block is a grid item.\n * @param {number} props.numOfColumns The number of columns for grid layout.\n * @param {number} props.parentWidth The width of the parent block.\n * @param {number} props.tileCount The total number of tiles in the grid.\n * @param {number} props.tileIndex The index of the current tile in the grid.\n * @param {number} props.blockWidth The width of the block.\n * @param {string} props.clientId The block client ID.\n * @param {string} props.contentResizeMode The content resize mode, e.g \"stretch\".\n * @param {Object} props.contentStyle Styles for the block content\n * @param {Object} props.index Block item index\n * @param {boolean} props.isStackedHorizontally Whether the block is stacked horizontally.\n * @param {number} props.marginHorizontal The horizontal margin.\n * @param {number} props.marginVertical The vertical margin.\n * @param {Function} props.onAddBlock On add block callback.\n * @param {Function} props.onDeleteBlock On delete block callback.\n * @param {string} props.rootClientId The root client ID.\n * @param {Function} props.shouldShowInnerBlockAppender Whether to show the inner block appender.\n *\n * @return {WPComponent|null} The rendered block list item or null if the block width is not provided.\n */\nfunction BlockListItem( props ) {\n\tconst { isGridItem, numOfColumns, tileCount, tileIndex, ...restProps } =\n\t\tprops;\n\n\tif ( ! props?.blockWidth ) {\n\t\treturn null;\n\t}\n\n\tif ( isGridItem ) {\n\t\treturn (\n\t\t\t<Grid\n\t\t\t\tmaxWidth={ props?.parentWidth }\n\t\t\t\tnumOfColumns={ numOfColumns }\n\t\t\t\ttileCount={ tileCount }\n\t\t\t\tindex={ tileIndex }\n\t\t\t>\n\t\t\t\t<BlockListItemContent { ...restProps } />\n\t\t\t</Grid>\n\t\t);\n\t}\n\n\treturn <BlockListItemContent { ...restProps } />;\n}\n\nexport default BlockListItem;\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _reactNative = require("react-native");
|
|
13
|
+
|
|
14
|
+
var _compose = require("@wordpress/compose");
|
|
15
|
+
|
|
16
|
+
var _components = require("@wordpress/components");
|
|
17
|
+
|
|
18
|
+
var _block = _interopRequireDefault(require("./block.scss"));
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* External dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* WordPress dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal dependencies
|
|
30
|
+
*/
|
|
31
|
+
function BlockOutline(_ref) {
|
|
32
|
+
let {
|
|
33
|
+
align,
|
|
34
|
+
blockWidth,
|
|
35
|
+
isParentSelected,
|
|
36
|
+
isSelected,
|
|
37
|
+
name,
|
|
38
|
+
screenWidth
|
|
39
|
+
} = _ref;
|
|
40
|
+
const {
|
|
41
|
+
isFullWidth,
|
|
42
|
+
isContainerRelated
|
|
43
|
+
} = _components.alignmentHelpers;
|
|
44
|
+
const isScreenWidthWider = blockWidth < screenWidth;
|
|
45
|
+
const styleSolidBorder = [_block.default.solidBorder, isFullWidth(align) && isScreenWidthWider && _block.default.borderFullWidth, isFullWidth(align) && isContainerRelated(name) && isScreenWidthWider && _block.default.containerBorderFullWidth, (0, _compose.usePreferredColorSchemeStyle)(_block.default.solidBorderColor, _block.default.solidBorderColorDark)];
|
|
46
|
+
const styleDashedBorder = [_block.default.dashedBorder, (0, _compose.usePreferredColorSchemeStyle)(_block.default.dashedBorderColor, _block.default.dashedBorderColorDark)];
|
|
47
|
+
return (0, _element.createElement)(_element.Fragment, null, isSelected && (0, _element.createElement)(_reactNative.View, {
|
|
48
|
+
pointerEvents: "box-none",
|
|
49
|
+
style: styleSolidBorder
|
|
50
|
+
}), isParentSelected && (0, _element.createElement)(_reactNative.View, {
|
|
51
|
+
style: styleDashedBorder
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var _default = BlockOutline;
|
|
56
|
+
exports.default = _default;
|
|
57
|
+
//# sourceMappingURL=block-outline.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block-outline.native.js"],"names":["BlockOutline","align","blockWidth","isParentSelected","isSelected","name","screenWidth","isFullWidth","isContainerRelated","alignmentHelpers","isScreenWidthWider","styleSolidBorder","styles","solidBorder","borderFullWidth","containerBorderFullWidth","solidBorderColor","solidBorderColorDark","styleDashedBorder","dashedBorder","dashedBorderColor","dashedBorderColorDark"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,YAAT,OAOI;AAAA,MAPmB;AACtBC,IAAAA,KADsB;AAEtBC,IAAAA,UAFsB;AAGtBC,IAAAA,gBAHsB;AAItBC,IAAAA,UAJsB;AAKtBC,IAAAA,IALsB;AAMtBC,IAAAA;AANsB,GAOnB;AACH,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAAsCC,4BAA5C;AACA,QAAMC,kBAAkB,GAAGR,UAAU,GAAGI,WAAxC;AAEA,QAAMK,gBAAgB,GAAG,CACxBC,eAAOC,WADiB,EAExBN,WAAW,CAAEN,KAAF,CAAX,IAAwBS,kBAAxB,IAA8CE,eAAOE,eAF7B,EAGxBP,WAAW,CAAEN,KAAF,CAAX,IACCO,kBAAkB,CAAEH,IAAF,CADnB,IAECK,kBAFD,IAGCE,eAAOG,wBANgB,EAOxB,2CACCH,eAAOI,gBADR,EAECJ,eAAOK,oBAFR,CAPwB,CAAzB;AAYA,QAAMC,iBAAiB,GAAG,CACzBN,eAAOO,YADkB,EAEzB,2CACCP,eAAOQ,iBADR,EAECR,eAAOS,qBAFR,CAFyB,CAA1B;AAQA,SACC,qDACGjB,UAAU,IACX,4BAAC,iBAAD;AAAM,IAAA,aAAa,EAAC,UAApB;AAA+B,IAAA,KAAK,EAAGO;AAAvC,IAFF,EAIGR,gBAAgB,IAAI,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGe;AAAd,IAJvB,CADD;AAQA;;eAEclB,Y","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { alignmentHelpers } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport styles from './block.scss';\n\nfunction BlockOutline( {\n\talign,\n\tblockWidth,\n\tisParentSelected,\n\tisSelected,\n\tname,\n\tscreenWidth,\n} ) {\n\tconst { isFullWidth, isContainerRelated } = alignmentHelpers;\n\tconst isScreenWidthWider = blockWidth < screenWidth;\n\n\tconst styleSolidBorder = [\n\t\tstyles.solidBorder,\n\t\tisFullWidth( align ) && isScreenWidthWider && styles.borderFullWidth,\n\t\tisFullWidth( align ) &&\n\t\t\tisContainerRelated( name ) &&\n\t\t\tisScreenWidthWider &&\n\t\t\tstyles.containerBorderFullWidth,\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.solidBorderColor,\n\t\t\tstyles.solidBorderColorDark\n\t\t),\n\t];\n\tconst styleDashedBorder = [\n\t\tstyles.dashedBorder,\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.dashedBorderColor,\n\t\t\tstyles.dashedBorderColorDark\n\t\t),\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<View pointerEvents=\"box-none\" style={ styleSolidBorder } />\n\t\t\t) }\n\t\t\t{ isParentSelected && <View style={ styleDashedBorder } /> }\n\t\t</>\n\t);\n}\n\nexport default BlockOutline;\n"]}
|