@wordpress/block-editor 5.2.10 → 5.2.13

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 (30) hide show
  1. package/build/components/block-compare/block-view.js +6 -7
  2. package/build/components/block-compare/block-view.js.map +1 -1
  3. package/build/components/block-compare/index.js +5 -15
  4. package/build/components/block-compare/index.js.map +1 -1
  5. package/build/components/block-list/block.js +4 -1
  6. package/build/components/block-list/block.js.map +1 -1
  7. package/build/components/block-list/insertion-point.js +12 -4
  8. package/build/components/block-list/insertion-point.js.map +1 -1
  9. package/build/components/inserter/block-types-tab.js +1 -1
  10. package/build/components/inserter/block-types-tab.js.map +1 -1
  11. package/build-module/components/block-compare/block-view.js +5 -6
  12. package/build-module/components/block-compare/block-view.js.map +1 -1
  13. package/build-module/components/block-compare/index.js +6 -16
  14. package/build-module/components/block-compare/index.js.map +1 -1
  15. package/build-module/components/block-list/block.js +5 -3
  16. package/build-module/components/block-list/block.js.map +1 -1
  17. package/build-module/components/block-list/insertion-point.js +12 -4
  18. package/build-module/components/block-list/insertion-point.js.map +1 -1
  19. package/build-module/components/inserter/block-types-tab.js +1 -1
  20. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  21. package/build-style/style-rtl.css +8 -0
  22. package/build-style/style.css +8 -0
  23. package/package.json +12 -12
  24. package/src/components/block-compare/block-view.js +6 -6
  25. package/src/components/block-compare/index.js +6 -19
  26. package/src/components/block-compare/test/__snapshots__/block-view.js.snap +3 -1
  27. package/src/components/block-list/block.js +6 -2
  28. package/src/components/block-list/insertion-point.js +16 -7
  29. package/src/components/inserter/block-types-tab.js +1 -1
  30. package/src/components/rich-text/style.scss +9 -0
@@ -12,10 +12,11 @@ import {
12
12
  createContext,
13
13
  useMemo,
14
14
  useCallback,
15
+ RawHTML,
15
16
  } from '@wordpress/element';
16
17
  import {
17
18
  getBlockType,
18
- getSaveElement,
19
+ getSaveContent,
19
20
  isReusableBlock,
20
21
  isUnmodifiedDefaultBlock,
21
22
  getUnregisteredTypeHandlerName,
@@ -35,6 +36,7 @@ import {
35
36
  ifCondition,
36
37
  useViewportMatch,
37
38
  } from '@wordpress/compose';
39
+ import { safeHTML } from '@wordpress/dom';
38
40
 
39
41
  /**
40
42
  * Internal dependencies
@@ -235,10 +237,12 @@ function BlockListBlock( {
235
237
  let block;
236
238
 
237
239
  if ( ! isValid ) {
240
+ const saveContent = getSaveContent( blockType, attributes );
241
+
238
242
  block = (
239
243
  <Block>
240
244
  <BlockInvalidWarning clientId={ clientId } />
241
- <div>{ getSaveElement( blockType, attributes ) }</div>
245
+ <RawHTML>{ safeHTML( saveContent ) }</RawHTML>
242
246
  </Block>
243
247
  );
244
248
  } else if ( mode === 'html' ) {
@@ -199,6 +199,18 @@ function InsertionPointPopover( {
199
199
  }
200
200
  }
201
201
 
202
+ // Only show the inserter when there's a `nextElement` (a block after the
203
+ // insertion point). At the end of the block list the trailing appender
204
+ // should serve the purpose of inserting blocks.
205
+ const showInsertionPointInserter =
206
+ ! isHidden && nextElement && ( isInserterShown || isInserterForced );
207
+
208
+ // Show the indicator if the insertion point inserter is visible, or if
209
+ // the `showInsertionPoint` state is `true`. The latter is generally true
210
+ // when hovering blocks for insertion in the block library.
211
+ const showInsertionPointIndicator =
212
+ showInsertionPointInserter || ( ! isHidden && showInsertionPoint );
213
+
202
214
  /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
203
215
  // While ideally it would be enough to capture the
204
216
  // bubbling focus event from the Inserter, due to the
@@ -223,13 +235,10 @@ function InsertionPointPopover( {
223
235
  className={ className }
224
236
  style={ style }
225
237
  >
226
- { ! isHidden &&
227
- ( showInsertionPoint ||
228
- isInserterShown ||
229
- isInserterForced ) && (
230
- <div className="block-editor-block-list__insertion-point-indicator" />
231
- ) }
232
- { ! isHidden && ( isInserterShown || isInserterForced ) && (
238
+ { showInsertionPointIndicator && (
239
+ <div className="block-editor-block-list__insertion-point-indicator" />
240
+ ) }
241
+ { showInsertionPointInserter && (
233
242
  <InsertionPointInserter
234
243
  rootClientId={ rootClientId }
235
244
  clientId={ nextClientId }
@@ -112,7 +112,7 @@ export function BlockTypesTab( {
112
112
  );
113
113
  } ) }
114
114
 
115
- { ! uncategorizedItems.length && (
115
+ { uncategorizedItems.length > 0 && (
116
116
  <InserterPanel
117
117
  className="block-editor-inserter__uncategorized-blocks-panel"
118
118
  title={ __( 'Uncategorized' ) }
@@ -65,3 +65,12 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
65
65
  padding-right: $grid-unit-15;
66
66
  }
67
67
  }
68
+
69
+ [data-rich-text-script] {
70
+ display: inline;
71
+
72
+ &::before {
73
+ content: "</>";
74
+ background: rgb(255, 255, 0);
75
+ }
76
+ }