@wordpress/block-editor 14.10.1 → 14.12.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 +5 -1
- package/build/components/background-image-control/index.js +0 -1
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-actions/index.js +0 -3
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-inspector/index.js +6 -11
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js +1 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build/components/block-rename/modal.js +36 -11
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-rename/rename-control.js +2 -43
- package/build/components/block-rename/rename-control.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +12 -3
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/preview.native.js +1 -1
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +7 -7
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/block-variation-transformations.js +2 -2
- package/build/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build/components/block-switcher/index.js +1 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +2 -2
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/date-format-picker/index.js +1 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +2 -2
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +2 -2
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +3 -3
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +11 -19
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/utils.js +6 -4
- package/build/components/grid/utils.js.map +1 -1
- package/build/components/iframe/get-compatibility-styles.js +1 -1
- package/build/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build/components/iframe/index.js +1 -1
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-size-control/index.js +2 -1
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/menu.js +13 -2
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +49 -21
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build/components/line-height-control/index.native.js +1 -1
- package/build/components/line-height-control/index.native.js.map +1 -1
- package/build/components/link-control/index.js +1 -1
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +1 -1
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block-select-button.js +5 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/media-placeholder/index.js +1 -0
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -1
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/provider/index.js +0 -2
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +2 -2
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/event-listeners/input-rules.js +3 -3
- package/build/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build/components/rich-text/native/use-format-types.js +1 -1
- package/build/components/rich-text/native/use-format-types.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +1 -1
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +44 -2
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/linked-button.js +6 -9
- package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +0 -108
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/tabbed-sidebar/index.js +39 -0
- package/build/components/tabbed-sidebar/index.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +3 -3
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-commands/index.js +1 -1
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +1 -1
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/hooks/contrast-checker.js +41 -22
- package/build/hooks/contrast-checker.js.map +1 -1
- package/build/hooks/custom-class-name.js +2 -1
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +18 -7
- package/build/store/selectors.js.map +1 -1
- package/build/utils/transform-styles/index.js +1 -1
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build/utils/use-notify-copy.js +19 -11
- package/build/utils/use-notify-copy.js.map +1 -1
- package/build-module/components/background-image-control/index.js +0 -1
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +0 -3
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -11
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build-module/components/block-rename/modal.js +36 -11
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-rename/rename-control.js +2 -43
- package/build-module/components/block-rename/rename-control.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -3
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +1 -1
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +7 -7
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +2 -2
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build-module/components/block-switcher/index.js +1 -1
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +2 -2
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +1 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +2 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +2 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +3 -3
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +11 -19
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/utils.js +6 -4
- package/build-module/components/grid/utils.js.map +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build-module/components/iframe/index.js +1 -1
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +3 -2
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/menu.js +13 -2
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +51 -23
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build-module/components/line-height-control/index.native.js +1 -1
- package/build-module/components/line-height-control/index.native.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +1 -1
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +6 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +1 -0
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +1 -1
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/provider/index.js +0 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +2 -2
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js +3 -3
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build-module/components/rich-text/native/use-format-types.js +1 -1
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +1 -1
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +45 -1
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/linked-button.js +7 -10
- package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +0 -104
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +39 -0
- package/build-module/components/tabbed-sidebar/index.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +1 -1
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +1 -1
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/hooks/contrast-checker.js +42 -23
- package/build-module/hooks/contrast-checker.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +2 -1
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/store/actions.js +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +18 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +1 -1
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-module/utils/use-notify-copy.js +19 -11
- package/build-module/utils/use-notify-copy.js.map +1 -1
- package/build-style/content-rtl.css +0 -9
- package/build-style/content.css +0 -9
- package/build-style/style-rtl.css +19 -21
- package/build-style/style.css +19 -21
- package/package.json +34 -33
- package/src/components/background-image-control/index.js +0 -1
- package/src/components/block-actions/index.js +0 -3
- package/src/components/block-icon/content.scss +1 -1
- package/src/components/{block-card → block-icon}/stories/index.story.js +16 -26
- package/src/components/block-icon/style.scss +1 -1
- package/src/components/block-inspector/index.js +7 -10
- package/src/components/block-list/use-block-props/use-focus-handler.js +1 -1
- package/src/components/block-preview/style.scss +1 -1
- package/src/components/block-rename/modal.js +40 -12
- package/src/components/block-rename/rename-control.js +1 -53
- package/src/components/block-settings-menu/block-settings-dropdown.js +16 -2
- package/src/components/block-styles/preview.native.js +1 -1
- package/src/components/block-switcher/block-transformations-menu.js +9 -9
- package/src/components/block-switcher/block-variation-transformations.js +2 -2
- package/src/components/block-switcher/index.js +1 -1
- package/src/components/block-switcher/use-transformed-patterns.js +1 -1
- package/src/components/block-toolbar/index.native.js +2 -2
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/colors-gradients/style.scss +1 -0
- package/src/components/colors-gradients/test/control.js +2 -2
- package/src/components/date-format-picker/index.js +1 -1
- package/src/components/duotone-control/style.scss +2 -2
- package/src/components/global-styles/filters-panel.js +4 -2
- package/src/components/global-styles/image-settings-panel.js +2 -2
- package/src/components/global-styles/test/typography-utils.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +3 -3
- package/src/components/grid/grid-visualizer.js +10 -21
- package/src/components/grid/style.scss +1 -0
- package/src/components/grid/utils.js +6 -4
- package/src/components/iframe/get-compatibility-styles.js +1 -1
- package/src/components/iframe/index.js +1 -1
- package/src/components/image-size-control/index.js +6 -2
- package/src/components/inner-blocks/README.md +1 -1
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/src/components/inserter/menu.js +11 -9
- package/src/components/inserter/reusable-blocks-tab.native.js +1 -1
- package/src/components/inspector-controls-tabs/position-controls-panel.js +62 -27
- package/src/components/line-height-control/index.native.js +1 -1
- package/src/components/link-control/README.md +2 -2
- package/src/components/link-control/index.js +1 -1
- package/src/components/link-control/test/index.js +3 -3
- package/src/components/link-control/use-search-handler.js +1 -1
- package/src/components/list-view/README.md +1 -1
- package/src/components/list-view/block-select-button.js +5 -5
- package/src/components/list-view/style.scss +3 -7
- package/src/components/media-placeholder/content.scss +0 -8
- package/src/components/media-placeholder/index.js +1 -0
- package/src/components/media-placeholder/style.scss +7 -0
- package/src/components/observe-typing/index.js +1 -1
- package/src/components/provider/index.js +0 -1
- package/src/components/provider/use-block-sync.js +2 -2
- package/src/components/resolution-tool/stories/index.story.js +52 -2
- package/src/components/rich-text/README.md +1 -1
- package/src/components/rich-text/event-listeners/input-rules.js +3 -3
- package/src/components/rich-text/native/use-format-types.js +1 -1
- package/src/components/rich-text/use-format-types.js +1 -1
- package/src/components/spacing-sizes-control/README.md +93 -0
- package/src/components/spacing-sizes-control/index.js +44 -1
- package/src/components/spacing-sizes-control/linked-button.js +8 -10
- package/src/components/spacing-sizes-control/test/utils.js +0 -151
- package/src/components/spacing-sizes-control/utils.js +0 -106
- package/src/components/tabbed-sidebar/README.md +24 -13
- package/src/components/tabbed-sidebar/index.js +38 -0
- package/src/components/tabbed-sidebar/stories/index.story.js +104 -0
- package/src/components/typewriter/index.js +1 -1
- package/src/components/unit-control/README.md +1 -1
- package/src/components/unit-control/stories/index.story.js +124 -0
- package/src/components/url-popover/image-url-input-ui.js +3 -3
- package/src/components/use-block-commands/index.js +1 -1
- package/src/components/use-moving-animation/index.js +1 -1
- package/src/components/use-settings/README.md +1 -1
- package/src/components/warning/content.scss +1 -1
- package/src/components/writing-flow/test/index.js +1 -1
- package/src/hooks/color.scss +0 -7
- package/src/hooks/contrast-checker.js +64 -30
- package/src/hooks/custom-class-name.js +2 -1
- package/src/store/actions.js +1 -1
- package/src/store/selectors.js +20 -12
- package/src/store/test/private-selectors.js +1 -1
- package/src/store/test/selectors.js +3 -3
- package/src/style.scss +1 -0
- package/src/utils/test/sorting.js +1 -1
- package/src/utils/transform-styles/index.js +1 -1
- package/src/utils/use-notify-copy.js +51 -43
- package/tsconfig.json +1 -0
|
@@ -265,14 +265,14 @@ const ImageURLInputUI = ( {
|
|
|
265
265
|
<div className="block-editor-url-popover__expand-on-click">
|
|
266
266
|
<Icon icon={ fullscreen } />
|
|
267
267
|
<div className="text">
|
|
268
|
-
<p>{ __( '
|
|
268
|
+
<p>{ __( 'Enlarge on click' ) }</p>
|
|
269
269
|
<p className="description">
|
|
270
270
|
{ __( 'Scales the image with a lightbox effect' ) }
|
|
271
271
|
</p>
|
|
272
272
|
</div>
|
|
273
273
|
<Button
|
|
274
274
|
icon={ linkOff }
|
|
275
|
-
label={ __( 'Disable
|
|
275
|
+
label={ __( 'Disable enlarge on click' ) }
|
|
276
276
|
onClick={ () => {
|
|
277
277
|
onSetLightbox?.( false );
|
|
278
278
|
} }
|
|
@@ -372,7 +372,7 @@ const ImageURLInputUI = ( {
|
|
|
372
372
|
stopEditLink();
|
|
373
373
|
} }
|
|
374
374
|
>
|
|
375
|
-
{ __( '
|
|
375
|
+
{ __( 'Enlarge on click' ) }
|
|
376
376
|
</MenuItem>
|
|
377
377
|
) }
|
|
378
378
|
</NavigableMenu>
|
|
@@ -89,7 +89,7 @@ const getTransformCommands = () =>
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
// Simple block
|
|
92
|
+
// Simple block transformation based on the `Block Transforms` API.
|
|
93
93
|
function onBlockTransform( name ) {
|
|
94
94
|
const newBlocks = switchToBlockType( blocks, name );
|
|
95
95
|
replaceBlocks( clientIds, newBlocks );
|
|
@@ -96,7 +96,7 @@ function useMovingAnimation( { triggerAnimationOnChange, clientId } ) {
|
|
|
96
96
|
// motion, if the user is typing (insertion by Enter), or if the block
|
|
97
97
|
// count exceeds the threshold (insertion caused all the blocks that
|
|
98
98
|
// follow to animate).
|
|
99
|
-
// To do: consider
|
|
99
|
+
// To do: consider enabling the _moving_ animation even for large
|
|
100
100
|
// posts, while only disabling the _insertion_ animation?
|
|
101
101
|
const disableAnimation =
|
|
102
102
|
window.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
It does the lookup of the settings in the following order:
|
|
6
6
|
|
|
7
7
|
1. Third parties can provide the settings for the block using the filter `blockEditor.useSetting.before`.
|
|
8
|
-
2. If no third parties have provided this setting, then it looks up in the block instance
|
|
8
|
+
2. If no third parties have provided this setting, then it looks up in the block instance hierarchy starting from the current block and working its way upwards to its ancestors.
|
|
9
9
|
3. If that doesn't prove to be successful in getting a value, then it falls back to the settings from the block editor store.
|
|
10
10
|
4. If none of the above steps prove to be successful, then it's likely to be a deprecated setting and the deprecated setting is used instead.
|
|
11
11
|
|
|
@@ -50,7 +50,7 @@ describe( 'isNavigationCandidate', () => {
|
|
|
50
50
|
} );
|
|
51
51
|
} );
|
|
52
52
|
|
|
53
|
-
it( 'should return false if vertically navigating inputs with
|
|
53
|
+
it( 'should return false if vertically navigating inputs with vertical support like number', () => {
|
|
54
54
|
[ UP, DOWN ].forEach( ( keyCode ) => {
|
|
55
55
|
const result = isNavigationCandidate(
|
|
56
56
|
elements.inputNumber,
|
package/src/hooks/color.scss
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
.color-block-support-panel {
|
|
2
2
|
.block-editor-contrast-checker {
|
|
3
|
-
/**
|
|
4
|
-
* Contrast checkers are forced to the bottom of the panel so all
|
|
5
|
-
* injected color controls can appear as a single item group without
|
|
6
|
-
* the contrast checkers suddenly appearing between items.
|
|
7
|
-
*/
|
|
8
|
-
/* stylelint-disable-next-line property-disallowed-list -- This should be removed when https://github.com/WordPress/gutenberg/issues/58936 is fixed. */
|
|
9
|
-
order: 9999;
|
|
10
3
|
grid-column: span 2;
|
|
11
4
|
margin-top: $grid-unit-20;
|
|
12
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { useLayoutEffect, useReducer } from '@wordpress/element';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -9,52 +9,86 @@ import { useState, useEffect } from '@wordpress/element';
|
|
|
9
9
|
import ContrastChecker from '../components/contrast-checker';
|
|
10
10
|
import { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';
|
|
11
11
|
|
|
12
|
-
function
|
|
13
|
-
return node.ownerDocument.defaultView
|
|
12
|
+
function getComputedValue( node, property ) {
|
|
13
|
+
return node.ownerDocument.defaultView
|
|
14
|
+
.getComputedStyle( node )
|
|
15
|
+
.getPropertyValue( property );
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function getBlockElementColors( blockEl ) {
|
|
19
|
+
if ( ! blockEl ) {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const firstLinkElement = blockEl.querySelector( 'a' );
|
|
24
|
+
const linkColor = !! firstLinkElement?.innerText
|
|
25
|
+
? getComputedValue( firstLinkElement, 'color' )
|
|
26
|
+
: undefined;
|
|
27
|
+
|
|
28
|
+
const textColor = getComputedValue( blockEl, 'color' );
|
|
29
|
+
|
|
30
|
+
let backgroundColorNode = blockEl;
|
|
31
|
+
let backgroundColor = getComputedValue(
|
|
32
|
+
backgroundColorNode,
|
|
33
|
+
'background-color'
|
|
34
|
+
);
|
|
35
|
+
while (
|
|
36
|
+
backgroundColor === 'rgba(0, 0, 0, 0)' &&
|
|
37
|
+
backgroundColorNode.parentNode &&
|
|
38
|
+
backgroundColorNode.parentNode.nodeType ===
|
|
39
|
+
backgroundColorNode.parentNode.ELEMENT_NODE
|
|
40
|
+
) {
|
|
41
|
+
backgroundColorNode = backgroundColorNode.parentNode;
|
|
42
|
+
backgroundColor = getComputedValue(
|
|
43
|
+
backgroundColorNode,
|
|
44
|
+
'background-color'
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
textColor,
|
|
50
|
+
backgroundColor,
|
|
51
|
+
linkColor,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function reducer( prevColors, newColors ) {
|
|
56
|
+
const hasChanged = Object.keys( newColors ).some(
|
|
57
|
+
( key ) => prevColors[ key ] !== newColors[ key ]
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
// Do not re-render if the colors have not changed.
|
|
61
|
+
return hasChanged ? newColors : prevColors;
|
|
14
62
|
}
|
|
15
63
|
|
|
16
64
|
export default function BlockColorContrastChecker( { clientId } ) {
|
|
17
|
-
const [ detectedBackgroundColor, setDetectedBackgroundColor ] = useState();
|
|
18
|
-
const [ detectedColor, setDetectedColor ] = useState();
|
|
19
|
-
const [ detectedLinkColor, setDetectedLinkColor ] = useState();
|
|
20
65
|
const blockEl = useBlockElement( clientId );
|
|
66
|
+
const [ colors, setColors ] = useReducer( reducer, {} );
|
|
21
67
|
|
|
22
68
|
// There are so many things that can change the color of a block
|
|
23
69
|
// So we perform this check on every render.
|
|
24
|
-
|
|
70
|
+
useLayoutEffect( () => {
|
|
25
71
|
if ( ! blockEl ) {
|
|
26
72
|
return;
|
|
27
73
|
}
|
|
28
|
-
setDetectedColor( getComputedStyle( blockEl ).color );
|
|
29
|
-
|
|
30
|
-
const firstLinkElement = blockEl.querySelector( 'a' );
|
|
31
|
-
if ( firstLinkElement && !! firstLinkElement.innerText ) {
|
|
32
|
-
setDetectedLinkColor( getComputedStyle( firstLinkElement ).color );
|
|
33
|
-
}
|
|
34
74
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
getComputedStyle( backgroundColorNode ).backgroundColor;
|
|
38
|
-
while (
|
|
39
|
-
backgroundColor === 'rgba(0, 0, 0, 0)' &&
|
|
40
|
-
backgroundColorNode.parentNode &&
|
|
41
|
-
backgroundColorNode.parentNode.nodeType ===
|
|
42
|
-
backgroundColorNode.parentNode.ELEMENT_NODE
|
|
43
|
-
) {
|
|
44
|
-
backgroundColorNode = backgroundColorNode.parentNode;
|
|
45
|
-
backgroundColor =
|
|
46
|
-
getComputedStyle( backgroundColorNode ).backgroundColor;
|
|
75
|
+
function updateColors() {
|
|
76
|
+
setColors( getBlockElementColors( blockEl ) );
|
|
47
77
|
}
|
|
48
78
|
|
|
49
|
-
|
|
50
|
-
|
|
79
|
+
// Combine `useLayoutEffect` and two rAF calls to ensure that values are read
|
|
80
|
+
// after the current paint but before the next paint.
|
|
81
|
+
window.requestAnimationFrame( () =>
|
|
82
|
+
window.requestAnimationFrame( updateColors )
|
|
83
|
+
);
|
|
84
|
+
} );
|
|
51
85
|
|
|
52
86
|
return (
|
|
53
87
|
<ContrastChecker
|
|
54
|
-
backgroundColor={
|
|
55
|
-
textColor={
|
|
88
|
+
backgroundColor={ colors.backgroundColor }
|
|
89
|
+
textColor={ colors.textColor }
|
|
90
|
+
linkColor={ colors.linkColor }
|
|
56
91
|
enableAlphaChecker
|
|
57
|
-
linkColor={ detectedLinkColor }
|
|
58
92
|
/>
|
|
59
93
|
);
|
|
60
94
|
}
|
|
@@ -123,7 +123,8 @@ export function addTransforms( result, source, index, results ) {
|
|
|
123
123
|
// if source N does not exists we do nothing.
|
|
124
124
|
if ( source[ index ] ) {
|
|
125
125
|
const originClassName = source[ index ]?.attributes.className;
|
|
126
|
-
if
|
|
126
|
+
// Avoid overriding classes if the transformed block already includes them.
|
|
127
|
+
if ( originClassName && result.attributes.className === undefined ) {
|
|
127
128
|
return {
|
|
128
129
|
...result,
|
|
129
130
|
attributes: {
|
package/src/store/actions.js
CHANGED
|
@@ -1266,7 +1266,7 @@ export const mergeBlocks =
|
|
|
1266
1266
|
offset !== undefined &&
|
|
1267
1267
|
// We cannot restore text selection if the RichText identifier
|
|
1268
1268
|
// is not a defined block attribute key. This can be the case if the
|
|
1269
|
-
// fallback
|
|
1269
|
+
// fallback instance ID is used to store selection (and no RichText
|
|
1270
1270
|
// identifier is set), or when the identifier is wrong.
|
|
1271
1271
|
!! attributeDefinition;
|
|
1272
1272
|
|
package/src/store/selectors.js
CHANGED
|
@@ -1626,15 +1626,23 @@ const isBlockVisibleInTheInserter = (
|
|
|
1626
1626
|
Array.isArray( blockType.parent ) ? blockType.parent : []
|
|
1627
1627
|
).concat( Array.isArray( blockType.ancestor ) ? blockType.ancestor : [] );
|
|
1628
1628
|
if ( parents.length > 0 ) {
|
|
1629
|
-
const rootBlockName = getBlockName( state, rootClientId );
|
|
1630
1629
|
// This is an exception to the rule that says that all blocks are visible in the inserter.
|
|
1631
1630
|
// Blocks that require a given parent or ancestor are only visible if we're within that parent.
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1631
|
+
if ( parents.includes( 'core/post-content' ) ) {
|
|
1632
|
+
return true;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
let current = rootClientId;
|
|
1636
|
+
let hasParent = false;
|
|
1637
|
+
do {
|
|
1638
|
+
if ( parents.includes( getBlockName( state, current ) ) ) {
|
|
1639
|
+
hasParent = true;
|
|
1640
|
+
break;
|
|
1641
|
+
}
|
|
1642
|
+
current = state.blocks.parents.get( current );
|
|
1643
|
+
} while ( current );
|
|
1644
|
+
|
|
1645
|
+
return hasParent;
|
|
1638
1646
|
}
|
|
1639
1647
|
|
|
1640
1648
|
return true;
|
|
@@ -1958,7 +1966,7 @@ const canIncludeBlockTypeInInserter = ( state, blockType, rootClientId ) => {
|
|
|
1958
1966
|
};
|
|
1959
1967
|
|
|
1960
1968
|
/**
|
|
1961
|
-
* Return a function to be used to
|
|
1969
|
+
* Return a function to be used to transform a block variation to an inserter item
|
|
1962
1970
|
*
|
|
1963
1971
|
* @param {Object} state Global State
|
|
1964
1972
|
* @param {Object} item Denormalized inserter item
|
|
@@ -2021,7 +2029,7 @@ const calculateFrecency = ( time, count ) => {
|
|
|
2021
2029
|
/**
|
|
2022
2030
|
* Returns a function that accepts a block type and builds an item to be shown
|
|
2023
2031
|
* in a specific context. It's used for building items for Inserter and available
|
|
2024
|
-
* block
|
|
2032
|
+
* block Transforms list.
|
|
2025
2033
|
*
|
|
2026
2034
|
* @param {Object} state Editor state.
|
|
2027
2035
|
* @param {Object} options Options object for handling the building of a block type.
|
|
@@ -2522,7 +2530,7 @@ export const __experimentalGetAllowedPatterns = createRegistrySelector(
|
|
|
2522
2530
|
* or blocks transformations.
|
|
2523
2531
|
*
|
|
2524
2532
|
* @param {Object} state Editor state.
|
|
2525
|
-
* @param {string|string[]} blockNames Block's name or array of block names to find matching
|
|
2533
|
+
* @param {string|string[]} blockNames Block's name or array of block names to find matching patterns.
|
|
2526
2534
|
* @param {?string} rootClientId Optional target root client ID.
|
|
2527
2535
|
*
|
|
2528
2536
|
* @return {Array} The list of matched block patterns based on declared `blockTypes` and block name.
|
|
@@ -2941,7 +2949,7 @@ export const __unstableGetVisibleBlocks = createSelector(
|
|
|
2941
2949
|
);
|
|
2942
2950
|
|
|
2943
2951
|
export function __unstableHasActiveBlockOverlayActive( state, clientId ) {
|
|
2944
|
-
// Prevent overlay on blocks with a non-default editing mode. If the
|
|
2952
|
+
// Prevent overlay on blocks with a non-default editing mode. If the mode is
|
|
2945
2953
|
// 'disabled' then the overlay is redundant since the block can't be
|
|
2946
2954
|
// selected. If the mode is 'contentOnly' then the overlay is redundant
|
|
2947
2955
|
// since there will be no controls to interact with once selected.
|
|
@@ -3065,7 +3073,7 @@ export const getBlockEditingMode = createRegistrySelector(
|
|
|
3065
3073
|
return state.derivedNavModeBlockEditingModes.get( clientId );
|
|
3066
3074
|
}
|
|
3067
3075
|
|
|
3068
|
-
// In normal mode, consider that an
|
|
3076
|
+
// In normal mode, consider that an explicitly set editing mode takes over.
|
|
3069
3077
|
const blockEditingMode = state.blockEditingModes.get( clientId );
|
|
3070
3078
|
if ( blockEditingMode ) {
|
|
3071
3079
|
return blockEditingMode;
|
|
@@ -237,7 +237,7 @@ describe( 'private selectors', () => {
|
|
|
237
237
|
).toBe( false );
|
|
238
238
|
} );
|
|
239
239
|
|
|
240
|
-
it( 'should return false when top level block is disabled via
|
|
240
|
+
it( 'should return false when top level block is disabled via inheritance and there are non-disabled editing modes within it', () => {
|
|
241
241
|
const state = {
|
|
242
242
|
...baseState,
|
|
243
243
|
blockEditingModes: new Map( [
|
|
@@ -3534,7 +3534,7 @@ describe( 'selectors', () => {
|
|
|
3534
3534
|
beforeAll( () => {
|
|
3535
3535
|
registerBlockType( 'core/with-tranforms-a', {
|
|
3536
3536
|
category: 'text',
|
|
3537
|
-
title: '
|
|
3537
|
+
title: 'Transforms a',
|
|
3538
3538
|
edit: () => {},
|
|
3539
3539
|
save: () => {},
|
|
3540
3540
|
transforms: {
|
|
@@ -3563,7 +3563,7 @@ describe( 'selectors', () => {
|
|
|
3563
3563
|
} );
|
|
3564
3564
|
registerBlockType( 'core/with-tranforms-b', {
|
|
3565
3565
|
category: 'text',
|
|
3566
|
-
title: '
|
|
3566
|
+
title: 'Transforms b',
|
|
3567
3567
|
edit: () => {},
|
|
3568
3568
|
save: () => {},
|
|
3569
3569
|
transforms: {
|
|
@@ -3578,7 +3578,7 @@ describe( 'selectors', () => {
|
|
|
3578
3578
|
} );
|
|
3579
3579
|
registerBlockType( 'core/with-tranforms-c', {
|
|
3580
3580
|
category: 'text',
|
|
3581
|
-
title: '
|
|
3581
|
+
title: 'Transforms c',
|
|
3582
3582
|
edit: () => {},
|
|
3583
3583
|
save: () => {},
|
|
3584
3584
|
transforms: {
|
package/src/style.scss
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
@import "./components/justify-content-control/style.scss";
|
|
41
41
|
@import "./components/link-control/style.scss";
|
|
42
42
|
@import "./components/list-view/style.scss";
|
|
43
|
+
@import "./components/media-placeholder/style.scss";
|
|
43
44
|
@import "./components/media-replace-flow/style.scss";
|
|
44
45
|
@import "./components/multi-selection-inspector/style.scss";
|
|
45
46
|
@import "./components/responsive-block-control/style.scss";
|
|
@@ -37,7 +37,7 @@ describe( 'orderBy', () => {
|
|
|
37
37
|
expect( orderBy( input, 'x' ) ).toEqual( expected );
|
|
38
38
|
} );
|
|
39
39
|
|
|
40
|
-
it( 'should maintain original order of equal items in
|
|
40
|
+
it( 'should maintain original order of equal items in descending order', () => {
|
|
41
41
|
const a = { x: 1, a: 1 };
|
|
42
42
|
const b = { x: 1, b: 2 };
|
|
43
43
|
const c = { x: 0 };
|
|
@@ -160,7 +160,7 @@ function transformStyle(
|
|
|
160
160
|
/**
|
|
161
161
|
* @typedef {Object} EditorStyle
|
|
162
162
|
* @property {string} css the CSS block(s), as a single string.
|
|
163
|
-
* @property {?string} baseURL the base URL to be used as the reference when
|
|
163
|
+
* @property {?string} baseURL the base URL to be used as the reference when rewriting urls.
|
|
164
164
|
* @property {?string[]} ignoredSelectors the selectors not to wrap.
|
|
165
165
|
*/
|
|
166
166
|
|
|
@@ -17,47 +17,55 @@ export function useNotifyCopy() {
|
|
|
17
17
|
const { getBlockType } = useSelect( blocksStore );
|
|
18
18
|
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
19
19
|
|
|
20
|
-
return useCallback(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
20
|
+
return useCallback(
|
|
21
|
+
( eventType, selectedBlockClientIds ) => {
|
|
22
|
+
let notice = '';
|
|
23
|
+
|
|
24
|
+
if ( eventType === 'copyStyles' ) {
|
|
25
|
+
notice = __( 'Styles copied to clipboard.' );
|
|
26
|
+
} else if ( selectedBlockClientIds.length === 1 ) {
|
|
27
|
+
const clientId = selectedBlockClientIds[ 0 ];
|
|
28
|
+
const title = getBlockType( getBlockName( clientId ) )?.title;
|
|
29
|
+
|
|
30
|
+
if ( eventType === 'copy' ) {
|
|
31
|
+
notice = sprintf(
|
|
32
|
+
// Translators: Name of the block being copied, e.g. "Paragraph".
|
|
33
|
+
__( 'Copied "%s" to clipboard.' ),
|
|
34
|
+
title
|
|
35
|
+
);
|
|
36
|
+
} else {
|
|
37
|
+
notice = sprintf(
|
|
38
|
+
// Translators: Name of the block being cut, e.g. "Paragraph".
|
|
39
|
+
__( 'Moved "%s" to clipboard.' ),
|
|
40
|
+
title
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
} else if ( eventType === 'copy' ) {
|
|
44
|
+
notice = sprintf(
|
|
45
|
+
// Translators: %d: Number of blocks being copied.
|
|
46
|
+
_n(
|
|
47
|
+
'Copied %d block to clipboard.',
|
|
48
|
+
'Copied %d blocks to clipboard.',
|
|
49
|
+
selectedBlockClientIds.length
|
|
50
|
+
),
|
|
51
|
+
selectedBlockClientIds.length
|
|
52
|
+
);
|
|
53
|
+
} else {
|
|
54
|
+
notice = sprintf(
|
|
55
|
+
// Translators: %d: Number of blocks being moved.
|
|
56
|
+
_n(
|
|
57
|
+
'Moved %d block to clipboard.',
|
|
58
|
+
'Moved %d blocks to clipboard.',
|
|
59
|
+
selectedBlockClientIds.length
|
|
60
|
+
),
|
|
61
|
+
selectedBlockClientIds.length
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
createSuccessNotice( notice, {
|
|
66
|
+
type: 'snackbar',
|
|
67
|
+
} );
|
|
68
|
+
},
|
|
69
|
+
[ createSuccessNotice, getBlockName, getBlockType ]
|
|
70
|
+
);
|
|
63
71
|
}
|