@wordpress/block-editor 15.17.0 → 15.18.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 +6 -0
- 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-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/pattern-overrides-dropdown.cjs.map +3 -3
- package/build/components/block-variation-transforms/index.cjs +2 -1
- package/build/components/block-variation-transforms/index.cjs.map +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs +4 -4
- 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/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +87 -62
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/filters-panel.cjs.map +2 -2
- package/build/components/global-styles/hooks.cjs +9 -7
- package/build/components/global-styles/hooks.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/inserter/block-patterns-tab/pattern-category-previews.cjs.map +2 -2
- package/build/components/inserter/menu.cjs +2 -1
- package/build/components/inserter/menu.cjs.map +2 -2
- package/build/components/inserter/search-results.cjs +3 -3
- package/build/components/inserter/search-results.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/paste-handler.cjs +12 -5
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +3 -3
- package/build/components/url-popover/image-url-input-ui.cjs +1 -1
- package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
- package/build/components/writing-flow/use-arrow-nav.cjs +1 -1
- package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
- package/build/hooks/block-bindings.cjs.map +3 -3
- package/build/hooks/block-fields/link/index.cjs +1 -1
- package/build/hooks/block-fields/link/index.cjs.map +1 -1
- package/build/hooks/custom-css.cjs +21 -0
- package/build/hooks/custom-css.cjs.map +3 -3
- package/build/hooks/dimensions.cjs +5 -1
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/grid-visualizer.cjs +1 -1
- package/build/hooks/grid-visualizer.cjs.map +1 -1
- package/build/hooks/layout-child.cjs +1 -1
- package/build/hooks/layout-child.cjs.map +1 -1
- package/build/hooks/utils.cjs +4 -0
- package/build/hooks/utils.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/private-keys.cjs +3 -0
- package/build/store/private-keys.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-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/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 +2 -2
- package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +6 -6
- 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/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +87 -62
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +9 -7
- package/build-module/components/global-styles/hooks.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/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/menu.mjs +3 -2
- 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/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/paste-handler.mjs +12 -5
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +2 -2
- package/build-module/components/url-popover/image-url-input-ui.mjs +1 -1
- package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
- package/build-module/components/writing-flow/use-arrow-nav.mjs +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.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/block-fields/link/index.mjs +1 -1
- package/build-module/hooks/block-fields/link/index.mjs.map +1 -1
- package/build-module/hooks/custom-css.mjs +23 -2
- package/build-module/hooks/custom-css.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +5 -1
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/grid-visualizer.mjs +1 -1
- package/build-module/hooks/grid-visualizer.mjs.map +1 -1
- package/build-module/hooks/layout-child.mjs +1 -1
- package/build-module/hooks/layout-child.mjs.map +1 -1
- package/build-module/hooks/utils.mjs +4 -0
- package/build-module/hooks/utils.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/private-keys.mjs +2 -0
- package/build-module/store/private-keys.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 +1 -4
- package/build-style/content.css +1 -4
- package/build-style/style-rtl.css +12 -12
- package/build-style/style.css +12 -12
- package/build-types/utils/dom.d.ts +7 -0
- 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/background-image-control/style.scss +1 -1
- 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-list/content.scss +0 -4
- package/src/components/block-mover/button.js +17 -7
- package/src/components/block-pattern-setup/index.js +2 -1
- package/src/components/block-pattern-setup/style.scss +2 -2
- package/src/components/block-patterns-list/index.js +1 -1
- package/src/components/block-patterns-list/style.scss +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-switcher/style.scss +2 -2
- package/src/components/block-toolbar/pattern-overrides-dropdown.js +2 -2
- package/src/components/block-variation-transforms/index.js +2 -2
- package/src/components/block-visibility/viewport-visibility-info.js +7 -7
- 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/global-styles/color-panel.js +0 -2
- package/src/components/global-styles/dimensions-panel.js +100 -73
- package/src/components/global-styles/filters-panel.js +0 -2
- package/src/components/global-styles/hooks.js +9 -7
- package/src/components/global-styles/style.scss +1 -1
- package/src/components/grid/grid-item-movers.js +2 -5
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +5 -5
- package/src/components/inserter/menu.js +3 -2
- package/src/components/inserter/search-results.js +1 -1
- package/src/components/inserter/style.scss +2 -2
- package/src/components/inserter-list-item/style.scss +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/list-view/style.scss +1 -1
- package/src/components/media-placeholder/content.scss +1 -1
- 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/paste-handler.js +18 -4
- package/src/components/url-input/style.scss +1 -1
- package/src/components/url-popover/image-url-input-ui.js +1 -1
- package/src/components/writing-flow/use-arrow-nav.js +9 -2
- package/src/hooks/block-bindings.js +3 -3
- package/src/hooks/block-fields/link/index.js +1 -1
- package/src/hooks/custom-css.js +30 -9
- package/src/hooks/dimensions.js +6 -1
- package/src/hooks/grid-visualizer.js +1 -1
- package/src/hooks/layout-child.js +1 -1
- package/src/hooks/test/dimensions.js +16 -0
- package/src/hooks/test/style.js +2 -0
- package/src/hooks/utils.js +4 -0
- package/src/layouts/flex.js +7 -9
- package/src/layouts/grid.js +7 -4
- package/src/private-apis.js +6 -4
- package/src/store/private-keys.js +1 -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
|
@@ -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 }
|
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
useRef,
|
|
15
15
|
useLayoutEffect,
|
|
16
16
|
} from '@wordpress/element';
|
|
17
|
-
import {
|
|
17
|
+
import { SearchControl, Popover } from '@wordpress/components';
|
|
18
|
+
import { VisuallyHidden } from '@wordpress/ui';
|
|
18
19
|
import { __ } from '@wordpress/i18n';
|
|
19
20
|
import { useDebouncedInput, useViewportMatch } from '@wordpress/compose';
|
|
20
21
|
import { useSelect } from '@wordpress/data';
|
|
@@ -235,7 +236,7 @@ function InserterMenu(
|
|
|
235
236
|
</div>
|
|
236
237
|
{ showInserterHelpPanel && (
|
|
237
238
|
<div className="block-editor-inserter__tips">
|
|
238
|
-
<VisuallyHidden
|
|
239
|
+
<VisuallyHidden render={ <h2 /> }>
|
|
239
240
|
{ __( 'A tip for using the block editor' ) }
|
|
240
241
|
</VisuallyHidden>
|
|
241
242
|
<Tips />
|
|
@@ -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';
|
|
@@ -85,7 +85,7 @@ $block-inserter-tabs-height: 44px;
|
|
|
85
85
|
.block-editor-inserter__toggle.components-button {
|
|
86
86
|
display: inline-flex;
|
|
87
87
|
align-items: center;
|
|
88
|
-
cursor:
|
|
88
|
+
cursor: var(--wpds-cursor-control);
|
|
89
89
|
border: none;
|
|
90
90
|
outline: none;
|
|
91
91
|
padding: 0;
|
|
@@ -482,7 +482,7 @@ $block-inserter-tabs-height: 44px;
|
|
|
482
482
|
|
|
483
483
|
.block-editor-inserter__media-list__list-item {
|
|
484
484
|
position: relative;
|
|
485
|
-
cursor:
|
|
485
|
+
cursor: var(--wpds-cursor-control);
|
|
486
486
|
margin-bottom: $grid-unit-30;
|
|
487
487
|
|
|
488
488
|
&.is-placeholder {
|
|
@@ -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 {
|
|
@@ -469,7 +469,7 @@ $block-navigation-max-indent: 8;
|
|
|
469
469
|
.block-editor-list-view__expander {
|
|
470
470
|
height: $icon-size;
|
|
471
471
|
width: $icon-size;
|
|
472
|
-
cursor:
|
|
472
|
+
cursor: var(--wpds-cursor-control);
|
|
473
473
|
}
|
|
474
474
|
|
|
475
475
|
.block-editor-list-view-leaf[aria-level] .block-editor-list-view__expander {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
MediaUploadProvider,
|
|
9
9
|
store as uploadStore,
|
|
10
10
|
detectClientSideMediaSupport,
|
|
11
|
+
isHeicCanvasSupported,
|
|
11
12
|
} from '@wordpress/upload-media';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -38,6 +39,17 @@ let hasLoggedFallback = false;
|
|
|
38
39
|
*/
|
|
39
40
|
let isClientSideMediaEnabledCache = null;
|
|
40
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Cached result of whether HEIC-only canvas processing should be enabled.
|
|
44
|
+
*/
|
|
45
|
+
let isHeicCanvasEnabledCache = null;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* HEIC MIME types that should be routed through the upload-media pipeline
|
|
49
|
+
* when in HEIC-only mode.
|
|
50
|
+
*/
|
|
51
|
+
const HEIC_MIME_TYPES = [ 'image/heic', 'image/heif' ];
|
|
52
|
+
|
|
41
53
|
/**
|
|
42
54
|
* Checks if client-side media processing should be enabled.
|
|
43
55
|
*
|
|
@@ -85,6 +97,44 @@ function shouldEnableClientSideMediaProcessing() {
|
|
|
85
97
|
return true;
|
|
86
98
|
}
|
|
87
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Checks if HEIC-only canvas processing should be enabled.
|
|
102
|
+
*
|
|
103
|
+
* Returns true when:
|
|
104
|
+
* 1. Full client-side processing is NOT available (otherwise it handles HEIC already)
|
|
105
|
+
* 2. The server has set the __heicUploadSupport flag
|
|
106
|
+
* 3. The browser supports createImageBitmap + OffscreenCanvas (e.g. Safari)
|
|
107
|
+
*
|
|
108
|
+
* @return {boolean} Whether HEIC-only canvas processing should be enabled.
|
|
109
|
+
*/
|
|
110
|
+
function shouldEnableHeicCanvasProcessing() {
|
|
111
|
+
if ( isHeicCanvasEnabledCache !== null ) {
|
|
112
|
+
return isHeicCanvasEnabledCache;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// If full client-side processing is enabled, it already handles HEIC.
|
|
116
|
+
if ( shouldEnableClientSideMediaProcessing() ) {
|
|
117
|
+
isHeicCanvasEnabledCache = false;
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if ( ! window.__heicUploadSupport ) {
|
|
122
|
+
isHeicCanvasEnabledCache = false;
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (
|
|
127
|
+
typeof isHeicCanvasSupported !== 'function' ||
|
|
128
|
+
! isHeicCanvasSupported()
|
|
129
|
+
) {
|
|
130
|
+
isHeicCanvasEnabledCache = false;
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
isHeicCanvasEnabledCache = true;
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
|
|
88
138
|
/**
|
|
89
139
|
* Upload a media file when the file upload button is activated
|
|
90
140
|
* or when adding a file to the editor via drag & drop.
|
|
@@ -128,6 +178,92 @@ function mediaUpload(
|
|
|
128
178
|
} );
|
|
129
179
|
}
|
|
130
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Upload interceptor for HEIC-only mode.
|
|
183
|
+
*
|
|
184
|
+
* Routes HEIC files through the upload-media pipeline for canvas-based
|
|
185
|
+
* conversion, while passing non-HEIC files to the original mediaUpload
|
|
186
|
+
* function for standard server-side processing.
|
|
187
|
+
*
|
|
188
|
+
* @param {WPDataRegistry} registry
|
|
189
|
+
* @param {Object} settings Block editor settings.
|
|
190
|
+
* @param {Object} $3 Parameters object passed to the function.
|
|
191
|
+
* @param {Array} $3.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.
|
|
192
|
+
* @param {Object} $3.additionalData Additional data to include in the request.
|
|
193
|
+
* @param {Array<File>} $3.filesList List of files.
|
|
194
|
+
* @param {Function} $3.onError Function called when an error happens.
|
|
195
|
+
* @param {Function} $3.onFileChange Function called each time a file or a temporary representation of the file is available.
|
|
196
|
+
* @param {Function} $3.onSuccess Function called once a file has completely finished uploading, including thumbnails.
|
|
197
|
+
* @param {Function} $3.onBatchSuccess Function called once all files in a group have completely finished uploading, including thumbnails.
|
|
198
|
+
*/
|
|
199
|
+
function heicMediaUpload(
|
|
200
|
+
registry,
|
|
201
|
+
settings,
|
|
202
|
+
{
|
|
203
|
+
allowedTypes,
|
|
204
|
+
additionalData = {},
|
|
205
|
+
filesList,
|
|
206
|
+
onError = noop,
|
|
207
|
+
onFileChange,
|
|
208
|
+
onSuccess,
|
|
209
|
+
onBatchSuccess,
|
|
210
|
+
}
|
|
211
|
+
) {
|
|
212
|
+
const files = Array.from( filesList );
|
|
213
|
+
const heicFiles = files.filter( ( file ) =>
|
|
214
|
+
HEIC_MIME_TYPES.includes( file.type )
|
|
215
|
+
);
|
|
216
|
+
const otherFiles = files.filter(
|
|
217
|
+
( file ) => ! HEIC_MIME_TYPES.includes( file.type )
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
// When the batch contains both HEIC and non-HEIC files, coordinate
|
|
221
|
+
// onBatchSuccess so it fires only after *both* paths have completed.
|
|
222
|
+
const hasBothPaths =
|
|
223
|
+
heicFiles.length > 0 && otherFiles.length > 0 && settings?.mediaUpload;
|
|
224
|
+
let pathsRemaining = hasBothPaths ? 2 : 1;
|
|
225
|
+
const coordinatedBatchSuccess = hasBothPaths
|
|
226
|
+
? () => {
|
|
227
|
+
pathsRemaining--;
|
|
228
|
+
if ( pathsRemaining <= 0 ) {
|
|
229
|
+
onBatchSuccess?.();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
: onBatchSuccess;
|
|
233
|
+
|
|
234
|
+
// Route HEIC files through the upload-media pipeline.
|
|
235
|
+
if ( heicFiles.length > 0 ) {
|
|
236
|
+
void registry.dispatch( uploadStore ).addItems( {
|
|
237
|
+
files: heicFiles,
|
|
238
|
+
onChange: onFileChange,
|
|
239
|
+
onSuccess: ( attachments ) => {
|
|
240
|
+
settings?.[ mediaUploadOnSuccessKey ]?.( attachments );
|
|
241
|
+
onSuccess?.( attachments );
|
|
242
|
+
},
|
|
243
|
+
onBatchSuccess: coordinatedBatchSuccess,
|
|
244
|
+
onError: ( error ) =>
|
|
245
|
+
onError(
|
|
246
|
+
typeof error === 'string' ? error : error?.message ?? ''
|
|
247
|
+
),
|
|
248
|
+
additionalData,
|
|
249
|
+
allowedTypes,
|
|
250
|
+
} );
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Pass non-HEIC files to the original server-side upload function.
|
|
254
|
+
if ( otherFiles.length > 0 && settings?.mediaUpload ) {
|
|
255
|
+
settings.mediaUpload( {
|
|
256
|
+
allowedTypes,
|
|
257
|
+
additionalData,
|
|
258
|
+
filesList: otherFiles,
|
|
259
|
+
onError,
|
|
260
|
+
onFileChange,
|
|
261
|
+
onSuccess,
|
|
262
|
+
onBatchSuccess: coordinatedBatchSuccess,
|
|
263
|
+
} );
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
131
267
|
/**
|
|
132
268
|
* Calls useBlockSync as a child of SelectionContext.Provider so that the
|
|
133
269
|
* hook can read selection state from the context provided by this tree
|
|
@@ -152,6 +288,9 @@ export const ExperimentalBlockEditorProvider = withRegistryProvider(
|
|
|
152
288
|
|
|
153
289
|
const isClientSideMediaEnabled =
|
|
154
290
|
shouldEnableClientSideMediaProcessing();
|
|
291
|
+
const isHeicCanvasEnabled = shouldEnableHeicCanvasProcessing();
|
|
292
|
+
const useUploadMediaPipeline =
|
|
293
|
+
isClientSideMediaEnabled || isHeicCanvasEnabled;
|
|
155
294
|
|
|
156
295
|
// Nested providers (e.g. from useBlockPreview) inherit settings
|
|
157
296
|
// where mediaUpload has already been replaced with the
|
|
@@ -162,16 +301,17 @@ export const ExperimentalBlockEditorProvider = withRegistryProvider(
|
|
|
162
301
|
|
|
163
302
|
const settings = useMemo( () => {
|
|
164
303
|
if (
|
|
165
|
-
|
|
304
|
+
useUploadMediaPipeline &&
|
|
166
305
|
_settings?.mediaUpload &&
|
|
167
306
|
! isMediaUploadIntercepted
|
|
168
307
|
) {
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
308
|
+
// Choose the right interceptor:
|
|
309
|
+
// - Full mode: all uploads go through upload-media pipeline.
|
|
310
|
+
// - HEIC-only mode: only HEIC files go through, rest use legacy path.
|
|
311
|
+
const uploadFn = isClientSideMediaEnabled
|
|
312
|
+
? mediaUpload
|
|
313
|
+
: heicMediaUpload;
|
|
314
|
+
const interceptor = uploadFn.bind( null, registry, _settings );
|
|
175
315
|
interceptor.__isMediaUploadInterceptor = true;
|
|
176
316
|
return {
|
|
177
317
|
..._settings,
|
|
@@ -182,6 +322,7 @@ export const ExperimentalBlockEditorProvider = withRegistryProvider(
|
|
|
182
322
|
}, [
|
|
183
323
|
_settings,
|
|
184
324
|
registry,
|
|
325
|
+
useUploadMediaPipeline,
|
|
185
326
|
isClientSideMediaEnabled,
|
|
186
327
|
isMediaUploadIntercepted,
|
|
187
328
|
] );
|
|
@@ -258,7 +399,7 @@ export const ExperimentalBlockEditorProvider = withRegistryProvider(
|
|
|
258
399
|
// overwrite the store's server-side function with the
|
|
259
400
|
// interceptor, causing uploads to loop instead of reaching
|
|
260
401
|
// the server.
|
|
261
|
-
if (
|
|
402
|
+
if ( useUploadMediaPipeline && ! isMediaUploadIntercepted ) {
|
|
262
403
|
return (
|
|
263
404
|
<MediaUploadProvider
|
|
264
405
|
settings={ mediaUploadSettings }
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useInstanceId } from '@wordpress/compose';
|
|
5
|
-
import { VisuallyHidden } from '@wordpress/
|
|
5
|
+
import { VisuallyHidden } from '@wordpress/ui';
|
|
6
6
|
import { _x, sprintf } from '@wordpress/i18n';
|
|
7
7
|
|
|
8
8
|
export default function ResponsiveBlockControlLabel( {
|
|
@@ -27,7 +27,10 @@ export default function ResponsiveBlockControlLabel( {
|
|
|
27
27
|
<span aria-describedby={ `rbc-desc-${ instanceId }` }>
|
|
28
28
|
{ viewport.label }
|
|
29
29
|
</span>
|
|
30
|
-
<VisuallyHidden
|
|
30
|
+
<VisuallyHidden
|
|
31
|
+
id={ `rbc-desc-${ instanceId }` }
|
|
32
|
+
render={ <span /> }
|
|
33
|
+
>
|
|
31
34
|
{ accessibleLabel }
|
|
32
35
|
</VisuallyHidden>
|
|
33
36
|
</>
|
|
@@ -8,6 +8,7 @@ import { isURL } from '@wordpress/url';
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
+
import { store as blockEditorStore } from '../../../store';
|
|
11
12
|
import { addActiveFormats } from '../utils';
|
|
12
13
|
import { getPasteEventData } from '../../../utils/pasting';
|
|
13
14
|
|
|
@@ -25,6 +26,7 @@ export default ( props ) => ( element ) => {
|
|
|
25
26
|
__unstableEmbedURLOnPaste,
|
|
26
27
|
preserveWhiteSpace,
|
|
27
28
|
pastePlainText,
|
|
29
|
+
registry,
|
|
28
30
|
} = props.current;
|
|
29
31
|
|
|
30
32
|
// The event listener is attached to the window, so we need to check if
|
|
@@ -116,11 +118,23 @@ export default ( props ) => ( element ) => {
|
|
|
116
118
|
|
|
117
119
|
if ( typeof content === 'string' ) {
|
|
118
120
|
pasteInline( content );
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if ( ! content.length || ! onReplace || ! isEmpty( value ) ) {
|
|
125
|
+
return;
|
|
123
126
|
}
|
|
127
|
+
|
|
128
|
+
// Record an intermediate paragraph-with-URL state so a single undo
|
|
129
|
+
// after the URL → block transformation restores the pasted link.
|
|
130
|
+
if ( mode === 'BLOCKS' ) {
|
|
131
|
+
pasteInline( html );
|
|
132
|
+
registry
|
|
133
|
+
.dispatch( blockEditorStore )
|
|
134
|
+
.__unstableMarkLastChangeAsPersistent();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
onReplace( content, content.length - 1, -1 );
|
|
124
138
|
}
|
|
125
139
|
|
|
126
140
|
const { defaultView } = element.ownerDocument;
|
|
@@ -38,7 +38,7 @@ const LINK_DESTINATION_NONE = 'none';
|
|
|
38
38
|
const LINK_DESTINATION_CUSTOM = 'custom';
|
|
39
39
|
const LINK_DESTINATION_MEDIA = 'media';
|
|
40
40
|
const LINK_DESTINATION_ATTACHMENT = 'attachment';
|
|
41
|
-
const NEW_TAB_REL = [ '
|
|
41
|
+
const NEW_TAB_REL = [ 'noopener' ];
|
|
42
42
|
|
|
43
43
|
const ImageURLInputUI = ( {
|
|
44
44
|
linkDestination,
|
|
@@ -115,9 +115,16 @@ export function getClosestTabbable(
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
function isTabCandidate( node ) {
|
|
118
|
-
// If it's a block
|
|
119
|
-
// there are better
|
|
118
|
+
// If it's a block wrapper (not itself a contenteditable editing surface)
|
|
119
|
+
// and there are nested focusable nodes, skip because there are better
|
|
120
|
+
// candidates. We must not skip contenteditable nodes that happen to
|
|
121
|
+
// contain links or other focusable inline elements, since those are the
|
|
122
|
+
// correct navigation targets.
|
|
123
|
+
//
|
|
124
|
+
// See https://github.com/WordPress/gutenberg/pull/77474
|
|
125
|
+
// TODO: Consider fixing focus.tabbable
|
|
120
126
|
if (
|
|
127
|
+
node.contentEditable !== 'true' &&
|
|
121
128
|
getBlockClientId( node ) &&
|
|
122
129
|
focus.focusable
|
|
123
130
|
.find( node )
|
|
@@ -5,7 +5,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
5
5
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
6
6
|
import {
|
|
7
7
|
__experimentalItemGroup as ItemGroup,
|
|
8
|
-
__experimentalText as
|
|
8
|
+
__experimentalText as WCText,
|
|
9
9
|
__experimentalToolsPanel as ToolsPanel,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
11
|
import { useSelect } from '@wordpress/data';
|
|
@@ -103,13 +103,13 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => {
|
|
|
103
103
|
Use a div element to make the ToolsPanelHiddenInnerWrapper
|
|
104
104
|
toggle the visibility of this help text automatically.
|
|
105
105
|
*/ }
|
|
106
|
-
<
|
|
106
|
+
<WCText as="div" variant="muted">
|
|
107
107
|
<p>
|
|
108
108
|
{ __(
|
|
109
109
|
'Attributes connected to custom fields or other dynamic data.'
|
|
110
110
|
) }
|
|
111
111
|
</p>
|
|
112
|
-
</
|
|
112
|
+
</WCText>
|
|
113
113
|
</ToolsPanel>
|
|
114
114
|
</InspectorControls>
|
|
115
115
|
);
|
|
@@ -18,7 +18,7 @@ import { prependHTTP } from '@wordpress/url';
|
|
|
18
18
|
import LinkControl from '../../../components/link-control';
|
|
19
19
|
import { useInspectorPopoverPlacement } from '../use-inspector-popover-placement';
|
|
20
20
|
|
|
21
|
-
export const NEW_TAB_REL = '
|
|
21
|
+
export const NEW_TAB_REL = 'noopener';
|
|
22
22
|
export const NEW_TAB_TARGET = '_blank';
|
|
23
23
|
export const NOFOLLOW_REL = 'nofollow';
|
|
24
24
|
|
package/src/hooks/custom-css.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import { useMemo } from '@wordpress/element';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
1
|
+
import { useEffect, useMemo } from '@wordpress/element';
|
|
2
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
3
|
import { useInstanceId } from '@wordpress/compose';
|
|
7
4
|
import { getBlockType, hasBlockSupport } from '@wordpress/blocks';
|
|
8
5
|
import { __, sprintf } from '@wordpress/i18n';
|
|
9
6
|
import { processCSSNesting } from '@wordpress/global-styles-engine';
|
|
7
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
10
8
|
import { useBlockEditingMode } from '../components/block-editing-mode';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
9
|
import InspectorControls from '../components/inspector-controls';
|
|
16
10
|
import AdvancedPanel, {
|
|
17
11
|
validateCSS,
|
|
@@ -69,6 +63,8 @@ function CustomCSSControl( { blockName, setAttributes, style } ) {
|
|
|
69
63
|
);
|
|
70
64
|
}
|
|
71
65
|
|
|
66
|
+
const CUSTOM_CSS_WARNING_NOTICE_ID = 'custom-css-edit-warning';
|
|
67
|
+
|
|
72
68
|
function CustomCSSEdit( { clientId, name, setAttributes } ) {
|
|
73
69
|
const { style, canEditCSS } = useSelect(
|
|
74
70
|
( select ) => {
|
|
@@ -113,6 +109,31 @@ function useBlockProps( { style } ) {
|
|
|
113
109
|
customCSS.trim().length > 0 &&
|
|
114
110
|
validateCSS( customCSS );
|
|
115
111
|
|
|
112
|
+
const canEditCSS = useSelect(
|
|
113
|
+
( select ) => select( blockEditorStore ).getSettings().canEditCSS,
|
|
114
|
+
[]
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const { createWarningNotice } = useDispatch( noticesStore );
|
|
118
|
+
|
|
119
|
+
// Show a warning notice when the user lacks edit_css and a block has
|
|
120
|
+
// custom CSS. The fixed notice ID ensures only one notice is shown
|
|
121
|
+
// regardless of how many blocks have CSS.
|
|
122
|
+
const hasCustomCSS = !! customCSS?.trim();
|
|
123
|
+
useEffect( () => {
|
|
124
|
+
if ( ! canEditCSS && hasCustomCSS ) {
|
|
125
|
+
createWarningNotice(
|
|
126
|
+
__(
|
|
127
|
+
'This post contains blocks with custom CSS. You do not have permission to edit CSS. If you save this post, the custom CSS will be removed.'
|
|
128
|
+
),
|
|
129
|
+
{
|
|
130
|
+
id: CUSTOM_CSS_WARNING_NOTICE_ID,
|
|
131
|
+
isDismissible: true,
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
}, [ canEditCSS, hasCustomCSS, createWarningNotice ] );
|
|
136
|
+
|
|
116
137
|
const customCSSIdentifier = useInstanceId(
|
|
117
138
|
CUSTOM_CSS_INSTANCE_REFERENCE,
|
|
118
139
|
'wp-custom-css'
|