@wordpress/block-library 9.8.5 → 9.8.7

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.
Files changed (33) hide show
  1. package/build/cover/edit/index.js +4 -2
  2. package/build/cover/edit/index.js.map +1 -1
  3. package/build/post-content/edit.js +29 -2
  4. package/build/post-content/edit.js.map +1 -1
  5. package/build/query/edit/inspector-controls/index.js +3 -3
  6. package/build/query/edit/inspector-controls/index.js.map +1 -1
  7. package/build-module/cover/edit/index.js +5 -3
  8. package/build-module/cover/edit/index.js.map +1 -1
  9. package/build-module/post-content/edit.js +31 -3
  10. package/build-module/post-content/edit.js.map +1 -1
  11. package/build-module/query/edit/inspector-controls/index.js +3 -3
  12. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  13. package/build-style/cover/editor-rtl.css +0 -1
  14. package/build-style/cover/editor.css +0 -1
  15. package/build-style/cover/style-rtl.css +4 -4
  16. package/build-style/cover/style.css +4 -4
  17. package/build-style/editor-rtl.css +2 -3
  18. package/build-style/editor.css +2 -3
  19. package/build-style/group/editor-rtl.css +2 -2
  20. package/build-style/group/editor.css +2 -2
  21. package/build-style/post-content/style-rtl.css +2 -4
  22. package/build-style/post-content/style.css +2 -4
  23. package/build-style/style-rtl.css +6 -8
  24. package/build-style/style.css +6 -8
  25. package/package.json +10 -10
  26. package/src/cover/edit/index.js +6 -2
  27. package/src/cover/editor.scss +0 -1
  28. package/src/cover/style.scss +1 -1
  29. package/src/group/editor.scss +2 -2
  30. package/src/image/index.php +1 -1
  31. package/src/post-content/edit.js +30 -1
  32. package/src/post-content/style.scss +2 -4
  33. package/src/query/edit/inspector-controls/index.js +5 -8
@@ -89,8 +89,6 @@
89
89
  /**
90
90
  * Reset the WP Admin page styles for Gutenberg-like pages.
91
91
  */
92
- .wp-block-post-content::after {
93
- content: "";
94
- display: table;
95
- clear: both;
92
+ .wp-block-post-content {
93
+ display: flow-root;
96
94
  }
@@ -653,7 +653,7 @@
653
653
  right: 0;
654
654
  bottom: 0;
655
655
  left: 0;
656
- z-index: 1;
656
+ z-index: 0;
657
657
  opacity: 0.5;
658
658
  }
659
659
  .wp-block-cover-image.has-background-dim.has-background-dim-10:not(.has-background-gradient)::before,
@@ -816,8 +816,8 @@
816
816
  }
817
817
  .wp-block-cover-image .wp-block-cover__inner-container,
818
818
  .wp-block-cover .wp-block-cover__inner-container {
819
+ position: relative;
819
820
  width: 100%;
820
- z-index: 1;
821
821
  color: inherit; direction: rtl;
822
822
  }
823
823
  .wp-block-cover-image.is-position-top-left,
@@ -933,11 +933,11 @@ video.wp-block-cover__video-background.is-repeated {
933
933
  }
934
934
 
935
935
  .wp-block-cover__video-background {
936
- z-index: 0;
936
+ z-index: -1;
937
937
  }
938
938
 
939
939
  .wp-block-cover__image-background {
940
- z-index: 0;
940
+ z-index: -1;
941
941
  }
942
942
 
943
943
  section.wp-block-cover-image h2,
@@ -2883,10 +2883,8 @@ p.has-text-align-left[style*="writing-mode:vertical-lr"] {
2883
2883
  margin-right: 0.5em;
2884
2884
  }
2885
2885
 
2886
- .wp-block-post-content::after {
2887
- content: "";
2888
- display: table;
2889
- clear: both;
2886
+ .wp-block-post-content {
2887
+ display: flow-root;
2890
2888
  }
2891
2889
 
2892
2890
  .wp-block-post-date {
@@ -659,7 +659,7 @@
659
659
  left: 0;
660
660
  bottom: 0;
661
661
  right: 0;
662
- z-index: 1;
662
+ z-index: 0;
663
663
  opacity: 0.5;
664
664
  }
665
665
  .wp-block-cover-image.has-background-dim.has-background-dim-10:not(.has-background-gradient)::before,
@@ -822,8 +822,8 @@
822
822
  }
