@wordpress/edit-post 7.24.1 → 7.26.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 (267) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/browser-url/index.js +3 -2
  4. package/build/components/browser-url/index.js.map +1 -1
  5. package/build/components/header/index.js +35 -33
  6. package/build/components/header/index.js.map +1 -1
  7. package/build/components/header/mode-switcher/index.js +1 -1
  8. package/build/components/header/mode-switcher/index.js.map +1 -1
  9. package/build/components/header/more-menu/index.js +2 -1
  10. package/build/components/header/more-menu/index.js.map +1 -1
  11. package/build/components/header/writing-menu/index.js +22 -18
  12. package/build/components/header/writing-menu/index.js.map +1 -1
  13. package/build/components/keyboard-shortcuts/index.js +1 -20
  14. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  15. package/build/components/layout/index.js +45 -38
  16. package/build/components/layout/index.js.map +1 -1
  17. package/build/components/layout/index.native.js +3 -1
  18. package/build/components/layout/index.native.js.map +1 -1
  19. package/build/components/meta-boxes/meta-box-visibility.js +2 -6
  20. package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
  21. package/build/components/preferences-modal/index.js +87 -54
  22. package/build/components/preferences-modal/index.js.map +1 -1
  23. package/build/components/preferences-modal/options/enable-feature.js +23 -23
  24. package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
  25. package/build/components/preferences-modal/options/enable-panel.js +3 -6
  26. package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
  27. package/build/components/sidebar/plugin-document-setting-panel/index.js +3 -3
  28. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  29. package/build/components/sidebar/plugin-sidebar/index.js +2 -10
  30. package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
  31. package/build/components/sidebar/post-status/index.js +3 -5
  32. package/build/components/sidebar/post-status/index.js.map +1 -1
  33. package/build/components/sidebar/settings-header/index.js +17 -43
  34. package/build/components/sidebar/settings-header/index.js.map +1 -1
  35. package/build/components/sidebar/settings-sidebar/index.js +80 -26
  36. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  37. package/build/components/start-page-options/index.js +3 -3
  38. package/build/components/start-page-options/index.js.map +1 -1
  39. package/build/components/visual-editor/index.js +20 -257
  40. package/build/components/visual-editor/index.js.map +1 -1
  41. package/build/components/welcome-guide/index.js +6 -3
  42. package/build/components/welcome-guide/index.js.map +1 -1
  43. package/build/editor.js +20 -30
  44. package/build/editor.js.map +1 -1
  45. package/build/editor.native.js +3 -11
  46. package/build/editor.native.js.map +1 -1
  47. package/build/hooks/commands/use-common-commands.js +16 -12
  48. package/build/hooks/commands/use-common-commands.js.map +1 -1
  49. package/build/hooks/use-post-history.js +79 -0
  50. package/build/hooks/use-post-history.js.map +1 -0
  51. package/build/index.js +24 -20
  52. package/build/index.js.map +1 -1
  53. package/build/index.native.js +7 -1
  54. package/build/index.native.js.map +1 -1
  55. package/build/plugins/welcome-guide-menu-item/index.js +2 -6
  56. package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
  57. package/build/store/actions.js +94 -112
  58. package/build/store/actions.js.map +1 -1
  59. package/build/store/reducer.js +1 -95
  60. package/build/store/reducer.js.map +1 -1
  61. package/build/store/selectors.js +86 -48
  62. package/build/store/selectors.js.map +1 -1
  63. package/build-module/components/browser-url/index.js +3 -2
  64. package/build-module/components/browser-url/index.js.map +1 -1
  65. package/build-module/components/header/index.js +37 -35
  66. package/build-module/components/header/index.js.map +1 -1
  67. package/build-module/components/header/mode-switcher/index.js +1 -1
  68. package/build-module/components/header/mode-switcher/index.js.map +1 -1
  69. package/build-module/components/header/more-menu/index.js +2 -1
  70. package/build-module/components/header/more-menu/index.js.map +1 -1
  71. package/build-module/components/header/writing-menu/index.js +23 -19
  72. package/build-module/components/header/writing-menu/index.js.map +1 -1
  73. package/build-module/components/keyboard-shortcuts/index.js +1 -20
  74. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  75. package/build-module/components/layout/index.js +46 -38
  76. package/build-module/components/layout/index.js.map +1 -1
  77. package/build-module/components/layout/index.native.js +4 -2
  78. package/build-module/components/layout/index.native.js.map +1 -1
  79. package/build-module/components/meta-boxes/meta-box-visibility.js +2 -6
  80. package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
  81. package/build-module/components/preferences-modal/index.js +87 -54
  82. package/build-module/components/preferences-modal/index.js.map +1 -1
  83. package/build-module/components/preferences-modal/options/enable-feature.js +22 -23
  84. package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
  85. package/build-module/components/preferences-modal/options/enable-panel.js +3 -7
  86. package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
  87. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +3 -3
  88. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  89. package/build-module/components/sidebar/plugin-sidebar/index.js +2 -10
  90. package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
  91. package/build-module/components/sidebar/post-status/index.js +4 -6
  92. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  93. package/build-module/components/sidebar/settings-header/index.js +20 -46
  94. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  95. package/build-module/components/sidebar/settings-sidebar/index.js +80 -27
  96. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  97. package/build-module/components/start-page-options/index.js +3 -3
  98. package/build-module/components/start-page-options/index.js.map +1 -1
  99. package/build-module/components/visual-editor/index.js +24 -261
  100. package/build-module/components/visual-editor/index.js.map +1 -1
  101. package/build-module/components/welcome-guide/index.js +6 -3
  102. package/build-module/components/welcome-guide/index.js.map +1 -1
  103. package/build-module/editor.js +20 -30
  104. package/build-module/editor.js.map +1 -1
  105. package/build-module/editor.native.js +3 -11
  106. package/build-module/editor.native.js.map +1 -1
  107. package/build-module/hooks/commands/use-common-commands.js +16 -12
  108. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  109. package/build-module/hooks/use-post-history.js +73 -0
  110. package/build-module/hooks/use-post-history.js.map +1 -0
  111. package/build-module/index.js +19 -12
  112. package/build-module/index.js.map +1 -1
  113. package/build-module/index.native.js +7 -1
  114. package/build-module/index.native.js.map +1 -1
  115. package/build-module/plugins/welcome-guide-menu-item/index.js +2 -6
  116. package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
  117. package/build-module/store/actions.js +86 -105
  118. package/build-module/store/actions.js.map +1 -1
  119. package/build-module/store/reducer.js +1 -92
  120. package/build-module/store/reducer.js.map +1 -1
  121. package/build-module/store/selectors.js +76 -38
  122. package/build-module/store/selectors.js.map +1 -1
  123. package/build-style/style-rtl.css +65 -473
  124. package/build-style/style.css +65 -473
  125. package/package.json +32 -32
  126. package/src/components/browser-url/index.js +4 -2
  127. package/src/components/header/index.js +45 -46
  128. package/src/components/header/mode-switcher/index.js +2 -1
  129. package/src/components/header/more-menu/index.js +1 -0
  130. package/src/components/header/style.scss +63 -37
  131. package/src/components/header/writing-menu/index.js +24 -24
  132. package/src/components/keyboard-shortcut-help-modal/test/index.js +0 -15
  133. package/src/components/keyboard-shortcuts/index.js +1 -23
  134. package/src/components/layout/index.js +31 -39
  135. package/src/components/layout/index.native.js +9 -1
  136. package/src/components/meta-boxes/meta-box-visibility.js +2 -8
  137. package/src/components/preferences-modal/index.js +128 -97
  138. package/src/components/preferences-modal/options/enable-feature.js +26 -21
  139. package/src/components/preferences-modal/options/enable-panel.js +3 -7
  140. package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +187 -175
  141. package/src/components/preferences-modal/test/index.js +1 -52
  142. package/src/components/sidebar/plugin-document-setting-panel/index.js +3 -3
  143. package/src/components/sidebar/plugin-sidebar/index.js +1 -9
  144. package/src/components/sidebar/post-status/index.js +5 -5
  145. package/src/components/sidebar/settings-header/index.js +19 -71
  146. package/src/components/sidebar/settings-sidebar/index.js +125 -60
  147. package/src/components/sidebar/style.scss +4 -12
  148. package/src/components/start-page-options/index.js +3 -3
  149. package/src/components/text-editor/style.scss +0 -6
  150. package/src/components/visual-editor/index.js +26 -359
  151. package/src/components/visual-editor/style.scss +0 -15
  152. package/src/components/welcome-guide/index.js +4 -2
  153. package/src/editor.js +36 -35
  154. package/src/editor.native.js +2 -23
  155. package/src/hooks/commands/use-common-commands.js +14 -16
  156. package/src/hooks/use-post-history.js +73 -0
  157. package/src/index.js +24 -13
  158. package/src/index.native.js +8 -1
  159. package/src/plugins/welcome-guide-menu-item/index.js +3 -6
  160. package/src/store/actions.js +80 -131
  161. package/src/store/reducer.js +0 -93
  162. package/src/store/selectors.js +97 -55
  163. package/src/store/test/actions.js +10 -131
  164. package/src/store/test/reducer.js +1 -108
  165. package/src/store/test/selectors.js +0 -50
  166. package/src/style.scss +1 -8
  167. package/src/test/__snapshots__/editor.native.js.snap +21 -0
  168. package/src/test/editor.native.js +107 -56
  169. package/build/components/device-preview/index.js +0 -72
  170. package/build/components/device-preview/index.js.map +0 -1
  171. package/build/components/header/document-actions/index.js +0 -82
  172. package/build/components/header/document-actions/index.js.map +0 -1
  173. package/build/components/header/header-toolbar/index.js +0 -156
  174. package/build/components/header/header-toolbar/index.js.map +0 -1
  175. package/build/components/secondary-sidebar/inserter-sidebar.js +0 -73
  176. package/build/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
  177. package/build/components/secondary-sidebar/list-view-outline.js +0 -112
  178. package/build/components/secondary-sidebar/list-view-outline.js.map +0 -1
  179. package/build/components/secondary-sidebar/list-view-sidebar.js +0 -148
  180. package/build/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
  181. package/build/components/sidebar/discussion-panel/index.js +0 -59
  182. package/build/components/sidebar/discussion-panel/index.js.map +0 -1
  183. package/build/components/sidebar/featured-image/index.js +0 -70
  184. package/build/components/sidebar/featured-image/index.js.map +0 -1
  185. package/build/components/sidebar/last-revision/index.js +0 -21
  186. package/build/components/sidebar/last-revision/index.js.map +0 -1
  187. package/build/components/sidebar/page-attributes/index.js +0 -65
  188. package/build/components/sidebar/page-attributes/index.js.map +0 -1
  189. package/build/components/sidebar/plugin-post-excerpt/index.js +0 -72
  190. package/build/components/sidebar/plugin-post-excerpt/index.js.map +0 -1
  191. package/build/components/sidebar/post-excerpt/index.js +0 -54
  192. package/build/components/sidebar/post-excerpt/index.js.map +0 -1
  193. package/build/components/sidebar/post-taxonomies/index.js +0 -30
  194. package/build/components/sidebar/post-taxonomies/index.js.map +0 -1
  195. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -56
  196. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +0 -1
  197. package/build/components/sidebar/post-template/create-modal.js +0 -99
  198. package/build/components/sidebar/post-template/create-modal.js.map +0 -1
  199. package/build/components/sidebar/post-template/form.js +0 -110
  200. package/build/components/sidebar/post-template/form.js.map +0 -1
  201. package/build/components/sidebar/post-template/index.js +0 -106
  202. package/build/components/sidebar/post-template/index.js.map +0 -1
  203. package/build/components/view-link/index.js +0 -53
  204. package/build/components/view-link/index.js.map +0 -1
  205. package/build-module/components/device-preview/index.js +0 -65
  206. package/build-module/components/device-preview/index.js.map +0 -1
  207. package/build-module/components/header/document-actions/index.js +0 -74
  208. package/build-module/components/header/document-actions/index.js.map +0 -1
  209. package/build-module/components/header/header-toolbar/index.js +0 -148
  210. package/build-module/components/header/header-toolbar/index.js.map +0 -1
  211. package/build-module/components/secondary-sidebar/inserter-sidebar.js +0 -66
  212. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
  213. package/build-module/components/secondary-sidebar/list-view-outline.js +0 -105
  214. package/build-module/components/secondary-sidebar/list-view-outline.js.map +0 -1
  215. package/build-module/components/secondary-sidebar/list-view-sidebar.js +0 -140
  216. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
  217. package/build-module/components/sidebar/discussion-panel/index.js +0 -52
  218. package/build-module/components/sidebar/discussion-panel/index.js.map +0 -1
  219. package/build-module/components/sidebar/featured-image/index.js +0 -63
  220. package/build-module/components/sidebar/featured-image/index.js.map +0 -1
  221. package/build-module/components/sidebar/last-revision/index.js +0 -13
  222. package/build-module/components/sidebar/last-revision/index.js.map +0 -1
  223. package/build-module/components/sidebar/page-attributes/index.js +0 -57
  224. package/build-module/components/sidebar/page-attributes/index.js.map +0 -1
  225. package/build-module/components/sidebar/plugin-post-excerpt/index.js +0 -64
  226. package/build-module/components/sidebar/plugin-post-excerpt/index.js.map +0 -1
  227. package/build-module/components/sidebar/post-excerpt/index.js +0 -47
  228. package/build-module/components/sidebar/post-excerpt/index.js.map +0 -1
  229. package/build-module/components/sidebar/post-taxonomies/index.js +0 -21
  230. package/build-module/components/sidebar/post-taxonomies/index.js.map +0 -1
  231. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -48
  232. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +0 -1
  233. package/build-module/components/sidebar/post-template/create-modal.js +0 -92
  234. package/build-module/components/sidebar/post-template/create-modal.js.map +0 -1
  235. package/build-module/components/sidebar/post-template/form.js +0 -102
  236. package/build-module/components/sidebar/post-template/form.js.map +0 -1
  237. package/build-module/components/sidebar/post-template/index.js +0 -98
  238. package/build-module/components/sidebar/post-template/index.js.map +0 -1
  239. package/build-module/components/view-link/index.js +0 -46
  240. package/build-module/components/view-link/index.js.map +0 -1
  241. package/src/components/device-preview/index.js +0 -73
  242. package/src/components/header/document-actions/index.js +0 -82
  243. package/src/components/header/document-actions/style.scss +0 -64
  244. package/src/components/header/header-toolbar/index.js +0 -182
  245. package/src/components/header/header-toolbar/style.scss +0 -114
  246. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +0 -929
  247. package/src/components/secondary-sidebar/inserter-sidebar.js +0 -71
  248. package/src/components/secondary-sidebar/list-view-outline.js +0 -98
  249. package/src/components/secondary-sidebar/list-view-sidebar.js +0 -170
  250. package/src/components/secondary-sidebar/style.scss +0 -120
  251. package/src/components/sidebar/discussion-panel/index.js +0 -62
  252. package/src/components/sidebar/featured-image/index.js +0 -67
  253. package/src/components/sidebar/last-revision/index.js +0 -17
  254. package/src/components/sidebar/last-revision/style.scss +0 -10
  255. package/src/components/sidebar/page-attributes/index.js +0 -65
  256. package/src/components/sidebar/plugin-post-excerpt/index.js +0 -61
  257. package/src/components/sidebar/plugin-post-excerpt/test/index.js +0 -36
  258. package/src/components/sidebar/post-excerpt/index.js +0 -59
  259. package/src/components/sidebar/post-taxonomies/index.js +0 -30
  260. package/src/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -48
  261. package/src/components/sidebar/post-template/create-modal.js +0 -140
  262. package/src/components/sidebar/post-template/form.js +0 -141
  263. package/src/components/sidebar/post-template/index.js +0 -120
  264. package/src/components/sidebar/post-template/style.scss +0 -22
  265. package/src/components/sidebar/settings-header/style.scss +0 -74
  266. package/src/components/sidebar/template/style.scss +0 -35
  267. package/src/components/view-link/index.js +0 -48
