@wordpress/editor 14.33.3 → 14.33.5

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 (107) hide show
  1. package/build/bindings/post-data.js +47 -63
  2. package/build/bindings/post-data.js.map +3 -3
  3. package/build/bindings/post-meta.js +45 -39
  4. package/build/bindings/post-meta.js.map +2 -2
  5. package/build/components/collab-sidebar/add-comment.js +9 -5
  6. package/build/components/collab-sidebar/add-comment.js.map +2 -2
  7. package/build/components/collab-sidebar/comment-author-info.js +27 -15
  8. package/build/components/collab-sidebar/comment-author-info.js.map +2 -2
  9. package/build/components/collab-sidebar/comment-indicator-toolbar.js +9 -23
  10. package/build/components/collab-sidebar/comment-indicator-toolbar.js.map +3 -3
  11. package/build/components/collab-sidebar/comment-menu-item.js +36 -6
  12. package/build/components/collab-sidebar/comment-menu-item.js.map +3 -3
  13. package/build/components/collab-sidebar/comments.js +317 -301
  14. package/build/components/collab-sidebar/comments.js.map +3 -3
  15. package/build/components/collab-sidebar/hooks.js +5 -3
  16. package/build/components/collab-sidebar/hooks.js.map +2 -2
  17. package/build/components/collab-sidebar/index.js +35 -11
  18. package/build/components/collab-sidebar/index.js.map +3 -3
  19. package/build/components/collab-sidebar/utils.js +6 -3
  20. package/build/components/collab-sidebar/utils.js.map +2 -2
  21. package/build/components/editor/index.js +2 -2
  22. package/build/components/editor/index.js.map +3 -3
  23. package/build/components/more-menu/index.js +1 -1
  24. package/build/components/more-menu/index.js.map +2 -2
  25. package/build/components/visual-editor/index.js +20 -9
  26. package/build/components/visual-editor/index.js.map +2 -2
  27. package/build/store/private-actions.js +8 -0
  28. package/build/store/private-actions.js.map +2 -2
  29. package/build/store/private-selectors.js +5 -0
  30. package/build/store/private-selectors.js.map +2 -2
  31. package/build/store/reducer.js +10 -0
  32. package/build/store/reducer.js.map +2 -2
  33. package/build-module/bindings/post-data.js +47 -63
  34. package/build-module/bindings/post-data.js.map +2 -2
  35. package/build-module/bindings/post-meta.js +45 -39
  36. package/build-module/bindings/post-meta.js.map +2 -2
  37. package/build-module/components/collab-sidebar/add-comment.js +10 -6
  38. package/build-module/components/collab-sidebar/add-comment.js.map +2 -2
  39. package/build-module/components/collab-sidebar/comment-author-info.js +27 -15
  40. package/build-module/components/collab-sidebar/comment-author-info.js.map +2 -2
  41. package/build-module/components/collab-sidebar/comment-indicator-toolbar.js +15 -25
  42. package/build-module/components/collab-sidebar/comment-indicator-toolbar.js.map +2 -2
  43. package/build-module/components/collab-sidebar/comment-menu-item.js +40 -7
  44. package/build-module/components/collab-sidebar/comment-menu-item.js.map +2 -2
  45. package/build-module/components/collab-sidebar/comments.js +319 -302
  46. package/build-module/components/collab-sidebar/comments.js.map +2 -2
  47. package/build-module/components/collab-sidebar/hooks.js +5 -3
  48. package/build-module/components/collab-sidebar/hooks.js.map +2 -2
  49. package/build-module/components/collab-sidebar/index.js +35 -11
  50. package/build-module/components/collab-sidebar/index.js.map +2 -2
  51. package/build-module/components/collab-sidebar/utils.js +6 -3
  52. package/build-module/components/collab-sidebar/utils.js.map +2 -2
  53. package/build-module/components/editor/index.js +2 -2
  54. package/build-module/components/editor/index.js.map +2 -2
  55. package/build-module/components/more-menu/index.js +1 -1
  56. package/build-module/components/more-menu/index.js.map +2 -2
  57. package/build-module/components/visual-editor/index.js +20 -9
  58. package/build-module/components/visual-editor/index.js.map +2 -2
  59. package/build-module/store/private-actions.js +7 -0
  60. package/build-module/store/private-actions.js.map +2 -2
  61. package/build-module/store/private-selectors.js +4 -0
  62. package/build-module/store/private-selectors.js.map +2 -2
  63. package/build-module/store/reducer.js +9 -0
  64. package/build-module/store/reducer.js.map +2 -2
  65. package/build-style/style-rtl.css +6 -43
  66. package/build-style/style.css +6 -43
  67. package/build-types/bindings/post-data.d.ts +18 -8
  68. package/build-types/bindings/post-meta.d.ts +1 -7
  69. package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
  70. package/build-types/components/collab-sidebar/comment-author-info.d.ts +5 -16
  71. package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +1 -1
  72. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +1 -1
  73. package/build-types/components/collab-sidebar/comment-menu-item.d.ts +3 -2
  74. package/build-types/components/collab-sidebar/comment-menu-item.d.ts.map +1 -1
  75. package/build-types/components/collab-sidebar/comments.d.ts +1 -1
  76. package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
  77. package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
  78. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  79. package/build-types/components/collab-sidebar/utils.d.ts +2 -2
  80. package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
  81. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  82. package/build-types/store/private-actions.d.ts +7 -0
  83. package/build-types/store/private-actions.d.ts.map +1 -1
  84. package/build-types/store/private-selectors.d.ts +7 -0
  85. package/build-types/store/private-selectors.d.ts.map +1 -1
  86. package/build-types/store/reducer.d.ts +10 -0
  87. package/build-types/store/reducer.d.ts.map +1 -1
  88. package/package.json +8 -8
  89. package/src/bindings/post-data.js +63 -111
  90. package/src/bindings/post-meta.js +55 -46
  91. package/src/bindings/test/post-meta.js +211 -0
  92. package/src/components/collab-sidebar/add-comment.js +11 -6
  93. package/src/components/collab-sidebar/comment-author-info.js +33 -26
  94. package/src/components/collab-sidebar/comment-indicator-toolbar.js +19 -29
  95. package/src/components/collab-sidebar/comment-menu-item.js +51 -11
  96. package/src/components/collab-sidebar/comments.js +47 -27
  97. package/src/components/collab-sidebar/hooks.js +6 -4
  98. package/src/components/collab-sidebar/index.js +63 -27
  99. package/src/components/collab-sidebar/style.scss +6 -46
  100. package/src/components/collab-sidebar/utils.js +15 -5
  101. package/src/components/editor/index.js +1 -1
  102. package/src/components/more-menu/index.js +1 -1
  103. package/src/components/visual-editor/index.js +27 -6
  104. package/src/store/private-actions.js +13 -0
  105. package/src/store/private-selectors.js +10 -0
  106. package/src/store/reducer.js +16 -0
  107. package/tsconfig.tsbuildinfo +1 -1