823
823
  .wp-block-cover-image .wp-block-cover__inner-container,
824
824
  .wp-block-cover .wp-block-cover__inner-container {
825
+ position: relative;
825
826
  width: 100%;
826
- z-index: 1;
827
827
  color: inherit;
828
828
  /*rtl:raw: direction: rtl; */
829
829
  }
@@ -940,11 +940,11 @@ video.wp-block-cover__video-background.is-repeated {
940
940
  }
941
941
 
942
942
  .wp-block-cover__video-background {
943
- z-index: 0;
943
+ z-index: -1;
944
944
  }
945
945
 
946
946
  .wp-block-cover__image-background {
947
- z-index: 0;
947
+ z-index: -1;
948
948
  }
949
949
 
950
950
  section.wp-block-cover-image h2,
@@ -2913,10 +2913,8 @@ p.has-text-align-left[style*="writing-mode:vertical-lr"] {
2913
2913
  margin-left: 0.5em;
2914
2914
  }
2915
2915
 
2916
- .wp-block-post-content::after {
2917
- content: "";
2918
- display: table;
2919
- clear: both;
2916
+ .wp-block-post-content {
2917
+ display: flow-root;
2920
2918
  }
2921
2919
 
2922
2920
  .wp-block-post-date {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "9.8.5",
3
+ "version": "9.8.7",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -43,11 +43,11 @@
43
43
  "@wordpress/api-fetch": "^7.8.2",
44
44
  "@wordpress/autop": "^4.8.1",
45
45
  "@wordpress/blob": "^4.8.1",
46
- "@wordpress/block-editor": "^14.3.4",
46
+ "@wordpress/block-editor": "^14.3.6",
47
47
  "@wordpress/blocks": "^13.8.4",
48
- "@wordpress/components": "^28.8.4",
48
+ "@wordpress/components": "^28.8.6",
49
49
  "@wordpress/compose": "^7.8.3",
50
- "@wordpress/core-data": "^7.8.4",
50
+ "@wordpress/core-data": "^7.8.6",
51
51
  "@wordpress/data": "^10.8.3",
52
52
  "@wordpress/date": "^5.8.2",
53
53
  "@wordpress/deprecated": "^4.8.2",
@@ -58,17 +58,17 @@
58
58
  "@wordpress/html-entities": "^4.8.1",
59
59
  "@wordpress/i18n": "^5.8.2",
60
60
  "@wordpress/icons": "^10.8.2",
61
- "@wordpress/interactivity": "^6.8.2",
62
- "@wordpress/interactivity-router": "^2.8.3",
61
+ "@wordpress/interactivity": "^6.8.4",
62
+ "@wordpress/interactivity-router": "^2.8.5",
63
63
  "@wordpress/keyboard-shortcuts": "^5.8.3",
64
64
  "@wordpress/keycodes": "^4.8.2",
65
65
  "@wordpress/notices": "^5.8.3",
66
- "@wordpress/patterns": "^2.8.4",
66
+ "@wordpress/patterns": "^2.8.6",
67
67
  "@wordpress/primitives": "^4.8.1",
68
68
  "@wordpress/private-apis": "^1.8.1",
69
- "@wordpress/reusable-blocks": "^5.8.4",
69
+ "@wordpress/reusable-blocks": "^5.8.6",
70
70
  "@wordpress/rich-text": "^7.8.3",
71
- "@wordpress/server-side-render": "^5.8.4",
71
+ "@wordpress/server-side-render": "^5.8.6",
72
72
  "@wordpress/url": "^4.8.1",
73
73
  "@wordpress/viewport": "^6.8.3",
74
74
  "@wordpress/wordcount": "^4.8.1",
@@ -89,5 +89,5 @@
89
89
  "publishConfig": {
90
90
  "access": "public"
91
91
  },
92
- "gitHead": "07c75154341d1e5a1b8aaa1c226029b6666a52a9"
92
+ "gitHead": "b7af02f8431034ee19cdc33dd105d21705823eed"
93
93
  }
@@ -18,6 +18,7 @@ import {
18
18
  useInnerBlocksProps,
19
19
  __experimentalUseGradient,
20
20
  store as blockEditorStore,
21
+ useBlockEditingMode,
21
22
  } from '@wordpress/block-editor';
22
23
  import { __ } from '@wordpress/i18n';
23
24
  import { useSelect, useDispatch } from '@wordpress/data';
@@ -278,6 +279,9 @@ function CoverEdit( {
278
279
  const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
279
280
  const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
280
281
 
282
+ const blockEditingMode = useBlockEditingMode();
283
+ const hasNonContentControls = blockEditingMode === 'default';
284
+
281
285
  const [ resizeListener, { height, width } ] = useResizeObserver();
282
286
  const resizableBoxDimensions = useMemo( () => {
283
287
  return {
@@ -447,7 +451,7 @@ function CoverEdit( {
447
451
  <>
448
452
  { blockControls }
449
453
  { inspectorControls }
450
- { isSelected && (
454
+ { hasNonContentControls && isSelected && (
451
455
  <ResizableCoverPopover { ...resizableCoverProps } />
452
456
  ) }
453
457
  <TagName
@@ -576,7 +580,7 @@ function CoverEdit( {
576
580
  />
577
581
  <div { ...innerBlocksProps } />
578
582
  </TagName>
579
- { isSelected && (
583
+ { hasNonContentControls && isSelected && (
580
584
  <ResizableCoverPopover { ...resizableCoverProps } />
581
585
  ) }
582
586
  </>
@@ -42,7 +42,6 @@
42
42
  // Shown while media is being uploaded
43
43
  .components-spinner {
44
44
  position: absolute;
45
- z-index: z-index(".wp-block-cover__inner-container");
46
45
  top: 50%;
47
46
  left: 50%;
48
47
  transform: translate(-50%, -50%); // Account for spinner dimensions
@@ -95,8 +95,8 @@
95
95
  }
96
96
 
97
97
  .wp-block-cover__inner-container {
98
+ position: relative;
98
99
  width: 100%;
99
- z-index: z-index(".wp-block-cover__inner-container");
100
100
  color: inherit;
101
101
  // Reset the fixed LTR direction at the root of the block in RTL languages.
102
102
  /*rtl:raw: direction: rtl; */
@@ -39,9 +39,9 @@
39
39
  &::after {
40
40
  content: "";
41
41
  display: flex;
42
- flex: 1 0 $grid-unit-60;
42
+ flex: 1 0 $button-size-next-default-40px;
43
43
  pointer-events: none;
44
- min-height: $grid-unit-60 - $border-width - $border-width;
44
+ min-height: $button-size-next-default-40px - $border-width - $border-width;
45
45
  border: $border-width dashed currentColor;
46
46
  }
47
47
 
@@ -24,7 +24,7 @@ function render_block_core_image( $attributes, $content, $block ) {
24
24
 
25
25
  $p = new WP_HTML_Tag_Processor( $content );
26
26
 
27
- if ( ! $p->next_tag( 'img' ) || null === $p->get_attribute( 'src' ) ) {
27
+ if ( ! $p->next_tag( 'img' ) || ! $p->get_attribute( 'src' ) ) {
28
28
  return '';
29
29
  }
30
30
 
@@ -8,19 +8,24 @@ import {
8
8
  RecursionProvider,
9
9
  useHasRecursion,
10
10
  Warning,
11
+ __experimentalUseBlockPreview as useBlockPreview,
11
12
  } from '@wordpress/block-editor';
13
+ import { parse } from '@wordpress/blocks';
12
14
  import {
13
15
  useEntityProp,
14
16
  useEntityBlockEditor,
15
17
  store as coreStore,
16
18
  } from '@wordpress/core-data';
17
19
  import { useSelect } from '@wordpress/data';
20
+ import { useMemo } from '@wordpress/element';
21
+
18
22
  /**
19
23
  * Internal dependencies
20
24
  */
21
25
  import { useCanEditEntity } from '../utils/hooks';
22
26
 
23
27
  function ReadOnlyContent( {
28
+ parentLayout,
24
29
  layoutClassNames,
25
30
  userCanEdit,
26
31
  postType,
@@ -33,7 +38,28 @@ function ReadOnlyContent( {
33
38
  postId
34
39
  );
35
40
  const blockProps = useBlockProps( { className: layoutClassNames } );
36
- return content?.protected && ! userCanEdit ? (
41
+ const blocks = useMemo( () => {
42
+ return content?.raw ? parse( content.raw ) : [];
43
+ }, [ content?.raw ] );
44
+ const blockPreviewProps = useBlockPreview( {
45
+ blocks,
46
+ props: blockProps,
47
+ layout: parentLayout,
48
+ } );
49
+
50
+ if ( userCanEdit ) {
51
+ /*
52
+ * Rendering the block preview using the raw content blocks allows for
53
+ * block support styles to be generated and applied by the editor.
54
+ *
55
+ * The preview using the raw blocks can only be presented to users with
56
+ * edit permissions for the post to prevent potential exposure of private
57
+ * block content.
58
+ */
59
+ return <div { ...blockPreviewProps }></div>;
60
+ }
61
+
62
+ return content?.protected ? (
37
63
  <div { ...blockProps }>
38
64
  <Warning>{ __( 'This content is password protected.' ) }</Warning>
39
65
  </div>
@@ -96,6 +122,7 @@ function Content( props ) {
96
122
  <EditableContent { ...props } />
97
123
  ) : (
98
124
  <ReadOnlyContent
125
+ parentLayout={ props.parentLayout }
99
126
  layoutClassNames={ layoutClassNames }
100
127
  userCanEdit={ userCanEdit }
101
128
  postType={ postType }
@@ -141,6 +168,7 @@ function RecursionError() {
141
168
  export default function PostContentEdit( {
142
169
  context,
143
170
  __unstableLayoutClassNames: layoutClassNames,
171
+ __unstableParentLayout: parentLayout,
144
172
  } ) {
145
173
  const { postId: contextPostId, postType: contextPostType } = context;
146
174
  const hasAlreadyRendered = useHasRecursion( contextPostId );
@@ -154,6 +182,7 @@ export default function PostContentEdit( {
154
182
  { contextPostId && contextPostType ? (
155
183
  <Content
156
184
  context={ context }
185
+ parentLayout={ parentLayout }
157
186
  layoutClassNames={ layoutClassNames }
158
187
  />
159
188
  ) : (
@@ -1,5 +1,3 @@
1
- .wp-block-post-content::after {
2
- content: "";
3
- display: table;
4
- clear: both;
1
+ .wp-block-post-content {
2
+ display: flow-root;
5
3
  }
@@ -123,21 +123,18 @@ export default function QueryInspectorControls( props ) {
123
123
  const showInheritControl =
124
124
  isTemplate && isControlAllowed( allowedControls, 'inherit' );
125
125
  const showPostTypeControl =
126
- ( ! inherit && isControlAllowed( allowedControls, 'postType' ) ) ||
127
- ! isTemplate;
126
+ ! inherit && isControlAllowed( allowedControls, 'postType' );
128
127
  const postTypeControlLabel = __( 'Post type' );
129
128
  const postTypeControlHelp = __(
130
129
  'Select the type of content to display: posts, pages, or custom post types.'
131
130
  );
132
131
  const showColumnsControl = false;
133
132
  const showOrderControl =
134
- ( ! inherit && isControlAllowed( allowedControls, 'order' ) ) ||
135
- ! isTemplate;
133
+ ! inherit && isControlAllowed( allowedControls, 'order' );
136
134
  const showStickyControl =
137
- ( ! inherit &&
138
- showSticky &&
139
- isControlAllowed( allowedControls, 'sticky' ) ) ||
140
- ( showSticky && ! isTemplate );
135
+ ! inherit &&
136
+ showSticky &&
137
+ isControlAllowed( allowedControls, 'sticky' );
141
138
  const showSettingsPanel =
142
139
  showInheritControl ||
143
140
  showPostTypeControl ||