@wordpress/editor 11.0.1 → 12.0.2

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 (241) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/build/components/autosave-monitor/index.js +5 -0
  4. package/build/components/autosave-monitor/index.js.map +1 -1
  5. package/build/components/character-count/index.js +1 -1
  6. package/build/components/character-count/index.js.map +1 -1
  7. package/build/components/editor-help/add-blocks.native.js +6 -5
  8. package/build/components/editor-help/add-blocks.native.js.map +1 -1
  9. package/build/components/editor-help/customize-blocks.native.js +7 -6
  10. package/build/components/editor-help/customize-blocks.native.js.map +1 -1
  11. package/build/components/editor-help/help-detail-navigation-screen.native.js +29 -15
  12. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  13. package/build/components/editor-help/help-get-support-button.native.js +46 -0
  14. package/build/components/editor-help/help-get-support-button.native.js.map +1 -0
  15. package/build/components/editor-help/help-topic-row.native.js +3 -2
  16. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  17. package/build/components/editor-help/index.native.js +87 -26
  18. package/build/components/editor-help/index.native.js.map +1 -1
  19. package/build/components/editor-help/intro-to-blocks.native.js +19 -9
  20. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  21. package/build/components/editor-help/move-blocks.native.js +6 -5
  22. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  23. package/build/components/editor-help/remove-blocks.native.js +6 -5
  24. package/build/components/editor-help/remove-blocks.native.js.map +1 -1
  25. package/build/components/editor-help/view-sections.native.js +23 -5
  26. package/build/components/editor-help/view-sections.native.js.map +1 -1
  27. package/build/components/entities-saved-states/entity-type-list.js +22 -13
  28. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  29. package/build/components/entities-saved-states/index.js +23 -4
  30. package/build/components/entities-saved-states/index.js.map +1 -1
  31. package/build/components/global-keyboard-shortcuts/save-shortcut.js +12 -14
  32. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  33. package/build/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +0 -4
  34. package/build/components/global-keyboard-shortcuts/visual-editor-shortcuts.js.map +1 -1
  35. package/build/components/index.js +9 -0
  36. package/build/components/index.js.map +1 -1
  37. package/build/components/local-autosave-monitor/index.js +1 -2
  38. package/build/components/local-autosave-monitor/index.js.map +1 -1
  39. package/build/components/post-format/index.js +3 -1
  40. package/build/components/post-format/index.js.map +1 -1
  41. package/build/components/post-locked-modal/index.js +1 -1
  42. package/build/components/post-locked-modal/index.js.map +1 -1
  43. package/build/components/post-saved-state/index.js +37 -46
  44. package/build/components/post-saved-state/index.js.map +1 -1
  45. package/build/components/post-taxonomies/flat-term-selector.js +154 -211
  46. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  47. package/build/components/post-title/index.js +53 -25
  48. package/build/components/post-title/index.js.map +1 -1
  49. package/build/components/provider/index.native.js +18 -7
  50. package/build/components/provider/index.native.js.map +1 -1
  51. package/build/components/provider/use-block-editor-settings.js +32 -5
  52. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  53. package/build/components/word-count/index.js +1 -1
  54. package/build/components/word-count/index.js.map +1 -1
  55. package/build/store/actions.js +13 -38
  56. package/build/store/actions.js.map +1 -1
  57. package/build/store/defaults.js +7 -2
  58. package/build/store/defaults.js.map +1 -1
  59. package/build/store/selectors.js +4 -93
  60. package/build/store/selectors.js.map +1 -1
  61. package/build/store/utils/notice-builder.js +15 -18
  62. package/build/store/utils/notice-builder.js.map +1 -1
  63. package/build/{store/utils → utils}/get-template-part-icon.js +1 -1
  64. package/build/utils/get-template-part-icon.js.map +1 -0
  65. package/build/utils/index.js +8 -0
  66. package/build/utils/index.js.map +1 -1
  67. package/build-module/components/autosave-monitor/index.js +5 -0
  68. package/build-module/components/autosave-monitor/index.js.map +1 -1
  69. package/build-module/components/character-count/index.js +1 -1
  70. package/build-module/components/character-count/index.js.map +1 -1
  71. package/build-module/components/editor-help/add-blocks.native.js +7 -6
  72. package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
  73. package/build-module/components/editor-help/customize-blocks.native.js +8 -7
  74. package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
  75. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +31 -18
  76. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  77. package/build-module/components/editor-help/help-get-support-button.native.js +34 -0
  78. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -0
  79. package/build-module/components/editor-help/help-topic-row.native.js +3 -2
  80. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  81. package/build-module/components/editor-help/index.native.js +81 -28
  82. package/build-module/components/editor-help/index.native.js.map +1 -1
  83. package/build-module/components/editor-help/intro-to-blocks.native.js +19 -10
  84. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  85. package/build-module/components/editor-help/move-blocks.native.js +7 -6
  86. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  87. package/build-module/components/editor-help/remove-blocks.native.js +7 -6
  88. package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
  89. package/build-module/components/editor-help/view-sections.native.js +22 -5
  90. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  91. package/build-module/components/entities-saved-states/entity-type-list.js +24 -13
  92. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  93. package/build-module/components/entities-saved-states/index.js +23 -4
  94. package/build-module/components/entities-saved-states/index.js.map +1 -1
  95. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +12 -14
  96. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  97. package/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +0 -4
  98. package/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js.map +1 -1
  99. package/build-module/components/index.js +1 -0
  100. package/build-module/components/index.js.map +1 -1
  101. package/build-module/components/local-autosave-monitor/index.js +1 -2
  102. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  103. package/build-module/components/post-format/index.js +4 -2
  104. package/build-module/components/post-format/index.js.map +1 -1
  105. package/build-module/components/post-locked-modal/index.js +1 -1
  106. package/build-module/components/post-locked-modal/index.js.map +1 -1
  107. package/build-module/components/post-saved-state/index.js +38 -46
  108. package/build-module/components/post-saved-state/index.js.map +1 -1
  109. package/build-module/components/post-taxonomies/flat-term-selector.js +156 -214
  110. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  111. package/build-module/components/post-title/index.js +53 -22
  112. package/build-module/components/post-title/index.js.map +1 -1
  113. package/build-module/components/provider/index.native.js +18 -7
  114. package/build-module/components/provider/index.native.js.map +1 -1
  115. package/build-module/components/provider/use-block-editor-settings.js +31 -5
  116. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  117. package/build-module/components/word-count/index.js +1 -1
  118. package/build-module/components/word-count/index.js.map +1 -1
  119. package/build-module/store/actions.js +13 -36
  120. package/build-module/store/actions.js.map +1 -1
  121. package/build-module/store/defaults.js +7 -2
  122. package/build-module/store/defaults.js.map +1 -1
  123. package/build-module/store/selectors.js +3 -85
  124. package/build-module/store/selectors.js.map +1 -1
  125. package/build-module/store/utils/notice-builder.js +15 -18
  126. package/build-module/store/utils/notice-builder.js.map +1 -1
  127. package/build-module/{store/utils → utils}/get-template-part-icon.js +2 -2
  128. package/build-module/utils/get-template-part-icon.js.map +1 -0
  129. package/build-module/utils/index.js +1 -0
  130. package/build-module/utils/index.js.map +1 -1
  131. package/build-style/style-rtl.css +9 -60
  132. package/build-style/style.css +9 -60
  133. package/package.json +28 -28
  134. package/src/components/autosave-monitor/index.js +5 -0
  135. package/src/components/autosave-monitor/test/index.js +10 -4
  136. package/src/components/character-count/index.js +3 -2
  137. package/src/components/editor-help/add-blocks.native.js +17 -12
  138. package/src/components/editor-help/customize-blocks.native.js +16 -13
  139. package/src/components/editor-help/help-detail-navigation-screen.native.js +45 -15
  140. package/src/components/editor-help/help-get-support-button.native.js +38 -0
  141. package/src/components/editor-help/help-topic-row.native.js +2 -2
  142. package/src/components/editor-help/images/add-dark.png +0 -0
  143. package/src/components/editor-help/images/add-dark@2x.png +0 -0
  144. package/src/components/editor-help/images/add-dark@3x.png +0 -0
  145. package/src/components/editor-help/images/add-light.png +0 -0
  146. package/src/components/editor-help/images/add-light@2x.png +0 -0
  147. package/src/components/editor-help/images/add-light@3x.png +0 -0
  148. package/src/components/editor-help/images/block-layout-collage.png +0 -0
  149. package/src/components/editor-help/images/block-layout-collage@2x.png +0 -0
  150. package/src/components/editor-help/images/block-layout-collage@3x.png +0 -0
  151. package/src/components/editor-help/images/build-layouts-dark.png +0 -0
  152. package/src/components/editor-help/images/build-layouts-dark@2x.png +0 -0
  153. package/src/components/editor-help/images/build-layouts-dark@3x.png +0 -0
  154. package/src/components/editor-help/images/build-layouts-light.png +0 -0
  155. package/src/components/editor-help/images/build-layouts-light@2x.png +0 -0
  156. package/src/components/editor-help/images/build-layouts-light@3x.png +0 -0
  157. package/src/components/editor-help/images/edit-media-dark.png +0 -0
  158. package/src/components/editor-help/images/edit-media-dark@2x.png +0 -0
  159. package/src/components/editor-help/images/edit-media-dark@3x.png +0 -0
  160. package/src/components/editor-help/images/edit-media-light.png +0 -0
  161. package/src/components/editor-help/images/edit-media-light@2x.png +0 -0
  162. package/src/components/editor-help/images/edit-media-light@3x.png +0 -0
  163. package/src/components/editor-help/images/embed-media-dark.png +0 -0
  164. package/src/components/editor-help/images/embed-media-dark@2x.png +0 -0
  165. package/src/components/editor-help/images/embed-media-dark@3x.png +0 -0
  166. package/src/components/editor-help/images/embed-media-light.png +0 -0
  167. package/src/components/editor-help/images/embed-media-light@2x.png +0 -0
  168. package/src/components/editor-help/images/embed-media-light@3x.png +0 -0
  169. package/src/components/editor-help/images/move-dark.png +0 -0
  170. package/src/components/editor-help/images/move-dark@2x.png +0 -0
  171. package/src/components/editor-help/images/move-dark@3x.png +0 -0
  172. package/src/components/editor-help/images/move-light.png +0 -0
  173. package/src/components/editor-help/images/move-light@2x.png +0 -0
  174. package/src/components/editor-help/images/move-light@3x.png +0 -0
  175. package/src/components/editor-help/images/options-dark.png +0 -0
  176. package/src/components/editor-help/images/options-dark@2x.png +0 -0
  177. package/src/components/editor-help/images/options-dark@3x.png +0 -0
  178. package/src/components/editor-help/images/options-light.png +0 -0
  179. package/src/components/editor-help/images/options-light@2x.png +0 -0
  180. package/src/components/editor-help/images/options-light@3x.png +0 -0
  181. package/src/components/editor-help/images/rich-text-dark.png +0 -0
  182. package/src/components/editor-help/images/rich-text-dark@2x.png +0 -0
  183. package/src/components/editor-help/images/rich-text-dark@3x.png +0 -0
  184. package/src/components/editor-help/images/rich-text-light.png +0 -0
  185. package/src/components/editor-help/images/rich-text-light@2x.png +0 -0
  186. package/src/components/editor-help/images/rich-text-light@3x.png +0 -0
  187. package/src/components/editor-help/images/settings-dark.png +0 -0
  188. package/src/components/editor-help/images/settings-dark@2x.png +0 -0
  189. package/src/components/editor-help/images/settings-dark@3x.png +0 -0
  190. package/src/components/editor-help/images/settings-light.png +0 -0
  191. package/src/components/editor-help/images/settings-light@2x.png +0 -0
  192. package/src/components/editor-help/images/settings-light@3x.png +0 -0
  193. package/src/components/editor-help/index.native.js +147 -43
  194. package/src/components/editor-help/intro-to-blocks.native.js +63 -43
  195. package/src/components/editor-help/move-blocks.native.js +12 -7
  196. package/src/components/editor-help/remove-blocks.native.js +11 -8
  197. package/src/components/editor-help/style.android.scss +6 -0
  198. package/src/components/editor-help/style.ios.scss +6 -0
  199. package/src/components/editor-help/style.scss +49 -32
  200. package/src/components/editor-help/test/index.native.js +80 -0
  201. package/src/components/editor-help/view-sections.native.js +47 -4
  202. package/src/components/entities-saved-states/entity-type-list.js +29 -10
  203. package/src/components/entities-saved-states/index.js +38 -8
  204. package/src/components/global-keyboard-shortcuts/save-shortcut.js +34 -42
  205. package/src/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +8 -16
  206. package/src/components/index.js +1 -0
  207. package/src/components/local-autosave-monitor/index.js +1 -3
  208. package/src/components/post-format/index.js +6 -2
  209. package/src/components/post-format/style.scss +1 -0
  210. package/src/components/post-locked-modal/index.js +1 -1
  211. package/src/components/post-saved-state/index.js +41 -55
  212. package/src/components/post-saved-state/style.scss +10 -1
  213. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +20 -0
  214. package/src/components/post-saved-state/test/index.js +2 -2
  215. package/src/components/post-taxonomies/flat-term-selector.js +220 -254
  216. package/src/components/post-title/index.js +47 -30
  217. package/src/components/post-title/style.scss +1 -70
  218. package/src/components/provider/index.native.js +17 -5
  219. package/src/components/provider/use-block-editor-settings.js +25 -2
  220. package/src/components/word-count/index.js +3 -2
  221. package/src/store/actions.js +13 -41
  222. package/src/store/defaults.js +7 -2
  223. package/src/store/selectors.js +2 -112
  224. package/src/store/test/actions.js +4 -2
  225. package/src/store/utils/notice-builder.js +17 -19
  226. package/src/store/utils/test/notice-builder.js +1 -1
  227. package/src/{store/utils → utils}/get-template-part-icon.js +2 -2
  228. package/src/utils/index.js +1 -0
  229. package/build/store/utils/get-template-part-icon.js.map +0 -1
  230. package/build-module/store/utils/get-template-part-icon.js.map +0 -1
  231. package/src/components/editor-help/images/add-blocks.png +0 -0
  232. package/src/components/editor-help/images/customize-blocks.png +0 -0
  233. package/src/components/editor-help/images/cut-copy-duplicate-blocks.png +0 -0
  234. package/src/components/editor-help/images/edit-or-replace-media.png +0 -0
  235. package/src/components/editor-help/images/intro-blocks-1.png +0 -0
  236. package/src/components/editor-help/images/intro-blocks-2.png +0 -0
  237. package/src/components/editor-help/images/intro-blocks-3.png +0 -0
  238. package/src/components/editor-help/images/intro-blocks-4.png +0 -0
  239. package/src/components/editor-help/images/move-blocks.png +0 -0
  240. package/src/components/editor-help/images/remove-blocks.png +0 -0
  241. package/src/components/editor-help/images/what-is-a-block.png +0 -0
