@wordpress/block-editor 10.1.1-next.4d3b314fd5.0 → 10.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +41 -0
- package/build/components/block-controls/slot.js +2 -2
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +4 -2
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-inspector/index.js +4 -5
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-compact.native.js +1 -0
- package/build/components/block-list/block-list-compact.native.js.map +1 -1
- package/build/components/block-list/block.js +72 -14
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +79 -12
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +7 -23
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/modal.js +9 -6
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-parent-selector/index.js +5 -5
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +5 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-popover/drop-zone.js +85 -0
- package/build/components/block-popover/drop-zone.js.map +1 -0
- package/build/components/block-popover/inbetween.js +3 -1
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +22 -17
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +2 -2
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +6 -9
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-preview/live.js +3 -7
- package/build/components/block-preview/live.js.map +1 -1
- package/build/components/block-selection-clearer/index.js +9 -1
- package/build/components/block-selection-clearer/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +22 -16
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.js +18 -42
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +4 -4
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -1
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +50 -20
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +15 -3
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/colors-gradients/control.js +1 -1
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -2
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +256 -0
- package/build/components/font-sizes/fluid-utils.js.map +1 -0
- package/build/components/font-sizes/index.js +8 -0
- package/build/components/font-sizes/index.js.map +1 -1
- package/build/components/image-editor/use-transform-image.js +2 -2
- package/build/components/image-editor/use-transform-image.js.map +1 -1
- package/build/components/index.js +0 -9
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +3 -2
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +151 -78
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +1 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/menu.js +14 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/search-items.js +2 -17
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +4 -2
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/slot.js +2 -1
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +1 -14
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/preview-options/index.js +2 -3
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/index.js +17 -0
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +10 -2
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +40 -9
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +98 -57
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +12 -12
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-on-block-drop/types.js +6 -0
- package/build/components/use-on-block-drop/types.js.map +1 -0
- package/build/hooks/align.js +1 -3
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +1 -7
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/font-size.js +60 -0
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/margin.js +6 -5
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +2 -1
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +126 -4
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-typography-props.js +17 -3
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/utils.js +1 -1
- package/build/hooks/utils.js.map +1 -1
- package/build/store/actions.js +59 -45
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +3 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +36 -18
- package/build/store/reducer.js.map +1 -1
- package/build/utils/math.js +14 -0
- package/build/utils/math.js.map +1 -1
- package/build/utils/pre-parse-patterns.js +19 -2
- package/build/utils/pre-parse-patterns.js.map +1 -1
- package/build-module/components/block-controls/slot.js +3 -3
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +7 -3
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-inspector/index.js +5 -6
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-compact.native.js +1 -0
- package/build-module/components/block-list/block-list-compact.native.js.map +1 -1
- package/build-module/components/block-list/block.js +72 -14
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +80 -13
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +8 -24
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/modal.js +10 -8
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +5 -5
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +5 -4
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-popover/drop-zone.js +70 -0
- package/build-module/components/block-popover/drop-zone.js.map +1 -0
- package/build-module/components/block-popover/inbetween.js +3 -1
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +22 -17
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +1 -1
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +6 -9
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-preview/live.js +3 -6
- package/build-module/components/block-preview/live.js.map +1 -1
- package/build-module/components/block-selection-clearer/index.js +9 -1
- package/build-module/components/block-selection-clearer/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +25 -19
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.js +19 -44
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +4 -4
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +2 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +48 -20
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +15 -3
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +2 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +3 -3
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +245 -0
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -0
- package/build-module/components/font-sizes/index.js +1 -0
- package/build-module/components/font-sizes/index.js.map +1 -1
- package/build-module/components/image-editor/use-transform-image.js +2 -2
- package/build-module/components/image-editor/use-transform-image.js.map +1 -1
- package/build-module/components/index.js +0 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +3 -2
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +148 -81
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +3 -3
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/menu.js +10 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/search-items.js +3 -17
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +4 -2
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +3 -2
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +1 -14
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/preview-options/index.js +2 -3
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +17 -0
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +10 -3
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +40 -10
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +98 -58
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +12 -12
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/types.js +2 -0
- package/build-module/components/use-on-block-drop/types.js.map +1 -0
- package/build-module/hooks/align.js +1 -2
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +1 -6
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/font-size.js +59 -1
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/margin.js +6 -5
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +2 -1
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +124 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +17 -4
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/utils.js +2 -2
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/store/actions.js +55 -42
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +3 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +36 -19
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/utils/math.js +12 -0
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/pre-parse-patterns.js +19 -2
- package/build-module/utils/pre-parse-patterns.js.map +1 -1
- package/build-style/style-rtl.css +256 -152
- package/build-style/style.css +256 -152
- package/package.json +28 -29
- package/src/components/block-breadcrumb/test/index.js +1 -1
- package/src/components/block-controls/slot.js +3 -3
- package/src/components/block-draggable/draggable-chip.js +4 -2
- package/src/components/block-inspector/index.js +8 -11
- package/src/components/block-list/block-list-compact.native.js +1 -0
- package/src/components/block-list/block.js +111 -7
- package/src/components/block-list/block.native.js +123 -9
- package/src/components/block-list/style.scss +93 -126
- package/src/components/block-list/use-in-between-inserter.js +8 -19
- package/src/components/block-lock/modal.js +12 -7
- package/src/components/block-mover/style.scss +0 -1
- package/src/components/block-parent-selector/index.js +5 -5
- package/src/components/block-patterns-list/index.js +9 -5
- package/src/components/block-patterns-list/style.scss +7 -3
- package/src/components/block-popover/README.md +8 -0
- package/src/components/block-popover/drop-zone.js +63 -0
- package/src/components/block-popover/inbetween.js +1 -1
- package/src/components/block-popover/index.js +39 -22
- package/src/components/block-popover/style.scss +17 -1
- package/src/components/block-preview/auto.js +1 -1
- package/src/components/block-preview/index.js +7 -8
- package/src/components/block-preview/live.js +2 -7
- package/src/components/block-preview/test/index.js +1 -7
- package/src/components/block-selection-clearer/index.js +7 -2
- package/src/components/block-selection-clearer/test/index.js +118 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +32 -18
- package/src/components/block-settings-menu/test/block-mode-toggle.js +17 -17
- package/src/components/block-styles/index.js +26 -49
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +104 -33
- package/src/components/block-switcher/test/index.js +121 -61
- package/src/components/block-toolbar/index.js +4 -6
- package/src/components/block-toolbar/style.scss +38 -14
- package/src/components/block-tools/back-compat.js +1 -0
- package/src/components/block-tools/insertion-point.js +42 -17
- package/src/components/block-tools/selected-block-popover.js +14 -1
- package/src/components/button-block-appender/style.scss +5 -1
- package/src/components/color-palette/test/__snapshots__/control.js.snap +32 -52
- package/src/components/color-palette/test/control.js +11 -15
- package/src/components/colors-gradients/control.js +2 -2
- package/src/components/colors-gradients/panel-color-gradient-settings.js +3 -4
- package/src/components/colors-gradients/test/control.js +49 -77
- package/src/components/font-sizes/fluid-utils.js +296 -0
- package/src/components/font-sizes/index.js +1 -0
- package/src/components/font-sizes/test/fluid-utils.js +168 -0
- package/src/components/image-editor/use-transform-image.js +2 -2
- package/src/components/image-size-control/test/index.js +47 -60
- package/src/components/index.js +0 -1
- package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -2
- package/src/components/inserter/block-patterns-tab.js +232 -98
- package/src/components/inserter/block-types-tab.js +3 -3
- package/src/components/inserter/menu.js +15 -2
- package/src/components/inserter/search-items.js +3 -15
- package/src/components/inserter/style.scss +94 -9
- package/src/components/inserter/test/reusable-blocks-tab.js +6 -6
- package/src/components/inserter/test/search-items.js +4 -0
- package/src/components/inserter-draggable-blocks/index.js +12 -2
- package/src/components/inserter-list-item/style.scss +20 -1
- package/src/components/inspector-controls/slot.js +6 -2
- package/src/components/link-control/test/index.js +1 -1
- package/src/components/list-view/use-list-view-drop-zone.js +4 -18
- package/src/components/panel-color-settings/test/index.js +4 -4
- package/src/components/preview-options/index.js +2 -2
- package/src/components/preview-options/style.scss +1 -1
- package/src/components/provider/test/use-block-sync.js +131 -165
- package/src/components/responsive-block-control/test/index.js +77 -122
- package/src/components/rich-text/index.js +22 -0
- package/src/components/spacing-sizes-control/index.js +15 -3
- package/src/components/spacing-sizes-control/spacing-input-control.js +24 -9
- package/src/components/spacing-sizes-control/style.scss +42 -31
- package/src/components/use-block-drop-zone/index.js +136 -79
- package/src/components/use-block-drop-zone/test/index.js +333 -81
- package/src/components/use-on-block-drop/index.js +11 -12
- package/src/components/use-on-block-drop/types.ts +1 -0
- package/src/hooks/align.js +3 -2
- package/src/hooks/align.native.js +5 -8
- package/src/hooks/font-size.js +75 -0
- package/src/hooks/margin.js +5 -4
- package/src/hooks/padding.js +1 -0
- package/src/hooks/style.js +122 -3
- package/src/hooks/test/style.js +206 -1
- package/src/hooks/test/use-typography-props.js +22 -0
- package/src/hooks/use-typography-props.js +18 -3
- package/src/hooks/utils.js +6 -2
- package/src/store/actions.js +20 -12
- package/src/store/defaults.js +3 -0
- package/src/store/reducer.js +35 -28
- package/src/store/test/actions.js +0 -9
- package/src/utils/math.js +17 -0
- package/src/utils/pre-parse-patterns.js +12 -7
- package/build/components/inserter/pattern-panel.js +0 -87
- package/build/components/inserter/pattern-panel.js.map +0 -1
- package/build-module/components/inserter/pattern-panel.js +0 -74
- package/build-module/components/inserter/pattern-panel.js.map +0 -1
- package/src/components/inserter/pattern-panel.js +0 -93
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { noCase } from 'change-case';
|
|
5
4
|
import removeAccents from 'remove-accents';
|
|
6
|
-
import { find } from 'lodash';
|
|
5
|
+
import { find, words } from 'lodash';
|
|
7
6
|
|
|
8
7
|
// Default search helpers.
|
|
9
8
|
const defaultGetName = ( item ) => item.name || '';
|
|
@@ -36,17 +35,6 @@ function normalizeSearchInput( input = '' ) {
|
|
|
36
35
|
return input;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
/**
|
|
40
|
-
* Extracts words from an input string.
|
|
41
|
-
*
|
|
42
|
-
* @param {string} input The input string.
|
|
43
|
-
*
|
|
44
|
-
* @return {Array} Words, extracted from the input string.
|
|
45
|
-
*/
|
|
46
|
-
function extractWords( input = '' ) {
|
|
47
|
-
return noCase( input ).split( ' ' ).filter( Boolean );
|
|
48
|
-
}
|
|
49
|
-
|
|
50
38
|
/**
|
|
51
39
|
* Converts the search term into a list of normalized terms.
|
|
52
40
|
*
|
|
@@ -55,7 +43,7 @@ function extractWords( input = '' ) {
|
|
|
55
43
|
* @return {string[]} The normalized list of search terms.
|
|
56
44
|
*/
|
|
57
45
|
export const getNormalizedSearchTerms = ( input = '' ) => {
|
|
58
|
-
return
|
|
46
|
+
return words( normalizeSearchInput( input ) );
|
|
59
47
|
};
|
|
60
48
|
|
|
61
49
|
const removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => {
|
|
@@ -162,7 +150,7 @@ export function getItemSearchRank( item, searchTerm, config = {} ) {
|
|
|
162
150
|
category,
|
|
163
151
|
collection,
|
|
164
152
|
].join( ' ' );
|
|
165
|
-
const normalizedSearchTerms =
|
|
153
|
+
const normalizedSearchTerms = words( normalizedSearchInput );
|
|
166
154
|
const unmatchedTerms = removeMatchingTerms(
|
|
167
155
|
normalizedSearchTerms,
|
|
168
156
|
terms
|
|
@@ -22,14 +22,13 @@ $block-inserter-tabs-height: 44px;
|
|
|
22
22
|
flex-direction: column;
|
|
23
23
|
height: 100%;
|
|
24
24
|
gap: $grid-unit-20;
|
|
25
|
-
width: auto;
|
|
26
|
-
@include break-medium {
|
|
27
|
-
width: $block-inserter-width;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
25
|
&.show-as-tabs {
|
|
31
26
|
gap: 0;
|
|
32
27
|
}
|
|
28
|
+
|
|
29
|
+
@include break-medium {
|
|
30
|
+
width: $block-inserter-width;
|
|
31
|
+
}
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
.block-editor-inserter__popover.is-quick {
|
|
@@ -148,10 +147,6 @@ $block-inserter-tabs-height: 44px;
|
|
|
148
147
|
padding: $grid-unit-20 $grid-unit-20 0;
|
|
149
148
|
}
|
|
150
149
|
|
|
151
|
-
.block-editor-inserter__panel-header-patterns {
|
|
152
|
-
padding: $grid-unit-20 $grid-unit-20 0;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
150
|
.block-editor-inserter__panel-content {
|
|
156
151
|
padding: $grid-unit-20;
|
|
157
152
|
}
|
|
@@ -235,6 +230,92 @@ $block-inserter-tabs-height: 44px;
|
|
|
235
230
|
}
|
|
236
231
|
}
|
|
237
232
|
|
|
233
|
+
.block-editor-inserter__patterns-explore-button.components-button {
|
|
234
|
+
padding: $grid-unit-20;
|
|
235
|
+
justify-content: center;
|
|
236
|
+
margin-top: $grid-unit-20;
|
|
237
|
+
width: 100%;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.block-editor-inserter__patterns-selected-category.block-editor-inserter__patterns-selected-category {
|
|
241
|
+
color: var(--wp-admin-theme-color);
|
|
242
|
+
position: relative;
|
|
243
|
+
|
|
244
|
+
.components-flex-item {
|
|
245
|
+
filter: brightness(0.95);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
svg {
|
|
249
|
+
fill: var(--wp-admin-theme-color);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
&::after {
|
|
253
|
+
content: "";
|
|
254
|
+
position: absolute;
|
|
255
|
+
top: 0;
|
|
256
|
+
bottom: 0;
|
|
257
|
+
left: 0;
|
|
258
|
+
right: 0;
|
|
259
|
+
border-radius: $radius-block-ui;
|
|
260
|
+
opacity: 0.04;
|
|
261
|
+
background: var(--wp-admin-theme-color);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.block-editor-inserter__block-patterns-tabs-container {
|
|
266
|
+
height: 100%;
|
|
267
|
+
nav {
|
|
268
|
+
height: 100%;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.block-editor-inserter__block-patterns-tabs {
|
|
273
|
+
display: flex;
|
|
274
|
+
flex-direction: column;
|
|
275
|
+
padding: $grid-unit-20;
|
|
276
|
+
overflow-y: auto;
|
|
277
|
+
height: 100%;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.block-editor-inserter__patterns-fill-space {
|
|
281
|
+
flex-grow: 1;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.block-editor-inserter__patterns-category-panel {
|
|
285
|
+
background: $gray-100;
|
|
286
|
+
border-left: $border-width solid $gray-200;
|
|
287
|
+
border-right: $border-width solid $gray-200;
|
|
288
|
+
position: absolute;
|
|
289
|
+
padding: $grid-unit-40 $grid-unit-30;
|
|
290
|
+
top: 0;
|
|
291
|
+
left: 0;
|
|
292
|
+
height: 100%;
|
|
293
|
+
width: 100%;
|
|
294
|
+
overflow-y: auto;
|
|
295
|
+
scrollbar-gutter: stable both-edges;
|
|
296
|
+
|
|
297
|
+
@include break-medium {
|
|
298
|
+
left: 100%;
|
|
299
|
+
display: block;
|
|
300
|
+
width: 300px;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.block-editor-block-patterns-list {
|
|
304
|
+
margin-top: $grid-unit-30;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.block-editor-block-preview__container {
|
|
308
|
+
box-shadow: 0 15px 25px rgb(0 0 0 / 7%);
|
|
309
|
+
&:hover {
|
|
310
|
+
box-shadow: 0 0 0 2px $gray-900, 0 15px 25px rgb(0 0 0 / 7%);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.block-editor-block-patterns-list__item-title {
|
|
315
|
+
display: none;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
238
319
|
.block-editor-inserter__preview-content {
|
|
239
320
|
min-height: $grid-unit-60 * 3;
|
|
240
321
|
background: $gray-100;
|
|
@@ -388,3 +469,7 @@ $block-inserter-tabs-height: 44px;
|
|
|
388
469
|
}
|
|
389
470
|
}
|
|
390
471
|
}
|
|
472
|
+
|
|
473
|
+
.block-editor-inserter__patterns-category-panel-title {
|
|
474
|
+
font-size: calc(1.25 * 13px);
|
|
475
|
+
}
|
|
@@ -41,14 +41,14 @@ function InserterBlockList( props ) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const initializeAllClosedMenuState = ( propOverrides ) => {
|
|
44
|
-
const
|
|
45
|
-
const activeTabs =
|
|
44
|
+
const { container } = render( <InserterBlockList { ...propOverrides } /> );
|
|
45
|
+
const activeTabs = container.querySelectorAll(
|
|
46
46
|
'.components-panel__body.is-opened button.components-panel__body-toggle'
|
|
47
47
|
);
|
|
48
48
|
activeTabs.forEach( ( tab ) => {
|
|
49
49
|
fireEvent.click( tab );
|
|
50
50
|
} );
|
|
51
|
-
return
|
|
51
|
+
return container;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
describe( 'InserterMenu', () => {
|
|
@@ -92,13 +92,13 @@ describe( 'InserterMenu', () => {
|
|
|
92
92
|
} );
|
|
93
93
|
|
|
94
94
|
it( 'should list reusable blocks', () => {
|
|
95
|
-
const
|
|
95
|
+
const container = initializeAllClosedMenuState();
|
|
96
96
|
const blocks = container.querySelectorAll(
|
|
97
97
|
'.block-editor-block-types-list__item-title'
|
|
98
98
|
);
|
|
99
99
|
|
|
100
100
|
expect( blocks ).toHaveLength( 1 );
|
|
101
|
-
expect( blocks[ 0 ]
|
|
101
|
+
expect( blocks[ 0 ] ).toHaveTextContent( 'My reusable block' );
|
|
102
102
|
} );
|
|
103
103
|
|
|
104
104
|
it( 'should trim whitespace of search terms', () => {
|
|
@@ -111,6 +111,6 @@ describe( 'InserterMenu', () => {
|
|
|
111
111
|
);
|
|
112
112
|
|
|
113
113
|
expect( blocks ).toHaveLength( 1 );
|
|
114
|
-
expect( blocks[ 0 ]
|
|
114
|
+
expect( blocks[ 0 ] ).toHaveTextContent( 'My reusable block' );
|
|
115
115
|
} );
|
|
116
116
|
} );
|
|
@@ -42,6 +42,10 @@ describe( 'getNormalizedSearchTerms', () => {
|
|
|
42
42
|
getNormalizedSearchTerms( ' Média & Text Tag-Cloud > 123' )
|
|
43
43
|
).toEqual( [ 'media', 'text', 'tag', 'cloud', '123' ] );
|
|
44
44
|
} );
|
|
45
|
+
|
|
46
|
+
it( 'should support non-latin letters', () => {
|
|
47
|
+
expect( getNormalizedSearchTerms( 'მედია' ) ).toEqual( [ 'მედია' ] );
|
|
48
|
+
} );
|
|
45
49
|
} );
|
|
46
50
|
|
|
47
51
|
describe( 'getItemSearchRank', () => {
|
|
@@ -7,7 +7,13 @@ import { Draggable } from '@wordpress/components';
|
|
|
7
7
|
*/
|
|
8
8
|
import BlockDraggableChip from '../block-draggable/draggable-chip';
|
|
9
9
|
|
|
10
|
-
const InserterDraggableBlocks = ( {
|
|
10
|
+
const InserterDraggableBlocks = ( {
|
|
11
|
+
isEnabled,
|
|
12
|
+
blocks,
|
|
13
|
+
icon,
|
|
14
|
+
children,
|
|
15
|
+
isPattern,
|
|
16
|
+
} ) => {
|
|
11
17
|
const transferData = {
|
|
12
18
|
type: 'inserter',
|
|
13
19
|
blocks,
|
|
@@ -18,7 +24,11 @@ const InserterDraggableBlocks = ( { isEnabled, blocks, icon, children } ) => {
|
|
|
18
24
|
__experimentalTransferDataType="wp-blocks"
|
|
19
25
|
transferData={ transferData }
|
|
20
26
|
__experimentalDragComponent={
|
|
21
|
-
<BlockDraggableChip
|
|
27
|
+
<BlockDraggableChip
|
|
28
|
+
count={ blocks.length }
|
|
29
|
+
icon={ icon }
|
|
30
|
+
isPattern={ isPattern }
|
|
31
|
+
/>
|
|
22
32
|
}
|
|
23
33
|
>
|
|
24
34
|
{ ( { onDraggableStart, onDraggableEnd } ) => {
|
|
@@ -30,7 +30,26 @@
|
|
|
30
30
|
|
|
31
31
|
&:not(:disabled) {
|
|
32
32
|
&:hover {
|
|
33
|
-
|
|
33
|
+
.block-editor-block-types-list__item-title {
|
|
34
|
+
color: var(--wp-admin-theme-color) !important;
|
|
35
|
+
filter: brightness(0.95);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
svg {
|
|
39
|
+
color: var(--wp-admin-theme-color) !important;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&::after {
|
|
43
|
+
content: "";
|
|
44
|
+
position: absolute;
|
|
45
|
+
top: 0;
|
|
46
|
+
bottom: 0;
|
|
47
|
+
left: 0;
|
|
48
|
+
right: 0;
|
|
49
|
+
border-radius: $radius-block-ui;
|
|
50
|
+
opacity: 0.04;
|
|
51
|
+
background: var(--wp-admin-theme-color);
|
|
52
|
+
}
|
|
34
53
|
}
|
|
35
54
|
|
|
36
55
|
&:focus {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
__experimentalUseSlot as useSlot,
|
|
6
|
+
__experimentalUseSlotFills as useSlotFills,
|
|
7
|
+
} from '@wordpress/components';
|
|
5
8
|
import warning from '@wordpress/warning';
|
|
6
9
|
|
|
7
10
|
/**
|
|
@@ -18,12 +21,13 @@ export default function InspectorControlsSlot( {
|
|
|
18
21
|
} ) {
|
|
19
22
|
const Slot = groups[ group ]?.Slot;
|
|
20
23
|
const slot = useSlot( Slot?.__unstableName );
|
|
24
|
+
const fills = useSlotFills( Slot?.__unstableName );
|
|
21
25
|
if ( ! Slot || ! slot ) {
|
|
22
26
|
warning( `Unknown InspectorControl group "${ group }" provided.` );
|
|
23
27
|
return null;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
const hasFills = Boolean(
|
|
30
|
+
const hasFills = Boolean( fills && fills.length );
|
|
27
31
|
if ( ! hasFills ) {
|
|
28
32
|
return null;
|
|
29
33
|
}
|
|
@@ -392,7 +392,7 @@ describe( 'Searching for a link', () => {
|
|
|
392
392
|
fauxEntitySuggestions.length
|
|
393
393
|
);
|
|
394
394
|
|
|
395
|
-
expect( searchInput.
|
|
395
|
+
expect( searchInput ).toHaveAttribute( 'aria-expanded', 'true' );
|
|
396
396
|
|
|
397
397
|
// Sanity check that a search suggestion shows up corresponding to the data.
|
|
398
398
|
expect( searchResultElements[ 0 ] ).toHaveTextContent(
|
|
@@ -11,7 +11,10 @@ import {
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
getDistanceToNearestEdge,
|
|
16
|
+
isPointContainedByRect,
|
|
17
|
+
} from '../../utils/math';
|
|
15
18
|
import useOnBlockDrop from '../use-on-block-drop';
|
|
16
19
|
import { store as blockEditorStore } from '../../store';
|
|
17
20
|
|
|
@@ -48,23 +51,6 @@ import { store as blockEditorStore } from '../../store';
|
|
|
48
51
|
* 'inside' refers to nesting as an inner block.
|
|
49
52
|
*/
|
|
50
53
|
|
|
51
|
-
/**
|
|
52
|
-
* Is the point contained by the rectangle.
|
|
53
|
-
*
|
|
54
|
-
* @param {WPPoint} point The point.
|
|
55
|
-
* @param {DOMRect} rect The rectangle.
|
|
56
|
-
*
|
|
57
|
-
* @return {boolean} True if the point is contained by the rectangle, false otherwise.
|
|
58
|
-
*/
|
|
59
|
-
function isPointContainedByRect( point, rect ) {
|
|
60
|
-
return (
|
|
61
|
-
rect.left <= point.x &&
|
|
62
|
-
rect.right >= point.x &&
|
|
63
|
-
rect.top <= point.y &&
|
|
64
|
-
rect.bottom >= point.y
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
54
|
/**
|
|
69
55
|
* Determines whether the user positioning the dragged block to nest as an
|
|
70
56
|
* inner block.
|
|
@@ -31,7 +31,7 @@ describe( 'PanelColorSettings', () => {
|
|
|
31
31
|
] }
|
|
32
32
|
/>
|
|
33
33
|
);
|
|
34
|
-
expect( container
|
|
34
|
+
expect( container ).toBeEmptyDOMElement();
|
|
35
35
|
} );
|
|
36
36
|
|
|
37
37
|
it( 'should render a color panel if at least one setting supports custom colors', async () => {
|
|
@@ -55,7 +55,7 @@ describe( 'PanelColorSettings', () => {
|
|
|
55
55
|
] }
|
|
56
56
|
/>
|
|
57
57
|
);
|
|
58
|
-
expect( container
|
|
58
|
+
expect( container ).not.toBeEmptyDOMElement();
|
|
59
59
|
} );
|
|
60
60
|
|
|
61
61
|
it( 'should render a color panel if at least one setting specifies some colors to choose', async () => {
|
|
@@ -85,7 +85,7 @@ describe( 'PanelColorSettings', () => {
|
|
|
85
85
|
] }
|
|
86
86
|
/>
|
|
87
87
|
);
|
|
88
|
-
expect( container
|
|
88
|
+
expect( container ).not.toBeEmptyDOMElement();
|
|
89
89
|
} );
|
|
90
90
|
|
|
91
91
|
it( 'should not render anything if none of the setting panels has colors to choose', async () => {
|
|
@@ -112,6 +112,6 @@ describe( 'PanelColorSettings', () => {
|
|
|
112
112
|
] }
|
|
113
113
|
/>
|
|
114
114
|
);
|
|
115
|
-
expect( container
|
|
115
|
+
expect( container ).not.toBeEmptyDOMElement();
|
|
116
116
|
} );
|
|
117
117
|
} );
|
|
@@ -13,6 +13,7 @@ import { check } from '@wordpress/icons';
|
|
|
13
13
|
|
|
14
14
|
export default function PreviewOptions( {
|
|
15
15
|
children,
|
|
16
|
+
viewLabel,
|
|
16
17
|
className,
|
|
17
18
|
isEnabled = true,
|
|
18
19
|
deviceType,
|
|
@@ -32,8 +33,7 @@ export default function PreviewOptions( {
|
|
|
32
33
|
variant: 'tertiary',
|
|
33
34
|
className: 'block-editor-post-preview__button-toggle',
|
|
34
35
|
disabled: ! isEnabled,
|
|
35
|
-
|
|
36
|
-
children: __( 'View' ),
|
|
36
|
+
children: viewLabel,
|
|
37
37
|
};
|
|
38
38
|
const menuProps = {
|
|
39
39
|
'aria-label': __( 'View options' ),
|