@wordpress/editor 11.0.1 → 12.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/build/components/autosave-monitor/index.js +5 -0
  4. package/build/components/autosave-monitor/index.js.map +1 -1
  5. package/build/components/character-count/index.js +1 -1
  6. package/build/components/character-count/index.js.map +1 -1
  7. package/build/components/editor-help/add-blocks.native.js +6 -5
  8. package/build/components/editor-help/add-blocks.native.js.map +1 -1
  9. package/build/components/editor-help/customize-blocks.native.js +7 -6
  10. package/build/components/editor-help/customize-blocks.native.js.map +1 -1
  11. package/build/components/editor-help/help-detail-navigation-screen.native.js +29 -15
  12. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  13. package/build/components/editor-help/help-get-support-button.native.js +46 -0
  14. package/build/components/editor-help/help-get-support-button.native.js.map +1 -0
  15. package/build/components/editor-help/help-topic-row.native.js +3 -2
  16. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  17. package/build/components/editor-help/index.native.js +87 -26
  18. package/build/components/editor-help/index.native.js.map +1 -1
  19. package/build/components/editor-help/intro-to-blocks.native.js +19 -9
  20. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  21. package/build/components/editor-help/move-blocks.native.js +6 -5
  22. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  23. package/build/components/editor-help/remove-blocks.native.js +6 -5
  24. package/build/components/editor-help/remove-blocks.native.js.map +1 -1
  25. package/build/components/editor-help/view-sections.native.js +23 -5
  26. package/build/components/editor-help/view-sections.native.js.map +1 -1
  27. package/build/components/entities-saved-states/entity-type-list.js +22 -13
  28. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  29. package/build/components/entities-saved-states/index.js +23 -4
  30. package/build/components/entities-saved-states/index.js.map +1 -1
  31. package/build/components/global-keyboard-shortcuts/save-shortcut.js +12 -14
  32. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  33. package/build/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +0 -4
  34. package/build/components/global-keyboard-shortcuts/visual-editor-shortcuts.js.map +1 -1
  35. package/build/components/index.js +9 -0
  36. package/build/components/index.js.map +1 -1
  37. package/build/components/local-autosave-monitor/index.js +1 -2
  38. package/build/components/local-autosave-monitor/index.js.map +1 -1
  39. package/build/components/post-format/index.js +3 -1
  40. package/build/components/post-format/index.js.map +1 -1
  41. package/build/components/post-locked-modal/index.js +1 -1
  42. package/build/components/post-locked-modal/index.js.map +1 -1
  43. package/build/components/post-saved-state/index.js +37 -46
  44. package/build/components/post-saved-state/index.js.map +1 -1
  45. package/build/components/post-taxonomies/flat-term-selector.js +154 -211
  46. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  47. package/build/components/post-title/index.js +53 -25
  48. package/build/components/post-title/index.js.map +1 -1
  49. package/build/components/provider/index.native.js +18 -7
  50. package/build/components/provider/index.native.js.map +1 -1
  51. package/build/components/provider/use-block-editor-settings.js +32 -5
  52. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  53. package/build/components/word-count/index.js +1 -1
  54. package/build/components/word-count/index.js.map +1 -1
  55. package/build/store/actions.js +13 -38
  56. package/build/store/actions.js.map +1 -1
  57. package/build/store/defaults.js +7 -2
  58. package/build/store/defaults.js.map +1 -1
  59. package/build/store/selectors.js +4 -93
  60. package/build/store/selectors.js.map +1 -1
  61. package/build/store/utils/notice-builder.js +15 -18
  62. package/build/store/utils/notice-builder.js.map +1 -1
  63. package/build/{store/utils → utils}/get-template-part-icon.js +1 -1
  64. package/build/utils/get-template-part-icon.js.map +1 -0
  65. package/build/utils/index.js +8 -0
  66. package/build/utils/index.js.map +1 -1
  67. package/build-module/components/autosave-monitor/index.js +5 -0
  68. package/build-module/components/autosave-monitor/index.js.map +1 -1
  69. package/build-module/components/character-count/index.js +1 -1
  70. package/build-module/components/character-count/index.js.map +1 -1
  71. package/build-module/components/editor-help/add-blocks.native.js +7 -6
  72. package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
  73. package/build-module/components/editor-help/customize-blocks.native.js +8 -7
  74. package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
  75. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +31 -18
  76. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  77. package/build-module/components/editor-help/help-get-support-button.native.js +34 -0
  78. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -0
  79. package/build-module/components/editor-help/help-topic-row.native.js +3 -2
  80. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  81. package/build-module/components/editor-help/index.native.js +81 -28
  82. package/build-module/components/editor-help/index.native.js.map +1 -1
  83. package/build-module/components/editor-help/intro-to-blocks.native.js +19 -10
  84. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  85. package/build-module/components/editor-help/move-blocks.native.js +7 -6
  86. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  87. package/build-module/components/editor-help/remove-blocks.native.js +7 -6
  88. package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
  89. package/build-module/components/editor-help/view-sections.native.js +22 -5
  90. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  91. package/build-module/components/entities-saved-states/entity-type-list.js +24 -13
  92. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  93. package/build-module/components/entities-saved-states/index.js +23 -4
  94. package/build-module/components/entities-saved-states/index.js.map +1 -1
  95. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +12 -14
  96. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  97. package/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +0 -4
  98. package/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js.map +1 -1
  99. package/build-module/components/index.js +1 -0
  100. package/build-module/components/index.js.map +1 -1
  101. package/build-module/components/local-autosave-monitor/index.js +1 -2
  102. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  103. package/build-module/components/post-format/index.js +4 -2
  104. package/build-module/components/post-format/index.js.map +1 -1
  105. package/build-module/components/post-locked-modal/index.js +1 -1
  106. package/build-module/components/post-locked-modal/index.js.map +1 -1
  107. package/build-module/components/post-saved-state/index.js +38 -46
  108. package/build-module/components/post-saved-state/index.js.map +1 -1
  109. package/build-module/components/post-taxonomies/flat-term-selector.js +156 -214
  110. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  111. package/build-module/components/post-title/index.js +53 -22
  112. package/build-module/components/post-title/index.js.map +1 -1
  113. package/build-module/components/provider/index.native.js +18 -7
  114. package/build-module/components/provider/index.native.js.map +1 -1
  115. package/build-module/components/provider/use-block-editor-settings.js +31 -5
  116. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  117. package/build-module/components/word-count/index.js +1 -1
  118. package/build-module/components/word-count/index.js.map +1 -1
  119. package/build-module/store/actions.js +13 -36
  120. package/build-module/store/actions.js.map +1 -1
  121. package/build-module/store/defaults.js +7 -2
  122. package/build-module/store/defaults.js.map +1 -1
  123. package/build-module/store/selectors.js +3 -85
  124. package/build-module/store/selectors.js.map +1 -1
  125. package/build-module/store/utils/notice-builder.js +15 -18
  126. package/build-module/store/utils/notice-builder.js.map +1 -1
  127. package/build-module/{store/utils → utils}/get-template-part-icon.js +2 -2
  128. package/build-module/utils/get-template-part-icon.js.map +1 -0
  129. package/build-module/utils/index.js +1 -0
  130. package/build-module/utils/index.js.map +1 -1
  131. package/build-style/style-rtl.css +9 -60
  132. package/build-style/style.css +9 -60
  133. package/package.json +28 -28
  134. package/src/components/autosave-monitor/index.js +5 -0
  135. package/src/components/autosave-monitor/test/index.js +10 -4
  136. package/src/components/character-count/index.js +3 -2
  137. package/src/components/editor-help/add-blocks.native.js +17 -12
  138. package/src/components/editor-help/customize-blocks.native.js +16 -13
  139. package/src/components/editor-help/help-detail-navigation-screen.native.js +45 -15
  140. package/src/components/editor-help/help-get-support-button.native.js +38 -0
  141. package/src/components/editor-help/help-topic-row.native.js +2 -2
  142. package/src/components/editor-help/images/add-dark.png +0 -0
  143. package/src/components/editor-help/images/add-dark@2x.png +0 -0
  144. package/src/components/editor-help/images/add-dark@3x.png +0 -0
  145. package/src/components/editor-help/images/add-light.png +0 -0
  146. package/src/components/editor-help/images/add-light@2x.png +0 -0
  147. package/src/components/editor-help/images/add-light@3x.png +0 -0
  148. package/src/components/editor-help/images/block-layout-collage.png +0 -0
  149. package/src/components/editor-help/images/block-layout-collage@2x.png +0 -0
  150. package/src/components/editor-help/images/block-layout-collage@3x.png +0 -0
  151. package/src/components/editor-help/images/build-layouts-dark.png +0 -0
  152. package/src/components/editor-help/images/build-layouts-dark@2x.png +0 -0
  153. package/src/components/editor-help/images/build-layouts-dark@3x.png +0 -0
  154. package/src/components/editor-help/images/build-layouts-light.png +0 -0
  155. package/src/components/editor-help/images/build-layouts-light@2x.png +0 -0
  156. package/src/components/editor-help/images/build-layouts-light@3x.png +0 -0
  157. package/src/components/editor-help/images/edit-media-dark.png +0 -0
  158. package/src/components/editor-help/images/edit-media-dark@2x.png +0 -0
  159. package/src/components/editor-help/images/edit-media-dark@3x.png +0 -0
  160. package/src/components/editor-help/images/edit-media-light.png +0 -0
  161. package/src/components/editor-help/images/edit-media-light@2x.png +0 -0
  162. package/src/components/editor-help/images/edit-media-light@3x.png +0 -0
  163. package/src/components/editor-help/images/embed-media-dark.png +0 -0
  164. package/src/components/editor-help/images/embed-media-dark@2x.png +0 -0
  165. package/src/components/editor-help/images/embed-media-dark@3x.png +0 -0
  166. package/src/components/editor-help/images/embed-media-light.png +0 -0
  167. package/src/components/editor-help/images/embed-media-light@2x.png +0 -0
  168. package/src/components/editor-help/images/embed-media-light@3x.png +0 -0
  169. package/src/components/editor-help/images/move-dark.png +0 -0
  170. package/src/components/editor-help/images/move-dark@2x.png +0 -0
  171. package/src/components/editor-help/images/move-dark@3x.png +0 -0
  172. package/src/components/editor-help/images/move-light.png +0 -0
  173. package/src/components/editor-help/images/move-light@2x.png +0 -0
  174. package/src/components/editor-help/images/move-light@3x.png +0 -0
  175. package/src/components/editor-help/images/options-dark.png +0 -0
  176. package/src/components/editor-help/images/options-dark@2x.png +0 -0
  177. package/src/components/editor-help/images/options-dark@3x.png +0 -0
  178. package/src/components/editor-help/images/options-light.png +0 -0
  179. package/src/components/editor-help/images/options-light@2x.png +0 -0
  180. package/src/components/editor-help/images/options-light@3x.png +0 -0
  181. package/src/components/editor-help/images/rich-text-dark.png +0 -0
  182. package/src/components/editor-help/images/rich-text-dark@2x.png +0 -0
  183. package/src/components/editor-help/images/rich-text-dark@3x.png +0 -0
  184. package/src/components/editor-help/images/rich-text-light.png +0 -0
  185. package/src/components/editor-help/images/rich-text-light@2x.png +0 -0
  186. package/src/components/editor-help/images/rich-text-light@3x.png +0 -0
  187. package/src/components/editor-help/images/settings-dark.png +0 -0
  188. package/src/components/editor-help/images/settings-dark@2x.png +0 -0
  189. package/src/components/editor-help/images/settings-dark@3x.png +0 -0
  190. package/src/components/editor-help/images/settings-light.png +0 -0
  191. package/src/components/editor-help/images/settings-light@2x.png +0 -0
  192. package/src/components/editor-help/images/settings-light@3x.png +0 -0
  193. package/src/components/editor-help/index.native.js +147 -43
  194. package/src/components/editor-help/intro-to-blocks.native.js +63 -43
  195. package/src/components/editor-help/move-blocks.native.js +12 -7
  196. package/src/components/editor-help/remove-blocks.native.js +11 -8
  197. package/src/components/editor-help/style.android.scss +6 -0
  198. package/src/components/editor-help/style.ios.scss +6 -0
  199. package/src/components/editor-help/style.scss +49 -32
  200. package/src/components/editor-help/test/index.native.js +80 -0
  201. package/src/components/editor-help/view-sections.native.js +47 -4
  202. package/src/components/entities-saved-states/entity-type-list.js +29 -10
  203. package/src/components/entities-saved-states/index.js +38 -8
  204. package/src/components/global-keyboard-shortcuts/save-shortcut.js +34 -42
  205. package/src/components/global-keyboard-shortcuts/visual-editor-shortcuts.js +8 -16
  206. package/src/components/index.js +1 -0
  207. package/src/components/local-autosave-monitor/index.js +1 -3
  208. package/src/components/post-format/index.js +6 -2
  209. package/src/components/post-format/style.scss +1 -0
  210. package/src/components/post-locked-modal/index.js +1 -1
  211. package/src/components/post-saved-state/index.js +41 -55
  212. package/src/components/post-saved-state/style.scss +10 -1
  213. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +20 -0
  214. package/src/components/post-saved-state/test/index.js +2 -2
  215. package/src/components/post-taxonomies/flat-term-selector.js +220 -254
  216. package/src/components/post-title/index.js +47 -30
  217. package/src/components/post-title/style.scss +1 -70
  218. package/src/components/provider/index.native.js +17 -5
  219. package/src/components/provider/use-block-editor-settings.js +25 -2
  220. package/src/components/word-count/index.js +3 -2
  221. package/src/store/actions.js +13 -41
  222. package/src/store/defaults.js +7 -2
  223. package/src/store/selectors.js +2 -112
  224. package/src/store/test/actions.js +4 -2
  225. package/src/store/utils/notice-builder.js +17 -19
  226. package/src/store/utils/test/notice-builder.js +1 -1
  227. package/src/{store/utils → utils}/get-template-part-icon.js +2 -2
  228. package/src/utils/index.js +1 -0
  229. package/build/store/utils/get-template-part-icon.js.map +0 -1
  230. package/build-module/store/utils/get-template-part-icon.js.map +0 -1
  231. package/src/components/editor-help/images/add-blocks.png +0 -0
  232. package/src/components/editor-help/images/customize-blocks.png +0 -0
  233. package/src/components/editor-help/images/cut-copy-duplicate-blocks.png +0 -0
  234. package/src/components/editor-help/images/edit-or-replace-media.png +0 -0
  235. package/src/components/editor-help/images/intro-blocks-1.png +0 -0
  236. package/src/components/editor-help/images/intro-blocks-2.png +0 -0
  237. package/src/components/editor-help/images/intro-blocks-3.png +0 -0
  238. package/src/components/editor-help/images/intro-blocks-4.png +0 -0
  239. package/src/components/editor-help/images/move-blocks.png +0 -0
  240. package/src/components/editor-help/images/remove-blocks.png +0 -0
  241. package/src/components/editor-help/images/what-is-a-block.png +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-title/index.js"],"names":["TextareaAutosize","classnames","__","useEffect","useRef","useState","decodeEntities","ENTER","useSelect","useDispatch","VisuallyHidden","useInstanceId","pasteHandler","store","blockEditorStore","PostTypeSupportCheck","editorStore","REGEXP_NEWLINES","PostTitle","instanceId","ref","isSelected","setIsSelected","editPost","insertDefaultBlock","clearSelectedBlock","insertBlocks","isCleanNewPost","title","placeholder","isFocusMode","hasFixedToolbar","select","getEditedPostAttribute","_isCleanNewPost","getSettings","titlePlaceholder","focusMode","_hasFixedToolbar","current","ownerDocument","activeElement","body","focus","onEnterPress","undefined","onInsertBlockAfter","blocks","onUpdate","newTitle","onSelect","onUnselect","onChange","event","target","value","replace","onKeyDown","keyCode","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","HTML","length","firstBlock","name","attributes","slice","className","decodedPlaceholder"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,gBAAP,MAA6B,yBAA7B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,QAA5B,QAA4C,oBAA5C;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAT,QAAsB,qBAAtB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,cAAT,QAA+B,uBAA/B;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,4BAAjC;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;;AACA,MAAMC,eAAe,GAAG,UAAxB;AAEA,eAAe,SAASC,SAAT,GAAqB;AACnC,QAAMC,UAAU,GAAGR,aAAa,CAAEO,SAAF,CAAhC;AACA,QAAME,GAAG,GAAGhB,MAAM,EAAlB;AACA,QAAM,CAAEiB,UAAF,EAAcC,aAAd,IAA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C,cAAC,cAAD;AACC,IAAA,EAAE,EAAC,OADJ;AAEC,IAAA,OAAO,EAAI,cAAc1D,UAAY;AAFtC,KAIG2D,kBAAkB,IAAI5E,EAAE,CAAE,WAAF,CAJ3B,CADD,EAOC,cAAC,gBAAD;AACC,IAAA,GAAG,EAAGkB,GADP;AAEC,IAAA,EAAE,EAAI,cAAcD,UAAY,EAFjC;AAGC,IAAA,SAAS,EAAC,0BAHX;AAIC,IAAA,KAAK,EAAGS,KAJT;AAKC,IAAA,QAAQ,EAAGwB,QALZ;AAMC,IAAA,WAAW,EAAG0B,kBAAkB,IAAI5E,EAAE,CAAE,WAAF,CANvC;AAOC,IAAA,OAAO,EAAGgD,QAPX;AAQC,IAAA,MAAM,EAAGC,UARV;AASC,IAAA,SAAS,EAAGM,SATb;AAUC,IAAA,UAAU,EAAGN,UAVd;AAWC,IAAA,OAAO,EAAGS;AAXX,IAPD,CADD,CADD;AAyBA","sourcesContent":["/**\n * External dependencies\n */\nimport TextareaAutosize from 'react-autosize-textarea';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { ENTER } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { VisuallyHidden } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\n/**\n * Constants\n */\nconst REGEXP_NEWLINES = /[\\r\\n]+/g;\n\nexport default function PostTitle() {\n\tconst instanceId = useInstanceId( PostTitle );\n\tconst ref = useRef();\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst {\n\t\tinsertDefaultBlock,\n\t\tclearSelectedBlock,\n\t\tinsertBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst {\n\t\tisCleanNewPost,\n\t\ttitle,\n\t\tplaceholder,\n\t\tisFocusMode,\n\t\thasFixedToolbar,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostAttribute,\n\t\t\tisCleanNewPost: _isCleanNewPost,\n\t\t} = select( editorStore );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst {\n\t\t\ttitlePlaceholder,\n\t\t\tfocusMode,\n\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t} = getSettings();\n\n\t\treturn {\n\t\t\tisCleanNewPost: _isCleanNewPost(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tplaceholder: titlePlaceholder,\n\t\t\tisFocusMode: focusMode,\n\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t};\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { activeElement, body } = ownerDocument;\n\n\t\t// Only autofocus the title when the post is entirely empty. This should\n\t\t// only happen for a new post, which means we focus the title on new\n\t\t// post so the author can start typing right away, without needing to\n\t\t// click anything.\n\t\tif ( isCleanNewPost && ( ! activeElement || body === activeElement ) ) {\n\t\t\tref.current.focus();\n\t\t}\n\t}, [ isCleanNewPost ] );\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onUpdate( newTitle ) {\n\t\teditPost( { title: newTitle } );\n\t}\n\n\tfunction onSelect() {\n\t\tsetIsSelected( true );\n\t\tclearSelectedBlock();\n\t}\n\n\tfunction onUnselect() {\n\t\tsetIsSelected( false );\n\t}\n\n\tfunction onChange( event ) {\n\t\tonUpdate( event.target.value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t// arguments first, then fallback to `Text` if they fail.\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error1 ) {\n\t\t\ttry {\n\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t} catch ( error2 ) {\n\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t// behaviour.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tif ( typeof content !== 'string' && content.length ) {\n\t\t\tevent.preventDefault();\n\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\tonUpdate( firstBlock.attributes.content );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t}\n\t}\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = classnames(\n\t\t'wp-block editor-post-title editor-post-title__block',\n\t\t{\n\t\t\t'is-selected': isSelected,\n\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t}\n\t);\n\tconst decodedPlaceholder = decodeEntities( placeholder );\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<div className={ className }>\n\t\t\t\t<VisuallyHidden\n\t\t\t\t\tas=\"label\"\n\t\t\t\t\thtmlFor={ `post-title-${ instanceId }` }\n\t\t\t\t>\n\t\t\t\t\t{ decodedPlaceholder || __( 'Add title' ) }\n\t\t\t\t</VisuallyHidden>\n\t\t\t\t<TextareaAutosize\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tid={ `post-title-${ instanceId }` }\n\t\t\t\t\tclassName=\"editor-post-title__input\"\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tplaceholder={ decodedPlaceholder || __( 'Add title' ) }\n\t\t\t\t\tonFocus={ onSelect }\n\t\t\t\t\tonBlur={ onUnselect }\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\t\tonPaste={ onPaste }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-title/index.js"],"names":["classnames","__","useEffect","useRef","useState","decodeEntities","ENTER","useSelect","useDispatch","pasteHandler","store","blockEditorStore","__unstableUseRichText","useRichText","useMergeRefs","PostTypeSupportCheck","editorStore","REGEXP_NEWLINES","PostTitle","ref","isSelected","setIsSelected","editPost","insertDefaultBlock","clearSelectedBlock","insertBlocks","isCleanNewPost","title","placeholder","isFocusMode","hasFixedToolbar","select","getEditedPostAttribute","_isCleanNewPost","getSettings","titlePlaceholder","focusMode","_hasFixedToolbar","current","ownerDocument","activeElement","body","focus","onEnterPress","undefined","onInsertBlockAfter","blocks","onUpdate","newTitle","selection","setSelection","onSelect","onUnselect","onChange","value","replace","onKeyDown","event","keyCode","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","HTML","length","firstBlock","name","attributes","slice","className","decodedPlaceholder","richTextRef","selectionStart","start","selectionEnd","end","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","preserveWhiteSpace"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,QAA5B,QAA4C,oBAA5C;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAT,QAAsB,qBAAtB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,qBAAqB,IAAIC,WAAlC,QAAqD,sBAArD;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,4BAAjC;AACA,SAASL,KAAK,IAAIM,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;;AACA,MAAMC,eAAe,GAAG,UAAxB;AAEA,eAAe,SAASC,SAAT,GAAqB;AACnC,QAAMC,GAAG,GAAGhB,MAAM,EAAlB;AACA,QAAM,CAAEiB,UAAF,EAAcC,aAAd,IAAgCjB,QAAQ,CAAE,KAAF,CAA9C;AACA,QAAM;AAAEkB,IAAAA;AAAF,MAAed,WAAW,CAAEQ,WAAF,CAAhC;AACA,QAAM;AACLO,IAAAA,kBADK;AAELC,IAAAA,kBAFK;AAGLC,IAAAA;AAHK,MAIFjB,WAAW,CAAEG,gBAAF,CAJf;AAKA,QAAM;AACLe,IAAAA,cADK;AAELC,IAAAA,KAFK;AAGLC,IAAAA,WAHK;AAILC,IAAAA,WAJK;AAKLC,IAAAA;AALK,MAMFvB,SAAS,CAAIwB,MAAF,IAAc;AAC5B,UAAM;AACLC,MAAAA,sBADK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AY,CAAIqC,GAAF,IAAW;AACxB,cAAM;AAAEN,UAAAA,KAAF;AAASE,UAAAA;AAAT,YAAiBI,GAAvB;;AACA,YAAKN,KAAK,KAAKI,QAAV,IAAsBF,GAAG,KAAKG,MAAnC,EAA4C;AAC3C,iBAAOC,GAAP;AACA;;AACD,eAAO;AACNN,UAAAA,KAAK,EAAEI,QADD;AAENF,UAAAA,GAAG,EAAEG;AAFC,SAAP;AAIA,OATW,CAAZ;AAUA,KAjBwC;;AAkBzCE,IAAAA,wBAAwB,EAAE,IAlBe;AAmBzCC,IAAAA,kBAAkB,EAAE;AAnBqB,GAAF,CAAxC;AAsBA;;AACA,SACC,cAAC,oBAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACC;AACC,IAAA,GAAG,EAAG3E,YAAY,CAAE,CAAEiE,WAAF,EAAe5D,GAAf,CAAF,CADnB;AAEC,IAAA,eAAe,MAFhB;AAGC,IAAA,SAAS,EAAG0D,SAHb;AAIC,kBAAaC,kBAJd;AAKC,IAAA,IAAI,EAAC,SALN;AAMC,sBAAe,MANhB;AAOC,IAAA,OAAO,EAAG3B,QAPX;AAQC,IAAA,MAAM,EAAGC,UARV;AASC,IAAA,SAAS,EAAGI,SATb;AAUC,IAAA,UAAU,EAAGJ,UAVd;AAWC,IAAA,OAAO,EAAGQ;AAXX,IADD,CADD;AAiBA;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { ENTER } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __unstableUseRichText as useRichText } from '@wordpress/rich-text';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\n/**\n * Constants\n */\nconst REGEXP_NEWLINES = /[\\r\\n]+/g;\n\nexport default function PostTitle() {\n\tconst ref = useRef();\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst {\n\t\tinsertDefaultBlock,\n\t\tclearSelectedBlock,\n\t\tinsertBlocks,\n\t} = useDispatch( blockEditorStore );\n\tconst {\n\t\tisCleanNewPost,\n\t\ttitle,\n\t\tplaceholder,\n\t\tisFocusMode,\n\t\thasFixedToolbar,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostAttribute,\n\t\t\tisCleanNewPost: _isCleanNewPost,\n\t\t} = select( editorStore );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst {\n\t\t\ttitlePlaceholder,\n\t\t\tfocusMode,\n\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t} = getSettings();\n\n\t\treturn {\n\t\t\tisCleanNewPost: _isCleanNewPost(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tplaceholder: titlePlaceholder,\n\t\t\tisFocusMode: focusMode,\n\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { activeElement, body } = ownerDocument;\n\n\t\t// Only autofocus the title when the post is entirely empty. This should\n\t\t// only happen for a new post, which means we focus the title on new\n\t\t// post so the author can start typing right away, without needing to\n\t\t// click anything.\n\t\tif ( isCleanNewPost && ( ! activeElement || body === activeElement ) ) {\n\t\t\tref.current.focus();\n\t\t}\n\t}, [ isCleanNewPost ] );\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onUpdate( newTitle ) {\n\t\teditPost( { title: newTitle } );\n\t}\n\n\tconst [ selection, setSelection ] = useState( {} );\n\n\tfunction onSelect() {\n\t\tsetIsSelected( true );\n\t\tclearSelectedBlock();\n\t}\n\n\tfunction onUnselect() {\n\t\tsetIsSelected( false );\n\t\tsetSelection( {} );\n\t}\n\n\tfunction onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t// arguments first, then fallback to `Text` if they fail.\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error1 ) {\n\t\t\ttry {\n\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t} catch ( error2 ) {\n\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t// behaviour.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tif ( typeof content !== 'string' && content.length ) {\n\t\t\tevent.preventDefault();\n\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\tonUpdate( firstBlock.attributes.content );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t}\n\t}\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = classnames(\n\t\t'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text',\n\t\t{\n\t\t\t'is-selected': isSelected,\n\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t}\n\t);\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\tconst { ref: richTextRef } = useRichText( {\n\t\tvalue: title,\n\t\tonChange,\n\t\tplaceholder: decodedPlaceholder,\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange( newStart, newEnd ) {\n\t\t\tsetSelection( ( sel ) => {\n\t\t\t\tconst { start, end } = sel;\n\t\t\t\tif ( start === newStart && end === newEnd ) {\n\t\t\t\t\treturn sel;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tend: newEnd,\n\t\t\t\t};\n\t\t\t} );\n\t\t},\n\t\t__unstableDisableFormats: true,\n\t\tpreserveWhiteSpace: true,\n\t} );\n\n\t/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<h1\n\t\t\t\tref={ useMergeRefs( [ richTextRef, ref ] ) }\n\t\t\t\tcontentEditable\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ decodedPlaceholder }\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline=\"true\"\n\t\t\t\tonFocus={ onSelect }\n\t\t\t\tonBlur={ onUnselect }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\tonPaste={ onPaste }\n\t\t\t/>\n\t\t</PostTypeSupportCheck>\n\t);\n\t/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n"]}
@@ -40,7 +40,8 @@ const postTypeEntities = [{
40
40
  },
41
41
  mergedEdits: {
42
42
  meta: true
43
- }
43
+ },
44
+ rawAttributes: ['title', 'excerpt', 'content']
44
45
  }));
