@wordpress/block-editor 14.8.0 → 14.8.1-next.a9f418477.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/build/autocompleters/block.js +2 -4
- package/build/autocompleters/block.js.map +1 -1
- package/build/autocompleters/link.js +2 -4
- package/build/autocompleters/link.js.map +1 -1
- package/build/components/block-canvas/index.js +3 -6
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-list/block.js +6 -5
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/index.js +0 -1
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +6 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +87 -0
- package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -0
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +98 -5
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-lock/modal.js +4 -4
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-parent-selector/index.js +2 -15
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +13 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-popover/inbetween.js +4 -0
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +7 -4
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +12 -22
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +0 -1
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-switcher/utils.js +0 -1
- package/build/components/block-switcher/utils.js.map +1 -1
- package/build/components/block-toolbar/index.js +7 -6
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +0 -1
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +0 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +1 -0
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +10 -0
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +17 -16
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +0 -1
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/iframe/use-scale-canvas.js +68 -47
- package/build/components/iframe/use-scale-canvas.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +0 -10
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/menu.js +2 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +19 -10
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/slot.js +2 -13
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +10 -0
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.js +1 -0
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +18 -18
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +9 -25
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/observe-typing/index.js +0 -1
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/recursion-provider/index.js +0 -1
- package/build/components/recursion-provider/index.js.map +1 -1
- package/build/components/rich-text/index.js +5 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/native/use-format-types.js +0 -1
- package/build/components/rich-text/native/use-format-types.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +0 -1
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +0 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/typewriter/index.js +0 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +11 -2
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +15 -2
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +1 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/warning/index.js +2 -3
- package/build/components/warning/index.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +11 -0
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +6 -2
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/block-bindings.js +4 -3
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/gap.js +1 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/generated-class-name.js +0 -1
- package/build/hooks/generated-class-name.js.map +1 -1
- package/build/hooks/use-zoom-out.js +47 -14
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/store/private-selectors.js +1 -7
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +478 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +12 -55
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +0 -1
- package/build/utils/object.js.map +1 -1
- package/build-module/autocompleters/block.js +2 -4
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/autocompleters/link.js +2 -4
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/block-canvas/index.js +3 -6
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-list/block.js +8 -7
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/index.js +0 -1
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +6 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +80 -0
- package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -0
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +97 -5
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-lock/modal.js +4 -4
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +2 -15
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +13 -4
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +4 -0
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -4
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -1
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +13 -23
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js +0 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build-module/components/block-switcher/utils.js +0 -1
- package/build-module/components/block-switcher/utils.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +7 -6
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +0 -1
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +0 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +1 -0
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +10 -0
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +17 -16
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +0 -1
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/iframe/use-scale-canvas.js +68 -47
- package/build-module/components/iframe/use-scale-canvas.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +1 -11
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/menu.js +2 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +20 -11
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +3 -14
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +9 -0
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +1 -0
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +18 -18
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +9 -25
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +0 -1
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/recursion-provider/index.js +0 -1
- package/build-module/components/recursion-provider/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +5 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/native/use-format-types.js +0 -1
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +0 -1
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +0 -1
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +0 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +11 -2
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +15 -2
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +1 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/warning/index.js +2 -3
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +11 -0
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +6 -2
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/block-bindings.js +4 -3
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/gap.js +1 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/generated-class-name.js +0 -1
- package/build-module/hooks/generated-class-name.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +48 -15
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/store/private-selectors.js +1 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +479 -3
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +12 -55
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +0 -1
- package/build-module/utils/object.js.map +1 -1
- package/build-style/content-rtl.css +18 -5
- package/build-style/content.css +18 -5
- package/build-style/style-rtl.css +25 -64
- package/build-style/style.css +25 -64
- package/package.json +32 -32
- package/src/autocompleters/block.js +2 -4
- package/src/autocompleters/link.js +2 -4
- package/src/components/alignment-control/stories/aliginment-toolbar.story.js +47 -0
- package/src/components/alignment-control/stories/index.story.js +51 -0
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +5 -5
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +4 -4
- package/src/components/block-canvas/index.js +3 -5
- package/src/components/block-draggable/content.scss +11 -5
- package/src/components/block-list/block.js +7 -13
- package/src/components/block-list/content.scss +6 -0
- package/src/components/block-list/use-block-props/index.js +5 -0
- package/src/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +83 -0
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +112 -8
- package/src/components/block-lock/modal.js +4 -6
- package/src/components/block-parent-selector/index.js +1 -19
- package/src/components/block-patterns-list/index.js +12 -1
- package/src/components/block-patterns-list/stories/fixtures.js +1 -0
- package/src/components/block-patterns-list/style.scss +16 -5
- package/src/components/block-popover/inbetween.js +4 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +6 -1
- package/src/components/block-settings-menu-controls/index.js +2 -1
- package/src/components/block-switcher/index.js +19 -21
- package/src/components/block-switcher/style.scss +0 -9
- package/src/components/block-title/test/index.js +2 -0
- package/src/components/block-toolbar/index.js +9 -6
- package/src/components/block-tools/style.scss +5 -0
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +3 -3
- package/src/components/dimensions-tool/stories/aspect-ratio-tool.story.js +1 -1
- package/src/components/dimensions-tool/stories/index.story.js +1 -1
- package/src/components/dimensions-tool/stories/scale-tool.story.js +1 -1
- package/src/components/dimensions-tool/stories/width-height-tool.story.js +1 -1
- package/src/components/font-appearance-control/index.js +1 -0
- package/src/components/font-family/index.js +10 -0
- package/src/components/font-family/style.scss +5 -0
- package/src/components/global-styles/dimensions-panel.js +16 -16
- package/src/components/iframe/content.scss +6 -1
- package/src/components/iframe/use-scale-canvas.js +103 -81
- package/src/components/inserter/block-patterns-tab/index.js +1 -17
- package/src/components/inserter/menu.js +8 -1
- package/src/components/inserter-draggable-blocks/index.js +19 -29
- package/src/components/inspector-controls/slot.js +3 -22
- package/src/components/letter-spacing-control/README.md +2 -1
- package/src/components/letter-spacing-control/index.js +17 -0
- package/src/components/line-height-control/index.js +1 -0
- package/src/components/media-placeholder/index.js +25 -28
- package/src/components/multi-selection-inspector/index.js +17 -27
- package/src/components/multi-selection-inspector/style.scss +0 -12
- package/src/components/resolution-tool/stories/index.story.js +1 -1
- package/src/components/rich-text/index.js +5 -0
- package/src/components/spacing-sizes-control/style.scss +0 -29
- package/src/components/text-alignment-control/stories/index.story.js +1 -1
- package/src/components/use-block-drop-zone/index.js +18 -1
- package/src/components/use-moving-animation/index.js +15 -0
- package/src/components/use-resize-canvas/index.js +1 -1
- package/src/components/warning/index.js +3 -4
- package/src/components/warning/test/index.js +3 -1
- package/src/components/writing-flow/use-drag-selection.js +11 -0
- package/src/components/writing-flow/use-tab-nav.js +9 -6
- package/src/hooks/block-bindings.js +8 -4
- package/src/hooks/gap.js +1 -1
- package/src/hooks/use-zoom-out.js +48 -16
- package/src/store/private-selectors.js +2 -17
- package/src/store/reducer.js +639 -2
- package/src/store/selectors.js +19 -69
- package/src/store/test/private-selectors.js +1 -0
- package/src/store/test/reducer.js +849 -0
- package/src/store/test/selectors.js +4 -110
- package/src/style.scss +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { sprintf, _n } from '@wordpress/i18n';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
|
-
import { serialize } from '@wordpress/blocks';
|
|
7
|
-
import { count as wordCount } from '@wordpress/wordcount';
|
|
8
6
|
import { copy } from '@wordpress/icons';
|
|
7
|
+
import { __experimentalHStack as HStack } from '@wordpress/components';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Internal dependencies
|
|
@@ -14,33 +13,24 @@ import BlockIcon from '../block-icon';
|
|
|
14
13
|
import { store as blockEditorStore } from '../../store';
|
|
15
14
|
|
|
16
15
|
export default function MultiSelectionInspector() {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
}, [] );
|
|
23
|
-
const words = wordCount( serialize( blocks ), 'words' );
|
|
24
|
-
|
|
16
|
+
const selectedBlockCount = useSelect(
|
|
17
|
+
( select ) => select( blockEditorStore ).getSelectedBlockCount(),
|
|
18
|
+
[]
|
|
19
|
+
);
|
|
25
20
|
return (
|
|
26
|
-
<
|
|
21
|
+
<HStack
|
|
22
|
+
justify="flex-start"
|
|
23
|
+
spacing={ 2 }
|
|
24
|
+
className="block-editor-multi-selection-inspector__card"
|
|
25
|
+
>
|
|
27
26
|
<BlockIcon icon={ copy } showColors />
|
|
28
|
-
<div className="block-editor-multi-selection-inspector__card-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
) }
|
|
35
|
-
</div>
|
|
36
|
-
<div className="block-editor-multi-selection-inspector__card-description">
|
|
37
|
-
{ sprintf(
|
|
38
|
-
/* translators: %d: number of words */
|
|
39
|
-
_n( '%d word selected.', '%d words selected.', words ),
|
|
40
|
-
words
|
|
41
|
-
) }
|
|
42
|
-
</div>
|
|
27
|
+
<div className="block-editor-multi-selection-inspector__card-title">
|
|
28
|
+
{ sprintf(
|
|
29
|
+
/* translators: %d: number of blocks */
|
|
30
|
+
_n( '%d Block', '%d Blocks', selectedBlockCount ),
|
|
31
|
+
selectedBlockCount
|
|
32
|
+
) }
|
|
43
33
|
</div>
|
|
44
|
-
</
|
|
34
|
+
</HStack>
|
|
45
35
|
);
|
|
46
36
|
}
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
.block-editor-multi-selection-inspector__card {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: flex-start;
|
|
4
2
|
padding: $grid-unit-20;
|
|
5
3
|
}
|
|
6
4
|
|
|
7
|
-
.block-editor-multi-selection-inspector__card-content {
|
|
8
|
-
flex-grow: 1;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
5
|
.block-editor-multi-selection-inspector__card-title {
|
|
12
6
|
font-weight: 500;
|
|
13
|
-
margin-bottom: 5px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.block-editor-multi-selection-inspector__card-description {
|
|
17
|
-
font-size: $default-font-size;
|
|
18
7
|
}
|
|
19
8
|
|
|
20
9
|
.block-editor-multi-selection-inspector__card .block-editor-block-icon {
|
|
21
10
|
margin-left: -2px;
|
|
22
|
-
margin-right: 10px;
|
|
23
11
|
padding: 0 3px;
|
|
24
12
|
width: $button-size;
|
|
25
13
|
height: $button-size-small;
|
|
@@ -431,6 +431,11 @@ export function RichTextWrapper(
|
|
|
431
431
|
aria-multiline={ ! disableLineBreaks }
|
|
432
432
|
aria-readonly={ shouldDisableEditing }
|
|
433
433
|
{ ...props }
|
|
434
|
+
// Unset draggable (coming from block props) for contentEditable
|
|
435
|
+
// elements because it will interfere with multi block selection
|
|
436
|
+
// when the contentEditable and draggable elements are the same
|
|
437
|
+
// element.
|
|
438
|
+
draggable={ undefined }
|
|
434
439
|
aria-label={
|
|
435
440
|
bindingsLabel || props[ 'aria-label' ] || placeholder
|
|
436
441
|
}
|
|
@@ -4,40 +4,11 @@
|
|
|
4
4
|
margin-bottom: 0;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.is-marked {
|
|
8
|
-
.components-range-control__track {
|
|
9
|
-
transition: width ease 0.1s;
|
|
10
|
-
@include reduce-motion("transition");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.components-range-control__thumb-wrapper {
|
|
14
|
-
transition: left ease 0.1s;
|
|
15
|
-
@include reduce-motion("transition");
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
7
|
.spacing-sizes-control__range-control,
|
|
20
8
|
.spacing-sizes-control__custom-value-range {
|
|
21
9
|
flex: 1;
|
|
22
10
|
margin-bottom: 0; // Needed for some instances of the range control, such as the Spacer block.
|
|
23
11
|
}
|
|
24
|
-
|
|
25
|
-
.components-range-control__mark {
|
|
26
|
-
transform: translateX(-50%);
|
|
27
|
-
height: $grid-unit-05;
|
|
28
|
-
width: math.div($grid-unit-05, 2);
|
|
29
|
-
background-color: $white;
|
|
30
|
-
z-index: 1;
|
|
31
|
-
top: -#{$grid-unit-05};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.components-range-control__marks {
|
|
35
|
-
margin-top: 17px;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.components-range-control__thumb-wrapper {
|
|
39
|
-
z-index: 3;
|
|
40
|
-
}
|
|
41
12
|
}
|
|
42
13
|
|
|
43
14
|
.spacing-sizes-control__header {
|
|
@@ -332,6 +332,7 @@ export default function useBlockDropZone( {
|
|
|
332
332
|
isGroupable,
|
|
333
333
|
isZoomOut,
|
|
334
334
|
getSectionRootClientId,
|
|
335
|
+
getBlockParents,
|
|
335
336
|
} = unlock( useSelect( blockEditorStore ) );
|
|
336
337
|
const {
|
|
337
338
|
showInsertionPoint,
|
|
@@ -358,13 +359,29 @@ export default function useBlockDropZone( {
|
|
|
358
359
|
// So, ensure that the drag state is set when the user drags over a drop zone.
|
|
359
360
|
startDragging();
|
|
360
361
|
}
|
|
362
|
+
|
|
363
|
+
const draggedBlockClientIds = getDraggedBlockClientIds();
|
|
364
|
+
const targetParents = [
|
|
365
|
+
targetRootClientId,
|
|
366
|
+
...getBlockParents( targetRootClientId, true ),
|
|
367
|
+
];
|
|
368
|
+
|
|
369
|
+
// Check if the target is within any of the dragged blocks.
|
|
370
|
+
const isTargetWithinDraggedBlocks = draggedBlockClientIds.some(
|
|
371
|
+
( clientId ) => targetParents.includes( clientId )
|
|
372
|
+
);
|
|
373
|
+
|
|
374
|
+
if ( isTargetWithinDraggedBlocks ) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
|
|
361
378
|
const allowedBlocks = getAllowedBlocks( targetRootClientId );
|
|
362
379
|
const targetBlockName = getBlockNamesByClientId( [
|
|
363
380
|
targetRootClientId,
|
|
364
381
|
] )[ 0 ];
|
|
365
382
|
|
|
366
383
|
const draggedBlockNames = getBlockNamesByClientId(
|
|
367
|
-
|
|
384
|
+
draggedBlockClientIds
|
|
368
385
|
);
|
|
369
386
|
const isBlockDroppingAllowed = isDropTargetValid(
|
|
370
387
|
getBlockType,
|
|
@@ -52,6 +52,7 @@ function useMovingAnimation( { triggerAnimationOnChange, clientId } ) {
|
|
|
52
52
|
isFirstMultiSelectedBlock,
|
|
53
53
|
isBlockMultiSelected,
|
|
54
54
|
isAncestorMultiSelected,
|
|
55
|
+
isDraggingBlocks,
|
|
55
56
|
} = useSelect( blockEditorStore );
|
|
56
57
|
|
|
57
58
|
// Whenever the trigger changes, we need to take a snapshot of the current
|
|
@@ -73,8 +74,14 @@ function useMovingAnimation( { triggerAnimationOnChange, clientId } ) {
|
|
|
73
74
|
const isSelected = isBlockSelected( clientId );
|
|
74
75
|
const adjustScrolling =
|
|
75
76
|
isSelected || isFirstMultiSelectedBlock( clientId );
|
|
77
|
+
const isDragging = isDraggingBlocks();
|
|
76
78
|
|
|
77
79
|
function preserveScrollPosition() {
|
|
80
|
+
// The user already scrolled when dragging blocks.
|
|
81
|
+
if ( isDragging ) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
78
85
|
if ( adjustScrolling && prevRect ) {
|
|
79
86
|
const blockRect = ref.current.getBoundingClientRect();
|
|
80
87
|
const diff = blockRect.top - prevRect.top;
|
|
@@ -107,6 +114,13 @@ function useMovingAnimation( { triggerAnimationOnChange, clientId } ) {
|
|
|
107
114
|
isSelected ||
|
|
108
115
|
isBlockMultiSelected( clientId ) ||
|
|
109
116
|
isAncestorMultiSelected( clientId );
|
|
117
|
+
|
|
118
|
+
// The user already dragged the blocks to the new position, so don't
|
|
119
|
+
// animate the dragged blocks.
|
|
120
|
+
if ( isPartOfSelection && isDragging ) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
110
124
|
// Make sure the other blocks move under the selected block(s).
|
|
111
125
|
const zIndex = isPartOfSelection ? '1' : '';
|
|
112
126
|
|
|
@@ -153,6 +167,7 @@ function useMovingAnimation( { triggerAnimationOnChange, clientId } ) {
|
|
|
153
167
|
isFirstMultiSelectedBlock,
|
|
154
168
|
isBlockMultiSelected,
|
|
155
169
|
isAncestorMultiSelected,
|
|
170
|
+
isDraggingBlocks,
|
|
156
171
|
] );
|
|
157
172
|
|
|
158
173
|
return ref;
|
|
@@ -6,7 +6,6 @@ import clsx from 'clsx';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { Children } from '@wordpress/element';
|
|
10
9
|
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
11
10
|
import { __ } from '@wordpress/i18n';
|
|
12
11
|
import { moreVertical } from '@wordpress/icons';
|
|
@@ -20,10 +19,10 @@ function Warning( { className, actions, children, secondaryActions } ) {
|
|
|
20
19
|
{ children }
|
|
21
20
|
</p>
|
|
22
21
|
|
|
23
|
-
{ (
|
|
22
|
+
{ ( actions?.length > 0 || secondaryActions ) && (
|
|
24
23
|
<div className="block-editor-warning__actions">
|
|
25
|
-
{
|
|
26
|
-
|
|
24
|
+
{ actions?.length > 0 &&
|
|
25
|
+
actions.map( ( action, i ) => (
|
|
27
26
|
<span
|
|
28
27
|
key={ i }
|
|
29
28
|
className="block-editor-warning__action"
|
|
@@ -18,7 +18,9 @@ describe( 'Warning', () => {
|
|
|
18
18
|
|
|
19
19
|
it( 'should show primary actions', () => {
|
|
20
20
|
render(
|
|
21
|
-
<Warning actions={ <button>Click me</button> }>
|
|
21
|
+
<Warning actions={ [ <button key="test">Click me</button> ] }>
|
|
22
|
+
Message
|
|
23
|
+
</Warning>
|
|
22
24
|
);
|
|
23
25
|
|
|
24
26
|
expect(
|
|
@@ -80,7 +80,17 @@ export default function useDragSelection() {
|
|
|
80
80
|
} );
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
let lastMouseDownTarget;
|
|
84
|
+
|
|
85
|
+
function onMouseDown( { target } ) {
|
|
86
|
+
lastMouseDownTarget = target;
|
|
87
|
+
}
|
|
88
|
+
|
|
83
89
|
function onMouseLeave( { buttons, target, relatedTarget } ) {
|
|
90
|
+
if ( ! target.contains( lastMouseDownTarget ) ) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
84
94
|
// If we're moving into a child element, ignore. We're tracking
|
|
85
95
|
// the mouse leaving the element to a parent, no a child.
|
|
86
96
|
if ( target.contains( relatedTarget ) ) {
|
|
@@ -141,6 +151,7 @@ export default function useDragSelection() {
|
|
|
141
151
|
}
|
|
142
152
|
|
|
143
153
|
node.addEventListener( 'mouseout', onMouseLeave );
|
|
154
|
+
node.addEventListener( 'mousedown', onMouseDown );
|
|
144
155
|
|
|
145
156
|
return () => {
|
|
146
157
|
node.removeEventListener( 'mouseout', onMouseLeave );
|
|
@@ -35,6 +35,11 @@ export default function useTabNav() {
|
|
|
35
35
|
const noCaptureRef = useRef();
|
|
36
36
|
|
|
37
37
|
function onFocusCapture( event ) {
|
|
38
|
+
const canvasElement =
|
|
39
|
+
container.current.ownerDocument === event.target.ownerDocument
|
|
40
|
+
? container.current
|
|
41
|
+
: container.current.ownerDocument.defaultView.frameElement;
|
|
42
|
+
|
|
38
43
|
// Do not capture incoming focus if set by us in WritingFlow.
|
|
39
44
|
if ( noCaptureRef.current ) {
|
|
40
45
|
noCaptureRef.current = null;
|
|
@@ -64,17 +69,15 @@ export default function useTabNav() {
|
|
|
64
69
|
.focus();
|
|
65
70
|
}
|
|
66
71
|
// If we don't have any section blocks, focus the section root.
|
|
67
|
-
else {
|
|
72
|
+
else if ( sectionRootClientId ) {
|
|
68
73
|
container.current
|
|
69
74
|
.querySelector( `[data-block="${ sectionRootClientId }"]` )
|
|
70
75
|
.focus();
|
|
76
|
+
} else {
|
|
77
|
+
// If we don't have any section root, focus the canvas.
|
|
78
|
+
canvasElement.focus();
|
|
71
79
|
}
|
|
72
80
|
} else {
|
|
73
|
-
const canvasElement =
|
|
74
|
-
container.current.ownerDocument === event.target.ownerDocument
|
|
75
|
-
? container.current
|
|
76
|
-
: container.current.ownerDocument.defaultView.frameElement;
|
|
77
|
-
|
|
78
81
|
const isBefore =
|
|
79
82
|
// eslint-disable-next-line no-bitwise
|
|
80
83
|
event.target.compareDocumentPosition( canvasElement ) &
|
|
@@ -300,13 +300,17 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => {
|
|
|
300
300
|
/>
|
|
301
301
|
) }
|
|
302
302
|
</ItemGroup>
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
{ /*
|
|
304
|
+
Use a div element to make the ToolsPanelHiddenInnerWrapper
|
|
305
|
+
toggle the visibility of this help text automatically.
|
|
306
|
+
*/ }
|
|
307
|
+
<Text as="div" variant="muted">
|
|
308
|
+
<p>
|
|
305
309
|
{ __(
|
|
306
310
|
'Attributes connected to custom fields or other dynamic data.'
|
|
307
311
|
) }
|
|
308
|
-
</
|
|
309
|
-
</
|
|
312
|
+
</p>
|
|
313
|
+
</Text>
|
|
310
314
|
</ToolsPanel>
|
|
311
315
|
</InspectorControls>
|
|
312
316
|
);
|
package/src/hooks/gap.js
CHANGED
|
@@ -27,7 +27,7 @@ export function getGapBoxControlValueFromStyle( blockGapValue ) {
|
|
|
27
27
|
* Returns a CSS value for the `gap` property from a given blockGap style.
|
|
28
28
|
*
|
|
29
29
|
* @param {string? | Object?} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}.
|
|
30
|
-
* @param {string
|
|
30
|
+
* @param {?string} defaultValue A default gap value.
|
|
31
31
|
* @return {string|null} The concatenated gap value (row and column).
|
|
32
32
|
*/
|
|
33
33
|
export function getGapCSSValue( blockGapValue, defaultValue = '0' ) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
-
import { useEffect } from '@wordpress/element';
|
|
5
|
+
import { useEffect, useRef } from '@wordpress/element';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
@@ -12,32 +12,64 @@ import { unlock } from '../lock-unlock';
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* A hook used to set the editor mode to zoomed out mode, invoking the hook sets the mode.
|
|
15
|
+
* Concepts:
|
|
16
|
+
* - If we most recently changed the zoom level for them (in or out), we always resetZoomLevel() level when unmounting.
|
|
17
|
+
* - If the user most recently changed the zoom level (manually toggling), we do nothing when unmounting.
|
|
15
18
|
*
|
|
16
|
-
* @param {boolean}
|
|
19
|
+
* @param {boolean} enabled If we should enter into zoomOut mode or not
|
|
17
20
|
*/
|
|
18
|
-
export function useZoomOut(
|
|
21
|
+
export function useZoomOut( enabled = true ) {
|
|
19
22
|
const { setZoomLevel, resetZoomLevel } = unlock(
|
|
20
23
|
useDispatch( blockEditorStore )
|
|
21
24
|
);
|
|
22
|
-
const { isZoomOut } = unlock( useSelect( blockEditorStore ) );
|
|
23
25
|
|
|
26
|
+
/**
|
|
27
|
+
* We need access to both the value and the function. The value is to trigger a useEffect hook
|
|
28
|
+
* and the function is to check zoom out within another hook without triggering a re-render.
|
|
29
|
+
*/
|
|
30
|
+
const { isZoomedOut, isZoomOut } = useSelect( ( select ) => {
|
|
31
|
+
const { isZoomOut: _isZoomOut } = unlock( select( blockEditorStore ) );
|
|
32
|
+
return {
|
|
33
|
+
isZoomedOut: _isZoomOut(),
|
|
34
|
+
isZoomOut: _isZoomOut,
|
|
35
|
+
};
|
|
36
|
+
}, [] );
|
|
37
|
+
|
|
38
|
+
const controlZoomLevelRef = useRef( false );
|
|
39
|
+
const isEnabledRef = useRef( enabled );
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* This hook tracks if the zoom state was changed manually by the user via clicking
|
|
43
|
+
* the zoom out button. We only want this to run when isZoomedOut changes, so we use
|
|
44
|
+
* a ref to track the enabled state.
|
|
45
|
+
*/
|
|
24
46
|
useEffect( () => {
|
|
25
|
-
|
|
47
|
+
// If the zoom state changed (isZoomOut) and it does not match the requested zoom
|
|
48
|
+
// state (zoomOut), then it means the user manually changed the zoom state while
|
|
49
|
+
// this hook was mounted, and we should no longer control the zoom state.
|
|
50
|
+
if ( isZoomedOut !== isEnabledRef.current ) {
|
|
51
|
+
controlZoomLevelRef.current = false;
|
|
52
|
+
}
|
|
53
|
+
}, [ isZoomedOut ] );
|
|
26
54
|
|
|
27
|
-
|
|
28
|
-
|
|
55
|
+
useEffect( () => {
|
|
56
|
+
isEnabledRef.current = enabled;
|
|
57
|
+
|
|
58
|
+
if ( enabled !== isZoomOut() ) {
|
|
59
|
+
controlZoomLevelRef.current = true;
|
|
60
|
+
|
|
61
|
+
if ( enabled ) {
|
|
29
62
|
setZoomLevel( 'auto-scaled' );
|
|
30
63
|
} else {
|
|
31
64
|
resetZoomLevel();
|
|
32
65
|
}
|
|
33
|
-
};
|
|
34
|
-
}, [] );
|
|
35
|
-
|
|
36
|
-
useEffect( () => {
|
|
37
|
-
if ( zoomOut ) {
|
|
38
|
-
setZoomLevel( 'auto-scaled' );
|
|
39
|
-
} else {
|
|
40
|
-
resetZoomLevel();
|
|
41
66
|
}
|
|
42
|
-
|
|
67
|
+
|
|
68
|
+
return () => {
|
|
69
|
+
// If we are controlling zoom level and are zoomed out, reset the zoom level.
|
|
70
|
+
if ( controlZoomLevelRef.current && isZoomOut() ) {
|
|
71
|
+
resetZoomLevel();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}, [ enabled, isZoomOut, resetZoomLevel, setZoomLevel ] );
|
|
43
75
|
}
|
|
@@ -112,12 +112,12 @@ function getEnabledClientIdsTreeUnmemoized( state, rootClientId ) {
|
|
|
112
112
|
export const getEnabledClientIdsTree = createRegistrySelector( ( select ) =>
|
|
113
113
|
createSelector( getEnabledClientIdsTreeUnmemoized, ( state ) => [
|
|
114
114
|
state.blocks.order,
|
|
115
|
+
state.derivedBlockEditingModes,
|
|
116
|
+
state.derivedNavModeBlockEditingModes,
|
|
115
117
|
state.blockEditingModes,
|
|
116
118
|
state.settings.templateLock,
|
|
117
119
|
state.blockListSettings,
|
|
118
120
|
select( STORE_NAME ).__unstableGetEditorMode( state ),
|
|
119
|
-
state.zoomLevel,
|
|
120
|
-
getSectionRootClientId( state ),
|
|
121
121
|
] )
|
|
122
122
|
);
|
|
123
123
|
|
|
@@ -406,21 +406,6 @@ export const getAllPatterns = createRegistrySelector( ( select ) =>
|
|
|
406
406
|
}, getAllPatternsDependants( select ) )
|
|
407
407
|
);
|
|
408
408
|
|
|
409
|
-
export const isResolvingPatterns = createRegistrySelector( ( select ) =>
|
|
410
|
-
createSelector( ( state ) => {
|
|
411
|
-
const blockPatternsSelect = state.settings[ selectBlockPatternsKey ];
|
|
412
|
-
const reusableBlocksSelect = state.settings[ reusableBlocksSelectKey ];
|
|
413
|
-
return (
|
|
414
|
-
( blockPatternsSelect
|
|
415
|
-
? blockPatternsSelect( select ) === undefined
|
|
416
|
-
: false ) ||
|
|
417
|
-
( reusableBlocksSelect
|
|
418
|
-
? reusableBlocksSelect( select ) === undefined
|
|
419
|
-
: false )
|
|
420
|
-
);
|
|
421
|
-
}, getAllPatternsDependants( select ) )
|
|
422
|
-
);
|
|
423
|
-
|
|
424
409
|
const EMPTY_ARRAY = [];
|
|
425
410
|
|
|
426
411
|
export const getReusableBlocks = createRegistrySelector(
|