@@ -50,12 +50,10 @@ class Editor extends _element.Component {
50
50
  });
51
51
  this.setTitleRef = this.setTitleRef.bind(this);
52
52
  }
53
- getEditorSettings(settings, hasFixedToolbar, focusMode, hiddenBlockTypes, blockTypes) {
53
+ getEditorSettings(settings, hiddenBlockTypes, blockTypes) {
54
54
  settings = {
55
55
  ...settings,
56
- isRTL: _reactNative.I18nManager.isRTL,
57
- hasFixedToolbar,
58
- focusMode
56
+ isRTL: _reactNative.I18nManager.isRTL
59
57
  };
60
58
 
61
59
  // Omit hidden block types if exists and non-empty.
@@ -115,8 +113,6 @@ class Editor extends _element.Component {
115
113
  render() {
116
114
  const {
117
115
  settings,
118
- hasFixedToolbar,
119
- focusMode,
120
116
  initialEdits,
121
117
  hiddenBlockTypes,
122
118
  blockTypes,
@@ -127,7 +123,7 @@ class Editor extends _element.Component {
127
123
  initialHtml,
128
124
  ...props
129
125
  } = this.props;
130
- const editorSettings = this.getEditorSettings(settings, hasFixedToolbar, focusMode, hiddenBlockTypes, blockTypes);
126
+ const editorSettings = this.getEditorSettings(settings, hiddenBlockTypes, blockTypes);
131
127
  const normalizedPost = post || {
132
128
  id: postId,
133
129
  title: {
@@ -161,17 +157,13 @@ class Editor extends _element.Component {
161
157
  }
162
158
  var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
163
159
  const {
164
- isFeatureActive,
165
160
  getEditorMode,
166
- __experimentalGetPreviewDeviceType,
167
161
  getHiddenBlockTypes
168
162
  } = select(_store.store);
169
163
  const {
170
164
  getBlockTypes
171
165
  } = select(_blocks.store);
172
166
  return {
173
- hasFixedToolbar: isFeatureActive('fixedToolbar') || __experimentalGetPreviewDeviceType() !== 'Desktop',
174
- focusMode: isFeatureActive('focusMode'),
175
167
  mode: getEditorMode(),
176
168
  hiddenBlockTypes: getHiddenBlockTypes(),
177
169
  blockTypes: getBlockTypes()
@@ -1 +1 @@
1
- {"version":3,"names":["_memize","_interopRequireDefault","require","_reactNative","_reactNativeGestureHandler","_element","_editor","_blocks","_data","_compose","_reactNativeBridge","_components","_coreData","_layout","_store","Editor","Component","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","memize","maxSize","setTitleRef","bind","settings","hasFixedToolbar","focusMode","hiddenBlockTypes","blockTypes","isRTL","I18nManager","length","allowedBlockTypes","undefined","defaultAllowedBlockTypes","map","name","filter","type","includes","componentDidMount","editEntityRecord","postType","postId","subscriptionParentSetFocusOnTitle","subscribeSetFocusOnTitle","postTitleRef","focus","focusTitleWhenAvailable","subscriptionParentFeaturedImageIdNativeUpdated","subscribeFeaturedImageIdNativeUpdated","payload","featured_media","featuredImageId","undoIgnore","componentWillUnmount","remove","titleRef","render","initialEdits","post","initialHtml","editorSettings","normalizedPost","id","title","raw","initialTitle","content","serialize","parse","status","meta","_react","createElement","GestureHandlerRootView","style","flex","SlotFillProvider","EditorProvider","useSubRegistry","default","_default","compose","withSelect","select","isFeatureActive","getEditorMode","__experimentalGetPreviewDeviceType","getHiddenBlockTypes","editPostStore","getBlockTypes","blocksStore","withDispatch","dispatch","coreStore","exports"],"sources":["@wordpress/edit-post/src/editor.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { I18nManager } from 'react-native';\nimport { GestureHandlerRootView } from 'react-native-gesture-handler';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { EditorProvider } from '@wordpress/editor';\nimport { parse, serialize, store as blocksStore } from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport {\n\tsubscribeSetFocusOnTitle,\n\tsubscribeFeaturedImageIdNativeUpdated,\n} from '@wordpress/react-native-bridge';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport { store as editPostStore } from './store';\n\nclass Editor extends Component {\n\tconstructor( props ) {\n\t\tsuper( ...arguments );\n\n\t\t// need to set this globally to avoid race with deprecations\n\t\t// defaulting to true to avoid issues with a not-yet-cached value\n\t\tconst { galleryWithImageBlocks = true } = props;\n\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\n\t\tif ( props.initialHtmlModeEnabled && props.mode === 'visual' ) {\n\t\t\t// Enable html mode if the initial mode the parent wants it but we're not already in it.\n\t\t\tthis.props.switchEditorMode( 'text' );\n\t\t}\n\n\t\tthis.getEditorSettings = memize( this.getEditorSettings, {\n\t\t\tmaxSize: 1,\n\t\t} );\n\n\t\tthis.setTitleRef = this.setTitleRef.bind( this );\n\t}\n\n\tgetEditorSettings(\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thiddenBlockTypes,\n\t\tblockTypes\n\t) {\n\t\tsettings = {\n\t\t\t...settings,\n\t\t\tisRTL: I18nManager.isRTL,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\tif ( settings.allowedBlockTypes === undefined ) {\n\t\t\t\t// If no specific flags for allowedBlockTypes are set, assume `true`\n\t\t\t\t// meaning allow all block types.\n\t\t\t\tsettings.allowedBlockTypes = true;\n\t\t\t}\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tsettings.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings;\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { editEntityRecord, postType, postId } = this.props;\n\n\t\tthis.subscriptionParentSetFocusOnTitle = subscribeSetFocusOnTitle(\n\t\t\t() => {\n\t\t\t\tif ( this.postTitleRef ) {\n\t\t\t\t\tthis.postTitleRef.focus();\n\t\t\t\t} else {\n\t\t\t\t\t// If the post title ref is not available, we postpone setting focus to when it's available.\n\t\t\t\t\tthis.focusTitleWhenAvailable = true;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentFeaturedImageIdNativeUpdated =\n\t\t\tsubscribeFeaturedImageIdNativeUpdated( ( payload ) => {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t\t{ featured_media: payload.featuredImageId },\n\t\t\t\t\t{\n\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentSetFocusOnTitle ) {\n\t\t\tthis.subscriptionParentSetFocusOnTitle.remove();\n\t\t}\n\n\t\tif ( this.subscribeFeaturedImageIdNativeUpdated ) {\n\t\t\tthis.subscribeFeaturedImageIdNativeUpdated.remove();\n\t\t}\n\t}\n\n\tsetTitleRef( titleRef ) {\n\t\tif ( this.focusTitleWhenAvailable && ! this.postTitleRef ) {\n\t\t\tthis.focusTitleWhenAvailable = false;\n\t\t\ttitleRef.focus();\n\t\t}\n\n\t\tthis.postTitleRef = titleRef;\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tsettings,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tinitialEdits,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes,\n\t\t\tpost,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tfeaturedImageId,\n\t\t\tinitialHtml,\n\t\t\t...props\n\t\t} = this.props;\n\n\t\tconst editorSettings = this.getEditorSettings(\n\t\t\tsettings,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes\n\t\t);\n\n\t\tconst normalizedPost = post || {\n\t\t\tid: postId,\n\t\t\ttitle: {\n\t\t\t\traw: props.initialTitle || '',\n\t\t\t},\n\t\t\tfeatured_media: featuredImageId,\n\t\t\tcontent: {\n\t\t\t\t// Make sure the post content is in sync with gutenberg store\n\t\t\t\t// to avoid marking the post as modified when simply loaded\n\t\t\t\t// For now, let's assume: serialize( parse( html ) ) !== html.\n\t\t\t\traw: serialize( parse( initialHtml || '' ) ),\n\t\t\t},\n\t\t\ttype: postType,\n\t\t\tstatus: 'draft',\n\t\t\tmeta: [],\n\t\t};\n\n\t\treturn (\n\t\t\t<GestureHandlerRootView style={ { flex: 1 } }>\n\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tpost={ normalizedPost }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Layout setTitleRef={ this.setTitleRef } />\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</GestureHandlerRootView>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tgetEditorMode,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetHiddenBlockTypes,\n\t\t} = select( editPostStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\n\t\treturn {\n\t\t\thasFixedToolbar:\n\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\tmode: getEditorMode(),\n\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\tblockTypes: getBlockTypes(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { editEntityRecord } = dispatch( coreStore );\n\t\treturn {\n\t\t\tswitchEditorMode,\n\t\t\teditEntityRecord,\n\t\t};\n\t} ),\n] )( Editor );\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AAIA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AAKA,IAAAW,OAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AA1BA;AACA;AACA;;AAKA;AACA;AACA;;AAaA;AACA;AACA;;AAIA,MAAMa,MAAM,SAASC,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a;IACbC,kCAAkC;IAClCC;EACD,CAAC,GAAGJ,MAAM,CAAEK,YAAc,CAAC;EAC3B,MAAM;IAAEC;EAAc,CAAC,GAAGN,MAAM,CAAEO,aAAY,CAAC;EAE/C,OAAO;IACNnE,eAAe,EACd6D,eAAe,CAAE,cAAe,CAAC,IACjCE,kCAAkC,CAAC,CAAC,KAAK,SAAS;IACnD9D,SAAS,EAAE4D,eAAe,CAAE,WAAY,CAAC;IACzCrE,IAAI,EAAEsE,aAAa,CAAC,CAAC;IACrB5D,gBAAgB,EAAE8D,mBAAmB,CAAC,CAAC;IACvC7D,UAAU,EAAE+D,aAAa,CAAC;EAC3B,CAAC;AACF,CAAE,CAAC,EACH,IAAAE,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,MAAM;IAAE5E;EAAiB,CAAC,GAAG4E,QAAQ,CAAEJ,YAAc,CAAC;EACtD,MAAM;IAAEjD;EAAiB,CAAC,GAAGqD,QAAQ,CAAEC,eAAU,CAAC;EAClD,OAAO;IACN7E,gBAAgB;IAChBuB;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAElC,MAAO,CAAC;AAAAyF,OAAA,CAAAf,OAAA,GAAAC,QAAA"}
1
+ {"version":3,"names":["_memize","_interopRequireDefault","require","_reactNative","_reactNativeGestureHandler","_element","_editor","_blocks","_data","_compose","_reactNativeBridge","_components","_coreData","_layout","_store","Editor","Component","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","memize","maxSize","setTitleRef","bind","settings","hiddenBlockTypes","blockTypes","isRTL","I18nManager","length","allowedBlockTypes","undefined","defaultAllowedBlockTypes","map","name","filter","type","includes","componentDidMount","editEntityRecord","postType","postId","subscriptionParentSetFocusOnTitle","subscribeSetFocusOnTitle","postTitleRef","focus","focusTitleWhenAvailable","subscriptionParentFeaturedImageIdNativeUpdated","subscribeFeaturedImageIdNativeUpdated","payload","featured_media","featuredImageId","undoIgnore","componentWillUnmount","remove","titleRef","render","initialEdits","post","initialHtml","editorSettings","normalizedPost","id","title","raw","initialTitle","content","serialize","parse","status","meta","_react","createElement","GestureHandlerRootView","style","flex","SlotFillProvider","EditorProvider","useSubRegistry","default","_default","compose","withSelect","select","getEditorMode","getHiddenBlockTypes","editPostStore","getBlockTypes","blocksStore","withDispatch","dispatch","coreStore","exports"],"sources":["@wordpress/edit-post/src/editor.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { I18nManager } from 'react-native';\nimport { GestureHandlerRootView } from 'react-native-gesture-handler';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { EditorProvider } from '@wordpress/editor';\nimport { parse, serialize, store as blocksStore } from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport {\n\tsubscribeSetFocusOnTitle,\n\tsubscribeFeaturedImageIdNativeUpdated,\n} from '@wordpress/react-native-bridge';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport { store as editPostStore } from './store';\n\nclass Editor extends Component {\n\tconstructor( props ) {\n\t\tsuper( ...arguments );\n\n\t\t// need to set this globally to avoid race with deprecations\n\t\t// defaulting to true to avoid issues with a not-yet-cached value\n\t\tconst { galleryWithImageBlocks = true } = props;\n\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\n\t\tif ( props.initialHtmlModeEnabled && props.mode === 'visual' ) {\n\t\t\t// Enable html mode if the initial mode the parent wants it but we're not already in it.\n\t\t\tthis.props.switchEditorMode( 'text' );\n\t\t}\n\n\t\tthis.getEditorSettings = memize( this.getEditorSettings, {\n\t\t\tmaxSize: 1,\n\t\t} );\n\n\t\tthis.setTitleRef = this.setTitleRef.bind( this );\n\t}\n\n\tgetEditorSettings( settings, hiddenBlockTypes, blockTypes ) {\n\t\tsettings = {\n\t\t\t...settings,\n\t\t\tisRTL: I18nManager.isRTL,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\tif ( settings.allowedBlockTypes === undefined ) {\n\t\t\t\t// If no specific flags for allowedBlockTypes are set, assume `true`\n\t\t\t\t// meaning allow all block types.\n\t\t\t\tsettings.allowedBlockTypes = true;\n\t\t\t}\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tsettings.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings;\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { editEntityRecord, postType, postId } = this.props;\n\n\t\tthis.subscriptionParentSetFocusOnTitle = subscribeSetFocusOnTitle(\n\t\t\t() => {\n\t\t\t\tif ( this.postTitleRef ) {\n\t\t\t\t\tthis.postTitleRef.focus();\n\t\t\t\t} else {\n\t\t\t\t\t// If the post title ref is not available, we postpone setting focus to when it's available.\n\t\t\t\t\tthis.focusTitleWhenAvailable = true;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentFeaturedImageIdNativeUpdated =\n\t\t\tsubscribeFeaturedImageIdNativeUpdated( ( payload ) => {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t\t{ featured_media: payload.featuredImageId },\n\t\t\t\t\t{\n\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentSetFocusOnTitle ) {\n\t\t\tthis.subscriptionParentSetFocusOnTitle.remove();\n\t\t}\n\n\t\tif ( this.subscribeFeaturedImageIdNativeUpdated ) {\n\t\t\tthis.subscribeFeaturedImageIdNativeUpdated.remove();\n\t\t}\n\t}\n\n\tsetTitleRef( titleRef ) {\n\t\tif ( this.focusTitleWhenAvailable && ! this.postTitleRef ) {\n\t\t\tthis.focusTitleWhenAvailable = false;\n\t\t\ttitleRef.focus();\n\t\t}\n\n\t\tthis.postTitleRef = titleRef;\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tsettings,\n\t\t\tinitialEdits,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes,\n\t\t\tpost,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tfeaturedImageId,\n\t\t\tinitialHtml,\n\t\t\t...props\n\t\t} = this.props;\n\n\t\tconst editorSettings = this.getEditorSettings(\n\t\t\tsettings,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes\n\t\t);\n\n\t\tconst normalizedPost = post || {\n\t\t\tid: postId,\n\t\t\ttitle: {\n\t\t\t\traw: props.initialTitle || '',\n\t\t\t},\n\t\t\tfeatured_media: featuredImageId,\n\t\t\tcontent: {\n\t\t\t\t// Make sure the post content is in sync with gutenberg store\n\t\t\t\t// to avoid marking the post as modified when simply loaded\n\t\t\t\t// For now, let's assume: serialize( parse( html ) ) !== html.\n\t\t\t\traw: serialize( parse( initialHtml || '' ) ),\n\t\t\t},\n\t\t\ttype: postType,\n\t\t\tstatus: 'draft',\n\t\t\tmeta: [],\n\t\t};\n\n\t\treturn (\n\t\t\t<GestureHandlerRootView style={ { flex: 1 } }>\n\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tpost={ normalizedPost }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Layout setTitleRef={ this.setTitleRef } />\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</GestureHandlerRootView>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getEditorMode, getHiddenBlockTypes } = select( editPostStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\tblockTypes: getBlockTypes(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { editEntityRecord } = dispatch( coreStore );\n\t\treturn {\n\t\t\tswitchEditorMode,\n\t\t\teditEntityRecord,\n\t\t};\n\t} ),\n] )( Editor );\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAR,OAAA;AAIA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AAKA,IAAAW,OAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AA1BA;AACA;AACA;;AAKA;AACA;AACA;;AAaA;AACA;AACA;;AAIA,MAAMa,MAAM,SAASC,kBAAS,CAAC;EAC9BC,WAAWA,CAAEC,KAAK,EAAG;IACpB,KAAK,CAAE,GAAGC,SAAU,CAAC;;IAErB;IACA;IACA,MAAM;MAAEC,sBAAsB,GAAG;IA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Aa,CAAC;EAC3B,CAAC;AACF,CAAE,CAAC,EACH,IAAAE,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,MAAM;IAAExE;EAAiB,CAAC,GAAGwE,QAAQ,CAAEJ,YAAc,CAAC;EACtD,MAAM;IAAE/C;EAAiB,CAAC,GAAGmD,QAAQ,CAAEC,eAAU,CAAC;EAClD,OAAO;IACNzE,gBAAgB;IAChBqB;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEhC,MAAO,CAAC;AAAAqF,OAAA,CAAAb,OAAA,GAAAC,QAAA"}
@@ -28,7 +28,6 @@ function useCommonCommands() {
28
28
  openGeneralSidebar,
29
29
  closeGeneralSidebar,
30
30
  switchEditorMode,
31
- setIsListViewOpened,
32
31
  toggleDistractionFree
33
32
  } = (0, _data.useDispatch)(_store.store);
34
33
  const {
@@ -43,17 +42,21 @@ function useCommonCommands() {
43
42
  isDistractionFree
44
43
  } = (0, _data.useSelect)(select => {
45
44
  const {
46
- getEditorMode,
47
- isListViewOpened,
48
- isFeatureActive
45
+ get
46
+ } = select(_preferences.store);
47
+ const {
48
+ getEditorMode
49
49
  } = select(_store.store);
50
+ const {
51
+ isListViewOpened
52
+ } = select(_editor.store);
50
53
  return {
51
54
  activeSidebar: select(_interface.store).getActiveComplementaryArea(_store.store.name),
52
55
  editorMode: getEditorMode(),
53
56
  isListViewOpen: isListViewOpened(),
54
57
  isPublishSidebarEnabled: select(_editor.store).isPublishSidebarEnabled(),
55
- showBlockBreadcrumbs: isFeatureActive('showBlockBreadcrumbs'),
56
- isDistractionFree: select(_preferences.store).get(_store.store.name, 'distractionFree')
58
+ showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
59
+ isDistractionFree: get('core', 'distractionFree')
57
60
  };
58
61
  }, []);
59
62
  const {
@@ -63,7 +66,8 @@ function useCommonCommands() {
63
66
  createInfoNotice
64
67
  } = (0, _data.useDispatch)(_notices.store);
65
68
  const {
66
- __unstableSaveForPreview
69
+ __unstableSaveForPreview,
70
+ setIsListViewOpened
67
71
  } = (0, _data.useDispatch)(_editor.store);
68
72
  const {
69
73
  getCurrentPostId
@@ -114,7 +118,7 @@ function useCommonCommands() {
114
118
  callback: ({
115
119
  close
116
120
  }) => {
117
- toggle('core/edit-post', 'focusMode');
121
+ toggle('core', 'focusMode');
118
122
  close();
119
123
  }
120
124
  });
@@ -146,7 +150,7 @@ function useCommonCommands() {
146
150
  callback: ({
147
151
  close
148
152
  }) => {
149
- toggle('core/edit-post', 'fixedToolbar');
153
+ toggle('core', 'fixedToolbar');
150
154
  if (isDistractionFree) {
151
155
  toggleDistractionFree();
152
156
  }
@@ -185,7 +189,7 @@ function useCommonCommands() {
185
189
  callback: ({
186
190
  close
187
191
  }) => {
188
- toggle('core/edit-post', 'showBlockBreadcrumbs');
192
+ toggle('core', 'showBlockBreadcrumbs');
189
193
  close();
190
194
  createInfoNotice(showBlockBreadcrumbs ? (0, _i18n.__)('Breadcrumbs hidden.') : (0, _i18n.__)('Breadcrumbs visible.'), {
191
195
  id: 'core/edit-post/toggle-breadcrumbs/notice',
@@ -195,14 +199,14 @@ function useCommonCommands() {
195
199
  });
196
200
  (0, _commands.useCommand)({
197
201
  name: 'core/toggle-publish-sidebar',
198
- label: isPublishSidebarEnabled ? (0, _i18n.__)('Disable pre-publish checklist') : (0, _i18n.__)('Enable pre-publish checklist'),
202
+ label: isPublishSidebarEnabled ? (0, _i18n.__)('Disable pre-publish checks') : (0, _i18n.__)('Enable pre-publish checks'),
199
203
  icon: _icons.formatListBullets,
200
204
  callback: ({
201
205
  close
202
206
  }) => {
203
207
  close();
204
208
  toggle('core/edit-post', 'isPublishSidebarEnabled');
205
- createInfoNotice(isPublishSidebarEnabled ? (0, _i18n.__)('Pre-publish checklist off.') : (0, _i18n.__)('Pre-publish checklist on.'), {
209
+ createInfoNotice(isPublishSidebarEnabled ? (0, _i18n.__)('Pre-publish checks disabled.') : (0, _i18n.__)('Pre-publish checks enabled.'), {
206
210
  id: 'core/edit-post/publish-sidebar/notice',
207
211
  type: 'snackbar'
208
212
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_interface","_editor","_notices","_keyboardShortcutHelpModal","_preferencesModal","_store","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","setIsListViewOpened","toggleDistractionFree","useDispatch","editPostStore","openModal","interfaceStore","editorMode","activeSidebar","isListViewOpen","isPublishSidebarEnabled","showBlockBreadcrumbs","isDistractionFree","useSelect","select","getEditorMode","isListViewOpened","isFeatureActive","getActiveComplementaryArea","name","editorStore","preferencesStore","get","toggle","createInfoNotice","noticesStore","__unstableSaveForPreview","getCurrentPostId","useCommand","label","__","icon","isRTL","drawerLeft","drawerRight","callback","close","blockDefault","desktop","listView","code","PREFERENCES_MODAL_NAME","keyboard","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","id","type","formatListBullets","external","postId","link","window","open"],"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tcode,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tkeyboard,\n\tdesktop,\n\tlistView,\n\texternal,\n\tformatListBullets,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { store as editPostStore } from '../../store';\n\nexport default function useCommonCommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\tswitchEditorMode,\n\t\tsetIsListViewOpened,\n\t\ttoggleDistractionFree,\n\t} = useDispatch( editPostStore );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst {\n\t\teditorMode,\n\t\tactiveSidebar,\n\t\tisListViewOpen,\n\t\tisPublishSidebarEnabled,\n\t\tshowBlockBreadcrumbs,\n\t\tisDistractionFree,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorMode, isListViewOpened, isFeatureActive } =\n\t\t\tselect( editPostStore );\n\t\treturn {\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditPostStore.name\n\t\t\t),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisPublishSidebarEnabled:\n\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\tshowBlockBreadcrumbs: isFeatureActive( 'showBlockBreadcrumbs' ),\n\t\t\tisDistractionFree: select( preferencesStore ).get(\n\t\t\t\teditPostStore.name,\n\t\t\t\t'distractionFree'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\tconst { __unstableSaveForPreview } = useDispatch( editorStore );\n\tconst { getCurrentPostId } = useSelect( editorStore );\n\n\tuseCommand( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: __( 'Toggle distraction free' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggleDistractionFree();\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight mode' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-fullscreen-mode',\n\t\tlabel: __( 'Toggle fullscreen mode' ),\n\t\ticon: desktop,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: __( 'Toggle list view' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fixedToolbar' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t}\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel: __( 'Toggle code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-publish-sidebar',\n\t\tlabel: isPublishSidebarEnabled\n\t\t\t? __( 'Disable pre-publish checklist' )\n\t\t\t: __( 'Enable pre-publish checklist' ),\n\t\ticon: formatListBullets,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\ttoggle( 'core/edit-post', 'isPublishSidebarEnabled' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t? __( 'Pre-publish checklist off.' )\n\t\t\t\t\t: __( 'Pre-publish checklist on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/publish-sidebar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/preview-link',\n\t\tlabel: __( 'Preview in a new tab' ),\n\t\ticon: external,\n\t\tcallback: async ( { close } ) => {\n\t\t\tclose();\n\t\t\tconst postId = getCurrentPostId();\n\t\t\tconst link = await __unstableSaveForPreview();\n\t\t\twindow.open( link, `wp-preview-${ postId }` );\n\t\t},\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAWA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,0BAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AA3BA;AACA;AACA;;AAoBA;AACA;AACA;;AAKe,SAASW,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IACLC,kBAAkB;IAClBC,mBAAmB;IACnBC,gBAAgB;IAChBC,mBAAmB;IACnBC;EACD,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAChC,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAF,iBAAW,EAAEG,gBAAe,CAAC;EACnD,MAAM;IACLC,UAAU;IACVC,aAAa;IACbC,cAAc;IACdC,uBAAuB;IACvBC,oBAAoB;IACpBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5B,MAAM;MAAEC,aAAa;MAAEC,gBAAgB;MAAEC;IAAgB,CAAC,GACzDH,MAAM,CAAEV,YAAc,CAAC;IACxB,OAAO;MACNI,aAAa,EAAEM,MAAM,CAAER,gBAAe,CAAC,CAACY,0BAA0B,CACjEd,YAAa,CAACe,IACf,CAAC;MACDZ,UAAU,EAAEQ,aAAa,CAAC,CAAC;MAC3BN,cAAc,EAAEO,gBAAgB,CAAC,C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","_commands","_preferences","_interface","_editor","_notices","_keyboardShortcutHelpModal","_preferencesModal","_store","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","toggleDistractionFree","useDispatch","editPostStore","openModal","interfaceStore","editorMode","activeSidebar","isListViewOpen","isPublishSidebarEnabled","showBlockBreadcrumbs","isDistractionFree","useSelect","select","get","preferencesStore","getEditorMode","isListViewOpened","editorStore","getActiveComplementaryArea","name","toggle","createInfoNotice","noticesStore","__unstableSaveForPreview","setIsListViewOpened","getCurrentPostId","useCommand","label","__","icon","isRTL","drawerLeft","drawerRight","callback","close","blockDefault","desktop","listView","code","PREFERENCES_MODAL_NAME","keyboard","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","id","type","formatListBullets","external","postId","link","window","open"],"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tcode,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tkeyboard,\n\tdesktop,\n\tlistView,\n\texternal,\n\tformatListBullets,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { store as editPostStore } from '../../store';\n\nexport default function useCommonCommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\tswitchEditorMode,\n\t\ttoggleDistractionFree,\n\t} = useDispatch( editPostStore );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst {\n\t\teditorMode,\n\t\tactiveSidebar,\n\t\tisListViewOpen,\n\t\tisPublishSidebarEnabled,\n\t\tshowBlockBreadcrumbs,\n\t\tisDistractionFree,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editPostStore );\n\t\tconst { isListViewOpened } = select( editorStore );\n\t\treturn {\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditPostStore.name\n\t\t\t),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisPublishSidebarEnabled:\n\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t};\n\t}, [] );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\tconst { __unstableSaveForPreview, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\tconst { getCurrentPostId } = useSelect( editorStore );\n\n\tuseCommand( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: __( 'Toggle distraction free' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggleDistractionFree();\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight mode' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-fullscreen-mode',\n\t\tlabel: __( 'Toggle fullscreen mode' ),\n\t\ticon: desktop,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: __( 'Toggle list view' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t}\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel: __( 'Toggle code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-publish-sidebar',\n\t\tlabel: isPublishSidebarEnabled\n\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t: __( 'Enable pre-publish checks' ),\n\t\ticon: formatListBullets,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\ttoggle( 'core/edit-post', 'isPublishSidebarEnabled' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t? __( 'Pre-publish checks disabled.' )\n\t\t\t\t\t: __( 'Pre-publish checks enabled.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/publish-sidebar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/preview-link',\n\t\tlabel: __( 'Preview in a new tab' ),\n\t\ticon: external,\n\t\tcallback: async ( { close } ) => {\n\t\t\tclose();\n\t\t\tconst postId = getCurrentPostId();\n\t\t\tconst link = await __unstableSaveForPreview();\n\t\t\twindow.open(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ostHistory;
7
+ var _element = require("@wordpress/element");
8
+ var _url = require("@wordpress/url");
9
+ /**
10
+ * WordPress dependencies
11
+ */
12
+
13
+ /**
14
+ * A hook that records the 'entity' history in the post editor as a user
15
+ * navigates between editing a post and editing the post template or patterns.
16
+ *
17
+ * Implemented as a stack, so a little similar to the browser history API.
18
+ *
19
+ * Used to control displaying UI elements like the back button.
20
+ *
21
+ * @param {number} initialPostId The post id of the post when the editor loaded.
22
+ * @param {string} initialPostType The post type of the post when the editor loaded.
23
+ *
24
+ * @return {Object} An object containing the `currentPost` variable and
25
+ * `getPostLinkProps` and `goBack` functions.
26
+ */
27
+ function usePostHistory(initialPostId, initialPostType) {
28
+ const [postHistory, dispatch] = (0, _element.useReducer)((historyState, {
29
+ type,
30
+ post
31
+ }) => {
32
+ if (type === 'push') {
33
+ return [...historyState, post];
34
+ }
35
+ if (type === 'pop') {
36
+ // Try to leave one item in the history.
37
+ if (historyState.length > 1) {
38
+ return historyState.slice(0, -1);
39
+ }
40
+ }
41
+ return historyState;
42
+ }, [{
43
+ postId: initialPostId,
44
+ postType: initialPostType
45
+ }]);
46
+ const getPostLinkProps = (0, _element.useCallback)(params => {
47
+ const currentArgs = (0, _url.getQueryArgs)(window.location.href);
48
+ const currentUrlWithoutArgs = (0, _url.removeQueryArgs)(window.location.href, ...Object.keys(currentArgs));
49
+ const newUrl = (0, _url.addQueryArgs)(currentUrlWithoutArgs, {
50
+ post: params.postId,
51
+ action: 'edit'
52
+ });
53
+ return {
54
+ href: newUrl,
55
+ onClick: event => {
56
+ event.preventDefault();
57
+ dispatch({
58
+ type: 'push',
59
+ post: {
60
+ postId: params.postId,
61
+ postType: params.postType
62
+ }
63
+ });
64
+ }
65
+ };
66
+ }, []);
67
+ const goBack = (0, _element.useCallback)(() => {
68
+ dispatch({
69
+ type: 'pop'
70
+ });
71
+ }, []);
72
+ const currentPost = postHistory[postHistory.length - 1];
73
+ return {
74
+ currentPost,
75
+ getPostLinkProps,
76
+ goBack: postHistory.length > 1 ? goBack : undefined
77
+ };
78
+ }
79
+ //# sourceMappingURL=use-post-history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_element","require","_url","usePostHistory","initialPostId","initialPostType","postHistory","dispatch","useReducer","historyState","type","post","length","slice","postId","postType","getPostLinkProps","useCallback","params","currentArgs","getQueryArgs","window","location","href","currentUrlWithoutArgs","removeQueryArgs","Object","keys","newUrl","addQueryArgs","action","onClick","event","preventDefault","goBack","currentPost","undefined"],"sources":["@wordpress/edit-post/src/hooks/use-post-history.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useReducer } from '@wordpress/element';\nimport { addQueryArgs, getQueryArgs, removeQueryArgs } from '@wordpress/url';\n\n/**\n * A hook that records the 'entity' history in the post editor as a user\n * navigates between editing a post and editing the post template or patterns.\n *\n * Implemented as a stack, so a little similar to the browser history API.\n *\n * Used to control displaying UI elements like the back button.\n *\n * @param {number} initialPostId The post id of the post when the editor loaded.\n * @param {string} initialPostType The post type of the post when the editor loaded.\n *\n * @return {Object} An object containing the `currentPost` variable and\n * `getPostLinkProps` and `goBack` functions.\n */\nexport default function usePostHistory( initialPostId, initialPostType ) {\n\tconst [ postHistory, dispatch ] = useReducer(\n\t\t( historyState, { type, post } ) => {\n\t\t\tif ( type === 'push' ) {\n\t\t\t\treturn [ ...historyState, post ];\n\t\t\t}\n\t\t\tif ( type === 'pop' ) {\n\t\t\t\t// Try to leave one item in the history.\n\t\t\t\tif ( historyState.length > 1 ) {\n\t\t\t\t\treturn historyState.slice( 0, -1 );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn historyState;\n\t\t},\n\t\t[ { postId: initialPostId, postType: initialPostType } ]\n\t);\n\n\tconst getPostLinkProps = useCallback( ( params ) => {\n\t\tconst currentArgs = getQueryArgs( window.location.href );\n\t\tconst currentUrlWithoutArgs = removeQueryArgs(\n\t\t\twindow.location.href,\n\t\t\t...Object.keys( currentArgs )\n\t\t);\n\n\t\tconst newUrl = addQueryArgs( currentUrlWithoutArgs, {\n\t\t\tpost: params.postId,\n\t\t\taction: 'edit',\n\t\t} );\n\n\t\treturn {\n\t\t\thref: newUrl,\n\t\t\tonClick: ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'push',\n\t\t\t\t\tpost: { postId: params.postId, postType: params.postType },\n\t\t\t\t} );\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst goBack = useCallback( () => {\n\t\tdispatch( { type: 'pop' } );\n\t}, [] );\n\n\tconst currentPost = postHistory[ postHistory.length - 1 ];\n\n\treturn {\n\t\tcurrentPost,\n\t\tgetPostLinkProps,\n\t\tgoBack: postHistory.length > 1 ? goBack : undefined,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,cAAcA,CAAEC,aAAa,EAAEC,eAAe,EAAG;EACxE,MAAM,CAAEC,WAAW,EAAEC,QAAQ,CAAE,GAAG,IAAAC,mBAAU,EAC3C,CAAEC,YAAY,EAAE;IAAEC,IAAI;IAAEC;EAAK,CAAC,KAAM;IACnC,IAAKD,IAAI,KAAK,MAAM,EAAG;MACtB,OAAO,CAAE,GAAGD,YAAY,EAAEE,IAAI,CAAE;IACjC;IACA,IAAKD,IAAI,KAAK,KAAK,EAAG;MACrB;MACA,IAAKD,YAAY,CAACG,MAAM,GAAG,CAAC,EAAG;QAC9B,OAAOH,YAAY,CAACI,KAAK,CAAE,CAAC,EAAE,CAAC,CAAE,CAAC;MACnC;IACD;IACA,OAAOJ,YAAY;EACpB,CAAC,EACD,CAAE;IAAEK,MAAM,EAAEV,aAAa;IAAEW,QAAQ,EAAEV;EAAgB,CAAC,CACvD,CAAC;EAED,MAAMW,gBAAgB,GAAG,IAAAC,oBAAW,EAAIC,MAAM,IAAM;IACnD,MAAMC,WAAW,GAAG,IAAAC,iBAAY,EAAEC,MAAM,CAACC,QAAQ,CAACC,IAAK,CAAC;IACxD,MAAMC,qBAAqB,GAAG,IAAAC,oBAAe,EAC5CJ,MAAM,CAACC,QAAQ,CAACC,IAAI,EACpB,GAAGG,MAAM,CAACC,IAAI,CAAER,WAAY,CAC7B,CAAC;IAED,MAAMS,MAAM,GAAG,IAAAC,iBAAY,EAAEL,qBAAqB,EAAE;MACnDb,IAAI,EAAEO,MAAM,CAACJ,MAAM;MACnBgB,MAAM,EAAE;IACT,CAAE,CAAC;IAEH,OAAO;MACNP,IAAI,EAAEK,MAAM;MACZG,OAAO,EAAIC,KAAK,IAAM;QACrBA,KAAK,CAACC,cAAc,CAAC,CAAC;QACtB1B,QAAQ,CAAE;UACTG,IAAI,EAAE,MAAM;UACZC,IAAI,EAAE;YAAEG,MAAM,EAAEI,MAAM,CAACJ,MAAM;YAAEC,QAAQ,EAAEG,MAAM,CAACH;UAAS;QAC1D,CAAE,CAAC;MACJ;IACD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMmB,MAAM,GAAG,IAAAjB,oBAAW,EAAE,MAAM;IACjCV,QAAQ,CAAE;MAAEG,IAAI,EAAE;IAAM,CAAE,CAAC;EAC5B,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMyB,WAAW,GAAG7B,WAAW,CAAEA,WAAW,CAACM,MAAM,GAAG,CAAC,CAAE;EAEzD,OAAO;IACNuB,WAAW;IACXnB,gBAAgB;IAChBkB,MAAM,EAAE5B,WAAW,CAACM,MAAM,GAAG,CAAC,GAAGsB,MAAM,GAAGE;EAC3C,CAAC;AACF"}
package/build/index.js CHANGED
@@ -64,12 +64,7 @@ Object.defineProperty(exports, "__experimentalMainDashboardButton", {
64
64
  return _mainDashboardButton.default;
65
65
  }
66
66
  });
67
- Object.defineProperty(exports, "__experimentalPluginPostExcerpt", {
68
- enumerable: true,
69
- get: function () {
70
- return _pluginPostExcerpt.default;
71
- }
72
- });
67
+ exports.__experimentalPluginPostExcerpt = void 0;
73
68
  exports.initializeEditor = initializeEditor;
74
69
  exports.reinitializeEditor = reinitializeEditor;
75
70
  Object.defineProperty(exports, "store", {
@@ -87,10 +82,11 @@ var _data = require("@wordpress/data");
87
82
  var _hooks = require("@wordpress/hooks");
88
83
  var _preferences = require("@wordpress/preferences");
89
84
  var _widgets = require("@wordpress/widgets");
85
+ var _editor = require("@wordpress/editor");
90
86
  require("./hooks");
91
87
  require("./plugins");
92
- var _editor = _interopRequireDefault(require("./editor"));
93
- var _store = require("./store");
88
+ var _editor2 = _interopRequireDefault(require("./editor"));
89
+ var _lockUnlock = require("./lock-unlock");
94
90
  var _pluginBlockSettingsMenuItem = _interopRequireDefault(require("./components/block-settings-menu/plugin-block-settings-menu-item"));
95
91
  var _pluginDocumentSettingPanel = _interopRequireDefault(require("./components/sidebar/plugin-document-setting-panel"));
96
92
  var _pluginMoreMenuItem = _interopRequireDefault(require("./components/header/plugin-more-menu-item"));
@@ -101,7 +97,7 @@ var _pluginSidebar = _interopRequireDefault(require("./components/sidebar/plugin
101
97
  var _pluginSidebarMoreMenuItem = _interopRequireDefault(require("./components/header/plugin-sidebar-more-menu-item"));
102
98
  var _fullscreenModeClose = _interopRequireDefault(require("./components/header/fullscreen-mode-close"));
103
99
  var _mainDashboardButton = _interopRequireDefault(require("./components/header/main-dashboard-button"));
104
- var _pluginPostExcerpt = _interopRequireDefault(require("./components/sidebar/plugin-post-excerpt"));
100
+ var _store = require("./store");
105
101
  /**
106
102
  * WordPress dependencies
107
103
  */
@@ -110,6 +106,10 @@ var _pluginPostExcerpt = _interopRequireDefault(require("./components/sidebar/pl
110
106
  * Internal dependencies
111
107
  */
112
108
 
109
+ const {
110
+ PluginPostExcerpt: __experimentalPluginPostExcerpt
111
+ } = (0, _lockUnlock.unlock)(_editor.privateApis);
112
+
113
113
  /**
114
114
  * Initializes and returns an instance of Editor.
115
115
  *
@@ -121,31 +121,35 @@ var _pluginPostExcerpt = _interopRequireDefault(require("./components/sidebar/pl
121
121
  * considered as non-user-initiated (bypass for
122
122
  * unsaved changes prompt).
123
123
  */
124
+ exports.__experimentalPluginPostExcerpt = __experimentalPluginPostExcerpt;
124
125
  function initializeEditor(id, postType, postId, settings, initialEdits) {
125
126
  const target = document.getElementById(id);
126
127
  const root = (0, _element.createRoot)(target);
127
128
  (0, _data.dispatch)(_preferences.store).setDefaults('core/edit-post', {
128
129
  editorMode: 'visual',
129
- fixedToolbar: false,
130
130
  fullscreenMode: true,
131
131
  hiddenBlockTypes: [],
132
- inactivePanels: [],
133
132
  isPublishSidebarEnabled: true,
134
- openPanels: ['post-status'],
135
133
  preferredStyleVariations: {},
136
- showBlockBreadcrumbs: true,
137
- showIconLabels: false,
138
- showListViewByDefault: false,
139
134
  themeStyles: true,
140
135
  welcomeGuide: true,
141
136
  welcomeGuideTemplate: true
142
137
  });
138
+ (0, _data.dispatch)(_preferences.store).setDefaults('core', {
139
+ allowRightClickOverrides: true,
140
+ fixedToolbar: false,
141
+ inactivePanels: [],
142
+ openPanels: ['post-status'],
143
+ showBlockBreadcrumbs: true,
144
+ showIconLabels: false,
145
+ showListViewByDefault: false
146
+ });
143
147
  (0, _data.dispatch)(_blocks.store).reapplyBlockTypeFilters();
144
148
 
145
149
  // Check if the block list view should be open by default.
146
150
  // If `distractionFree` mode is enabled, the block list view should not be open.
147
- if ((0, _data.select)(_store.store).isFeatureActive('showListViewByDefault') && !(0, _data.select)(_store.store).isFeatureActive('distractionFree')) {
148
- (0, _data.dispatch)(_store.store).setIsListViewOpened(true);
151
+ if ((0, _data.select)(_preferences.store).get('core', 'showListViewByDefault') && !(0, _data.select)(_preferences.store).get('core', 'distractionFree')) {
152
+ (0, _data.dispatch)(_editor.store).setIsListViewOpened(true);
149
153
  }
150
154
  (0, _blockLibrary.registerCoreBlocks)();
151
155
  (0, _widgets.registerLegacyWidgetBlock)({
@@ -167,7 +171,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
167
171
  * so that common filters in the block library are not overwritten.
168
172
  */
169
173
  (0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => {
170
- if (!(0, _data.select)(_store.store).isEditingTemplate() && blockType.name === 'core/template-part') {
174
+ if ((0, _data.select)(_editor.store).getRenderingMode() === 'post-only' && blockType.name === 'core/template-part') {
171
175
  return false;
172
176
  }
173
177
  return canInsert;
@@ -182,7 +186,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
182
186
  (0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, {
183
187
  getBlockParentsByBlockName
184
188
  }) => {
185
- if (!(0, _data.select)(_store.store).isEditingTemplate() && blockType.name === 'core/post-content') {
189
+ if ((0, _data.select)(_editor.store).getRenderingMode() === 'post-only' && blockType.name === 'core/post-content') {
186
190
  return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0;
187
191
  }
188
192
  return canInsert;
@@ -223,7 +227,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
223
227
  // Prevent the default browser action for files dropped outside of dropzones.
224
228
  window.addEventListener('dragover', e => e.preventDefault(), false);
225
229
  window.addEventListener('drop', e => e.preventDefault(), false);
226
- root.render((0, _react.createElement)(_editor.default, {
230
+ root.render((0, _react.createElement)(_editor2.default, {
227
231
  settings: settings,
228
232
  postId: postId,
229
233
  postType: postType,
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_blockLibrary","_deprecated","_interopRequireDefault","_element","_data","_hooks","_preferences","_widgets","_editor","_store","_pluginBlockSettingsMenuItem","_pluginDocumentSettingPanel","_pluginMoreMenuItem","_pluginPostPublishPanel","_pluginPostStatusInfo","_pluginPrePublishPanel","_pluginSidebar","_pluginSidebarMoreMenuItem","_fullscreenModeClose","_mainDashboardButton","_pluginPostExcerpt","initializeEditor","id","postType","postId","settings","initialEdits","target","document","getElementById","root","createRoot","dispatch","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","themeStyles","welcomeGuide","welcomeGuideTemplate","blocksStore","reapplyBlockTypeFilters","select","editPostStore","isFeatureActive","setIsListViewOpened","registerCoreBlocks","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","process","env","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","addFilter","canInsert","blockType","isEditingTemplate","name","rootClientId","getBlockParentsByBlockName","length","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","_react","createElement","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\tif (\n\t\tselect( editPostStore ).isFeatureActive( 'showListViewByDefault' ) &&\n\t\t! select( editPostStore ).isFeatureActive( 'distractionFree' )\n\t) {\n\t\tdispatch( editPostStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t/*\n\t * Prevent adding template part in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t/*\n\t * Prevent adding post content block (except in query block) in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removePostContentFromInserter',\n\t\t(\n\t\t\tcanInsert,\n\t\t\tblockType,\n\t\t\trootClientId,\n\t\t\t{ getBlockParentsByBlockName }\n\t\t) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/post-content'\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\tgetBlockParentsByBlockName( rootClientId, 'core/query' )\n\t\t\t\t\t\t.length > 0\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { default as __experimentalPluginPostExcerpt } from './components/sidebar/plugin-post-excerpt';\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAIA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAQAA,OAAA;AACAA,OAAA;AACA,IAAAS,OAAA,GAAAN,sBAAA,CAAAH,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AA8KA,IAAAW,4BAAA,GAAAR,sBAAA,CAAAH,OAAA;AACA,IAAAY,2BAAA,GAAAT,sBAAA,CAAAH,OAAA;AACA,IAAAa,mBAAA,GAAAV,sBAAA,CAAAH,OAAA;AACA,IAAAc,uBAAA,GAAAX,sBAAA,CAAAH,OAAA;AACA,IAAAe,qBAAA,GAAAZ,sBAAA,CAAAH,OAAA;AACA,IAAAgB,sBAAA,GAAAb,sBAAA,CAAAH,OAAA;AACA,IAAAiB,cAAA,GAAAd,sBAAA,CAAAH,OAAA;AACA,IAAAkB,0BAAA,GAAAf,sBAAA,CAAAH,OAAA;AACA,IAAAmB,oBAAA,GAAAhB,sBAAA,CAAAH,OAAA;AACA,IAAAoB,oBAAA,GAAAjB,sBAAA,CAAAH,OAAA;AACA,IAAAqB,kBAAA,GAAAlB,sBAAA,CAAAH,OAAA;AAhN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M,CAACI,gBAAgB,CAAE,QAAQ,EAAIC,KAAK,IAAM;MAC/C,MAAMC,qBAAqB,GAAGxD,QAAQ,CAACyD,sBAAsB,CAC5D,oCACD,CAAC,CAAE,CAAC,CAAE;MACN,IAAKF,KAAK,CAACxD,MAAM,KAAKC,QAAQ,EAAG;QAChC;QACA;QACA,IAAKkD,MAAM,CAACQ,OAAO,GAAG,GAAG,EAAG;UAC3BF,qBAAqB,CAACG,SAAS,GAC9BH,qBAAqB,CAACG,SAAS,GAAGT,MAAM,CAACQ,OAAO;QAClD;QACA;QACA,IACC1D,QAAQ,CAACyD,sBAAsB,CAAE,gBAAiB,CAAC,CAAE,CAAC,CAAE,EACvD;UACDP,MAAM,CAACU,QAAQ,CAAE,CAAC,EAAE,CAAE,CAAC;QACxB;MACD;IACD,CAAE,CAAC;EACJ;;EAEA;EACAV,MAAM,CAACI,gBAAgB,CAAE,UAAU,EAAIO,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EACzEZ,MAAM,CAACI,gBAAgB,CAAE,MAAM,EAAIO,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErE5D,IAAI,CAAC6D,MAAM,CACV,IAAAC,MAAA,CAAAC,aAAA,EAACrF,OAAA,CAAAsF,OAAM;IACNrE,QAAQ,EAAGA,QAAU;IACrBD,MAAM,EAAGA,MAAQ;IACjBD,QAAQ,EAAGA,QAAU;IACrBG,YAAY,EAAGA;EAAc,CAC7B,CACF,CAAC;EAED,OAAOI,IAAI;AACZ;;AAEA;AACA;AACA;AACO,SAASiE,kBAAkBA,CAAA,EAAG;EACpC,IAAAC,mBAAU,EAAE,gCAAgC,EAAE;IAC7CC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ"}
1
+ {"version":3,"names":["_blocks","require","_blockLibrary","_deprecated","_interopRequireDefault","_element","_data","_hooks","_preferences","_widgets","_editor","_editor2","_lockUnlock","_pluginBlockSettingsMenuItem","_pluginDocumentSettingPanel","_pluginMoreMenuItem","_pluginPostPublishPanel","_pluginPostStatusInfo","_pluginPrePublishPanel","_pluginSidebar","_pluginSidebarMoreMenuItem","_fullscreenModeClose","_mainDashboardButton","_store","PluginPostExcerpt","__experimentalPluginPostExcerpt","unlock","editorPrivateApis","exports","initializeEditor","id","postType","postId","settings","initialEdits","target","document","getElementById","root","createRoot","dispatch","preferencesStore","setDefaults","editorMode","fullscreenMode","hiddenBlockTypes","isPublishSidebarEnabled","preferredStyleVariations","themeStyles","welcomeGuide","welcomeGuideTemplate","allowRightClickOverrides","fixedToolbar","inactivePanels","openPanels","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","blocksStore","reapplyBlockTypeFilters","select","get","editorStore","setIsListViewOpened","registerCoreBlocks","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","process","env","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","addFilter","canInsert","blockType","getRenderingMode","name","rootClientId","getBlockParentsByBlockName","length","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault","render","_react","createElement","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-post/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { unlock } from './lock-unlock';\n\nconst { PluginPostExcerpt: __experimentalPluginPostExcerpt } =\n\tunlock( editorPrivateApis );\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tisPublishSidebarEnabled: true,\n\t\tpreferredStyleVariations: {},\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tfixedToolbar: false,\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\tif (\n\t\tselect( preferencesStore ).get( 'core', 'showListViewByDefault' ) &&\n\t\t! select( preferencesStore ).get( 'core', 'distractionFree' )\n\t) {\n\t\tdispatch( editorStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t/*\n\t * Prevent adding template part in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif (\n\t\t\t\tselect( editorStore ).getRenderingMode() === 'post-only' &&\n\t\t\t\tblockType.name === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t/*\n\t * Prevent adding post content block (except in query block) in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removePostContentFromInserter',\n\t\t(\n\t\t\tcanInsert,\n\t\t\tblockType,\n\t\t\trootClientId,\n\t\t\t{ getBlockParentsByBlockName }\n\t\t) => {\n\t\t\tif (\n\t\t\t\tselect( editorStore ).getRenderingMode() === 'post-only' &&\n\t\t\t\tblockType.name === 'core/post-content'\n\t\t\t) {\n\t\t\t\treturn (\n\t\t\t\t\tgetBlockParentsByBlockName( rootClientId, 'core/query' )\n\t\t\t\t\t\t.length > 0\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { __experimentalPluginPostExcerpt };\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAIA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAIA,IAAAS,OAAA,GAAAT,OAAA;AAQAA,OAAA;AACAA,OAAA;AACA,IAAAU,QAAA,GAAAP,sBAAA,CAAAH,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AAqLA,IAAAY,4BAAA,GAAAT,sBAAA,CAAAH,OAAA;AACA,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CAAE,CAAC;QACxB;MACD;IACD,CAAE,CAAC;EACJ;;EAEA;EACAV,MAAM,CAACI,gBAAgB,CAAE,UAAU,EAAIO,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EACzEZ,MAAM,CAACI,gBAAgB,CAAE,MAAM,EAAIO,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErE7D,IAAI,CAAC8D,MAAM,CACV,IAAAC,MAAA,CAAAC,aAAA,EAAC3F,QAAA,CAAA4F,OAAM;IACNtE,QAAQ,EAAGA,QAAU;IACrBD,MAAM,EAAGA,MAAQ;IACjBD,QAAQ,EAAGA,QAAU;IACrBG,YAAY,EAAGA;EAAc,CAC7B,CACF,CAAC;EAED,OAAOI,IAAI;AACZ;;AAEA;AACA;AACA;AACO,SAASkE,kBAAkBA,CAAA,EAAG;EACpC,IAAAC,mBAAU,EAAE,gCAAgC,EAAE;IAC7CC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ"}
@@ -37,7 +37,6 @@ var _editor = _interopRequireDefault(require("./editor"));
37
37
  function initializeEditor(id, postType, postId) {
38
38
  (0, _data.dispatch)(_preferences.store).setDefaults('core/edit-post', {
39
39
  editorMode: 'visual',
40
- fixedToolbar: false,
41
40
  fullscreenMode: true,
42
41
  hiddenBlockTypes: [],
43
42
  inactivePanels: [],
@@ -46,6 +45,13 @@ function initializeEditor(id, postType, postId) {
46
45
  preferredStyleVariations: {},
47
46
  welcomeGuide: true
48
47
  });
48
+ (0, _data.dispatch)(_preferences.store).setDefaults('core', {
49
+ inactivePanels: [],
50
+ openPanels: ['post-status']
51
+ });
52
+ (0, _data.dispatch)(_preferences.store).setDefaults('core', {
53
+ fixedToolbar: false
54
+ });
49
55
  return (0, _react.createElement)(_editor.default, {
50
56
  postId: postId,
51
57
  postType: postType
@@ -1 +1 @@
1
- {"version":3,"names":["require","_data","_preferences","_store","_editor","_interopRequireDefault","initializeEditor","id","postType","postId","dispatch","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","welcomeGuide","_react","createElement","default"],"sources":["@wordpress/edit-post/src/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport '@wordpress/core-data';\nimport '@wordpress/format-library';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nexport { store } from './store';\nimport Editor from './editor';\n\n/**\n * Initializes the Editor and returns a componentProvider\n * that can be registered with `AppRegistry.registerComponent`\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit (unused right now)\n */\nexport function initializeEditor( id, postType, postId ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\twelcomeGuide: true,\n\t} );\n\n\treturn <Editor postId={ postId } postType={ postType } />;\n}\n"],"mappings":";;;;;;;;;;;;;;AAGAA,OAAA;AACAA,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,gBAAgBA,CAAEC,EAAE,EAAEC,QAAQ,EAAEC,MAAM,EAAG;EACxD,IAAAC,cAAQ,EAAEC,kBAAiB,CAAC,CAACC,WAAW,CAAE,gBAAgB,EAAE;IAC3DC,UAAU,EAAE,QAAQ;IACpBC,YAAY,EAAE,KAAK;IACnBC,cAAc,EAAE,IAAI;IACpBC,gBAAgB,EAAE,EAAE;IACpBC,cAAc,EAAE,EAAE;IAClBC,uBAAuB,EAAE,IAAI;IAC7BC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BC,wBAAwB,EAAE,CAAC,CAAC;IAC5BC,YAAY,EAAE;EACf,CAAE,CAAC;EAEH,OAAO,IAAAC,MAAA,CAAAC,aAAA,EAACnB,OAAA,CAAAoB,OAAM;IAACf,MAAM,EAAGA,MAAQ;IAACD,QAAQ,EAAGA;EAAU,CAAE,CAAC;AAC1D"}
1
+ {"version":3,"names":["require","_data","_preferences","_store","_editor","_interopRequireDefault","initializeEditor","id","postType","postId","dispatch","preferencesStore","setDefaults","editorMode","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","welcomeGuide","fixedToolbar","_react","createElement","default"],"sources":["@wordpress/edit-post/src/index.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport '@wordpress/core-data';\nimport '@wordpress/format-library';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nexport { store } from './store';\nimport Editor from './editor';\n\n/**\n * Initializes the Editor and returns a componentProvider\n * that can be registered with `AppRegistry.registerComponent`\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit (unused right now)\n */\nexport function initializeEditor( id, postType, postId ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\twelcomeGuide: true,\n\t} );\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tinactivePanels: [],\n\t\topenPanels: [ 'post-status' ],\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tfixedToolbar: false,\n\t} );\n\n\treturn <Editor postId={ postId } postType={ postType } />;\n}\n"],"mappings":";;;;;;;;;;;;;;AAGAA,OAAA;AACAA,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAC,sBAAA,CAAAL,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,gBAAgBA,CAAEC,EAAE,EAAEC,QAAQ,EAAEC,MAAM,EAAG;EACxD,IAAAC,cAAQ,EAAEC,kBAAiB,CAAC,CAACC,WAAW,CAAE,gBAAgB,EAAE;IAC3DC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,IAAI;IACpBC,gBAAgB,EAAE,EAAE;IACpBC,cAAc,EAAE,EAAE;IAClBC,uBAAuB,EAAE,IAAI;IAC7BC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BC,wBAAwB,EAAE,CAAC,CAAC;IAC5BC,YAAY,EAAE;EACf,CAAE,CAAC;EACH,IAAAV,cAAQ,EAAEC,kBAAiB,CAAC,CAACC,WAAW,CAAE,MAAM,EAAE;IACjDI,cAAc,EAAE,EAAE;IAClBE,UAAU,EAAE,CAAE,aAAa;EAC5B,CAAE,CAAC;EAEH,IAAAR,cAAQ,EAAEC,kBAAiB,CAAC,CAACC,WAAW,CAAE,MAAM,EAAE;IACjDS,YAAY,EAAE;EACf,CAAE,CAAC;EAEH,OAAO,IAAAC,MAAA,CAAAC,aAAA,EAACnB,OAAA,CAAAoB,OAAM;IAACf,MAAM,EAAGA,MAAQ;IAACD,QAAQ,EAAGA;EAAU,CAAE,CAAC;AAC1D"}
@@ -8,17 +8,13 @@ var _react = require("react");
8
8
  var _data = require("@wordpress/data");
9
9
  var _preferences = require("@wordpress/preferences");
10
10
  var _i18n = require("@wordpress/i18n");
11
- var _store = require("../../store");
11
+ var _editor = require("@wordpress/editor");
12
12
  /**
13
13
  * WordPress dependencies
14
14
  */
15
15
 
16
- /**
17
- * Internal dependencies
18
- */
19
-
20
16
  function WelcomeGuideMenuItem() {
21
- const isTemplateMode = (0, _data.useSelect)(select => select(_store.store).isEditingTemplate(), []);
17
+ const isTemplateMode = (0, _data.useSelect)(select => select(_editor.store).getRenderingMode() === 'template-only', []);
22
18
  return (0, _react.createElement)(_preferences.PreferenceToggleMenuItem, {
23
19
  scope: "core/edit-post",
24
20
  name: isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide',
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_preferences","_i18n","_store","WelcomeGuideMenuItem","isTemplateMode","useSelect","select","editPostStore","isEditingTemplate","_react","createElement","PreferenceToggleMenuItem","scope","name","label","__"],"sources":["@wordpress/edit-post/src/plugins/welcome-guide-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function WelcomeGuideMenuItem() {\n\tconst isTemplateMode = useSelect(\n\t\t( select ) => select( editPostStore ).isEditingTemplate(),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<PreferenceToggleMenuItem\n\t\t\tscope=\"core/edit-post\"\n\t\t\tname={ isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide' }\n\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASI,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,cAAc,GAAG,IAAAC,eAAS,EAC7BC,MAAM,IAAMA,MAAM,CAAEC,YAAc,CAAC,CAACC,iBAAiB,CAAC,CAAC,EACzD,EACD,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACV,YAAA,CAAAW,wBAAwB;IACxBC,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAGT,cAAc,GAAG,sBAAsB,GAAG,cAAgB;IACjEU,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB;EAAG,CAC/B,CAAC;AAEJ"}
1
+ {"version":3,"names":["_data","require","_preferences","_i18n","_editor","WelcomeGuideMenuItem","isTemplateMode","useSelect","select","editorStore","getRenderingMode","_react","createElement","PreferenceToggleMenuItem","scope","name","label","__"],"sources":["@wordpress/edit-post/src/plugins/welcome-guide-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function WelcomeGuideMenuItem() {\n\tconst isTemplateMode = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getRenderingMode() === 'template-only',\n\t\t[]\n\t);\n\n\treturn (\n\t\t<PreferenceToggleMenuItem\n\t\t\tscope=\"core/edit-post\"\n\t\t\tname={ isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide' }\n\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMe,SAASI,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,cAAc,GAAG,IAAAC,eAAS,EAC7BC,MAAM,IACPA,MAAM,CAAEC,aAAY,CAAC,CAACC,gBAAgB,CAAC,CAAC,KAAK,eAAe,EAC7D,EACD,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACV,YAAA,CAAAW,wBAAwB;IACxBC,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAGT,cAAc,GAAG,sBAAsB,GAAG,cAAgB;IACjEU,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB;EAAG,CAC/B,CAAC;AAEJ"}