@wordpress/block-editor 11.3.8 → 11.3.10

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 (44) hide show
  1. package/build/components/block-list/block-invalid-warning.js +3 -2
  2. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  3. package/build/components/inserter/block-patterns-tab.js +4 -2
  4. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  5. package/build/components/inserter/index.js +2 -1
  6. package/build/components/inserter/index.js.map +1 -1
  7. package/build/components/rich-text/index.js +2 -1
  8. package/build/components/rich-text/index.js.map +1 -1
  9. package/build/components/rich-text/use-input-rules.js +7 -3
  10. package/build/components/rich-text/use-input-rules.js.map +1 -1
  11. package/build/hooks/position.js +2 -2
  12. package/build/hooks/position.js.map +1 -1
  13. package/build/layouts/utils.js +3 -2
  14. package/build/layouts/utils.js.map +1 -1
  15. package/build/store/selectors.js +2 -2
  16. package/build/store/selectors.js.map +1 -1
  17. package/build-module/components/block-list/block-invalid-warning.js +3 -2
  18. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  19. package/build-module/components/inserter/block-patterns-tab.js +5 -2
  20. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  21. package/build-module/components/inserter/index.js +2 -1
  22. package/build-module/components/inserter/index.js.map +1 -1
  23. package/build-module/components/rich-text/index.js +2 -1
  24. package/build-module/components/rich-text/index.js.map +1 -1
  25. package/build-module/components/rich-text/use-input-rules.js +7 -3
  26. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  27. package/build-module/hooks/position.js +3 -3
  28. package/build-module/hooks/position.js.map +1 -1
  29. package/build-module/layouts/utils.js +3 -2
  30. package/build-module/layouts/utils.js.map +1 -1
  31. package/build-module/store/selectors.js +2 -2
  32. package/build-module/store/selectors.js.map +1 -1
  33. package/build-style/style-rtl.css +1 -0
  34. package/build-style/style.css +1 -0
  35. package/package.json +5 -5
  36. package/src/components/block-inspector/style.scss +3 -0
  37. package/src/components/block-list/block-invalid-warning.js +9 -2
  38. package/src/components/inserter/block-patterns-tab.js +4 -2
  39. package/src/components/inserter/index.js +1 -1
  40. package/src/components/rich-text/index.js +2 -1
  41. package/src/components/rich-text/use-input-rules.js +6 -2
  42. package/src/hooks/position.js +3 -3
  43. package/src/layouts/utils.js +2 -2
  44. package/src/store/selectors.js +2 -2
@@ -164,6 +164,7 @@
164
164
  .block-editor-block-inspector .components-panel__body {
165
165
  border: none;
166
166
  border-top: 1px solid #e0e0e0;
167
+ margin-top: -1px;
167
168
  }