@@ -114,6 +114,7 @@ function VisualEditor( {
114
114
  isDesignPostType,
115
115
  postType,
116
116
  isPreview,
117
+ canvasMinHeight,
117
118
  } = useSelect( ( select ) => {
118
119
  const {
119
120
  getCurrentPostId,
@@ -122,7 +123,8 @@ function VisualEditor( {
122
123
  getEditorSettings,
123
124
  getRenderingMode,
124
125
  getDeviceType,
125
- } = select( editorStore );
126
+ getCanvasMinHeight,
127
+ } = unlock( select( editorStore ) );
126
128
  const { getPostType, getEditedEntityRecord } = select( coreStore );
127
129
  const postTypeSlug = getCurrentPostType();
128
130
  const _renderingMode = getRenderingMode();
@@ -162,6 +164,7 @@ function VisualEditor( {
162
164
  isFocusedEntity: !! editorSettings.onNavigateToPreviousEntityRecord,
163
165
  postType: postTypeSlug,
164
166
  isPreview: editorSettings.isPreviewMode,
167
+ canvasMinHeight: getCanvasMinHeight(),
165
168
  };
166
169
  }, [] );
167
170
  const { isCleanNewPost } = useSelect( editorStore );
@@ -185,6 +188,7 @@ function VisualEditor( {
185
188
  };
186
189
  }, [] );
187
190
 
191
+ const localRef = useRef();
188
192
  const deviceStyles = useResizeCanvas( deviceType );
189
193
  const [ globalLayoutSettings ] = useSettings( 'layout' );
190
194
 
@@ -331,30 +335,47 @@ function VisualEditor( {
331
335
  // Disable resizing in zoomed-out mode.
332
336
  ! isZoomedOut;
333
337
 
338
+ // Calculate the minimum height including scroll offset to fit all notes.
339
+ const calculatedMinHeight = useMemo( () => {
340
+ if ( ! localRef.current ) {
341
+ return canvasMinHeight;
342
+ }
343
+
344
+ const { ownerDocument } = localRef.current;
345
+ const scrollTop =
346
+ ownerDocument.documentElement.scrollTop ||
347
+ ownerDocument.body.scrollTop;
348
+
349
+ return canvasMinHeight + scrollTop;
350
+ }, [ canvasMinHeight ] );
351
+
334
352
  const iframeStyles = useMemo( () => {
335
353
  return [
336
354
  ...( styles ?? [] ),
337
355
  {
338
356
  // Ensures margins of children are contained so that the body background paints behind them.
339
- // Otherwise, the background of html (when zoomed out) would show there and appear broken. Its
357
+ // Otherwise, the background of html (when zoomed out) would show there and appear broken. It's
340
358
  // important mostly for post-only views yet conceivably an issue in templated views too.
341
- css: `:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${
359
+ css: `:where(.block-editor-iframe__body){display:flow-root;${
360
+ calculatedMinHeight
361
+ ? `min-height:${ calculatedMinHeight }px;`
362
+ : ''
363
+ }}.is-root-container{display:flow-root;${
342
364
  // Some themes will have `min-height: 100vh` for the root container,
343
365
  // which isn't a requirement in auto resize mode.
344
366
  enableResizing ? 'min-height:0!important;' : ''
345
367
  }}
346
368
  ${
347
369
  enableResizing
348
- ? '.block-editor-iframe__html{background:var(--wp-editor-canvas-background);display:flex;align-items:center;justify-content:center;min-height:100vh;}.block-editor-iframe__body{width:100%;}'
370
+ ? `.block-editor-iframe__html{background:var(--wp-editor-canvas-background);display:flex;align-items:center;justify-content:center;min-height:100vh;}.block-editor-iframe__body{width:100%;}`
349
371
  : ''
350
372
  }`,
351
373
  // The CSS above centers the body content vertically when resizing is enabled and applies a background
352
374
  // color to the iframe HTML element to match the background color of the editor canvas.
353
375
  },
354
376
  ];
355
- }, [ styles, enableResizing ] );
377
+ }, [ styles, enableResizing, calculatedMinHeight ] );
356
378
 
357
- const localRef = useRef();
358
379
  const typewriterRef = useTypewriter();
359
380
  contentRef = useMergeRefs( [
360
381
  localRef,
@@ -526,3 +526,16 @@ export const setDefaultRenderingMode =
526
526
  .dispatch( preferencesStore )
527
527
  .set( 'core', 'renderingModes', newModes );
528
528
  };
529
+
530
+ /**
531
+ * Set the minimum height of the canvas.
532
+ *
533
+ * @param {number} minHeight
534
+ * @return {Object} Action object.
535
+ */
536
+ export function setCanvasMinHeight( minHeight ) {
537
+ return {
538
+ type: 'SET_CANVAS_MIN_HEIGHT',
539
+ minHeight,
540
+ };
541
+ }
@@ -270,3 +270,13 @@ export const getDefaultRenderingMode = createRegistrySelector(
270
270
  return defaultMode;
271
271
  }
272
272
  );
273
+
274
+ /**
275
+ * Get the canvas minimum height.
276
+ *
277
+ * @param {Object} state Global application state.
278
+ * @return {number} The canvas minimum height.
279
+ */
280
+ export function getCanvasMinHeight( state ) {
281
+ return state.canvasMinHeight;
282
+ }
@@ -384,6 +384,21 @@ export function publishSidebarActive( state = false, action ) {
384
384
  return state;
385
385
  }
386
386
 
387
+ /**
388
+ * Reducer for the canvas minimum height.
389
+ *
390
+ * @param {number} state Current state.
391
+ * @param {Object} action Dispatched action.
392
+ * @return {number} Updated state.
393
+ */
394
+ export function canvasMinHeight( state = 0, action ) {
395
+ switch ( action.type ) {
396
+ case 'SET_CANVAS_MIN_HEIGHT':
397
+ return action.minHeight;
398
+ }
399
+ return state;
400
+ }
401
+
387
402
  export default combineReducers( {
388
403
  postId,
389
404
  postType,
@@ -403,5 +418,6 @@ export default combineReducers( {
403
418
  listViewPanel,
404
419
  listViewToggleRef,
405
420
  publishSidebarActive,
421
+ canvasMinHeight,
406
422
  dataviews: dataviewsReducer,
407
423
  } );