@wordpress/block-editor 15.18.1-next.v.202604201441.0 → 15.19.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 +7 -1
- package/build/components/autocomplete/index.cjs.map +3 -3
- package/build/components/background-image-control/index.cjs +2 -1
- package/build/components/background-image-control/index.cjs.map +2 -2
- package/build/components/block-allowed-blocks/modal.cjs.map +2 -2
- package/build/components/block-bindings/attribute-control.cjs.map +3 -3
- package/build/components/block-card/index.cjs +2 -2
- package/build/components/block-card/index.cjs.map +3 -3
- package/build/components/block-controls/fill.cjs.map +2 -2
- package/build/components/block-inspector/edit-contents.cjs +7 -1
- package/build/components/block-inspector/edit-contents.cjs.map +2 -2
- package/build/components/block-mover/button.cjs +9 -3
- package/build/components/block-mover/button.cjs.map +2 -2
- package/build/components/block-pattern-setup/index.cjs +3 -2
- package/build/components/block-pattern-setup/index.cjs.map +2 -2
- package/build/components/block-patterns-list/index.cjs +2 -1
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-patterns-paging/index.cjs.map +3 -3
- package/build/components/block-settings-menu/block-settings-dropdown.cjs +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +3 -3
- package/build/components/block-settings-menu/index.cjs +2 -2
- package/build/components/block-settings-menu/index.cjs.map +3 -3
- package/build/components/block-styles/menu-items.cjs.map +3 -3
- package/build/components/block-switcher/index.cjs.map +3 -3
- package/build/components/block-switcher/pattern-transformations-menu.cjs +2 -1
- package/build/components/block-switcher/pattern-transformations-menu.cjs.map +2 -2
- package/build/components/block-toolbar/edit-section-button.cjs +7 -1
- package/build/components/block-toolbar/edit-section-button.cjs.map +2 -2
- package/build/components/block-toolbar/pattern-overrides-dropdown.cjs.map +3 -3
- package/build/components/block-variation-transforms/index.cjs +4 -3
- package/build/components/block-variation-transforms/index.cjs.map +2 -2
- package/build/components/block-visibility/modal.cjs +0 -10
- package/build/components/block-visibility/modal.cjs.map +3 -3
- package/build/components/block-visibility/viewport-visibility-info.cjs +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +3 -3
- package/build/components/collab/{block-comment-icon-slot.cjs → note-icon-slot.cjs} +8 -8
- package/build/components/collab/note-icon-slot.cjs.map +7 -0
- package/build/components/collab/{block-comment-icon-toolbar-slot.cjs → note-icon-toolbar-slot.cjs} +9 -9
- package/build/components/collab/note-icon-toolbar-slot.cjs.map +7 -0
- package/build/components/date-format-picker/index.cjs +2 -1
- package/build/components/date-format-picker/index.cjs.map +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
- package/build/components/global-styles/state-control.cjs +111 -37
- package/build/components/global-styles/state-control.cjs.map +3 -3
- package/build/components/gradients/use-gradient.cjs +2 -2
- package/build/components/gradients/use-gradient.cjs.map +2 -2
- package/build/components/grid/grid-item-movers.cjs +2 -1
- package/build/components/grid/grid-item-movers.cjs.map +2 -2
- package/build/components/iframe/use-scale-canvas.cjs.map +2 -2
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.cjs.map +2 -2
- package/build/components/inserter/index.cjs +41 -43
- package/build/components/inserter/index.cjs.map +2 -2
- package/build/components/inserter/menu.cjs +32 -3
- package/build/components/inserter/menu.cjs.map +3 -3
- package/build/components/inserter/search-results.cjs +3 -3
- package/build/components/inserter/search-results.cjs.map +2 -2
- package/build/components/inserter/tips.cjs +1 -1
- package/build/components/inserter/tips.cjs.map +2 -2
- package/build/components/inspector-popover-header/index.cjs.map +3 -3
- package/build/components/link-control/link-preview.cjs +2 -2
- package/build/components/link-control/link-preview.cjs.map +2 -2
- package/build/components/link-control/settings.cjs +2 -1
- package/build/components/link-control/settings.cjs.map +2 -2
- package/build/components/link-picker/link-picker.cjs +3 -2
- package/build/components/link-picker/link-picker.cjs.map +2 -2
- package/build/components/link-picker/link-preview.cjs +2 -2
- package/build/components/link-picker/link-preview.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +2 -2
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/index.cjs +2 -1
- package/build/components/list-view/index.cjs.map +2 -2
- package/build/components/provider/index.cjs +80 -7
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/responsive-block-control/label.cjs +9 -2
- package/build/components/responsive-block-control/label.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/index.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/paste-handler.cjs +12 -5
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +3 -3
- package/build/hooks/block-bindings.cjs.map +3 -3
- package/build/hooks/custom-css.cjs +1 -1
- package/build/hooks/custom-css.cjs.map +2 -2
- package/build/layouts/flex.cjs +5 -8
- package/build/layouts/flex.cjs.map +3 -3
- package/build/layouts/grid.cjs +5 -5
- package/build/layouts/grid.cjs.map +2 -2
- package/build/private-apis.cjs +5 -4
- package/build/private-apis.cjs.map +3 -3
- package/build/store/actions.cjs +2 -2
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-keys.cjs +3 -0
- package/build/store/private-keys.cjs.map +2 -2
- package/build/store/reducer.cjs +8 -30
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/dom.cjs +3 -1
- package/build/utils/dom.cjs.map +2 -2
- package/build-module/components/autocomplete/index.mjs +2 -2
- package/build-module/components/autocomplete/index.mjs.map +2 -2
- package/build-module/components/background-image-control/index.mjs +2 -2
- package/build-module/components/background-image-control/index.mjs.map +2 -2
- package/build-module/components/block-allowed-blocks/modal.mjs +2 -2
- package/build-module/components/block-allowed-blocks/modal.mjs.map +2 -2
- package/build-module/components/block-bindings/attribute-control.mjs +3 -3
- package/build-module/components/block-bindings/attribute-control.mjs.map +2 -2
- package/build-module/components/block-card/index.mjs +4 -4
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-controls/fill.mjs.map +2 -2
- package/build-module/components/block-inspector/edit-contents.mjs +7 -1
- package/build-module/components/block-inspector/edit-contents.mjs.map +2 -2
- package/build-module/components/block-mover/button.mjs +11 -5
- package/build-module/components/block-mover/button.mjs.map +2 -2
- package/build-module/components/block-pattern-setup/index.mjs +2 -1
- package/build-module/components/block-pattern-setup/index.mjs.map +2 -2
- package/build-module/components/block-patterns-list/index.mjs +1 -1
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-patterns-paging/index.mjs +3 -3
- package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
- package/build-module/components/block-settings-menu/index.mjs +2 -2
- package/build-module/components/block-settings-menu/index.mjs.map +2 -2
- package/build-module/components/block-styles/menu-items.mjs +2 -2
- package/build-module/components/block-styles/menu-items.mjs.map +2 -2
- package/build-module/components/block-switcher/index.mjs +2 -2
- package/build-module/components/block-switcher/index.mjs.map +2 -2
- package/build-module/components/block-switcher/pattern-transformations-menu.mjs +2 -7
- package/build-module/components/block-switcher/pattern-transformations-menu.mjs.map +2 -2
- package/build-module/components/block-toolbar/edit-section-button.mjs +7 -1
- package/build-module/components/block-toolbar/edit-section-button.mjs.map +2 -2
- package/build-module/components/block-toolbar/pattern-overrides-dropdown.mjs +2 -2
- package/build-module/components/block-toolbar/pattern-overrides-dropdown.mjs.map +2 -2
- package/build-module/components/block-variation-transforms/index.mjs +4 -4
- package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +0 -10
- package/build-module/components/block-visibility/modal.mjs.map +3 -3
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +4 -4
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
- package/build-module/components/collab/note-icon-slot.mjs +8 -0
- package/build-module/components/collab/note-icon-slot.mjs.map +7 -0
- package/build-module/components/collab/note-icon-toolbar-slot.mjs +10 -0
- package/build-module/components/collab/note-icon-toolbar-slot.mjs.map +7 -0
- package/build-module/components/date-format-picker/index.mjs +2 -2
- package/build-module/components/date-format-picker/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
- package/build-module/components/global-styles/state-control.mjs +119 -40
- package/build-module/components/global-styles/state-control.mjs.map +2 -2
- package/build-module/components/gradients/use-gradient.mjs +2 -2
- package/build-module/components/gradients/use-gradient.mjs.map +2 -2
- package/build-module/components/grid/grid-item-movers.mjs +2 -5
- package/build-module/components/grid/grid-item-movers.mjs.map +2 -2
- package/build-module/components/iframe/use-scale-canvas.mjs.map +2 -2
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.mjs +3 -3
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.mjs.map +1 -1
- package/build-module/components/inserter/index.mjs +41 -43
- package/build-module/components/inserter/index.mjs.map +2 -2
- package/build-module/components/inserter/menu.mjs +34 -4
- package/build-module/components/inserter/menu.mjs.map +2 -2
- package/build-module/components/inserter/search-results.mjs +1 -1
- package/build-module/components/inserter/search-results.mjs.map +1 -1
- package/build-module/components/inserter/tips.mjs +1 -1
- package/build-module/components/inserter/tips.mjs.map +2 -2
- package/build-module/components/inspector-popover-header/index.mjs +2 -2
- package/build-module/components/inspector-popover-header/index.mjs.map +2 -2
- package/build-module/components/link-control/link-preview.mjs +2 -2
- package/build-module/components/link-control/link-preview.mjs.map +2 -2
- package/build-module/components/link-control/settings.mjs +3 -2
- package/build-module/components/link-control/settings.mjs.map +2 -2
- package/build-module/components/link-picker/link-picker.mjs +1 -1
- package/build-module/components/link-picker/link-picker.mjs.map +2 -2
- package/build-module/components/link-picker/link-preview.mjs +2 -2
- package/build-module/components/link-picker/link-preview.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +2 -2
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/index.mjs +2 -4
- package/build-module/components/list-view/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +82 -8
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/responsive-block-control/label.mjs +9 -2
- package/build-module/components/responsive-block-control/label.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/index.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs +12 -5
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +2 -2
- package/build-module/hooks/block-bindings.mjs +2 -2
- package/build-module/hooks/block-bindings.mjs.map +2 -2
- package/build-module/hooks/custom-css.mjs +1 -1
- package/build-module/hooks/custom-css.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +4 -7
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/layouts/grid.mjs +4 -4
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/private-apis.mjs +7 -5
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +2 -2
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-keys.mjs +2 -0
- package/build-module/store/private-keys.mjs.map +2 -2
- package/build-module/store/reducer.mjs +8 -30
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/dom.mjs +2 -1
- package/build-module/utils/dom.mjs.map +2 -2
- package/build-style/content-rtl.css +0 -3
- package/build-style/content.css +0 -3
- package/build-style/style-rtl.css +29 -3
- package/build-style/style.css +29 -3
- package/build-types/components/block-context/index.d.ts +9 -16
- package/build-types/components/block-context/index.d.ts.map +1 -1
- package/build-types/utils/dom.d.ts +13 -6
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +39 -38
- package/src/components/autocomplete/index.js +4 -2
- package/src/components/background-image-control/index.js +2 -2
- package/src/components/block-allowed-blocks/modal.js +3 -3
- package/src/components/block-bindings/attribute-control.js +4 -4
- package/src/components/block-card/index.js +5 -5
- package/src/components/block-controls/fill.js +1 -0
- package/src/components/block-inspector/edit-contents.js +4 -2
- package/src/components/block-list/content.scss +0 -4
- package/src/components/block-manager/style.scss +3 -2
- package/src/components/block-mover/button.js +17 -7
- package/src/components/block-pattern-setup/index.js +2 -1
- package/src/components/block-patterns-list/index.js +1 -1
- package/src/components/block-patterns-paging/index.js +5 -6
- package/src/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/src/components/block-settings-menu/index.js +2 -2
- package/src/components/block-styles/menu-items.js +3 -3
- package/src/components/block-switcher/index.js +3 -3
- package/src/components/block-switcher/pattern-transformations-menu.js +2 -7
- package/src/components/block-toolbar/edit-section-button.js +5 -1
- package/src/components/block-toolbar/pattern-overrides-dropdown.js +2 -2
- package/src/components/block-variation-transforms/index.js +4 -4
- package/src/components/block-visibility/modal.js +0 -1
- package/src/components/block-visibility/viewport-visibility-info.js +5 -5
- package/src/components/collab/note-icon-slot.js +8 -0
- package/src/components/collab/note-icon-toolbar-slot.js +10 -0
- package/src/components/date-format-picker/index.js +4 -2
- package/src/components/dimensions-tool/scale-tool.js +2 -2
- package/src/components/global-styles/state-control.js +152 -49
- package/src/components/global-styles/style.scss +9 -0
- package/src/components/gradients/use-gradient.js +3 -1
- package/src/components/grid/grid-item-movers.js +2 -5
- package/src/components/iframe/use-scale-canvas.js +0 -4
- package/src/components/inner-blocks/README.md +5 -1
- package/src/components/inner-blocks/index.native.js +1 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +5 -5
- package/src/components/inserter/index.js +58 -69
- package/src/components/inserter/menu.js +35 -3
- package/src/components/inserter/search-results.js +1 -1
- package/src/components/inserter/style.scss +18 -3
- package/src/components/inserter/tips.js +1 -1
- package/src/components/inspector-popover-header/index.js +2 -2
- package/src/components/link-control/link-preview.js +3 -3
- package/src/components/link-control/settings.js +3 -2
- package/src/components/link-picker/link-picker.js +1 -1
- package/src/components/link-picker/link-preview.js +3 -3
- package/src/components/list-view/block-select-button.js +3 -3
- package/src/components/list-view/index.js +2 -4
- package/src/components/provider/index.js +149 -8
- package/src/components/responsive-block-control/label.js +5 -2
- package/src/components/rich-text/event-listeners/index.js +0 -1
- package/src/components/rich-text/event-listeners/paste-handler.js +18 -4
- package/src/hooks/block-bindings.js +3 -3
- package/src/hooks/custom-css.js +1 -8
- package/src/layouts/flex.js +7 -9
- package/src/layouts/grid.js +7 -4
- package/src/private-apis.js +6 -4
- package/src/store/actions.js +12 -6
- package/src/store/private-keys.js +1 -0
- package/src/store/reducer.js +11 -39
- package/src/store/selectors.js +6 -0
- package/src/store/test/reducer.js +39 -0
- package/src/utils/dom.js +3 -3
- package/src/utils/test/dom.js +47 -4
- package/build/components/collab/block-comment-icon-slot.cjs.map +0 -7
- package/build/components/collab/block-comment-icon-toolbar-slot.cjs.map +0 -7
- package/build-module/components/collab/block-comment-icon-slot.mjs +0 -8
- package/build-module/components/collab/block-comment-icon-slot.mjs.map +0 -7
- package/build-module/components/collab/block-comment-icon-toolbar-slot.mjs +0 -10
- package/build-module/components/collab/block-comment-icon-toolbar-slot.mjs.map +0 -7
- package/src/components/collab/block-comment-icon-slot.js +0 -8
- package/src/components/collab/block-comment-icon-toolbar-slot.js +0 -10
|
@@ -286,10 +286,6 @@ export function useScaleCanvas( {
|
|
|
286
286
|
|
|
287
287
|
iframeDocument.documentElement.classList.remove( 'zoom-out-animation' );
|
|
288
288
|
|
|
289
|
-
// Set the final scroll position that was just animated to.
|
|
290
|
-
// Disable reason: Eslint isn't smart enough to know that this is a
|
|
291
|
-
// DOM element. https://github.com/facebook/react/issues/31483
|
|
292
|
-
// eslint-disable-next-line react-compiler/react-compiler
|
|
293
289
|
iframeDocument.documentElement.scrollTop =
|
|
294
290
|
transitionToRef.current.scrollTop;
|
|
295
291
|
|
|
@@ -205,4 +205,8 @@ const DEFAULT_BLOCK = { name: 'core/paragraph', attributes: { content: 'Lorem ip
|
|
|
205
205
|
### `directInsert`
|
|
206
206
|
|
|
207
207
|
- **Type:** `Boolean`
|
|
208
|
-
- **Default:**
|
|
208
|
+
- **Default:** `undefined`.
|
|
209
|
+
|
|
210
|
+
When `true`, the appender inserts `defaultBlock` directly and skips the inserter dropdown, **including any registered inserter variations** of that block type. Use this to opt out of the variation picker; otherwise leave unset.
|
|
211
|
+
|
|
212
|
+
Note: redundant when `allowedBlocks` resolves to a single block type with no variations, the appender already inserts directly.
|
|
@@ -35,7 +35,7 @@ import { MAX_NESTING_DEPTH } from './constants';
|
|
|
35
35
|
* returns. Optionally, you can also pass any other props through this hook, and
|
|
36
36
|
* they will be merged and returned.
|
|
37
37
|
*
|
|
38
|
-
* @see https://github.com/WordPress/gutenberg/blob/
|
|
38
|
+
* @see https://github.com/WordPress/gutenberg/blob/trunk/packages/block-editor/src/components/inner-blocks/README.md
|
|
39
39
|
*
|
|
40
40
|
* @param {Object} props Optional. Props to pass to the element. Must contain
|
|
41
41
|
* the ref if one is defined.
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
__experimentalHStack as HStack,
|
|
15
15
|
__experimentalVStack as VStack,
|
|
16
16
|
__experimentalHeading as Heading,
|
|
17
|
-
__experimentalText as
|
|
17
|
+
__experimentalText as WCText,
|
|
18
18
|
FlexBlock,
|
|
19
19
|
} from '@wordpress/components';
|
|
20
20
|
|
|
@@ -162,23 +162,23 @@ export function PatternCategoryPreviews( {
|
|
|
162
162
|
/>
|
|
163
163
|
</HStack>
|
|
164
164
|
{ ! currentCategoryPatterns.length && (
|
|
165
|
-
<
|
|
165
|
+
<WCText
|
|
166
166
|
variant="muted"
|
|
167
167
|
className="block-editor-inserter__patterns-category-no-results"
|
|
168
168
|
>
|
|
169
169
|
{ __( 'No results found' ) }
|
|
170
|
-
</
|
|
170
|
+
</WCText>
|
|
171
171
|
) }
|
|
172
172
|
</VStack>
|
|
173
173
|
{ currentCategoryPatterns.length > 0 && (
|
|
174
174
|
<>
|
|
175
|
-
<
|
|
175
|
+
<WCText
|
|
176
176
|
size="12"
|
|
177
177
|
as="p"
|
|
178
178
|
className="block-editor-inserter__help-text"
|
|
179
179
|
>
|
|
180
180
|
{ __( 'Drag and drop patterns into the canvas.' ) }
|
|
181
|
-
</
|
|
181
|
+
</WCText>
|
|
182
182
|
<BlockPatternsList
|
|
183
183
|
ref={ scrollContainerRef }
|
|
184
184
|
blockPatterns={ pagingProps.categoryPatterns }
|
|
@@ -144,7 +144,6 @@ class Inserter extends Component {
|
|
|
144
144
|
clientId,
|
|
145
145
|
isAppender,
|
|
146
146
|
showInserterHelpPanel,
|
|
147
|
-
|
|
148
147
|
// This prop is experimental to give some time for the quick inserter to mature
|
|
149
148
|
// Feel free to make them stable after a few releases.
|
|
150
149
|
__experimentalIsQuick: isQuick,
|
|
@@ -194,13 +193,13 @@ class Inserter extends Component {
|
|
|
194
193
|
const {
|
|
195
194
|
position,
|
|
196
195
|
hasSingleBlockType,
|
|
197
|
-
|
|
196
|
+
blockToInsert,
|
|
198
197
|
insertOnlyAllowedBlock,
|
|
199
198
|
__experimentalIsQuick: isQuick,
|
|
200
199
|
onSelectOrClose,
|
|
201
200
|
} = this.props;
|
|
202
201
|
|
|
203
|
-
if ( hasSingleBlockType ||
|
|
202
|
+
if ( hasSingleBlockType || blockToInsert ) {
|
|
204
203
|
return this.renderToggle( { onToggle: insertOnlyAllowedBlock } );
|
|
205
204
|
}
|
|
206
205
|
|
|
@@ -230,26 +229,35 @@ export default compose( [
|
|
|
230
229
|
hasInserterItems,
|
|
231
230
|
getAllowedBlocks,
|
|
232
231
|
getDirectInsertBlock,
|
|
232
|
+
getBlockListSettings,
|
|
233
233
|
} = select( blockEditorStore );
|
|
234
|
-
|
|
235
234
|
const { getBlockVariations, getBlockType } = select( blocksStore );
|
|
236
235
|
|
|
237
236
|
rootClientId =
|
|
238
237
|
rootClientId || getBlockRootClientId( clientId ) || undefined;
|
|
239
238
|
|
|
240
239
|
const allowedBlocks = getAllowedBlocks( rootClientId );
|
|
241
|
-
|
|
242
240
|
const directInsertBlock =
|
|
243
241
|
shouldDirectInsert && getDirectInsertBlock( rootClientId );
|
|
242
|
+
const { defaultBlock } = getBlockListSettings( rootClientId ) ?? {};
|
|
244
243
|
|
|
245
244
|
const hasSingleBlockType =
|
|
246
245
|
allowedBlocks?.length === 1 &&
|
|
247
246
|
getBlockVariations( allowedBlocks[ 0 ].name, 'inserter' )
|
|
248
247
|
?.length === 0;
|
|
248
|
+
const allowedBlockType = hasSingleBlockType
|
|
249
|
+
? allowedBlocks[ 0 ]
|
|
250
|
+
: null;
|
|
249
251
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
// Single-block-type parents get adjacent-attribute copying
|
|
253
|
+
// without needing to set `directInsert: true`.
|
|
254
|
+
let blockToInsert = directInsertBlock || null;
|
|
255
|
+
if (
|
|
256
|
+
! blockToInsert &&
|
|
257
|
+
hasSingleBlockType &&
|
|
258
|
+
defaultBlock?.name === allowedBlockType.name
|
|
259
|
+
) {
|
|
260
|
+
blockToInsert = defaultBlock;
|
|
253
261
|
}
|
|
254
262
|
|
|
255
263
|
const defaultBlockType = directInsertBlock
|
|
@@ -265,7 +273,7 @@ export default compose( [
|
|
|
265
273
|
hasSingleBlockType,
|
|
266
274
|
blockTitle: allowedBlockType ? allowedBlockType.title : '',
|
|
267
275
|
allowedBlockType,
|
|
268
|
-
|
|
276
|
+
blockToInsert,
|
|
269
277
|
appenderLabel,
|
|
270
278
|
rootClientId,
|
|
271
279
|
};
|
|
@@ -280,70 +288,57 @@ export default compose( [
|
|
|
280
288
|
isAppender,
|
|
281
289
|
hasSingleBlockType,
|
|
282
290
|
allowedBlockType,
|
|
283
|
-
|
|
291
|
+
blockToInsert,
|
|
284
292
|
onSelectOrClose,
|
|
285
293
|
selectBlockOnInsert,
|
|
286
294
|
} = ownProps;
|
|
287
295
|
|
|
288
|
-
if ( ! hasSingleBlockType && !
|
|
296
|
+
if ( ! hasSingleBlockType && ! blockToInsert ) {
|
|
289
297
|
return;
|
|
290
298
|
}
|
|
291
299
|
|
|
292
|
-
|
|
293
|
-
const { getBlock, getPreviousBlockClientId } =
|
|
294
|
-
select( blockEditorStore );
|
|
300
|
+
const blockName = blockToInsert?.name ?? allowedBlockType.name;
|
|
295
301
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
( ! clientId && ! rootClientId )
|
|
299
|
-
) {
|
|
302
|
+
function getAdjacentBlockAttributes( attributesToCopy ) {
|
|
303
|
+
if ( ! attributesToCopy?.length ) {
|
|
300
304
|
return {};
|
|
301
305
|
}
|
|
302
306
|
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
//
|
|
307
|
-
//
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
if ( parentBlock?.innerBlocks?.length ) {
|
|
312
|
-
const lastInnerBlock =
|
|
313
|
-
parentBlock.innerBlocks[
|
|
314
|
-
parentBlock.innerBlocks.length - 1
|
|
315
|
-
];
|
|
316
|
-
|
|
317
|
-
if (
|
|
318
|
-
directInsertBlock &&
|
|
319
|
-
directInsertBlock?.name === lastInnerBlock.name
|
|
320
|
-
) {
|
|
321
|
-
adjacentAttributes = lastInnerBlock.attributes;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
} else {
|
|
325
|
-
// Otherwise, attempt to get attributes from the
|
|
326
|
-
// previous block relative to the current clientId.
|
|
307
|
+
const { getBlock, getPreviousBlockClientId } =
|
|
308
|
+
select( blockEditorStore );
|
|
309
|
+
|
|
310
|
+
// Find the adjacent block of the same type whose attributes
|
|
311
|
+
// should be copied: previous sibling when inserting next to
|
|
312
|
+
// an existing block, otherwise the last child of the root.
|
|
313
|
+
let adjacentAttributes;
|
|
314
|
+
if ( clientId ) {
|
|
327
315
|
const currentBlock = getBlock( clientId );
|
|
328
316
|
const previousBlock = getBlock(
|
|
329
317
|
getPreviousBlockClientId( clientId )
|
|
330
318
|
);
|
|
331
|
-
|
|
332
319
|
if ( currentBlock?.name === previousBlock?.name ) {
|
|
333
|
-
adjacentAttributes =
|
|
334
|
-
|
|
320
|
+
adjacentAttributes = previousBlock?.attributes;
|
|
321
|
+
}
|
|
322
|
+
} else if ( rootClientId ) {
|
|
323
|
+
const lastInnerBlock =
|
|
324
|
+
getBlock( rootClientId )?.innerBlocks?.at( -1 );
|
|
325
|
+
if ( lastInnerBlock?.name === blockName ) {
|
|
326
|
+
adjacentAttributes = lastInnerBlock.attributes;
|
|
335
327
|
}
|
|
336
328
|
}
|
|
337
329
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
result[ attribute ] =
|
|
342
|
-
adjacentAttributes[ attribute ];
|
|
343
|
-
}
|
|
344
|
-
} );
|
|
330
|
+
if ( ! adjacentAttributes ) {
|
|
331
|
+
return {};
|
|
332
|
+
}
|
|
345
333
|
|
|
346
|
-
return
|
|
334
|
+
return Object.fromEntries(
|
|
335
|
+
attributesToCopy
|
|
336
|
+
.filter( ( attr ) => attr in adjacentAttributes )
|
|
337
|
+
.map( ( attr ) => [
|
|
338
|
+
attr,
|
|
339
|
+
adjacentAttributes[ attr ],
|
|
340
|
+
] )
|
|
341
|
+
);
|
|
347
342
|
}
|
|
348
343
|
|
|
349
344
|
function getInsertionIndex() {
|
|
@@ -375,33 +370,27 @@ export default compose( [
|
|
|
375
370
|
|
|
376
371
|
const { insertBlock } = dispatch( blockEditorStore );
|
|
377
372
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
// Attempt to augment the directInsertBlock with attributes from an adjacent block.
|
|
373
|
+
// Attempt to augment the inserted block with attributes from an adjacent block.
|
|
381
374
|
// This ensures styling from nearby blocks is preserved in the newly inserted block.
|
|
382
375
|
// See: https://github.com/WordPress/gutenberg/issues/37904
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
);
|
|
376
|
+
const newAttributes = getAdjacentBlockAttributes(
|
|
377
|
+
blockToInsert?.attributesToCopy
|
|
378
|
+
);
|
|
387
379
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
} else {
|
|
393
|
-
blockToInsert = createBlock( allowedBlockType.name );
|
|
394
|
-
}
|
|
380
|
+
const newBlock = createBlock( blockName, {
|
|
381
|
+
...( blockToInsert?.attributes || {} ),
|
|
382
|
+
...newAttributes,
|
|
383
|
+
} );
|
|
395
384
|
|
|
396
385
|
insertBlock(
|
|
397
|
-
|
|
386
|
+
newBlock,
|
|
398
387
|
getInsertionIndex(),
|
|
399
388
|
rootClientId,
|
|
400
389
|
selectBlockOnInsert
|
|
401
390
|
);
|
|
402
391
|
|
|
403
392
|
if ( onSelectOrClose ) {
|
|
404
|
-
onSelectOrClose(
|
|
393
|
+
onSelectOrClose( newBlock );
|
|
405
394
|
}
|
|
406
395
|
|
|
407
396
|
const message = sprintf(
|
|
@@ -10,11 +10,13 @@ import {
|
|
|
10
10
|
forwardRef,
|
|
11
11
|
useState,
|
|
12
12
|
useCallback,
|
|
13
|
+
useEffect,
|
|
13
14
|
useMemo,
|
|
14
15
|
useRef,
|
|
15
16
|
useLayoutEffect,
|
|
16
17
|
} from '@wordpress/element';
|
|
17
|
-
import {
|
|
18
|
+
import { SearchControl, Popover } from '@wordpress/components';
|
|
19
|
+
import { VisuallyHidden } from '@wordpress/ui';
|
|
18
20
|
import { __ } from '@wordpress/i18n';
|
|
19
21
|
import { useDebouncedInput, useViewportMatch } from '@wordpress/compose';
|
|
20
22
|
import { useSelect } from '@wordpress/data';
|
|
@@ -168,6 +170,30 @@ function InserterMenu(
|
|
|
168
170
|
|
|
169
171
|
const showMediaPanel = selectedTab === 'media' && !! selectedMediaCategory;
|
|
170
172
|
|
|
173
|
+
const [ isScrolled, setIsScrolled ] = useState( false );
|
|
174
|
+
const blocksPanelRef = useRef( null );
|
|
175
|
+
const patternsPanelRef = useRef( null );
|
|
176
|
+
const mediaPanelRef = useRef( null );
|
|
177
|
+
useEffect( () => {
|
|
178
|
+
const handleScroll = ( event ) => {
|
|
179
|
+
setIsScrolled( event.currentTarget.scrollTop > 0 );
|
|
180
|
+
};
|
|
181
|
+
const panels = [
|
|
182
|
+
blocksPanelRef.current,
|
|
183
|
+
patternsPanelRef.current,
|
|
184
|
+
mediaPanelRef.current,
|
|
185
|
+
].filter( Boolean );
|
|
186
|
+
panels.forEach( ( panel ) =>
|
|
187
|
+
panel.addEventListener( 'scroll', handleScroll )
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
return () => {
|
|
191
|
+
panels.forEach( ( panel ) =>
|
|
192
|
+
panel.removeEventListener( 'scroll', handleScroll )
|
|
193
|
+
);
|
|
194
|
+
};
|
|
195
|
+
}, [] );
|
|
196
|
+
|
|
171
197
|
const inserterSearch = useMemo( () => {
|
|
172
198
|
if ( selectedTab === 'media' ) {
|
|
173
199
|
return null;
|
|
@@ -176,7 +202,9 @@ function InserterMenu(
|
|
|
176
202
|
return (
|
|
177
203
|
<>
|
|
178
204
|
<SearchControl
|
|
179
|
-
className=
|
|
205
|
+
className={ clsx( 'block-editor-inserter__search', {
|
|
206
|
+
'is-scrolled': isScrolled,
|
|
207
|
+
} ) }
|
|
180
208
|
onChange={ ( value ) => {
|
|
181
209
|
if ( hoveredItem ) {
|
|
182
210
|
setHoveredItem( null );
|
|
@@ -219,6 +247,7 @@ function InserterMenu(
|
|
|
219
247
|
rootClientId,
|
|
220
248
|
__experimentalInsertionIndex,
|
|
221
249
|
isAppender,
|
|
250
|
+
isScrolled,
|
|
222
251
|
] );
|
|
223
252
|
|
|
224
253
|
const blocksTab = useMemo( () => {
|
|
@@ -235,7 +264,7 @@ function InserterMenu(
|
|
|
235
264
|
</div>
|
|
236
265
|
{ showInserterHelpPanel && (
|
|
237
266
|
<div className="block-editor-inserter__tips">
|
|
238
|
-
<VisuallyHidden
|
|
267
|
+
<VisuallyHidden render={ <h2 /> }>
|
|
239
268
|
{ __( 'A tip for using the block editor' ) }
|
|
240
269
|
</VisuallyHidden>
|
|
241
270
|
<Tips />
|
|
@@ -343,6 +372,7 @@ function InserterMenu(
|
|
|
343
372
|
{
|
|
344
373
|
name: 'blocks',
|
|
345
374
|
title: __( 'Blocks' ),
|
|
375
|
+
panelRef: blocksPanelRef,
|
|
346
376
|
panel: (
|
|
347
377
|
<>
|
|
348
378
|
{ inserterSearch }
|
|
@@ -355,6 +385,7 @@ function InserterMenu(
|
|
|
355
385
|
{
|
|
356
386
|
name: 'patterns',
|
|
357
387
|
title: __( 'Patterns' ),
|
|
388
|
+
panelRef: patternsPanelRef,
|
|
358
389
|
panel: (
|
|
359
390
|
<>
|
|
360
391
|
{ inserterSearch }
|
|
@@ -367,6 +398,7 @@ function InserterMenu(
|
|
|
367
398
|
{
|
|
368
399
|
name: 'media',
|
|
369
400
|
title: __( 'Media' ),
|
|
401
|
+
panelRef: mediaPanelRef,
|
|
370
402
|
panel: (
|
|
371
403
|
<>
|
|
372
404
|
{ inserterSearch }
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useMemo, useEffect } from '@wordpress/element';
|
|
5
5
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
6
|
-
import { VisuallyHidden } from '@wordpress/
|
|
6
|
+
import { VisuallyHidden } from '@wordpress/ui';
|
|
7
7
|
import { useDebounce, useAsyncList } from '@wordpress/compose';
|
|
8
8
|
import { speak } from '@wordpress/a11y';
|
|
9
9
|
import { useSelect } from '@wordpress/data';
|
|
@@ -119,7 +119,18 @@ $block-inserter-tabs-height: 44px;
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
.block-editor-inserter__search {
|
|
122
|
-
padding: $grid-unit-20
|
|
122
|
+
padding: $grid-unit-20;
|
|
123
|
+
position: sticky;
|
|
124
|
+
top: 0;
|
|
125
|
+
z-index: 2;
|
|
126
|
+
background-color: $white;
|
|
127
|
+
border-bottom: 1px solid transparent;
|
|
128
|
+
@media not ( prefers-reduced-motion ) {
|
|
129
|
+
transition: border-bottom-color 0.1s linear;
|
|
130
|
+
}
|
|
131
|
+
&.is-scrolled {
|
|
132
|
+
border-bottom-color: $gray-200;
|
|
133
|
+
}
|
|
123
134
|
}
|
|
124
135
|
|
|
125
136
|
.block-editor-inserter__no-tab-container {
|
|
@@ -138,7 +149,7 @@ $block-inserter-tabs-height: 44px;
|
|
|
138
149
|
|
|
139
150
|
display: inline-flex;
|
|
140
151
|
align-items: center;
|
|
141
|
-
padding:
|
|
152
|
+
padding: 0 $grid-unit-20;
|
|
142
153
|
}
|
|
143
154
|
|
|
144
155
|
.block-editor-inserter__panel-content {
|
|
@@ -224,12 +235,16 @@ $block-inserter-tabs-height: 44px;
|
|
|
224
235
|
.block-editor-inserter__media-tabs-container,
|
|
225
236
|
.block-editor-inserter__block-patterns-tabs-container {
|
|
226
237
|
flex-grow: 1;
|
|
227
|
-
padding: $grid-unit-20;
|
|
238
|
+
padding: 0 $grid-unit-20 $grid-unit-20;
|
|
228
239
|
display: flex;
|
|
229
240
|
flex-direction: column;
|
|
230
241
|
justify-content: space-between;
|
|
231
242
|
}
|
|
232
243
|
|
|
244
|
+
.block-editor-inserter__media-tabs-container {
|
|
245
|
+
padding-top: $grid-unit-20;
|
|
246
|
+
}
|
|
247
|
+
|
|
233
248
|
.block-editor-inserter__category-tablist {
|
|
234
249
|
margin-bottom: $grid-unit-10;
|
|
235
250
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
__experimentalHeading as Heading,
|
|
8
8
|
__experimentalSpacer as Spacer,
|
|
9
9
|
Button,
|
|
10
|
-
__experimentalText as
|
|
10
|
+
__experimentalText as WCText,
|
|
11
11
|
} from '@wordpress/components';
|
|
12
12
|
import { closeSmall } from '@wordpress/icons';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
@@ -52,7 +52,7 @@ export default function InspectorPopoverHeader( {
|
|
|
52
52
|
/>
|
|
53
53
|
) }
|
|
54
54
|
</HStack>
|
|
55
|
-
{ help && <
|
|
55
|
+
{ help && <WCText>{ help }</WCText> }
|
|
56
56
|
</VStack>
|
|
57
57
|
);
|
|
58
58
|
}
|
|
@@ -36,7 +36,7 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
36
36
|
import { unlock } from '../../lock-unlock';
|
|
37
37
|
import { ViewerSlot } from './viewer-slot';
|
|
38
38
|
|
|
39
|
-
const { Badge } = unlock( componentsPrivateApis );
|
|
39
|
+
const { Badge: WCBadge } = unlock( componentsPrivateApis );
|
|
40
40
|
|
|
41
41
|
import useRichUrlData from './use-rich-url-data';
|
|
42
42
|
|
|
@@ -164,12 +164,12 @@ export default function LinkPreview( {
|
|
|
164
164
|
>
|
|
165
165
|
{ value.badges.map(
|
|
166
166
|
( badge, index ) => (
|
|
167
|
-
<
|
|
167
|
+
<WCBadge
|
|
168
168
|
key={ `${ badge.label }|${ badge.intent }|${ index }` }
|
|
169
169
|
intent={ badge.intent }
|
|
170
170
|
>
|
|
171
171
|
{ badge.label }
|
|
172
|
-
</
|
|
172
|
+
</WCBadge>
|
|
173
173
|
)
|
|
174
174
|
) }
|
|
175
175
|
</HStack>
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { CheckboxControl
|
|
5
|
+
import { CheckboxControl } from '@wordpress/components';
|
|
6
|
+
import { VisuallyHidden } from '@wordpress/ui';
|
|
6
7
|
|
|
7
8
|
const noop = () => {};
|
|
8
9
|
|
|
@@ -58,7 +59,7 @@ const LinkControlSettings = ( { value, onChange = noop, settings } ) => {
|
|
|
58
59
|
|
|
59
60
|
return (
|
|
60
61
|
<fieldset className="block-editor-link-control__settings">
|
|
61
|
-
<VisuallyHidden
|
|
62
|
+
<VisuallyHidden render={ <legend /> }>
|
|
62
63
|
{ __( 'Currently selected link settings' ) }
|
|
63
64
|
</VisuallyHidden>
|
|
64
65
|
{ theSettings }
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
BaseControl,
|
|
6
6
|
Button,
|
|
7
7
|
Popover,
|
|
8
|
-
VisuallyHidden,
|
|
9
8
|
useBaseControlProps,
|
|
10
9
|
} from '@wordpress/components';
|
|
10
|
+
import { VisuallyHidden } from '@wordpress/ui';
|
|
11
11
|
import { useState, useId, useRef } from '@wordpress/element';
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
|
16
16
|
*/
|
|
17
17
|
import { unlock } from '../../lock-unlock';
|
|
18
18
|
|
|
19
|
-
const { Badge } = unlock( componentsPrivateApis );
|
|
19
|
+
const { Badge: WCBadge } = unlock( componentsPrivateApis );
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Link preview component that displays the current link information.
|
|
@@ -67,12 +67,12 @@ export function LinkPreview( { title, url, image, badges } ) {
|
|
|
67
67
|
alignment="left"
|
|
68
68
|
>
|
|
69
69
|
{ badges.map( ( badge ) => (
|
|
70
|
-
<
|
|
70
|
+
<WCBadge
|
|
71
71
|
key={ `${ badge.label }|${ badge.intent }` }
|
|
72
72
|
intent={ badge.intent }
|
|
73
73
|
>
|
|
74
74
|
{ badge.label }
|
|
75
|
-
</
|
|
75
|
+
</WCBadge>
|
|
76
76
|
) ) }
|
|
77
77
|
</HStack>
|
|
78
78
|
) }
|
|
@@ -36,7 +36,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
36
36
|
import { unlock } from '../../lock-unlock';
|
|
37
37
|
import { getBlockVisibilityLabel } from '../block-visibility';
|
|
38
38
|
|
|
39
|
-
const { Badge } = unlock( componentsPrivateApis );
|
|
39
|
+
const { Badge: WCBadge } = unlock( componentsPrivateApis );
|
|
40
40
|
|
|
41
41
|
function ListViewBlockSelectButton(
|
|
42
42
|
{
|
|
@@ -136,9 +136,9 @@ function ListViewBlockSelectButton(
|
|
|
136
136
|
</span>
|
|
137
137
|
{ blockInformation?.anchor && (
|
|
138
138
|
<span className="block-editor-list-view-block-select-button__anchor-wrapper">
|
|
139
|
-
<
|
|
139
|
+
<WCBadge className="block-editor-list-view-block-select-button__anchor">
|
|
140
140
|
{ blockInformation.anchor }
|
|
141
|
-
</
|
|
141
|
+
</WCBadge>
|
|
142
142
|
</span>
|
|
143
143
|
) }
|
|
144
144
|
{ isSticky && (
|
|
@@ -11,10 +11,8 @@ import {
|
|
|
11
11
|
useMergeRefs,
|
|
12
12
|
__experimentalUseFixedWindowList as useFixedWindowList,
|
|
13
13
|
} from '@wordpress/compose';
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
VisuallyHidden,
|
|
17
|
-
} from '@wordpress/components';
|
|
14
|
+
import { __experimentalTreeGrid as TreeGrid } from '@wordpress/components';
|
|
15
|
+
import { VisuallyHidden } from '@wordpress/ui';
|
|
18
16
|
import { AsyncModeProvider, useSelect } from '@wordpress/data';
|
|
19
17
|
import deprecated from '@wordpress/deprecated';
|
|
20
18
|
import {
|