@wordpress/block-editor 14.17.0 → 14.19.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/background-image-control/index.js +21 -11
  3. package/build/components/background-image-control/index.js.map +1 -1
  4. package/build/components/block-canvas/index.js +6 -3
  5. package/build/components/block-canvas/index.js.map +1 -1
  6. package/build/components/block-settings-menu/block-mode-toggle.js +3 -3
  7. package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  8. package/build/components/block-toolbar/use-has-block-toolbar.js +3 -12
  9. package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
  10. package/build/components/child-layout-control/index.js +1 -0
  11. package/build/components/child-layout-control/index.js.map +1 -1
  12. package/build/components/html-element-control/index.js +107 -0
  13. package/build/components/html-element-control/index.js.map +1 -0
  14. package/build/components/html-element-control/messages.js +25 -0
  15. package/build/components/html-element-control/messages.js.map +1 -0
  16. package/build/components/keyboard-shortcuts/index.js +2 -2
  17. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  18. package/build/components/media-placeholder/index.js +5 -5
  19. package/build/components/media-placeholder/index.js.map +1 -1
  20. package/build/components/rich-text/event-listeners/delete.js +1 -9
  21. package/build/components/rich-text/event-listeners/delete.js.map +1 -1
  22. package/build/components/use-resize-canvas/index.js +1 -1
  23. package/build/components/use-resize-canvas/index.js.map +1 -1
  24. package/build/hooks/duotone.js +1 -1
  25. package/build/hooks/duotone.js.map +1 -1
  26. package/build/hooks/typography.js +1 -1
  27. package/build/hooks/typography.js.map +1 -1
  28. package/build/private-apis.js +2 -0
  29. package/build/private-apis.js.map +1 -1
  30. package/build/private-apis.native.js +4 -1
  31. package/build/private-apis.native.js.map +1 -1
  32. package/build/store/actions.js +1 -1
  33. package/build/store/actions.js.map +1 -1
  34. package/build-module/components/background-image-control/index.js +21 -11
  35. package/build-module/components/background-image-control/index.js.map +1 -1
  36. package/build-module/components/block-canvas/index.js +6 -3
  37. package/build-module/components/block-canvas/index.js.map +1 -1
  38. package/build-module/components/block-settings-menu/block-mode-toggle.js +3 -3
  39. package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
  40. package/build-module/components/block-toolbar/use-has-block-toolbar.js +3 -12
  41. package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
  42. package/build-module/components/child-layout-control/index.js +1 -0
  43. package/build-module/components/child-layout-control/index.js.map +1 -1
  44. package/build-module/components/html-element-control/index.js +102 -0
  45. package/build-module/components/html-element-control/index.js.map +1 -0
  46. package/build-module/components/html-element-control/messages.js +19 -0
  47. package/build-module/components/html-element-control/messages.js.map +1 -0
  48. package/build-module/components/keyboard-shortcuts/index.js +2 -2
  49. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  50. package/build-module/components/media-placeholder/index.js +5 -5
  51. package/build-module/components/media-placeholder/index.js.map +1 -1
  52. package/build-module/components/rich-text/event-listeners/delete.js +1 -9
  53. package/build-module/components/rich-text/event-listeners/delete.js.map +1 -1
  54. package/build-module/components/use-resize-canvas/index.js +1 -1
  55. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  56. package/build-module/hooks/duotone.js +1 -1
  57. package/build-module/hooks/duotone.js.map +1 -1
  58. package/build-module/hooks/typography.js +1 -1
  59. package/build-module/hooks/typography.js.map +1 -1
  60. package/build-module/private-apis.js +2 -0
  61. package/build-module/private-apis.js.map +1 -1
  62. package/build-module/private-apis.native.js +3 -1
  63. package/build-module/private-apis.native.js.map +1 -1
  64. package/build-module/store/actions.js +1 -1
  65. package/build-module/store/actions.js.map +1 -1
  66. package/build-style/content-rtl.css +131 -9
  67. package/build-style/content.css +131 -9
  68. package/build-style/default-editor-styles-rtl.css +130 -9
  69. package/build-style/default-editor-styles.css +130 -9
  70. package/build-style/style-rtl.css +137 -11
  71. package/build-style/style.css +138 -11
  72. package/package.json +34 -34
  73. package/src/components/background-image-control/index.js +21 -13
  74. package/src/components/block-canvas/index.js +5 -3
  75. package/src/components/block-inspector/style.scss +4 -2
  76. package/src/components/block-list/content.scss +1 -0
  77. package/src/components/block-settings-menu/block-mode-toggle.js +3 -3
  78. package/src/components/block-settings-menu/test/block-mode-toggle.js +1 -1
  79. package/src/components/block-toolbar/use-has-block-toolbar.js +7 -13
  80. package/src/components/child-layout-control/index.js +1 -0
  81. package/src/components/html-element-control/index.js +109 -0
  82. package/src/components/html-element-control/messages.js +34 -0
  83. package/src/components/keyboard-shortcuts/index.js +2 -2
  84. package/src/components/media-placeholder/index.js +5 -5
  85. package/src/components/media-placeholder/style.scss +6 -0
  86. package/src/components/rich-text/README.md +1 -1
  87. package/src/components/rich-text/event-listeners/delete.js +1 -6
  88. package/src/components/url-popover/stories/index.story.js +9 -1
  89. package/src/components/use-resize-canvas/index.js +1 -1
  90. package/src/hooks/duotone.js +4 -3
  91. package/src/hooks/typography.js +5 -3
  92. package/src/private-apis.js +2 -0
  93. package/src/private-apis.native.js +2 -0
  94. package/src/store/actions.js +5 -1
  95. package/src/store/test/actions.js +122 -0