45
46
  import { EditorHelpTopics } from '@wordpress/editor';
46
47
  /**
@@ -69,10 +70,16 @@ class NativeEditorProvider extends Component {
69
70
  componentDidMount() {
70
71
  const {
71
72
  capabilities,
72
- updateSettings
73
+ locale,
74
+ updateSettings,
75
+ galleryWithImageBlocks
73
76
  } = this.props;
74
77
  updateSettings({ ...capabilities,
75
- ...this.getThemeColors(this.props)
78
+ ...{
79
+ __unstableGalleryWithImageBlocks: galleryWithImageBlocks
80
+ },
81
+ ...this.getThemeColors(this.props),
82
+ locale
76
83
  });
77
84
  this.subscriptionParentGetHtml = subscribeParentGetHtml(() => {
78
85
  this.serializeToNativeAction();
@@ -100,8 +107,11 @@ class NativeEditorProvider extends Component {
100
107
  this.props.insertBlock(newBlock, insertionIndex);
101
108
  });
102
109
  this.subscriptionParentUpdateEditorSettings = subscribeUpdateEditorSettings(editorSettings => {
103
- const themeColors = this.getThemeColors(editorSettings);
104
- updateSettings(themeColors);
110
+ updateSettings({ ...{
111
+ __unstableGalleryWithImageBlocks: editorSettings.galleryWithImageBlocks
112
+ },
113
+ ...this.getThemeColors(editorSettings)
114
+ });
105
115
  });
106
116
  this.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(payload => {
107
117
  this.updateCapabilitiesAction(payload);
@@ -110,8 +120,6 @@ class NativeEditorProvider extends Component {
110
120
  this.props.createSuccessNotice(payload.message);
111
121
  });
112
122
  this.subscriptionParentShowEditorHelp = subscribeShowEditorHelp(() => {
113
- // Temporary: feature hidden from production. This is just here for testing
114
- // purposes and will be replaced with actual logic in a later PR.
115
123
  this.setState({
116
124
  isHelpVisible: true
117
125
  });
@@ -274,6 +282,9 @@ class NativeEditorProvider extends Component {
274
282
  isVisible: this.state.isHelpVisible,
275
283
  onClose: () => this.setState({
276
284
  isHelpVisible: false
285
+ }),
286
+ close: () => this.setState({
287
+ isHelpVisible: false
277
288
  })
278
289
  }));
279
290
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/provider/index.native.js"],"names":["memize","RNReactNativeGutenbergBridge","requestBlockTypeImpressions","setBlockTypeImpressions","subscribeParentGetHtml","subscribeParentToggleHTMLMode","subscribeUpdateHtml","subscribeSetTitle","subscribeMediaAppend","subscribeReplaceBlock","subscribeUpdateEditorSettings","subscribeUpdateCapabilities","subscribeShowNotice","subscribeShowEditorHelp","Component","count","wordCount","parse","serialize","getUnregisteredTypeHandlerName","createBlock","withDispatch","withSelect","compose","applyFilters","validateThemeColors","validateThemeGradients","store","blockEditorStore","getGlobalStyles","NEW_BLOCK_TYPES","postTypeEntities","name","baseURL","map","postTypeEntity","kind","transientEdits","blocks","selection","mergedEdits","meta","EditorHelpTopics","EditorProvider","NativeEditorProvider","constructor","arguments","post","props","addEntities","receiveEntityRecords","type","getEditorSettings","settings","capabilities","maxSize","state","isHelpVisible","componentDidMount","updateSettings","getThemeColors","subscriptionParentGetHtml","serializeToNativeAction","subscriptionParentToggleHTMLMode","toggleMode","subscriptionParentSetTitle","payload","editTitle","title","subscriptionParentUpdateHtml","updateHtmlAction","html","subscriptionParentReplaceBlock","replaceBlockAction","clientId","subscriptionParentMediaAppend","blockName","mediaType","newBlock","id","mediaId","mediaUrl","indexAfterSelected","selectedBlockIndex","insertionIndex","blockCount","insertBlock","subscriptionParentUpdateEditorSettings","editorSettings","themeColors","subscriptionParentUpdateCapabilities","updateCapabilitiesAction","subscriptionParentShowNotice","createSuccessNotice","message","subscriptionParentShowEditorHelp","setState","storedImpressions","impressions","storedImpressionKeys","Object","keys","storedImpressionsCurrent","every","newKey","includes","componentWillUnmount","remove","colors","gradients","rawStyles","rawFeatures","componentDidUpdate","prevProps","isReady","isUnsupportedBlock","unsupportedBlockNames","filter","block","attributes","originalName","editorDidMount","mode","hasChanges","raw","content","contentInfo","characterCount","paragraphCount","provideToNative_Html","parsed","resetEditorBlocksWithoutUndoLevel","blockClientId","replaceBlock","switchMode","clearSelectedBlock","render","children","select","__unstableIsEditorReady","isEditorReady","getEditorBlocks","getEditedPostAttribute","getEditedPostContent","getEditorMode","getBlockIndex","getSelectedBlockClientId","getGlobalBlockCount","getSettings","getBlockEditorSettings","selectedBlockClientId","dispatch","editPost","resetEditorBlocks","switchEditorMode","__unstableShouldCreateUndoLevel"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,MAAP,MAAmB,QAAnB;AAEA;AACA;AACA;;AACA,OAAOC,4BAAP,IACCC,2BADD,EAECC,uBAFD,EAGCC,sBAHD,EAICC,6BAJD,EAKCC,mBALD,EAMCC,iBAND,EAOCC,oBAPD,EAQCC,qBARD,EASCC,6BATD,EAUCC,2BAVD,EAWCC,mBAXD,EAYCC,uBAZD,QAaO,gCAbP;AAcA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SACCC,KADD,EAECC,SAFD,EAGCC,8BAHD,EAICC,WAJD,QAKO,mBALP;AAMA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SACCC,mBADD,EAECC,sBAFD,EAGCC,KAAK,IAAIC,gBAHV,QAIO,yBAJP;AAKA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,eAAT,QAAgC,0BAAhC;AAEA,MAAMC,gBAAgB,GAAG,CACxB;AAAEC,EAAAA,IAAI,EAAE,MAAR;AAAgBC,EAAAA,OAAO,EAAE;AAAzB,CADwB,EAExB;AAAED,EAAAA,IAAI,EAAE,MAAR;AAAgBC,EAAAA,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CF,QAAQ,CAAE,aAAF,CAAhD;AACA,QAAM;AACL5F,IAAAA,cADK;AAEL4E,IAAAA,kBAFK;AAGLjD,IAAAA,WAHK;AAIL+C,IAAAA;AAJK,MAKFkB,QAAQ,CAAE3H,gBAAF,CALZ;AAMA,QAAM;AAAE8H,IAAAA;AAAF,MAAuBH,QAAQ,CAAE,gBAAF,CAArC;AACA,QAAM;AAAEtG,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAAwCqG,QAAQ,CAAE,MAAF,CAAtD;AACA,QAAM;AAAE1D,IAAAA;AAAF,MAA0B0D,QAAQ,CAAE,cAAF,CAAxC;AAEA,SAAO;AACN5F,IAAAA,cADM;AAENV,IAAAA,WAFM;AAGNsF,IAAAA,kBAHM;AAINjD,IAAAA,WAJM;AAKNO,IAAAA,mBALM;;AAMN1B,IAAAA,SAAS,CAAEC,KAAF,EAAU;AAClBoF,MAAAA,QAAQ,CAAE;AAAEpF,QAAAA;AAAF,OAAF,CAAR;AACA,KARK;;AASNlB,IAAAA,oBATM;;AAUNiF,IAAAA,iCAAiC,CAAE7F,MAAF,EAAW;AAC3CmH,MAAAA,iBAAiB,CAAEnH,MAAF,EAAU;AAC1BqH,QAAAA,+BAA+B,EAAE;AADP,OAAV,CAAjB;AAGA,KAdK;;AAeNrB,IAAAA,UAAU,CAAEZ,IAAF,EAAS;AAClBgC,MAAAA,gBAAgB,CAAEhC,IAAF,CAAhB;AACA,KAjBK;;AAkBNW,IAAAA;AAlBM,GAAP;AAoBA,CAhCW,CA9BW,CAAF,CAAP,CA+DVzF,oBA/DU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport RNReactNativeGutenbergBridge, {\n\trequestBlockTypeImpressions,\n\tsetBlockTypeImpressions,\n\tsubscribeParentGetHtml,\n\tsubscribeParentToggleHTMLMode,\n\tsubscribeUpdateHtml,\n\tsubscribeSetTitle,\n\tsubscribeMediaAppend,\n\tsubscribeReplaceBlock,\n\tsubscribeUpdateEditorSettings,\n\tsubscribeUpdateCapabilities,\n\tsubscribeShowNotice,\n\tsubscribeShowEditorHelp,\n} from '@wordpress/react-native-bridge';\nimport { Component } from '@wordpress/element';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport {\n\tparse,\n\tserialize,\n\tgetUnregisteredTypeHandlerName,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tvalidateThemeColors,\n\tvalidateThemeGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { getGlobalStyles } from '@wordpress/components';\nimport { NEW_BLOCK_TYPES } from '@wordpress/block-library';\n\nconst postTypeEntities = [\n\t{ name: 'post', baseURL: '/wp/v2/posts' },\n\t{ name: 'page', baseURL: '/wp/v2/pages' },\n\t{ name: 'attachment', baseURL: '/wp/v2/media' },\n\t{ name: 'wp_block', baseURL: '/wp/v2/blocks' },\n].map( ( postTypeEntity ) => ( {\n\tkind: 'postType',\n\t...postTypeEntity,\n\ttransientEdits: {\n\t\tblocks: true,\n\t\tselection: true,\n\t},\n\tmergedEdits: {\n\t\tmeta: true,\n\t},\n} ) );\nimport { EditorHelpTopics } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport EditorProvider from './index.js';\n\nclass NativeEditorProvider extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\t// Keep a local reference to `post` to detect changes\n\t\tthis.post = this.props.post;\n\t\tthis.props.addEntities( postTypeEntities );\n\t\tthis.props.receiveEntityRecords(\n\t\t\t'postType',\n\t\t\tthis.post.type,\n\t\t\tthis.post\n\t\t);\n\t\tthis.getEditorSettings = memize(\n\t\t\t( settings, capabilities ) => ( {\n\t\t\t\t...settings,\n\t\t\t\tcapabilities,\n\t\t\t} ),\n\t\t\t{\n\t\t\t\tmaxSize: 1,\n\t\t\t}\n\t\t);\n\t\tthis.state = {\n\t\t\tisHelpVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { capabilities, updateSettings } = this.props;\n\n\t\tupdateSettings( {\n\t\t\t...capabilities,\n\t\t\t...this.getThemeColors( this.props ),\n\t\t} );\n\n\t\tthis.subscriptionParentGetHtml = subscribeParentGetHtml( () => {\n\t\t\tthis.serializeToNativeAction();\n\t\t} );\n\n\t\tthis.subscriptionParentToggleHTMLMode = subscribeParentToggleHTMLMode(\n\t\t\t() => {\n\t\t\t\tthis.toggleMode();\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentSetTitle = subscribeSetTitle( ( payload ) => {\n\t\t\tthis.props.editTitle( payload.title );\n\t\t} );\n\n\t\tthis.subscriptionParentUpdateHtml = subscribeUpdateHtml(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateHtmlAction( payload.html );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentReplaceBlock = subscribeReplaceBlock(\n\t\t\t( payload ) => {\n\t\t\t\tthis.replaceBlockAction( payload.html, payload.clientId );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentMediaAppend = subscribeMediaAppend(\n\t\t\t( payload ) => {\n\t\t\t\tconst blockName = 'core/' + payload.mediaType;\n\t\t\t\tconst newBlock = createBlock( blockName, {\n\t\t\t\t\tid: payload.mediaId,\n\t\t\t\t\t[ payload.mediaType === 'image'\n\t\t\t\t\t\t? 'url'\n\t\t\t\t\t\t: 'src' ]: payload.mediaUrl,\n\t\t\t\t} );\n\n\t\t\t\tconst indexAfterSelected = this.props.selectedBlockIndex + 1;\n\t\t\t\tconst insertionIndex =\n\t\t\t\t\tindexAfterSelected || this.props.blockCount;\n\n\t\t\t\tthis.props.insertBlock( newBlock, insertionIndex );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateEditorSettings = subscribeUpdateEditorSettings(\n\t\t\t( editorSettings ) => {\n\t\t\t\tconst themeColors = this.getThemeColors( editorSettings );\n\t\t\t\tupdateSettings( themeColors );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateCapabilitiesAction( payload );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowNotice = subscribeShowNotice(\n\t\t\t( payload ) => {\n\t\t\t\tthis.props.createSuccessNotice( payload.message );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowEditorHelp = subscribeShowEditorHelp( () => {\n\t\t\t// Temporary: feature hidden from production. This is just here for testing\n\t\t\t// purposes and will be replaced with actual logic in a later PR.\n\t\t\tthis.setState( { isHelpVisible: true } );\n\t\t} );\n\n\t\t// Request current block impressions from native app\n\t\trequestBlockTypeImpressions( ( storedImpressions ) => {\n\t\t\tconst impressions = { ...NEW_BLOCK_TYPES, ...storedImpressions };\n\n\t\t\t// Persist impressions to JavaScript store\n\t\t\tupdateSettings( { impressions } );\n\n\t\t\t// Persist impressions to native store if they do not include latest\n\t\t\t// `NEW_BLOCK_TYPES` configuration\n\t\t\tconst storedImpressionKeys = Object.keys( storedImpressions );\n\t\t\tconst storedImpressionsCurrent = Object.keys(\n\t\t\t\tNEW_BLOCK_TYPES\n\t\t\t).every( ( newKey ) => storedImpressionKeys.includes( newKey ) );\n\t\t\tif ( ! storedImpressionsCurrent ) {\n\t\t\t\tsetBlockTypeImpressions( impressions );\n\t\t\t}\n\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentGetHtml ) {\n\t\t\tthis.subscriptionParentGetHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentToggleHTMLMode ) {\n\t\t\tthis.subscriptionParentToggleHTMLMode.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentSetTitle ) {\n\t\t\tthis.subscriptionParentSetTitle.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateHtml ) {\n\t\t\tthis.subscriptionParentUpdateHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentReplaceBlock ) {\n\t\t\tthis.subscriptionParentReplaceBlock.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentMediaAppend ) {\n\t\t\tthis.subscriptionParentMediaAppend.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateEditorSettings ) {\n\t\t\tthis.subscriptionParentUpdateEditorSettings.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateCapabilities ) {\n\t\t\tthis.subscriptionParentUpdateCapabilities.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowNotice ) {\n\t\t\tthis.subscriptionParentShowNotice.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowEditorHelp ) {\n\t\t\tthis.subscriptionParentShowEditorHelp.remove();\n\t\t}\n\t}\n\n\tgetThemeColors( { colors, gradients, rawStyles, rawFeatures } ) {\n\t\treturn {\n\t\t\t...( rawStyles && rawFeatures\n\t\t\t\t? getGlobalStyles( rawStyles, rawFeatures )\n\t\t\t\t: {\n\t\t\t\t\t\tcolors: validateThemeColors( colors ),\n\t\t\t\t\t\tgradients: validateThemeGradients( gradients ),\n\t\t\t\t } ),\n\t\t};\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( ! prevProps.isReady && this.props.isReady ) {\n\t\t\tconst blocks = this.props.blocks;\n\t\t\tconst isUnsupportedBlock = ( { name } ) =>\n\t\t\t\tname === getUnregisteredTypeHandlerName();\n\t\t\tconst unsupportedBlockNames = blocks\n\t\t\t\t.filter( isUnsupportedBlock )\n\t\t\t\t.map( ( block ) => block.attributes.originalName );\n\t\t\tRNReactNativeGutenbergBridge.editorDidMount(\n\t\t\t\tunsupportedBlockNames\n\t\t\t);\n\t\t}\n\t}\n\n\tserializeToNativeAction() {\n\t\tconst title = this.props.title;\n\t\tlet html;\n\n\t\tif ( this.props.mode === 'text' ) {\n\t\t\t// The HTMLTextInput component does not update the store when user is doing changes\n\t\t\t// Let's request the HTML from the component's state directly\n\t\t\thtml = applyFilters( 'native.persist-html' );\n\t\t} else {\n\t\t\thtml = serialize( this.props.blocks );\n\t\t}\n\n\t\tconst hasChanges =\n\t\t\ttitle !== this.post.title.raw || html !== this.post.content.raw;\n\n\t\t// Variable to store the content structure metrics.\n\t\tconst contentInfo = {};\n\t\tcontentInfo.characterCount = wordCount(\n\t\t\thtml,\n\t\t\t'characters_including_spaces'\n\t\t);\n\t\tcontentInfo.wordCount = wordCount( html, 'words' );\n\t\tcontentInfo.paragraphCount = this.props.paragraphCount;\n\t\tcontentInfo.blockCount = this.props.blockCount;\n\t\tRNReactNativeGutenbergBridge.provideToNative_Html(\n\t\t\thtml,\n\t\t\ttitle,\n\t\t\thasChanges,\n\t\t\tcontentInfo\n\t\t);\n\n\t\tif ( hasChanges ) {\n\t\t\tthis.post.title.raw = title;\n\t\t\tthis.post.content.raw = html;\n\t\t}\n\t}\n\n\tupdateHtmlAction( html ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.resetEditorBlocksWithoutUndoLevel( parsed );\n\t}\n\n\treplaceBlockAction( html, blockClientId ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.replaceBlock( blockClientId, parsed );\n\t}\n\n\ttoggleMode() {\n\t\tconst { mode, switchMode } = this.props;\n\t\t// refresh html content first\n\t\tthis.serializeToNativeAction();\n\t\t// make sure to blur the selected block and dismiss the keyboard\n\t\tthis.props.clearSelectedBlock();\n\t\tswitchMode( mode === 'visual' ? 'text' : 'visual' );\n\t}\n\n\tupdateCapabilitiesAction( capabilities ) {\n\t\tthis.props.updateSettings( capabilities );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tchildren,\n\t\t\tpost, // eslint-disable-line no-unused-vars\n\t\t\tcapabilities,\n\t\t\tsettings,\n\t\t\t...props\n\t\t} = this.props;\n\t\tconst editorSettings = this.getEditorSettings( settings, capabilities );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ this.post }\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</EditorProvider>\n\t\t\t\t<EditorHelpTopics\n\t\t\t\t\tisVisible={ this.state.isHelpVisible }\n\t\t\t\t\tonClose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\t__unstableIsEditorReady: isEditorReady,\n\t\t\tgetEditorBlocks,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostContent,\n\t\t} = select( 'core/editor' );\n\t\tconst { getEditorMode } = select( 'core/edit-post' );\n\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetGlobalBlockCount,\n\t\t\tgetSettings: getBlockEditorSettings,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t\tisReady: isEditorReady(),\n\t\t\tblocks: getEditorBlocks(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tgetEditedPostContent,\n\t\t\tgetBlockEditorSettings,\n\t\t\tselectedBlockIndex: getBlockIndex( selectedBlockClientId ),\n\t\t\tblockCount: getGlobalBlockCount(),\n\t\t\tparagraphCount: getGlobalBlockCount( 'core/paragraph' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, resetEditorBlocks } = dispatch( 'core/editor' );\n\t\tconst {\n\t\t\tupdateSettings,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\treplaceBlock,\n\t\t} = dispatch( blockEditorStore );\n\t\tconst { switchEditorMode } = dispatch( 'core/edit-post' );\n\t\tconst { addEntities, receiveEntityRecords } = dispatch( 'core' );\n\t\tconst { createSuccessNotice } = dispatch( 'core/notices' );\n\n\t\treturn {\n\t\t\tupdateSettings,\n\t\t\taddEntities,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\tcreateSuccessNotice,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\treceiveEntityRecords,\n\t\t\tresetEditorBlocksWithoutUndoLevel( blocks ) {\n\t\t\t\tresetEditorBlocks( blocks, {\n\t\t\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tswitchMode( mode ) {\n\t\t\t\tswitchEditorMode( mode );\n\t\t\t},\n\t\t\treplaceBlock,\n\t\t};\n\t} ),\n] )( NativeEditorProvider );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/provider/index.native.js"],"names":["memize","RNReactNativeGutenbergBridge","requestBlockTypeImpressions","setBlockTypeImpressions","subscribeParentGetHtml","subscribeParentToggleHTMLMode","subscribeUpdateHtml","subscribeSetTitle","subscribeMediaAppend","subscribeReplaceBlock","subscribeUpdateEditorSettings","subscribeUpdateCapabilities","subscribeShowNotice","subscribeShowEditorHelp","Component","count","wordCount","parse","serialize","getUnregisteredTypeHandlerName","createBlock","withDispatch","withSelect","compose","applyFilters","validateThemeColors","validateThemeGradients","store","blockEditorStore","getGlobalStyles","NEW_BLOCK_TYPES","postTypeEntities","name","baseURL","map","postTypeEntity","kind","transientEdits","blocks","selection","mergedEdits","meta","rawAttributes","EditorHelpTopics","EditorProvider","NativeEditorProvider","constructor","arguments","post","props","addEntities","receiveEntityRecords","type","getEditorSettings","settings","capabilities","maxSize","state","isHelpVisible","componentDidMount","locale","updateSettings","galleryWithImageBlocks","__unstableGalleryWithImageBlocks","getThemeColors","subscriptionParentGetHtml","serializeToNativeAction","subscriptionParentToggleHTMLMode","toggleMode","subscriptionParentSetTitle","payload","editTitle","title","subscriptionParentUpdateHtml","updateHtmlAction","html","subscriptionParentReplaceBlock","replaceBlockAction","clientId","subscriptionParentMediaAppend","blockName","mediaType","newBlock","id","mediaId","mediaUrl","indexAfterSelected","selectedBlockIndex","insertionIndex","blockCount","insertBlock","subscriptionParentUpdateEditorSettings","editorSettings","subscriptionParentUpdateCapabilities","updateCapabilitiesAction","subscriptionParentShowNotice","createSuccessNotice","message","subscriptionParentShowEditorHelp","setState","storedImpressions","impressions","storedImpressionKeys","Object","keys","storedImpressionsCurrent","every","newKey","includes","componentWillUnmount","remove","colors","gradients","rawStyles","rawFeatures","componentDidUpdate","prevProps","isReady","isUnsupportedBlock","unsupportedBlockNames","filter","block","attributes","originalName","editorDidMount","mode","hasChanges","raw","content","contentInfo","characterCount","paragraphCount","provideToNative_Html","parsed","resetEditorBlocksWithoutUndoLevel","blockClientId","replaceBlock","switchMode","clearSelectedBlock","render","children","select","__unstableIsEditorReady","isEditorReady","getEditorBlocks","getEditedPostAttribute","getEditedPostContent","getEditorMode","getBlockIndex","getSelectedBlockClientId","getGlobalBlockCount","getSettings","getBlockEditorSettings","selectedBlockClientId","dispatch","editPost","resetEditorBlocks","switchEditorMode","__unstableShouldCreateUndoLevel"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,MAAP,MAAmB,QAAnB;AAEA;AACA;AACA;;AACA,OAAOC,4BAAP,IACCC,2BADD,EAECC,uBAFD,EAGCC,sBAHD,EAICC,6BAJD,EAKCC,mBALD,EAMCC,iBAND,EAOCC,oBAPD,EAQCC,qBARD,EASCC,6BATD,EAUCC,2BAVD,EAWCC,mBAXD,EAYCC,uBAZD,QAaO,gCAbP;AAcA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SACCC,KADD,EAECC,SAFD,EAGCC,8BAHD,EAICC,WAJD,QAKO,mBALP;AAMA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SACCC,mBADD,EAECC,sBAFD,EAGCC,KAAK,IAAIC,gBAHV,Q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AAF,EAAW;AAC3CsH,MAAAA,iBAAiB,CAAEtH,MAAF,EAAU;AAC1BwH,QAAAA,+BAA+B,EAAE;AADP,OAAV,CAAjB;AAGA,KAdK;;AAeNrB,IAAAA,UAAU,CAAEZ,IAAF,EAAS;AAClBgC,MAAAA,gBAAgB,CAAEhC,IAAF,CAAhB;AACA,KAjBK;;AAkBNW,IAAAA;AAlBM,GAAP;AAoBA,CAhCW,CA9BW,CAAF,CAAP,CA+DV3F,oBA/DU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport RNReactNativeGutenbergBridge, {\n\trequestBlockTypeImpressions,\n\tsetBlockTypeImpressions,\n\tsubscribeParentGetHtml,\n\tsubscribeParentToggleHTMLMode,\n\tsubscribeUpdateHtml,\n\tsubscribeSetTitle,\n\tsubscribeMediaAppend,\n\tsubscribeReplaceBlock,\n\tsubscribeUpdateEditorSettings,\n\tsubscribeUpdateCapabilities,\n\tsubscribeShowNotice,\n\tsubscribeShowEditorHelp,\n} from '@wordpress/react-native-bridge';\nimport { Component } from '@wordpress/element';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport {\n\tparse,\n\tserialize,\n\tgetUnregisteredTypeHandlerName,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tvalidateThemeColors,\n\tvalidateThemeGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { getGlobalStyles } from '@wordpress/components';\nimport { NEW_BLOCK_TYPES } from '@wordpress/block-library';\n\nconst postTypeEntities = [\n\t{ name: 'post', baseURL: '/wp/v2/posts' },\n\t{ name: 'page', baseURL: '/wp/v2/pages' },\n\t{ name: 'attachment', baseURL: '/wp/v2/media' },\n\t{ name: 'wp_block', baseURL: '/wp/v2/blocks' },\n].map( ( postTypeEntity ) => ( {\n\tkind: 'postType',\n\t...postTypeEntity,\n\ttransientEdits: {\n\t\tblocks: true,\n\t\tselection: true,\n\t},\n\tmergedEdits: {\n\t\tmeta: true,\n\t},\n\trawAttributes: [ 'title', 'excerpt', 'content' ],\n} ) );\nimport { EditorHelpTopics } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport EditorProvider from './index.js';\n\nclass NativeEditorProvider extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\t// Keep a local reference to `post` to detect changes\n\t\tthis.post = this.props.post;\n\t\tthis.props.addEntities( postTypeEntities );\n\t\tthis.props.receiveEntityRecords(\n\t\t\t'postType',\n\t\t\tthis.post.type,\n\t\t\tthis.post\n\t\t);\n\t\tthis.getEditorSettings = memize(\n\t\t\t( settings, capabilities ) => ( {\n\t\t\t\t...settings,\n\t\t\t\tcapabilities,\n\t\t\t} ),\n\t\t\t{\n\t\t\t\tmaxSize: 1,\n\t\t\t}\n\t\t);\n\t\tthis.state = {\n\t\t\tisHelpVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst {\n\t\t\tcapabilities,\n\t\t\tlocale,\n\t\t\tupdateSettings,\n\t\t\tgalleryWithImageBlocks,\n\t\t} = this.props;\n\n\t\tupdateSettings( {\n\t\t\t...capabilities,\n\t\t\t...{ __unstableGalleryWithImageBlocks: galleryWithImageBlocks },\n\t\t\t...this.getThemeColors( this.props ),\n\t\t\tlocale,\n\t\t} );\n\n\t\tthis.subscriptionParentGetHtml = subscribeParentGetHtml( () => {\n\t\t\tthis.serializeToNativeAction();\n\t\t} );\n\n\t\tthis.subscriptionParentToggleHTMLMode = subscribeParentToggleHTMLMode(\n\t\t\t() => {\n\t\t\t\tthis.toggleMode();\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentSetTitle = subscribeSetTitle( ( payload ) => {\n\t\t\tthis.props.editTitle( payload.title );\n\t\t} );\n\n\t\tthis.subscriptionParentUpdateHtml = subscribeUpdateHtml(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateHtmlAction( payload.html );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentReplaceBlock = subscribeReplaceBlock(\n\t\t\t( payload ) => {\n\t\t\t\tthis.replaceBlockAction( payload.html, payload.clientId );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentMediaAppend = subscribeMediaAppend(\n\t\t\t( payload ) => {\n\t\t\t\tconst blockName = 'core/' + payload.mediaType;\n\t\t\t\tconst newBlock = createBlock( blockName, {\n\t\t\t\t\tid: payload.mediaId,\n\t\t\t\t\t[ payload.mediaType === 'image'\n\t\t\t\t\t\t? 'url'\n\t\t\t\t\t\t: 'src' ]: payload.mediaUrl,\n\t\t\t\t} );\n\n\t\t\t\tconst indexAfterSelected = this.props.selectedBlockIndex + 1;\n\t\t\t\tconst insertionIndex =\n\t\t\t\t\tindexAfterSelected || this.props.blockCount;\n\n\t\t\t\tthis.props.insertBlock( newBlock, insertionIndex );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateEditorSettings = subscribeUpdateEditorSettings(\n\t\t\t( editorSettings ) => {\n\t\t\t\tupdateSettings( {\n\t\t\t\t\t...{\n\t\t\t\t\t\t__unstableGalleryWithImageBlocks:\n\t\t\t\t\t\t\teditorSettings.galleryWithImageBlocks,\n\t\t\t\t\t},\n\t\t\t\t\t...this.getThemeColors( editorSettings ),\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateCapabilitiesAction( payload );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowNotice = subscribeShowNotice(\n\t\t\t( payload ) => {\n\t\t\t\tthis.props.createSuccessNotice( payload.message );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowEditorHelp = subscribeShowEditorHelp( () => {\n\t\t\tthis.setState( { isHelpVisible: true } );\n\t\t} );\n\n\t\t// Request current block impressions from native app\n\t\trequestBlockTypeImpressions( ( storedImpressions ) => {\n\t\t\tconst impressions = { ...NEW_BLOCK_TYPES, ...storedImpressions };\n\n\t\t\t// Persist impressions to JavaScript store\n\t\t\tupdateSettings( { impressions } );\n\n\t\t\t// Persist impressions to native store if they do not include latest\n\t\t\t// `NEW_BLOCK_TYPES` configuration\n\t\t\tconst storedImpressionKeys = Object.keys( storedImpressions );\n\t\t\tconst storedImpressionsCurrent = Object.keys(\n\t\t\t\tNEW_BLOCK_TYPES\n\t\t\t).every( ( newKey ) => storedImpressionKeys.includes( newKey ) );\n\t\t\tif ( ! storedImpressionsCurrent ) {\n\t\t\t\tsetBlockTypeImpressions( impressions );\n\t\t\t}\n\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentGetHtml ) {\n\t\t\tthis.subscriptionParentGetHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentToggleHTMLMode ) {\n\t\t\tthis.subscriptionParentToggleHTMLMode.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentSetTitle ) {\n\t\t\tthis.subscriptionParentSetTitle.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateHtml ) {\n\t\t\tthis.subscriptionParentUpdateHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentReplaceBlock ) {\n\t\t\tthis.subscriptionParentReplaceBlock.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentMediaAppend ) {\n\t\t\tthis.subscriptionParentMediaAppend.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateEditorSettings ) {\n\t\t\tthis.subscriptionParentUpdateEditorSettings.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateCapabilities ) {\n\t\t\tthis.subscriptionParentUpdateCapabilities.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowNotice ) {\n\t\t\tthis.subscriptionParentShowNotice.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowEditorHelp ) {\n\t\t\tthis.subscriptionParentShowEditorHelp.remove();\n\t\t}\n\t}\n\n\tgetThemeColors( { colors, gradients, rawStyles, rawFeatures } ) {\n\t\treturn {\n\t\t\t...( rawStyles && rawFeatures\n\t\t\t\t? getGlobalStyles( rawStyles, rawFeatures )\n\t\t\t\t: {\n\t\t\t\t\t\tcolors: validateThemeColors( colors ),\n\t\t\t\t\t\tgradients: validateThemeGradients( gradients ),\n\t\t\t\t } ),\n\t\t};\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( ! prevProps.isReady && this.props.isReady ) {\n\t\t\tconst blocks = this.props.blocks;\n\t\t\tconst isUnsupportedBlock = ( { name } ) =>\n\t\t\t\tname === getUnregisteredTypeHandlerName();\n\t\t\tconst unsupportedBlockNames = blocks\n\t\t\t\t.filter( isUnsupportedBlock )\n\t\t\t\t.map( ( block ) => block.attributes.originalName );\n\t\t\tRNReactNativeGutenbergBridge.editorDidMount(\n\t\t\t\tunsupportedBlockNames\n\t\t\t);\n\t\t}\n\t}\n\n\tserializeToNativeAction() {\n\t\tconst title = this.props.title;\n\t\tlet html;\n\n\t\tif ( this.props.mode === 'text' ) {\n\t\t\t// The HTMLTextInput component does not update the store when user is doing changes\n\t\t\t// Let's request the HTML from the component's state directly\n\t\t\thtml = applyFilters( 'native.persist-html' );\n\t\t} else {\n\t\t\thtml = serialize( this.props.blocks );\n\t\t}\n\n\t\tconst hasChanges =\n\t\t\ttitle !== this.post.title.raw || html !== this.post.content.raw;\n\n\t\t// Variable to store the content structure metrics.\n\t\tconst contentInfo = {};\n\t\tcontentInfo.characterCount = wordCount(\n\t\t\thtml,\n\t\t\t'characters_including_spaces'\n\t\t);\n\t\tcontentInfo.wordCount = wordCount( html, 'words' );\n\t\tcontentInfo.paragraphCount = this.props.paragraphCount;\n\t\tcontentInfo.blockCount = this.props.blockCount;\n\t\tRNReactNativeGutenbergBridge.provideToNative_Html(\n\t\t\thtml,\n\t\t\ttitle,\n\t\t\thasChanges,\n\t\t\tcontentInfo\n\t\t);\n\n\t\tif ( hasChanges ) {\n\t\t\tthis.post.title.raw = title;\n\t\t\tthis.post.content.raw = html;\n\t\t}\n\t}\n\n\tupdateHtmlAction( html ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.resetEditorBlocksWithoutUndoLevel( parsed );\n\t}\n\n\treplaceBlockAction( html, blockClientId ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.replaceBlock( blockClientId, parsed );\n\t}\n\n\ttoggleMode() {\n\t\tconst { mode, switchMode } = this.props;\n\t\t// refresh html content first\n\t\tthis.serializeToNativeAction();\n\t\t// make sure to blur the selected block and dismiss the keyboard\n\t\tthis.props.clearSelectedBlock();\n\t\tswitchMode( mode === 'visual' ? 'text' : 'visual' );\n\t}\n\n\tupdateCapabilitiesAction( capabilities ) {\n\t\tthis.props.updateSettings( capabilities );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tchildren,\n\t\t\tpost, // eslint-disable-line no-unused-vars\n\t\t\tcapabilities,\n\t\t\tsettings,\n\t\t\t...props\n\t\t} = this.props;\n\t\tconst editorSettings = this.getEditorSettings( settings, capabilities );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ this.post }\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</EditorProvider>\n\t\t\t\t<EditorHelpTopics\n\t\t\t\t\tisVisible={ this.state.isHelpVisible }\n\t\t\t\t\tonClose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t\tclose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\t__unstableIsEditorReady: isEditorReady,\n\t\t\tgetEditorBlocks,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostContent,\n\t\t} = select( 'core/editor' );\n\t\tconst { getEditorMode } = select( 'core/edit-post' );\n\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetGlobalBlockCount,\n\t\t\tgetSettings: getBlockEditorSettings,\n\t\t} = select( blockEditorStore );\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t\tisReady: isEditorReady(),\n\t\t\tblocks: getEditorBlocks(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tgetEditedPostContent,\n\t\t\tgetBlockEditorSettings,\n\t\t\tselectedBlockIndex: getBlockIndex( selectedBlockClientId ),\n\t\t\tblockCount: getGlobalBlockCount(),\n\t\t\tparagraphCount: getGlobalBlockCount( 'core/paragraph' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, resetEditorBlocks } = dispatch( 'core/editor' );\n\t\tconst {\n\t\t\tupdateSettings,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\treplaceBlock,\n\t\t} = dispatch( blockEditorStore );\n\t\tconst { switchEditorMode } = dispatch( 'core/edit-post' );\n\t\tconst { addEntities, receiveEntityRecords } = dispatch( 'core' );\n\t\tconst { createSuccessNotice } = dispatch( 'core/notices' );\n\n\t\treturn {\n\t\t\tupdateSettings,\n\t\t\taddEntities,\n\t\t\tclearSelectedBlock,\n\t\t\tinsertBlock,\n\t\t\tcreateSuccessNotice,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\treceiveEntityRecords,\n\t\t\tresetEditorBlocksWithoutUndoLevel( blocks ) {\n\t\t\t\tresetEditorBlocks( blocks, {\n\t\t\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tswitchMode( mode ) {\n\t\t\t\tswitchEditorMode( mode );\n\t\t\t},\n\t\t\treplaceBlock,\n\t\t};\n\t} ),\n] )( NativeEditorProvider );\n"]}
@@ -9,6 +9,7 @@ import { pick, defaultTo } from 'lodash';
9
9
  import { Platform, useMemo } from '@wordpress/element';
10
10
  import { useDispatch, useSelect } from '@wordpress/data';
11
11
  import { store as coreStore, __experimentalFetchLinkSuggestions as fetchLinkSuggestions, __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';
12
+ import { __ } from '@wordpress/i18n';
12
13
  /**
13
14
  * Internal dependencies
14
15
  */