168
169
  .block-editor-block-inspector .block-editor-block-card {
169
170
  padding: 16px;
@@ -164,6 +164,7 @@
164
164
  .block-editor-block-inspector .components-panel__body {
165
165
  border: none;
166
166
  border-top: 1px solid #e0e0e0;
167
+ margin-top: -1px;
167
168
  }
168
169
  .block-editor-block-inspector .block-editor-block-card {
169
170
  padding: 16px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "11.3.8",
3
+ "version": "11.3.10",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -37,7 +37,7 @@
37
37
  "@wordpress/api-fetch": "^6.23.1",
38
38
  "@wordpress/blob": "^3.26.1",
39
39
  "@wordpress/blocks": "^12.3.3",
40
- "@wordpress/components": "^23.3.6",
40
+ "@wordpress/components": "^23.3.7",
41
41
  "@wordpress/compose": "^6.3.3",
42
42
  "@wordpress/data": "^8.3.3",
43
43
  "@wordpress/date": "^4.26.2",
@@ -53,9 +53,9 @@
53
53
  "@wordpress/keyboard-shortcuts": "^4.3.3",
54
54
  "@wordpress/keycodes": "^3.26.2",
55
55
  "@wordpress/notices": "^3.26.3",
56
- "@wordpress/preferences": "^3.3.6",
56
+ "@wordpress/preferences": "^3.3.7",
57
57
  "@wordpress/private-apis": "^0.8.1",
58
- "@wordpress/rich-text": "^6.3.3",
58
+ "@wordpress/rich-text": "^6.3.4",
59
59
  "@wordpress/shortcode": "^3.26.1",
60
60
  "@wordpress/style-engine": "^1.9.1",
61
61
  "@wordpress/token-list": "^2.26.1",
@@ -83,5 +83,5 @@
83
83
  "publishConfig": {
84
84
  "access": "public"
85
85
  },
86
- "gitHead": "446428841b54f47e5373d6e9723ef7ec24cf11b3"
86
+ "gitHead": "6cf78aefb52e1ca38b58aa38a44a312b744f3310"
87
87
  }
@@ -27,6 +27,9 @@
27
27
  .components-panel__body {
28
28
  border: none;
29
29
  border-top: $border-width solid $gray-200;
30
+
31
+ // Ensures this PanelBody is treated like the ToolsPanel, removing double borders.
32
+ margin-top: -$border-width;
30
33
  }
31
34
 
32
35
  .block-editor-block-card {
@@ -23,6 +23,7 @@ export function BlockInvalidWarning( {
23
23
  block,
24
24
  } ) {
25
25
  const hasHTMLBlock = !! getBlockType( 'core/html' );
26
+ const hasClassicBlock = !! getBlockType( 'core/freeform' );
26
27
  const [ compare, setCompare ] = useState( false );
27
28
 
28
29
  const onCompare = useCallback( () => setCompare( true ), [] );
@@ -41,12 +42,18 @@ export function BlockInvalidWarning( {
41
42
  title: __( 'Convert to HTML' ),
42
43
  onClick: convertToHTML,
43
44
  },
44
- {
45
+ hasClassicBlock && {
45
46
  title: __( 'Convert to Classic Block' ),
46
47
  onClick: convertToClassic,
47
48
  },
48
49
  ].filter( Boolean ),
49
- [ onCompare, convertToHTML, convertToClassic ]
50
+ [
51
+ onCompare,
52
+ hasHTMLBlock,
53
+ convertToHTML,
54
+ hasClassicBlock,
55
+ convertToClassic,
56
+ ]
50
57
  );
51
58
 
52
59
  return (
@@ -28,7 +28,9 @@ import BlockPatternList from '../block-patterns-list';
28
28
  import PatternsExplorerModal from './block-patterns-explorer/explorer';
29
29
  import MobileTabNavigation from './mobile-tab-navigation';
30
30
 
31
- // Preffered order of pattern categories. Any other categories should
31
+ const noop = () => {};
32
+
33
+ // Preferred order of pattern categories. Any other categories should
32
34
  // be at the bottom without any re-ordering.
33
35
  const patternCategoriesOrder = [
34
36
  'featured',
@@ -148,7 +150,7 @@ export function BlockPatternsCategoryDialog( {
148
150
  export function BlockPatternsCategoryPanel( {
149
151
  rootClientId,
150
152
  onInsert,
151
- onHover,
153
+ onHover = noop,
152
154
  category,
153
155
  showTitlesAsTooltip,
154
156
  } ) {
@@ -214,7 +214,7 @@ class PrivateInserter extends Component {
214
214
  'block-editor-inserter__popover',
215
215
  { 'is-quick': isQuick }
216
216
  ) }
217
- popoverProps={ { position } }
217
+ popoverProps={ { position, shift: true } }
218
218
  onToggle={ this.onToggle }
219
219
  expandOnMobile
220
220
  headerTitle={ __( 'Add a block' ) }
@@ -281,6 +281,7 @@ function RichTextWrapper(
281
281
 
282
282
  const {
283
283
  value,
284
+ getValue,
284
285
  onChange,
285
286
  ref: richTextRef,
286
287
  } = useRichText( {
@@ -401,7 +402,7 @@ function RichTextWrapper(
401
402
  richTextRef,
402
403
  useBeforeInputRules( { value, onChange } ),
403
404
  useInputRules( {
404
- value,
405
+ getValue,
405
406
  onChange,
406
407
  __unstableAllowPrefixTransformations,
407
408
  formatTypes,
@@ -49,12 +49,15 @@ export function useInputRules( props ) {
49
49
  propsRef.current = props;
50
50
  return useRefEffect( ( element ) => {
51
51
  function inputRule() {
52
- const { value, onReplace, selectionChange } = propsRef.current;
52
+ const { getValue, onReplace, selectionChange } = propsRef.current;
53
53
 
54
54
  if ( ! onReplace ) {
55
55
  return;
56
56
  }
57
57
 
58
+ // We must use getValue() here because value may be update
59
+ // asynchronously.
60
+ const value = getValue();
58
61
  const { start, text } = value;
59
62
  const characterBefore = text.slice( start - 1, start );
60
63
 
@@ -91,7 +94,7 @@ export function useInputRules( props ) {
91
94
  function onInput( event ) {
92
95
  const { inputType, type } = event;
93
96
  const {
94
- value,
97
+ getValue,
95
98
  onChange,
96
99
  __unstableAllowPrefixTransformations,
97
100
  formatTypes,
@@ -106,6 +109,7 @@ export function useInputRules( props ) {
106
109
  inputRule();
107
110
  }
108
111
 
112
+ const value = getValue();
109
113
  const transformed = formatTypes.reduce(
110
114
  ( accumlator, { __unstableInputRule } ) => {
111
115
  if ( __unstableInputRule ) {
@@ -6,7 +6,7 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { __, sprintf } from '@wordpress/i18n';
9
+ import { __, _x, sprintf } from '@wordpress/i18n';
10
10
  import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
11
11
  import {
12
12
  BaseControl,
@@ -49,7 +49,7 @@ const DEFAULT_OPTION = {
49
49
  const STICKY_OPTION = {
50
50
  key: 'sticky',
51
51
  value: 'sticky',
52
- name: __( 'Sticky' ),
52
+ name: _x( 'Sticky', 'Name for the value of the CSS position property' ),
53
53
  className: OPTION_CLASSNAME,
54
54
  __experimentalHint: __(
55
55
  'The block will stick to the top of the window instead of scrolling.'
@@ -59,7 +59,7 @@ const STICKY_OPTION = {
59
59
  const FIXED_OPTION = {
60
60
  key: 'fixed',
61
61
  value: 'fixed',
62
- name: __( 'Fixed' ),
62
+ name: _x( 'Fixed', 'Name for the value of the CSS position property' ),
63
63
  className: OPTION_CLASSNAME,
64
64
  __experimentalHint: __(
65
65
  'The block will not move when the page is scrolled.'
@@ -83,10 +83,10 @@ export function getBlockGapCSS(
83
83
  * @return {Object} An object with contextual info per alignment.
84
84
  */
85
85
  export function getAlignmentsInfo( layout ) {
86
- const { contentSize, wideSize } = layout;
86
+ const { contentSize, wideSize, type = 'default' } = layout;
87
87
  const alignmentInfo = {};
88
88
  const sizeRegex = /^(?!0)\d+(px|em|rem|vw|vh|%)?$/i;
89
- if ( sizeRegex.test( contentSize ) ) {
89
+ if ( sizeRegex.test( contentSize ) && type === 'constrained' ) {
90
90
  // translators: %s: container size (i.e. 600px etc)
91
91
  alignmentInfo.none = sprintf( __( 'Max %s wide' ), contentSize );
92
92
  }
@@ -2806,12 +2806,12 @@ export function __unstableHasActiveBlockOverlayActive( state, clientId ) {
2806
2806
  }
2807
2807
 
2808
2808
  export function __unstableIsWithinBlockOverlay( state, clientId ) {
2809
- let parent = state.blocks.parents[ clientId ];
2809
+ let parent = state.blocks.parents.get( clientId );
2810
2810
  while ( !! parent ) {
2811
2811
  if ( __unstableHasActiveBlockOverlayActive( state, parent ) ) {
2812
2812
  return true;
2813
2813
  }
2814
- parent = state.blocks.parents[ parent ];
2814
+ parent = state.blocks.parents.get( parent );
2815
2815
  }
2816
2816
  return false;
2817
2817
  }