@@ -822,6 +822,7 @@ describe( 'actions', () => {
822
822
  const select = {
823
823
  getBlock: ( clientId ) =>
824
824
  [ blockA, blockB ].find( ( b ) => b.clientId === clientId ),
825
+ getBlockEditingMode: () => 'default',
825
826
  };
826
827
  const dispatch = Object.assign( jest.fn(), {
827
828
  selectBlock: jest.fn(),
@@ -873,6 +874,7 @@ describe( 'actions', () => {
873
874
  attributeKey: 'content',
874
875
  offset: 0,
875
876
  } ),
877
+ getBlockEditingMode: () => 'default',
876
878
  };
877
879
  const dispatch = Object.assign( jest.fn(), {
878
880
  replaceBlocks: jest.fn(),
@@ -943,6 +945,7 @@ describe( 'actions', () => {
943
945
  attributeKey: 'content',
944
946
  offset: 0,
945
947
  } ),
948
+ getBlockEditingMode: () => 'default',
946
949
  };
947
950
  const dispatch = Object.assign( jest.fn(), {
948
951
  replaceBlocks: jest.fn(),
@@ -1019,6 +1022,7 @@ describe( 'actions', () => {
1019
1022
  attributeKey: 'content2',
1020
1023
  offset: 0,
1021
1024
  } ),
1025
+ getBlockEditingMode: () => 'default',
1022
1026
  };
1023
1027
  const dispatch = Object.assign( jest.fn(), {
1024
1028
  replaceBlocks: jest.fn(),
@@ -1049,6 +1053,124 @@ describe( 'actions', () => {
1049
1053
  0
1050
1054
  );
1051
1055
  } );
1056
+
1057
+ it( 'should not merge the blocks if blockB editing mode is `disabled`', () => {
1058
+ registerBlockType( 'core/test-block', {
1059
+ attributes: {
1060
+ content: {},
1061
+ },
1062
+ merge( attributes, attributesToMerge ) {
1063
+ return {
1064
+ content:
1065
+ attributes.content +
1066
+ ' ' +
1067
+ attributesToMerge.content,
1068
+ };
1069
+ },
1070
+ save: noop,
1071
+ category: 'text',
1072
+ title: 'test block',
1073
+ } );
1074
+ const blockA = deepFreeze( {
1075
+ clientId: 'chicken',
1076
+ name: 'core/test-block',
1077
+ attributes: { content: 'chicken' },
1078
+ innerBlocks: [],
1079
+ } );
1080
+ const blockB = deepFreeze( {
1081
+ clientId: 'ribs',
1082
+ name: 'core/test-block',
1083
+ attributes: { content: 'ribs' },
1084
+ innerBlocks: [],
1085
+ } );
1086
+
1087
+ const modes = {
1088
+ chicken: 'default',
1089
+ ribs: 'disabled',
1090
+ };
1091
+
1092
+ const select = {
1093
+ getBlock: ( clientId ) =>
1094
+ [ blockA, blockB ].find( ( b ) => b.clientId === clientId ),
1095
+ getSelectionStart: () => ( {
1096
+ clientId: blockB.clientId,
1097
+ attributeKey: 'content',
1098
+ offset: 0,
1099
+ } ),
1100
+ getBlockEditingMode: ( clientId ) => modes[ clientId ],
1101
+ };
1102
+ const dispatch = Object.assign( jest.fn(), {
1103
+ replaceBlocks: jest.fn(),
1104
+ selectionChange: jest.fn(),
1105
+ } );
1106
+
1107
+ mergeBlocks(
1108
+ blockA.clientId,
1109
+ blockB.clientId
1110
+ )( { select, dispatch } );
1111
+
1112
+ expect( dispatch.selectionChange ).not.toHaveBeenCalled();
1113
+ expect( dispatch.replaceBlocks ).not.toHaveBeenCalled();
1114
+ } );
1115
+
1116
+ it( 'should not merge the blocks if blockA editing mode is `disabled`', () => {
1117
+ registerBlockType( 'core/test-block', {
1118
+ attributes: {
1119
+ content: {},
1120
+ },
1121
+ merge( attributes, attributesToMerge ) {
1122
+ return {
1123
+ content:
1124
+ attributes.content +
1125
+ ' ' +
1126
+ attributesToMerge.content,
1127
+ };
1128
+ },
1129
+ save: noop,
1130
+ category: 'text',
1131
+ title: 'test block',
1132
+ } );
1133
+ const blockA = deepFreeze( {
1134
+ clientId: 'chicken',
1135
+ name: 'core/test-block',
1136
+ attributes: { content: 'chicken' },
1137
+ innerBlocks: [],
1138
+ } );
1139
+ const blockB = deepFreeze( {
1140
+ clientId: 'ribs',
1141
+ name: 'core/test-block',
1142
+ attributes: { content: 'ribs' },
1143
+ innerBlocks: [],
1144
+ } );
1145
+
1146
+ const modes = {
1147
+ chicken: 'disabled',
1148
+ ribs: 'default',
1149
+ };
1150
+
1151
+ const select = {
1152
+ getBlock: ( clientId ) =>
1153
+ [ blockA, blockB ].find( ( b ) => b.clientId === clientId ),
1154
+ getSelectionStart: () => ( {
1155
+ clientId: blockB.clientId,
1156
+ attributeKey: 'content',
1157
+ offset: 0,
1158
+ } ),
1159
+ getBlockEditingMode: ( clientId ) => modes[ clientId ],
1160
+ };
1161
+ const dispatch = Object.assign( jest.fn(), {
1162
+ replaceBlocks: jest.fn(),
1163
+ selectionChange: jest.fn(),
1164
+ } );
1165
+
1166
+ mergeBlocks(
1167
+ blockA.clientId,
1168
+ blockB.clientId
1169
+ )( { select, dispatch } );
1170
+
1171
+ expect( dispatch.selectionChange ).not.toHaveBeenCalled();
1172
+ expect( dispatch.replaceBlocks ).not.toHaveBeenCalled();
1173
+ } );
1052
1174
  } );
1053
1175
 
1054
1176
  describe( 'validateBlocksToTemplate', () => {