@@ -28,7 +29,8 @@ function useBlockEditorSettings(settings, hasTemplate) {
28
29
  const {
29
30
  reusableBlocks,
30
31
  hasUploadPermissions,
31
- canUseUnfilteredHTML
32
+ canUseUnfilteredHTML,
33
+ userCanCreatePages
32
34
  } = useSelect(select => {
33
35
  const {
34
36
  canUserUseUnfilteredHTML
@@ -49,21 +51,45 @@ function useBlockEditorSettings(settings, hasTemplate) {
49
51
  // Reusable blocks are fetched in the native version of this hook.
50
52
  hasUploadPermissions: defaultTo(canUser('create', 'media'), true),
51
53
  hasResolvedLocalSiteData: hasFinishedResolvingSiteData,
52
- baseUrl: (siteData === null || siteData === void 0 ? void 0 : siteData.url) || ''
54
+ baseUrl: (siteData === null || siteData === void 0 ? void 0 : siteData.url) || '',
55
+ userCanCreatePages: canUser('create', 'pages')
53
56
  };
54
57
  }, []);
55
58
  const {
56
59
  undo
57
60
  } = useDispatch(editorStore);
58
- return useMemo(() => ({ ...pick(settings, ['__experimentalBlockDirectory', '__experimentalBlockPatternCategories', '__experimentalBlockPatterns', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalGlobalStylesUserEntityId', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomGradients', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'hasFixedToolbar', 'hasReducedUI', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock']),
61
+ const {
62
+ saveEntityRecord
63
+ } = useDispatch(coreStore);
64
+ /**
65
+ * Creates a Post entity.
66
+ * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.
67
+ *
68
+ * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.
69
+ * @return {Object} the post type object that was created.
70
+ */
71
+
72
+ const createPageEntity = options => {
73
+ if (!userCanCreatePages) {
74
+ return Promise.reject({
75
+ message: __('You do not have permission to create Pages.')
76
+ });
77
+ }
78
+
79
+ return saveEntityRecord('postType', 'page', options);
80
+ };
81
+
82
+ return useMemo(() => ({ ...pick(settings, ['__experimentalBlockDirectory', '__experimentalBlockPatternCategories', '__experimentalBlockPatterns', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomGradients', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'hasFixedToolbar', 'hasReducedUI', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock']),
59
83
  mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
60
84
  __experimentalReusableBlocks: reusableBlocks,
61
85
  __experimentalFetchLinkSuggestions: (search, searchOptions) => fetchLinkSuggestions(search, searchOptions, settings),
62
86
  __experimentalFetchRichUrlData: fetchUrlData,
63
87
  __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
64
88
  __experimentalUndo: undo,
65
- outlineMode: hasTemplate
66
- }), [settings, hasUploadPermissions, reusableBlocks, canUseUnfilteredHTML, undo, hasTemplate]);
89
+ outlineMode: hasTemplate,
90
+ __experimentalCreatePageEntity: createPageEntity,
91
+ __experimentalUserCanCreatePages: userCanCreatePages
92
+ }), [settings, hasUploadPermissions, reusableBlocks, canUseUnfilteredHTML, undo, hasTemplate, userCanCreatePages]);
67
93
  }
68
94
 
69
95
  export default useBlockEditorSettings;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["pick","defaultTo","Platform","useMemo","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","mediaUpload","editorStore","useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","select","canUserUseUnfilteredHTML","isWeb","OS","canUser","getUnstableBase","hasFinishedResolution","siteData","hasFinishedResolvingSiteData","getEntityRecords","per_page","hasResolvedLocalSiteData","baseUrl","url","undo","undefined","__experimentalReusableBlocks","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,QAAhC;AAEA;AACA;AACA;;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,KAAK,IAAIC,SADV,EAECC,kCAAkC,IAAIC,oBAFvC,EAGCC,0BAA0B,IAAIC,YAH/B,QAIO,sBAJP;AAMA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAASN,KAAK,IAAIO,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,sBAAT,CAA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AOlB,wCAPkB,EAQlB,mCARkB,EASlB,WATkB,EAUlB,mBAVkB,EAWlB,iBAXkB,EAYlB,oBAZkB,EAalB,QAbkB,EAclB,qBAdkB,EAelB,wBAfkB,EAgBlB,wBAhBkB,EAiBlB,wBAjBkB,EAkBlB,qBAlBkB,EAmBlB,mBAnBkB,EAoBlB,WApBkB,EAqBlB,WArBkB,EAsBlB,WAtBkB,EAuBlB,iBAvBkB,EAwBlB,cAxBkB,EAyBlB,kBAzBkB,EA0BlB,iBA1BkB,EA2BlB,cA3BkB,EA4BlB,YA5BkB,EA6BlB,OA7BkB,EA8BlB,sBA9BkB,EA+BlB,UA/BkB,EAgClB,4BAhCkB,EAiClB,QAjCkB,EAkClB,UAlCkB,EAmClB,cAnCkB,EAoClB,kBApCkB,EAqClB,gBArCkB,EAsClB,wCAtCkB,CAAZ,CADA;AAyCPH,IAAAA,WAAW,EAAEM,oBAAoB,GAAGN,WAAH,GAAiBuB,SAzC3C;AA0CPC,IAAAA,4BAA4B,EAAEnB,cA1CvB;AA2CPT,IAAAA,kCAAkC,EAAE,CAAE6B,MAAF,EAAUC,aAAV,KACnC7B,oBAAoB,CAAE4B,MAAF,EAAUC,aAAV,EAAyBvB,QAAzB,CA5Cd;AA6CPwB,IAAAA,8BAA8B,EAAE5B,YA7CzB;AA8CP6B,IAAAA,sCAAsC,EAAErB,oBA9CjC;AA+CPsB,IAAAA,kBAAkB,EAAEP,IA/Cb;AAgDPQ,IAAAA,WAAW,EAAE1B;AAhDN,GAAR,CADa,EAmDb,CACCD,QADD,EAECG,oBAFD,EAGCD,cAHD,EAICE,oBAJD,EAKCe,IALD,EAMClB,WAND,CAnDa,CAAd;AA4DA;;AAED,eAAeF,sBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { pick, defaultTo } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Platform, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {boolean} hasTemplate Whether template mode is enabled.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, hasTemplate ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML } = select( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getUnstableBase, hasFinishedResolution } = select(\n\t\t\tcoreStore\n\t\t);\n\n\t\tconst siteData = getUnstableBase();\n\n\t\tconst hasFinishedResolvingSiteData = hasFinishedResolution(\n\t\t\t'getUnstableBase'\n\t\t);\n\n\t\treturn {\n\t\t\tcanUseUnfilteredHTML: canUserUseUnfilteredHTML(),\n\t\t\treusableBlocks: isWeb\n\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t{ per_page: -1 }\n\t\t\t\t )\n\t\t\t\t: [], // Reusable blocks are fetched in the native version of this hook.\n\t\t\thasUploadPermissions: defaultTo(\n\t\t\t\tcanUser( 'create', 'media' ),\n\t\t\t\ttrue\n\t\t\t),\n\t\t\thasResolvedLocalSiteData: hasFinishedResolvingSiteData,\n\t\t\tbaseUrl: siteData?.url || '',\n\t\t};\n\t}, [] );\n\n\tconst { undo } = useDispatch( editorStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...pick( settings, [\n\t\t\t\t'__experimentalBlockDirectory',\n\t\t\t\t'__experimentalBlockPatternCategories',\n\t\t\t\t'__experimentalBlockPatterns',\n\t\t\t\t'__experimentalFeatures',\n\t\t\t\t'__experimentalGlobalStylesBaseStyles',\n\t\t\t\t'__experimentalGlobalStylesUserEntityId',\n\t\t\t\t'__experimentalPreferredStyleVariations',\n\t\t\t\t'__experimentalSetIsInserterOpened',\n\t\t\t\t'alignWide',\n\t\t\t\t'allowedBlockTypes',\n\t\t\t\t'bodyPlaceholder',\n\t\t\t\t'codeEditingEnabled',\n\t\t\t\t'colors',\n\t\t\t\t'disableCustomColors',\n\t\t\t\t'disableCustomFontSizes',\n\t\t\t\t'disableCustomGradients',\n\t\t\t\t'enableCustomLineHeight',\n\t\t\t\t'enableCustomSpacing',\n\t\t\t\t'enableCustomUnits',\n\t\t\t\t'focusMode',\n\t\t\t\t'fontSizes',\n\t\t\t\t'gradients',\n\t\t\t\t'hasFixedToolbar',\n\t\t\t\t'hasReducedUI',\n\t\t\t\t'imageDefaultSize',\n\t\t\t\t'imageDimensions',\n\t\t\t\t'imageEditing',\n\t\t\t\t'imageSizes',\n\t\t\t\t'isRTL',\n\t\t\t\t'keepCaretInsideBlock',\n\t\t\t\t'maxWidth',\n\t\t\t\t'onUpdateDefaultBlockStyles',\n\t\t\t\t'styles',\n\t\t\t\t'template',\n\t\t\t\t'templateLock',\n\t\t\t\t'titlePlaceholder',\n\t\t\t\t'supportsLayout',\n\t\t\t\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t\t\t] ),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t__experimentalUndo: undo,\n\t\t\toutlineMode: hasTemplate,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["pick","defaultTo","Platform","useMemo","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__","mediaUpload","editorStore","useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","select","canUserUseUnfilteredHTML","isWeb","OS","canUser","getUnstableBase","hasFinishedResolution","siteData","hasFinishedResolvingSiteData","getEntityRecords","per_page","hasResolvedLocalSiteData","baseUrl","url","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","undefined","__experimentalReusableBlocks","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,QAAhC;AAEA;AACA;AACA;;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,KAAK,IAAIC,SADV,EAECC,kCAAkC,IAAIC,oBAFvC,EAGCC,0BAA0B,IAAIC,YAH/B,QAIO,sBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAASP,KAAK,IAAIQ,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,sBAAT,CAAiCC,QAAjC,EAA2CC,WAA3C,EAAyD;AACxD,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA;AAJK,MAKFhB,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jC,WA/CN;AAgDPkC,IAAAA,8BAA8B,EAAEb,gBAhDzB;AAiDPc,IAAAA,gCAAgC,EAAE/B;AAjD3B,GAAR,CADa,EAoDb,CACCL,QADD,EAECG,oBAFD,EAGCD,cAHD,EAICE,oBAJD,EAKCgB,IALD,EAMCnB,WAND,EAOCI,kBAPD,CApDa,CAAd;AA8DA;;AAED,eAAeN,sBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { pick, defaultTo } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Platform, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {boolean} hasTemplate Whether template mode is enabled.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, hasTemplate ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML } = select( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getUnstableBase, hasFinishedResolution } = select(\n\t\t\tcoreStore\n\t\t);\n\n\t\tconst siteData = getUnstableBase();\n\n\t\tconst hasFinishedResolvingSiteData = hasFinishedResolution(\n\t\t\t'getUnstableBase'\n\t\t);\n\n\t\treturn {\n\t\t\tcanUseUnfilteredHTML: canUserUseUnfilteredHTML(),\n\t\t\treusableBlocks: isWeb\n\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t{ per_page: -1 }\n\t\t\t\t )\n\t\t\t\t: [], // Reusable blocks are fetched in the native version of this hook.\n\t\t\thasUploadPermissions: defaultTo(\n\t\t\t\tcanUser( 'create', 'media' ),\n\t\t\t\ttrue\n\t\t\t),\n\t\t\thasResolvedLocalSiteData: hasFinishedResolvingSiteData,\n\t\t\tbaseUrl: siteData?.url || '',\n\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t};\n\t}, [] );\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = ( options ) => {\n\t\tif ( ! userCanCreatePages ) {\n\t\t\treturn Promise.reject( {\n\t\t\t\tmessage: __( 'You do not have permission to create Pages.' ),\n\t\t\t} );\n\t\t}\n\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t};\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...pick( settings, [\n\t\t\t\t'__experimentalBlockDirectory',\n\t\t\t\t'__experimentalBlockPatternCategories',\n\t\t\t\t'__experimentalBlockPatterns',\n\t\t\t\t'__experimentalFeatures',\n\t\t\t\t'__experimentalPreferredStyleVariations',\n\t\t\t\t'__experimentalSetIsInserterOpened',\n\t\t\t\t'__unstableGalleryWithImageBlocks',\n\t\t\t\t'alignWide',\n\t\t\t\t'allowedBlockTypes',\n\t\t\t\t'bodyPlaceholder',\n\t\t\t\t'codeEditingEnabled',\n\t\t\t\t'colors',\n\t\t\t\t'disableCustomColors',\n\t\t\t\t'disableCustomFontSizes',\n\t\t\t\t'disableCustomGradients',\n\t\t\t\t'enableCustomLineHeight',\n\t\t\t\t'enableCustomSpacing',\n\t\t\t\t'enableCustomUnits',\n\t\t\t\t'focusMode',\n\t\t\t\t'fontSizes',\n\t\t\t\t'gradients',\n\t\t\t\t'hasFixedToolbar',\n\t\t\t\t'hasReducedUI',\n\t\t\t\t'imageDefaultSize',\n\t\t\t\t'imageDimensions',\n\t\t\t\t'imageEditing',\n\t\t\t\t'imageSizes',\n\t\t\t\t'isRTL',\n\t\t\t\t'keepCaretInsideBlock',\n\t\t\t\t'maxWidth',\n\t\t\t\t'onUpdateDefaultBlockStyles',\n\t\t\t\t'styles',\n\t\t\t\t'template',\n\t\t\t\t'templateLock',\n\t\t\t\t'titlePlaceholder',\n\t\t\t\t'supportsLayout',\n\t\t\t\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t\t\t] ),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t__experimentalUndo: undo,\n\t\t\toutlineMode: hasTemplate,\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tuserCanCreatePages,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
@@ -12,7 +12,7 @@ import { count as wordCount } from '@wordpress/wordcount';
12
12
 
13
13
  import { store as editorStore } from '../../store';
14
14
  export default function WordCount() {
15
- const content = useSelect(select => select(editorStore).getEditedPostAttribute('content'));
15
+ const content = useSelect(select => select(editorStore).getEditedPostAttribute('content'), []);
16
16
  /*
17
17
  * translators: If your word count is based on single characters (e.g. East Asian characters),
18
18
  * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/word-count/index.js"],"names":["useSelect","_x","count","wordCount","store","editorStore","WordCount","content","select","getEditedPostAttribute","wordCountType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,eAAe,SAASC,SAAT,GAAqB;AACnC,QAAMC,OAAO,GAAGP,SAAS,CAAIQ,MAAF,IAC1BA,MAAM,CAAEH,WAAF,CAAN,CAAsBI,sBAAtB,CAA8C,SAA9C,CADwB,CAAzB;AAIA;AACD;AACA;AACA;AACA;;AACC,QAAMC,aAAa,GAAGT,EAAE,CAAE,OAAF,EAAW,oCAAX,CAAxB;;AAEA,SACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGE,SAAS,CAAEI,OAAF,EAAWG,aAAX,CADZ,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { _x } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function WordCount() {\n\tconst content = useSelect( ( select ) =>\n\t\tselect( editorStore ).getEditedPostAttribute( 'content' )\n\t);\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\treturn (\n\t\t<span className=\"word-count\">\n\t\t\t{ wordCount( content, wordCountType ) }\n\t\t</span>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/word-count/index.js"],"names":["useSelect","_x","count","wordCount","store","editorStore","WordCount","content","select","getEditedPostAttribute","wordCountType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,eAAe,SAASC,SAAT,GAAqB;AACnC,QAAMC,OAAO,GAAGP,SAAS,CACtBQ,MAAF,IAAcA,MAAM,CAAEH,WAAF,CAAN,CAAsBI,sBAAtB,CAA8C,SAA9C,CADU,EAExB,EAFwB,CAAzB;AAKA;AACD;AACA;AACA;AACA;;AACC,QAAMC,aAAa,GAAGT,EAAE,CAAE,OAAF,EAAW,oCAAX,CAAxB;;AAEA,SACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGE,SAAS,CAAEI,OAAF,EAAWG,aAAX,CADZ,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { _x } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function WordCount() {\n\tconst content = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),\n\t\t[]\n\t);\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\treturn (\n\t\t<span className=\"word-count\">\n\t\t\t{ wordCount( content, wordCountType ) }\n\t\t</span>\n\t);\n}\n"]}
@@ -90,29 +90,6 @@ export function resetPost(post) {
90
90
  post
91
91
  };
92
92
  }
93
- /**
94
- * Returns an action object used in signalling that the latest autosave of the
95
- * post has been received, by initialization or autosave.
96
- *
97
- * @deprecated since 5.6. Callers should use the `receiveAutosaves( postId, autosave )`
98
- * selector from the '@wordpress/core-data' package.
99
- *
100
- * @param {Object} newAutosave Autosave post object.
101
- *
102
- * @return {Object} Action object.
103
- */
104
-
105
- export function* resetAutosave(newAutosave) {
106
- deprecated('resetAutosave action (`core/editor` store)', {
107
- since: '5.3',
108
- alternative: 'receiveAutosaves action (`core` store)'
109
- });
110
- const postId = yield controls.select(STORE_NAME, 'getCurrentPostId');
111
- yield controls.dispatch(coreStore.name, 'receiveAutosaves', postId, newAutosave);
112
- return {
113
- type: '__INERT__'
114
- };
115
- }
116
93
  /**
117
94
  * Action for dispatching that a post update request has started.
118
95
  *
@@ -188,7 +165,7 @@ export function* editPost(edits, options) {
188
165
  id,
189
166
  type
190
167
  } = yield controls.select(STORE_NAME, 'getCurrentPost');
191
- yield controls.dispatch(coreStore.name, 'editEntityRecord', 'postType', type, id, edits, options);
168
+ yield controls.dispatch(coreStore, 'editEntityRecord', 'postType', type, id, edits, options);
192
169
  }
193
170
  /**
194
171
  * Action generator for saving the current post in the editor.
@@ -215,12 +192,12 @@ export function* savePost(options = {}) {
215
192
  const previousRecord = yield controls.select(STORE_NAME, 'getCurrentPost');
216
193
  edits = {
217
194
  id: previousRecord.id,
218
- ...(yield controls.select(coreStore.name, 'getEntityRecordNonTransientEdits', 'postType', previousRecord.type, previousRecord.id)),
195
+ ...(yield controls.select(coreStore, 'getEntityRecordNonTransientEdits', 'postType', previousRecord.type, previousRecord.id)),
219
196
  ...edits
220
197
  };
221
- yield controls.dispatch(coreStore.name, 'saveEntityRecord', 'postType', previousRecord.type, edits, options);
198
+ yield controls.dispatch(coreStore, 'saveEntityRecord', 'postType', previousRecord.type, edits, options);
222
199
  yield __experimentalRequestPostUpdateFinish(options);
223
- const error = yield controls.select(coreStore.name, 'getLastEntitySaveError', 'postType', previousRecord.type, previousRecord.id);
200
+ const error = yield controls.select(coreStore, 'getLastEntitySaveError', 'postType', previousRecord.type, previousRecord.id);
224
201
 
225
202
  if (error) {
226
203
  const args = getNotificationArgumentsForSaveFail({
@@ -237,7 +214,7 @@ export function* savePost(options = {}) {
237
214
  const args = getNotificationArgumentsForSaveSuccess({
238
215
  previousPost: previousRecord,
239
216
  post: updatedRecord,
240
- postType: yield controls.resolveSelect(coreStore.name, 'getPostType', updatedRecord.type),
217
+ postType: yield controls.resolveSelect(coreStore, 'getPostType', updatedRecord.type),
241
218
  options
242
219
  });
243
220
 
@@ -248,7 +225,7 @@ export function* savePost(options = {}) {
248
225
 
249
226
 
250
227
  if (!options.isAutosave) {
251
- yield controls.dispatch(blockEditorStore.name, '__unstableMarkLastChangeAsPersistent');
228
+ yield controls.dispatch(blockEditorStore, '__unstableMarkLastChangeAsPersistent');
252
229
  }
253
230
  }
254
231
  }
@@ -259,7 +236,7 @@ export function* savePost(options = {}) {
259
236
  export function* refreshPost() {
260
237
  const post = yield controls.select(STORE_NAME, 'getCurrentPost');
261
238
  const postTypeSlug = yield controls.select(STORE_NAME, 'getCurrentPostType');
262
- const postType = yield controls.resolveSelect(coreStore.name, 'getPostType', postTypeSlug);
239
+ const postType = yield controls.resolveSelect(coreStore, 'getPostType', postTypeSlug);
263
240
  const newPost = yield apiFetch({
264
241
  // Timestamp arg allows caller to bypass browser caching, which is
265
242
  // expected for this specific function.
@@ -273,7 +250,7 @@ export function* refreshPost() {
273
250
 
274
251
  export function* trashPost() {
275
252
  const postTypeSlug = yield controls.select(STORE_NAME, 'getCurrentPostType');
276
- const postType = yield controls.resolveSelect(coreStore.name, 'getPostType', postTypeSlug);
253
+ const postType = yield controls.resolveSelect(coreStore, 'getPostType', postTypeSlug);
277
254
  yield controls.dispatch(noticesStore, 'removeNotice', TRASH_POST_NOTICE_ID);
278
255
 
279
256
  try {
@@ -331,7 +308,7 @@ export function* autosave({
331
308
  */
332
309
 
333
310
  export function* redo() {
334
- yield controls.dispatch(coreStore.name, 'redo');
311
+ yield controls.dispatch(coreStore, 'redo');
335
312
  }
336
313
  /**
337
314
  * Returns an action object used in signalling that undo history should pop.
@@ -340,7 +317,7 @@ export function* redo() {
340
317
  */
341
318
 
342
319
  export function* undo() {
343
- yield controls.dispatch(coreStore.name, 'undo');
320
+ yield controls.dispatch(coreStore, 'undo');
344
321
  }
345
322
  /**
346
323
  * Returns an action object used in signalling that undo history record should
@@ -526,10 +503,10 @@ export function* resetEditorBlocks(blocks, options = {}) {
526
503
  id,
527
504
  type
528
505
  } = yield controls.select(STORE_NAME, 'getCurrentPost');
529
- const noChange = (yield controls.select(coreStore.name, 'getEditedEntityRecord', 'postType', type, id)).blocks === edits.blocks;
506
+ const noChange = (yield controls.select(coreStore, 'getEditedEntityRecord', 'postType', type, id)).blocks === edits.blocks;
530
507
 
531
508
  if (noChange) {
532
- return yield controls.dispatch(coreStore.name, '__unstableCreateUndoLevel', 'postType', type, id);
509
+ return yield controls.dispatch(coreStore, '__unstableCreateUndoLevel', 'postType', type, id);
533
510
  } // We create a new function here on every persistent edit
534
511
  // to make sure the edit makes the post dirty and creates
535
512
  // a new undo level.
@@ -565,7 +542,7 @@ const getBlockEditorAction = name => function* (...args) {
565
542
  since: '5.3',
566
543
  alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`'
567
544
  });
568
- yield controls.dispatch(blockEditorStore.name, name, ...args);
545
+ yield controls.dispatch(blockEditorStore, name, ...args);
569
546
  };
570
547
  /**
571
548
  * @see resetBlocks in core/block-editor store.