@@ -1,76 +1,7 @@
1
1
  .editor-post-title {
2
2
  position: relative;
3
3
 
4
- .editor-post-title__input {
5
- display: block;
6
- width: 100%;
7
- margin: 0;
8
- box-shadow: none;
9
- background: transparent;
10
- transition: border 0.1s ease-out, box-shadow 0.1s linear;
11
- @include reduce-motion("transition");
12
- padding: #{ $block-padding + 5px } 0;
13
- word-break: keep-all;
14
-
15
- // Inherit the styles set by the theme.
16
- font-family: inherit;
17
- color: inherit;
18
-
19
- // Stack borders on mobile.
20
- border: $border-width solid transparent;
21
- border-left-width: 0;
22
- border-right-width: 0;
23
- border-radius: 0;
24
-
25
- // Include transparent outline for Windows High Contrast mode.
26
- outline: $border-width solid transparent;
27
-
28
- @include break-small() {
29
- border-width: $border-width;
30
- }
31
-
32
- // Match h1 heading.
33
- font-size: 2.44em;
34
- font-weight: 800;
35
- line-height: 1.4;
36
-
37
- &::-webkit-input-placeholder {
38
- color: $dark-gray-placeholder;
39
- }
40
-
41
- &::-moz-placeholder {
42
- color: $dark-gray-placeholder;
43
- // Override Firefox default.
44
- opacity: 1;
45
- }
46
-
47
- &:-ms-input-placeholder {
48
- color: $dark-gray-placeholder;
49
- }
50
-
51
- .is-dark-theme & {
52
- &::-webkit-input-placeholder {
53
- color: $light-gray-placeholder;
54
- }
55
-
56
- &::-moz-placeholder {
57
- opacity: 1; // Necessary because Firefox reduces this from 1.
58
- color: $light-gray-placeholder;
59
- }
60
-
61
- &:-ms-input-placeholder {
62
- color: $light-gray-placeholder;
63
- }
64
- }
65
-
66
- &:focus {
67
- border: $border-width solid transparent;
68
- outline: $border-width solid transparent;
69
- box-shadow: none;
70
- }
71
- }
72
-
73
- &.is-focus-mode .editor-post-title__input {
4
+ &.is-focus-mode {
74
5
  opacity: 0.5;
75
6
  transition: opacity 0.1s linear;
76
7
  @include reduce-motion("transition");
@@ -54,6 +54,7 @@ const postTypeEntities = [
54
54
  mergedEdits: {
55
55
  meta: true,
56
56
  },
57
+ rawAttributes: [ 'title', 'excerpt', 'content' ],
57
58
  } ) );
58
59
  import { EditorHelpTopics } from '@wordpress/editor';
59
60
 
@@ -89,11 +90,18 @@ class NativeEditorProvider extends Component {
89
90
  }
90
91
 
91
92
  componentDidMount() {
92
- const { capabilities, updateSettings } = this.props;
93
+ const {
94
+ capabilities,
95
+ locale,
96
+ updateSettings,
97
+ galleryWithImageBlocks,
98
+ } = this.props;
93
99
 
94
100
  updateSettings( {
95
101
  ...capabilities,
102
+ ...{ __unstableGalleryWithImageBlocks: galleryWithImageBlocks },
96
103
  ...this.getThemeColors( this.props ),
104
+ locale,
97
105
  } );
98
106
 
99
107
  this.subscriptionParentGetHtml = subscribeParentGetHtml( () => {
@@ -142,8 +150,13 @@ class NativeEditorProvider extends Component {
142
150
 
143
151
  this.subscriptionParentUpdateEditorSettings = subscribeUpdateEditorSettings(
144
152
  ( editorSettings ) => {
145
- const themeColors = this.getThemeColors( editorSettings );
146
- updateSettings( themeColors );
153
+ updateSettings( {
154
+ ...{
155
+ __unstableGalleryWithImageBlocks:
156
+ editorSettings.galleryWithImageBlocks,
157
+ },
158
+ ...this.getThemeColors( editorSettings ),
159
+ } );
147
160
  }
148
161
  );
149
162
 
@@ -160,8 +173,6 @@ class NativeEditorProvider extends Component {
160
173
  );
161
174
 
162
175
  this.subscriptionParentShowEditorHelp = subscribeShowEditorHelp( () => {
163
- // Temporary: feature hidden from production. This is just here for testing
164
- // purposes and will be replaced with actual logic in a later PR.
165
176
  this.setState( { isHelpVisible: true } );
166
177
  } );
167
178
 
@@ -333,6 +344,7 @@ class NativeEditorProvider extends Component {
333
344
  <EditorHelpTopics
334
345
  isVisible={ this.state.isHelpVisible }
335
346
  onClose={ () => this.setState( { isHelpVisible: false } ) }
347
+ close={ () => this.setState( { isHelpVisible: false } ) }
336
348
  />
337
349
  </>
338
350
  );
@@ -13,6 +13,7 @@ import {
13
13
  __experimentalFetchLinkSuggestions as fetchLinkSuggestions,
14
14
  __experimentalFetchUrlData as fetchUrlData,
15
15
  } from '@wordpress/core-data';
16
+ import { __ } from '@wordpress/i18n';
16
17
 
17
18
  /**
18
19
  * Internal dependencies
@@ -33,6 +34,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
33
34
  reusableBlocks,
34
35
  hasUploadPermissions,
35
36
  canUseUnfilteredHTML,
37
+ userCanCreatePages,
36
38
  } = useSelect( ( select ) => {
37
39
  const { canUserUseUnfilteredHTML } = select( editorStore );
38
40
  const isWeb = Platform.OS === 'web';
@@ -61,11 +63,30 @@ function useBlockEditorSettings( settings, hasTemplate ) {
61
63
  ),
62
64
  hasResolvedLocalSiteData: hasFinishedResolvingSiteData,
63
65
  baseUrl: siteData?.url || '',
66
+ userCanCreatePages: canUser( 'create', 'pages' ),
64
67
  };
65
68
  }, [] );
66
69
 
67
70
  const { undo } = useDispatch( editorStore );
68
71
 
72
+ const { saveEntityRecord } = useDispatch( coreStore );
73
+
74
+ /**
75
+ * Creates a Post entity.
76
+ * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.
77
+ *
78
+ * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.
79
+ * @return {Object} the post type object that was created.
80
+ */
81
+ const createPageEntity = ( options ) => {
82
+ if ( ! userCanCreatePages ) {
83
+ return Promise.reject( {
84
+ message: __( 'You do not have permission to create Pages.' ),
85
+ } );
86
+ }
87
+ return saveEntityRecord( 'postType', 'page', options );
88
+ };
89
+
69
90
  return useMemo(
70
91
  () => ( {
71
92
  ...pick( settings, [
@@ -73,10 +94,9 @@ function useBlockEditorSettings( settings, hasTemplate ) {
73
94
  '__experimentalBlockPatternCategories',
74
95
  '__experimentalBlockPatterns',
75
96
  '__experimentalFeatures',
76
- '__experimentalGlobalStylesBaseStyles',
77
- '__experimentalGlobalStylesUserEntityId',
78
97
  '__experimentalPreferredStyleVariations',
79
98
  '__experimentalSetIsInserterOpened',
99
+ '__unstableGalleryWithImageBlocks',
80
100
  'alignWide',
81
101
  'allowedBlockTypes',
82
102
  'bodyPlaceholder',
@@ -116,6 +136,8 @@ function useBlockEditorSettings( settings, hasTemplate ) {
116
136
  __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
117
137
  __experimentalUndo: undo,
118
138
  outlineMode: hasTemplate,
139
+ __experimentalCreatePageEntity: createPageEntity,
140
+ __experimentalUserCanCreatePages: userCanCreatePages,
119
141
  } ),
120
142
  [
121
143
  settings,
@@ -124,6 +146,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
124
146
  canUseUnfilteredHTML,
125
147
  undo,
126
148
  hasTemplate,
149
+ userCanCreatePages,
127
150
  ]
128
151
  );
129
152
  }
@@ -11,8 +11,9 @@ import { count as wordCount } from '@wordpress/wordcount';
11
11
  import { store as editorStore } from '../../store';
12
12
 
13
13
  export default function WordCount() {
14
- const content = useSelect( ( select ) =>
15
- select( editorStore ).getEditedPostAttribute( 'content' )
14
+ const content = useSelect(
15
+ ( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),
16
+ []
16
17
  );
17
18
 
18
19
  /*
@@ -100,34 +100,6 @@ export function resetPost( post ) {
100
100
  };
101
101
  }
102
102
 
103
- /**
104
- * Returns an action object used in signalling that the latest autosave of the
105
- * post has been received, by initialization or autosave.
106
- *
107
- * @deprecated since 5.6. Callers should use the `receiveAutosaves( postId, autosave )`
108
- * selector from the '@wordpress/core-data' package.
109
- *
110
- * @param {Object} newAutosave Autosave post object.
111
- *
112
- * @return {Object} Action object.
113
- */
114
- export function* resetAutosave( newAutosave ) {
115
- deprecated( 'resetAutosave action (`core/editor` store)', {
116
- since: '5.3',
117
- alternative: 'receiveAutosaves action (`core` store)',
118
- } );
119
-
120
- const postId = yield controls.select( STORE_NAME, 'getCurrentPostId' );
121
- yield controls.dispatch(
122
- coreStore.name,
123
- 'receiveAutosaves',
124
- postId,
125
- newAutosave
126
- );
127
-
128
- return { type: '__INERT__' };
129
- }
130
-
131
103
  /**
132
104
  * Action for dispatching that a post update request has started.
133
105
  *
@@ -200,7 +172,7 @@ export function setupEditorState( post ) {
200
172
  export function* editPost( edits, options ) {
201
173
  const { id, type } = yield controls.select( STORE_NAME, 'getCurrentPost' );
202
174
  yield controls.dispatch(
203
- coreStore.name,
175
+ coreStore,
204
176
  'editEntityRecord',
205
177
  'postType',
206
178
  type,
@@ -236,7 +208,7 @@ export function* savePost( options = {} ) {
236
208
  edits = {
237
209
  id: previousRecord.id,
238
210
  ...( yield controls.select(
239
- coreStore.name,
211
+ coreStore,
240
212
  'getEntityRecordNonTransientEdits',
241
213
  'postType',
242
214
  previousRecord.type,
@@ -245,7 +217,7 @@ export function* savePost( options = {} ) {
245
217
  ...edits,
246
218
  };
247
219
  yield controls.dispatch(
248
- coreStore.name,
220
+ coreStore,
249
221
  'saveEntityRecord',
250
222
  'postType',
251
223
  previousRecord.type,
@@ -255,7 +227,7 @@ export function* savePost( options = {} ) {
255
227
  yield __experimentalRequestPostUpdateFinish( options );
256
228
 
257
229
  const error = yield controls.select(
258
- coreStore.name,
230
+ coreStore,
259
231
  'getLastEntitySaveError',
260
232
  'postType',
261
233
  previousRecord.type,
@@ -283,7 +255,7 @@ export function* savePost( options = {} ) {
283
255
  previousPost: previousRecord,
284
256
  post: updatedRecord,
285
257
  postType: yield controls.resolveSelect(
286
- coreStore.name,
258
+ coreStore,
287
259
  'getPostType',
288
260
  updatedRecord.type
289
261
  ),
@@ -300,7 +272,7 @@ export function* savePost( options = {} ) {
300
272
  // considered for change detection.
301
273
  if ( ! options.isAutosave ) {
302
274
  yield controls.dispatch(
303
- blockEditorStore.name,
275
+ blockEditorStore,
304
276
  '__unstableMarkLastChangeAsPersistent'
305
277
  );
306
278
  }
@@ -317,7 +289,7 @@ export function* refreshPost() {
317
289
  'getCurrentPostType'
318
290
  );
319
291
  const postType = yield controls.resolveSelect(
320
- coreStore.name,
292
+ coreStore,
321
293
  'getPostType',
322
294
  postTypeSlug
323
295
  );
@@ -340,7 +312,7 @@ export function* trashPost() {
340
312
  'getCurrentPostType'
341
313
  );
342
314
  const postType = yield controls.resolveSelect(
343
- coreStore.name,
315
+ coreStore,
344
316
  'getPostType',
345
317
  postTypeSlug
346
318
  );
@@ -419,7 +391,7 @@ export function* autosave( { local = false, ...options } = {} ) {
419
391
  * @yield {Object} Action object.
420
392
  */
421
393
  export function* redo() {
422
- yield controls.dispatch( coreStore.name, 'redo' );
394
+ yield controls.dispatch( coreStore, 'redo' );
423
395
  }
424
396
 
425
397
  /**
@@ -428,7 +400,7 @@ export function* redo() {
428
400
  * @yield {Object} Action object.
429
401
  */
430
402
  export function* undo() {
431
- yield controls.dispatch( coreStore.name, 'undo' );
403
+ yield controls.dispatch( coreStore, 'undo' );
432
404
  }
433
405
 
434
406
  /**
@@ -608,7 +580,7 @@ export function* resetEditorBlocks( blocks, options = {} ) {
608
580
  );
609
581
  const noChange =
610
582
  ( yield controls.select(
611
- coreStore.name,
583
+ coreStore,
612
584
  'getEditedEntityRecord',
613
585
  'postType',
614
586
  type,
@@ -616,7 +588,7 @@ export function* resetEditorBlocks( blocks, options = {} ) {
616
588
  ) ).blocks === edits.blocks;
617
589
  if ( noChange ) {
618
590
  return yield controls.dispatch(
619
- coreStore.name,
591
+ coreStore,
620
592
  '__unstableCreateUndoLevel',
621
593
  'postType',
622
594
  type,
@@ -658,7 +630,7 @@ const getBlockEditorAction = ( name ) =>
658
630
  alternative:
659
631
  "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
660
632
  } );
661
- yield controls.dispatch( blockEditorStore.name, name, ...args );
633
+ yield controls.dispatch( blockEditorStore, name, ...args );
662
634
  };
663
635
 
664
636
  /**
@@ -14,7 +14,12 @@ export const PREFERENCES_DEFAULTS = {
14
14
  * allowedBlockTypes boolean|Array Allowed block types
15
15
  * richEditingEnabled boolean Whether rich editing is enabled or not
16
16
  * codeEditingEnabled boolean Whether code editing is enabled or not
17
- * enableCustomFields boolean Whether the WordPress custom fields are enabled or not
17
+ * enableCustomFields boolean Whether the WordPress custom fields are enabled or not.
18
+ * true = the user has opted to show the Custom Fields panel at the bottom of the editor.
19
+ * false = the user has opted to hide the Custom Fields panel at the bottom of the editor.
20
+ * undefined = the current environment does not support Custom Fields,
21
+ * so the option toggle in Preferences -> Panels to
22
+ * enable the Custom Fields panel is not displayed.
18
23
  * autosaveInterval number Autosave Interval
19
24
  * availableTemplates array? The available post templates
20
25
  * disablePostFormats boolean Whether or not the post formats are disabled
@@ -27,6 +32,6 @@ export const EDITOR_SETTINGS_DEFAULTS = {
27
32
 
28
33
  richEditingEnabled: true,
29
34
  codeEditingEnabled: true,
30
- enableCustomFields: false,
35
+ enableCustomFields: undefined,
31
36
  supportsLayout: true,
32
37
  };
@@ -1,16 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import {
5
- find,
6
- get,
7
- has,
8
- isString,
9
- pick,
10
- mapValues,
11
- includes,
12
- some,
13
- } from 'lodash';
4
+ import { find, get, has, isString, includes, some } from 'lodash';
14
5
  import createSelector from 'rememo';
15
6
 
16
7
  /**
@@ -19,7 +10,6 @@ import createSelector from 'rememo';
19
10
  import {
20
11
  getFreeformContentHandlerName,
21
12
  getDefaultBlockName,
22
- isUnmodifiedDefaultBlock,
23
13
  __unstableSerializeAndClean,
24
14
  } from '@wordpress/blocks';
25
15
  import { isInTheFuture, getDate } from '@wordpress/date';
@@ -43,7 +33,7 @@ import {
43
33
  } from './constants';
44
34
  import { getPostRawValue } from './reducer';
45
35
  import { cleanForSlug } from '../utils/url';
46
- import { getTemplatePartIcon } from './utils/get-template-part-icon';
36
+ import { getTemplatePartIcon } from '../utils/get-template-part-icon';
47
37
 
48
38
  /**
49
39
  * Shared reference to an empty object for cases where it is important to avoid
@@ -678,63 +668,6 @@ export const isEditedPostAutosaveable = createRegistrySelector(
678
668
  }
679
669
  );
680
670
 
681
- /**
682
- * Returns the current autosave, or null if one is not set (i.e. if the post
683
- * has yet to be autosaved, or has been saved or published since the last
684
- * autosave).
685
- *
686
- * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )`
687
- * selector from the '@wordpress/core-data' package.
688
- *
689
- * @param {Object} state Editor state.
690
- *
691
- * @return {?Object} Current autosave, if exists.
692
- */
693
- export const getAutosave = createRegistrySelector( ( select ) => ( state ) => {
694
- deprecated( "`wp.data.select( 'core/editor' ).getAutosave()`", {
695
- since: '5.3',
696
- alternative:
697
- "`wp.data.select( 'core' ).getAutosave( postType, postId, userId )`",
698
- } );
699
-
700
- const postType = getCurrentPostType( state );
701
- const postId = getCurrentPostId( state );
702
- const currentUserId = get( select( coreStore ).getCurrentUser(), [ 'id' ] );
703
- const autosave = select( coreStore ).getAutosave(
704
- postType,
705
- postId,
706
- currentUserId
707
- );
708
- return mapValues( pick( autosave, AUTOSAVE_PROPERTIES ), getPostRawValue );
709
- } );
710
-
711
- /**
712
- * Returns the true if there is an existing autosave, otherwise false.
713
- *
714
- * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector
715
- * from the '@wordpress/core-data' package and check for a truthy value.
716
- *
717
- * @param {Object} state Global application state.
718
- *
719
- * @return {boolean} Whether there is an existing autosave.
720
- */
721
- export const hasAutosave = createRegistrySelector( ( select ) => ( state ) => {
722
- deprecated( "`wp.data.select( 'core/editor' ).hasAutosave()`", {
723
- since: '5.3',
724
- alternative:
725
- "`!! wp.data.select( 'core' ).getAutosave( postType, postId, userId )`",
726
- } );
727
-
728
- const postType = getCurrentPostType( state );
729
- const postId = getCurrentPostId( state );
730
- const currentUserId = get( select( coreStore ).getCurrentUser(), [ 'id' ] );
731
- return !! select( coreStore ).getAutosave(
732
- postType,
733
- postId,
734
- currentUserId
735
- );
736
- } );
737
-
738
671
  /**
739
672
  * Return true if the post being edited is being scheduled. Preferring the
740
673
  * unsaved status values.
@@ -975,42 +908,6 @@ export function getSuggestedPostFormat( state ) {
975
908
  }
976
909
  }
977
910
 
978
- /**
979
- * Returns a set of blocks which are to be used in consideration of the post's
980
- * generated save content.
981
- *
982
- * @deprecated since Gutenberg 6.2.0.
983
- *
984
- * @param {Object} state Editor state.
985
- *
986
- * @return {WPBlock[]} Filtered set of blocks for save.
987
- */
988
- export function getBlocksForSerialization( state ) {
989
- deprecated( '`core/editor` getBlocksForSerialization selector', {
990
- since: '5.3',
991
- alternative: 'getEditorBlocks',
992
- hint: 'Blocks serialization pre-processing occurs at save time',
993
- } );
994
-
995
- const blocks = state.editor.present.blocks.value;
996
-
997
- // WARNING: Any changes to the logic of this function should be verified
998
- // against the implementation of isEditedPostEmpty, which bypasses this
999
- // function for performance' sake, in an assumption of this current logic
1000
- // being irrelevant to the optimized condition of emptiness.
1001
-
1002
- // A single unmodified default block is assumed to be equivalent to an
1003
- // empty post.
1004
- const isSingleUnmodifiedDefaultBlock =
1005
- blocks.length === 1 && isUnmodifiedDefaultBlock( blocks[ 0 ] );
1006
-
1007
- if ( isSingleUnmodifiedDefaultBlock ) {
1008
- return [];
1009
- }
1010
-
1011
- return blocks;
1012
- }
1013
-
1014
911
  /**
1015
912
  * Returns the content of the post being edited.
1016
913
  *
@@ -1394,13 +1291,6 @@ export const getBlock = getBlockEditorSelector( 'getBlock' );
1394
1291
  */
1395
1292
  export const getBlocks = getBlockEditorSelector( 'getBlocks' );
1396
1293
 
1397
- /**
1398
- * @see __unstableGetBlockWithoutInnerBlocks in core/block-editor store.
1399
- */
1400
- export const __unstableGetBlockWithoutInnerBlocks = getBlockEditorSelector(
1401
- '__unstableGetBlockWithoutInnerBlocks'
1402
- );
1403
-
1404
1294
  /**
1405
1295
  * @see getClientIdsOfDescendants in core/block-editor store.
1406
1296
  */
@@ -188,13 +188,15 @@ describe( 'Post generator actions', () => {
188
188
  'yields an action for dispatching a success notice',
189
189
  () => true,
190
190
  () => {
191
- if ( ! isAutosave && currentPostStatus === 'publish' ) {
191
+ if ( ! isAutosave ) {
192
192
  const { value } = fulfillment.next( postType );
193
193
  expect( value ).toEqual(
194
194
  controls.dispatch(
195
195
  noticesStore,
196
196
  'createSuccessNotice',
197
- 'Updated Post',
197
+ currentPostStatus === 'publish'
198
+ ? 'Updated Post'
199
+ : 'Saved',
198
200
  {
199
201
  actions: [],
200
202
  id: 'SAVE_POST_NOTICE_ID',
@@ -35,9 +35,11 @@ export function getNotificationArgumentsForSaveSuccess( data ) {
35
35
  let noticeMessage;
36
36
  let shouldShowLink = get( postType, [ 'viewable' ], false );
37
37
 
38
+ // Always should a notice, which will be spoken for accessibility.
38
39
  if ( ! isPublished && ! willPublish ) {
39
40
  // If saving a non-published post, don't show notice.
40
- noticeMessage = null;
41
+ noticeMessage = __( 'Saved' );
42
+ shouldShowLink = false;
41
43
  } else if ( isPublished && ! willPublish ) {
42
44
  // If undoing publish status, show specific notice
43
45
  noticeMessage = postType.labels.item_reverted_to_draft;
@@ -55,25 +57,21 @@ export function getNotificationArgumentsForSaveSuccess( data ) {
55
57
  noticeMessage = postType.labels.item_updated;
56
58
  }
57
59
 
58
- if ( noticeMessage ) {
59
- const actions = [];
60
- if ( shouldShowLink ) {
61
- actions.push( {
62
- label: postType.labels.view_item,
63
- url: post.link,
64
- } );
65
- }
66
- return [
67
- noticeMessage,
68
- {
69
- id: SAVE_POST_NOTICE_ID,
70
- type: 'snackbar',
71
- actions,
72
- },
73
- ];
60
+ const actions = [];
61
+ if ( shouldShowLink ) {
62
+ actions.push( {
63
+ label: postType.labels.view_item,
64
+ url: post.link,
65
+ } );
74
66
  }
75
-
76
- return [];
67
+ return [
68
+ noticeMessage,
69
+ {
70
+ id: SAVE_POST_NOTICE_ID,
71
+ type: 'snackbar',
72
+ actions,
73
+ },
74
+ ];
77
75
  }
78
76
 
79
77
  /**
@@ -34,7 +34,7 @@ describe( 'getNotificationArgumentsForSaveSuccess()', () => {
34
34
  [
35
35
  'when previous post is not published and post will not be published',
36
36
  [ 'draft', 'draft', false ],
37
- [],
37
+ [ 'Saved', defaultExpectedAction ],
38
38
  ],
39
39
  [
40
40
  'when previous post is published and post will be unpublished',
@@ -5,7 +5,7 @@ import {
5
5
  header as headerIcon,
6
6
  footer as footerIcon,
7
7
  sidebar as sidebarIcon,
8
- layout as layoutIcon,
8
+ symbolFilled as symbolFilledIcon,
9
9
  } from '@wordpress/icons';
10
10
  /**
11
11
  * Helper function to retrieve the corresponding icon by name.
@@ -22,5 +22,5 @@ export function getTemplatePartIcon( iconName ) {
22
22
  } else if ( 'sidebar' === iconName ) {
23
23
  return sidebarIcon;
24
24
  }
25
- return layoutIcon;
25
+ return symbolFilledIcon;
26
26
  }
@@ -5,3 +5,4 @@ import mediaUpload from './media-upload';
5
5
 
6
6
  export { mediaUpload };
7
7
  export { cleanForSlug } from './url.js';
8
+ export { getTemplatePartIcon } from './get-template-part-icon';
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/editor/src/store/utils/get-template-part-icon.js"],"names":["getTemplatePartIcon","iconName","headerIcon","footerIcon","sidebarIcon","layoutIcon"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAT,CAA8BC,QAA9B,EAAyC;AAC/C,MAAK,aAAaA,QAAlB,EAA6B;AAC5B,WAAOC,aAAP;AACA,GAFD,MAEO,IAAK,aAAaD,QAAlB,EAA6B;AACnC,WAAOE,aAAP;AACA,GAFM,MAEA,IAAK,cAAcF,QAAnB,EAA8B;AACpC,WAAOG,cAAP;AACA;;AACD,SAAOC,aAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\theader as headerIcon,\n\tfooter as footerIcon,\n\tsidebar as sidebarIcon,\n\tlayout as layoutIcon,\n} from '@wordpress/icons';\n/**\n * Helper function to retrieve the corresponding icon by name.\n *\n * @param {string} iconName The name of the icon.\n *\n * @return {Object} The corresponding icon.\n */\nexport function getTemplatePartIcon( iconName ) {\n\tif ( 'header' === iconName ) {\n\t\treturn headerIcon;\n\t} else if ( 'footer' === iconName ) {\n\t\treturn footerIcon;\n\t} else if ( 'sidebar' === iconName ) {\n\t\treturn sidebarIcon;\n\t}\n\treturn layoutIcon;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/editor/src/store/utils/get-template-part-icon.js"],"names":["header","headerIcon","footer","footerIcon","sidebar","sidebarIcon","layout","layoutIcon","getTemplatePartIcon","iconName"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,MAAM,IAAIC,UADX,EAECC,MAAM,IAAIC,UAFX,EAGCC,OAAO,IAAIC,WAHZ,EAICC,MAAM,IAAIC,UAJX,QAKO,kBALP;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mBAAT,CAA8BC,QAA9B,EAAyC;AAC/C,MAAK,aAAaA,QAAlB,EAA6B;AAC5B,WAAOR,UAAP;AACA,GAFD,MAEO,IAAK,aAAaQ,QAAlB,EAA6B;AACnC,WAAON,UAAP;AACA,GAFM,MAEA,IAAK,cAAcM,QAAnB,EAA8B;AACpC,WAAOJ,WAAP;AACA;;AACD,SAAOE,UAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\theader as headerIcon,\n\tfooter as footerIcon,\n\tsidebar as sidebarIcon,\n\tlayout as layoutIcon,\n} from '@wordpress/icons';\n/**\n * Helper function to retrieve the corresponding icon by name.\n *\n * @param {string} iconName The name of the icon.\n *\n * @return {Object} The corresponding icon.\n */\nexport function getTemplatePartIcon( iconName ) {\n\tif ( 'header' === iconName ) {\n\t\treturn headerIcon;\n\t} else if ( 'footer' === iconName ) {\n\t\treturn footerIcon;\n\t} else if ( 'sidebar' === iconName ) {\n\t\treturn sidebarIcon;\n\t}\n\treturn layoutIcon;\n}\n"]}