@wordpress/editor 14.7.0 → 14.7.1-next.5368f64a9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/README.md +4 -0
  2. package/build/bindings/post-meta.js +2 -1
  3. package/build/bindings/post-meta.js.map +1 -1
  4. package/build/components/editor/index.js +2 -2
  5. package/build/components/editor/index.js.map +1 -1
  6. package/build/components/global-styles-provider/index.js +3 -4
  7. package/build/components/global-styles-provider/index.js.map +1 -1
  8. package/build/components/header/index.js +4 -4
  9. package/build/components/header/index.js.map +1 -1
  10. package/build/components/inserter-sidebar/index.js +2 -5
  11. package/build/components/inserter-sidebar/index.js.map +1 -1
  12. package/build/components/post-publish-panel/maybe-upload-media.js +151 -32
  13. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  14. package/build/components/post-publish-panel/media-util.js +79 -0
  15. package/build/components/post-publish-panel/media-util.js.map +1 -0
  16. package/build/components/post-trash/check.js +2 -1
  17. package/build/components/post-trash/check.js.map +1 -1
  18. package/build/components/post-trash/index.js +22 -8
  19. package/build/components/post-trash/index.js.map +1 -1
  20. package/build/components/preferences-modal/index.js +28 -1
  21. package/build/components/preferences-modal/index.js.map +1 -1
  22. package/build/components/provider/index.js +34 -8
  23. package/build/components/provider/index.js.map +1 -1
  24. package/build/components/provider/use-block-editor-settings.js +9 -4
  25. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  26. package/build/components/sidebar/post-summary.js +3 -0
  27. package/build/components/sidebar/post-summary.js.map +1 -1
  28. package/build/components/start-page-options/index.js +16 -19
  29. package/build/components/start-page-options/index.js.map +1 -1
  30. package/build/components/start-template-options/index.js +2 -4
  31. package/build/components/start-template-options/index.js.map +1 -1
  32. package/build/components/table-of-contents/index.js +2 -4
  33. package/build/components/table-of-contents/index.js.map +1 -1
  34. package/build/components/text-editor/index.js +2 -4
  35. package/build/components/text-editor/index.js.map +1 -1
  36. package/build/components/visual-editor/edit-template-blocks-notification.js +1 -1
  37. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  38. package/build/dataviews/actions/reset-post.js +4 -8
  39. package/build/dataviews/actions/reset-post.js.map +1 -1
  40. package/build/dataviews/actions/trash-post.js +4 -8
  41. package/build/dataviews/actions/trash-post.js.map +1 -1
  42. package/build/store/selectors.js +7 -3
  43. package/build/store/selectors.js.map +1 -1
  44. package/build-module/bindings/post-meta.js +2 -1
  45. package/build-module/bindings/post-meta.js.map +1 -1
  46. package/build-module/components/editor/index.js +2 -2
  47. package/build-module/components/editor/index.js.map +1 -1
  48. package/build-module/components/global-styles-provider/index.js +3 -4
  49. package/build-module/components/global-styles-provider/index.js.map +1 -1
  50. package/build-module/components/header/index.js +4 -4
  51. package/build-module/components/header/index.js.map +1 -1
  52. package/build-module/components/inserter-sidebar/index.js +2 -5
  53. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  54. package/build-module/components/post-publish-panel/maybe-upload-media.js +150 -31
  55. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  56. package/build-module/components/post-publish-panel/media-util.js +72 -0
  57. package/build-module/components/post-publish-panel/media-util.js.map +1 -0
  58. package/build-module/components/post-trash/check.js +2 -1
  59. package/build-module/components/post-trash/check.js.map +1 -1
  60. package/build-module/components/post-trash/index.js +23 -11
  61. package/build-module/components/post-trash/index.js.map +1 -1
  62. package/build-module/components/preferences-modal/index.js +28 -1
  63. package/build-module/components/preferences-modal/index.js.map +1 -1
  64. package/build-module/components/provider/index.js +35 -9
  65. package/build-module/components/provider/index.js.map +1 -1
  66. package/build-module/components/provider/use-block-editor-settings.js +9 -4
  67. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  68. package/build-module/components/sidebar/post-summary.js +3 -0
  69. package/build-module/components/sidebar/post-summary.js.map +1 -1
  70. package/build-module/components/start-page-options/index.js +17 -21
  71. package/build-module/components/start-page-options/index.js.map +1 -1
  72. package/build-module/components/start-template-options/index.js +2 -4
  73. package/build-module/components/start-template-options/index.js.map +1 -1
  74. package/build-module/components/table-of-contents/index.js +2 -4
  75. package/build-module/components/table-of-contents/index.js.map +1 -1
  76. package/build-module/components/text-editor/index.js +2 -4
  77. package/build-module/components/text-editor/index.js.map +1 -1
  78. package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -1
  79. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  80. package/build-module/dataviews/actions/reset-post.js +4 -8
  81. package/build-module/dataviews/actions/reset-post.js.map +1 -1
  82. package/build-module/dataviews/actions/trash-post.js +4 -8
  83. package/build-module/dataviews/actions/trash-post.js.map +1 -1
  84. package/build-module/store/selectors.js +6 -2
  85. package/build-module/store/selectors.js.map +1 -1
  86. package/build-style/style-rtl.css +2 -2
  87. package/build-style/style.css +2 -2
  88. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  89. package/build-types/components/header/back-button.d.ts.map +1 -1
  90. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  91. package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -1
  92. package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
  93. package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -1
  94. package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -1
  95. package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -1
  96. package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -1
  97. package/build-types/components/post-excerpt/plugin.d.ts.map +1 -1
  98. package/build-types/components/post-publish-panel/maybe-upload-media.d.ts +1 -1
  99. package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
  100. package/build-types/components/post-publish-panel/media-util.d.ts +20 -0
  101. package/build-types/components/post-publish-panel/media-util.d.ts.map +1 -0
  102. package/build-types/components/post-trash/check.d.ts.map +1 -1
  103. package/build-types/components/post-trash/index.d.ts +4 -1
  104. package/build-types/components/post-trash/index.d.ts.map +1 -1
  105. package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -1
  106. package/build-types/components/preferences-modal/index.d.ts.map +1 -1
  107. package/build-types/components/provider/index.d.ts.map +1 -1
  108. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  109. package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
  110. package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
  111. package/build-types/components/start-page-options/index.d.ts +1 -0
  112. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  113. package/build-types/components/start-template-options/index.d.ts.map +1 -1
  114. package/build-types/components/text-editor/index.d.ts.map +1 -1
  115. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
  116. package/build-types/dataviews/actions/reset-post.d.ts.map +1 -1
  117. package/build-types/dataviews/actions/trash-post.d.ts.map +1 -1
  118. package/build-types/store/selectors.d.ts +8 -8
  119. package/build-types/store/selectors.d.ts.map +1 -1
  120. package/package.json +36 -36
  121. package/src/bindings/post-meta.js +1 -1
  122. package/src/components/editor/index.js +1 -1
  123. package/src/components/global-styles-provider/index.js +11 -7
  124. package/src/components/header/index.js +3 -3
  125. package/src/components/header/style.scss +1 -1
  126. package/src/components/inserter-sidebar/index.js +2 -5
  127. package/src/components/post-publish-panel/maybe-upload-media.js +149 -48
  128. package/src/components/post-publish-panel/media-util.js +87 -0
  129. package/src/components/post-publish-panel/test/media-util.js +118 -0
  130. package/src/components/post-trash/check.js +5 -2
  131. package/src/components/post-trash/index.js +23 -12
  132. package/src/components/preferences-modal/index.js +227 -172
  133. package/src/components/provider/index.js +42 -10
  134. package/src/components/provider/use-block-editor-settings.js +11 -6
  135. package/src/components/sidebar/post-summary.js +4 -0
  136. package/src/components/start-page-options/index.js +28 -26
  137. package/src/components/start-template-options/index.js +1 -2
  138. package/src/components/table-of-contents/index.js +1 -2
  139. package/src/components/text-editor/index.js +1 -2
  140. package/src/components/text-editor/style.scss +1 -1
  141. package/src/components/visual-editor/edit-template-blocks-notification.js +4 -1
  142. package/src/dataviews/actions/reset-post.tsx +2 -4
  143. package/src/dataviews/actions/trash-post.tsx +2 -4
  144. package/src/store/selectors.js +9 -3
  145. package/tsconfig.json +1 -0
  146. package/tsconfig.tsbuildinfo +1 -1
package/README.md CHANGED
@@ -1471,6 +1471,10 @@ Undocumented declaration.
1471
1471
 
1472
1472
  Displays the Post Trash Button and Confirm Dialog in the Editor.
1473
1473
 
1474
+ _Parameters_
1475
+
1476
+ - _An_ `?{onActionPerformed: Object}`: object containing the onActionPerformed function.
1477
+
1474
1478
  _Returns_
1475
1479
 
1476
1480
  - `JSX.Element|null`: The rendered PostTrash component.
@@ -22,8 +22,9 @@ var _default = exports.default = {
22
22
  const meta = registry.select(_coreData.store).getEditedEntityRecord('postType', context?.postType, context?.postId)?.meta;
23
23
  const newValues = {};
24
24
  for (const [attributeName, source] of Object.entries(bindings)) {
25
+ var _meta$source$args$key;
25
26
  // Use the key if the value is not set.
26
- newValues[attributeName] = meta?.[source.args.key] || source.args.key;
27
+ newValues[attributeName] = (_meta$source$args$key = meta?.[source.args.key]) !== null && _meta$source$args$key !== void 0 ? _meta$source$args$key : source.args.key;
27
28
  }
28
29
  return newValues;
29
30
  },
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_store","_default","exports","default","name","getValues","registry","context","bindings","meta","select","coreDataStore","getEditedEntityRecord","postType","postId","newValues","attributeName","source","Object","entries","args","key","setValues","newMeta","values","forEach","newValue","dispatch","editEntityRecord","canUserEditValue","query","queryId","editorStore","getCurrentPostType","fieldValue","getEntityRecord","undefined","areCustomFieldsEnabled","getEditorSettings","enableCustomFields","canUserEdit","canUser","kind","id","getFieldsList","metaFields","keys","length","fromEntries","filter","charAt"],"sources":["@wordpress/editor/src/bindings/post-meta.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\nexport default {\n\tname: 'core/post-meta',\n\tgetValues( { registry, context, bindings } ) {\n\t\tconst meta = registry\n\t\t\t.select( coreDataStore )\n\t\t\t.getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcontext?.postType,\n\t\t\t\tcontext?.postId\n\t\t\t)?.meta;\n\t\tconst newValues = {};\n\t\tfor ( const [ attributeName, source ] of Object.entries( bindings ) ) {\n\t\t\t// Use the key if the value is not set.\n\t\t\tnewValues[ attributeName ] =\n\t\t\t\tmeta?.[ source.args.key ] || source.args.key;\n\t\t}\n\t\treturn newValues;\n\t},\n\tsetValues( { registry, context, bindings } ) {\n\t\tconst newMeta = {};\n\t\tObject.values( bindings ).forEach( ( { args, newValue } ) => {\n\t\t\tnewMeta[ args.key ] = newValue;\n\t\t} );\n\t\tregistry\n\t\t\t.dispatch( coreDataStore )\n\t\t\t.editEntityRecord( 'postType', context?.postType, context?.postId, {\n\t\t\t\tmeta: newMeta,\n\t\t\t} );\n\t},\n\tcanUserEditValue( { select, context, args } ) {\n\t\t// Lock editing in query loop.\n\t\tif ( context?.query || context?.queryId ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst postType =\n\t\t\tcontext?.postType || select( editorStore ).getCurrentPostType();\n\n\t\t// Check that editing is happening in the post editor and not a template.\n\t\tif ( postType === 'wp_template' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check that the custom field is not protected and available in the REST API.\n\t\t// Empty string or `false` could be a valid value, so we need to check if the field value is undefined.\n\t\tconst fieldValue = select( coreDataStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType,\n\t\t\tcontext?.postId\n\t\t)?.meta?.[ args.key ];\n\n\t\tif ( fieldValue === undefined ) {\n\t\t\treturn false;\n\t\t}\n\t\t// Check that custom fields metabox is not enabled.\n\t\tconst areCustomFieldsEnabled =\n\t\t\tselect( editorStore ).getEditorSettings().enableCustomFields;\n\t\tif ( areCustomFieldsEnabled ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check that the user has the capability to edit post meta.\n\t\tconst canUserEdit = select( coreDataStore ).canUser( 'update', {\n\t\t\tkind: 'postType',\n\t\t\tname: context?.postType,\n\t\t\tid: context?.postId,\n\t\t} );\n\t\tif ( ! canUserEdit ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t},\n\tgetFieldsList( { registry, context } ) {\n\t\tconst metaFields = registry\n\t\t\t.select( coreDataStore )\n\t\t\t.getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcontext?.postType,\n\t\t\t\tcontext?.postId\n\t\t\t).meta;\n\n\t\tif ( ! metaFields || ! Object.keys( metaFields ).length ) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Remove footnotes or private keys from the list of fields.\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries( metaFields ).filter(\n\t\t\t\t( [ key ] ) => key !== 'footnotes' && key.charAt( 0 ) !== '_'\n\t\t\t)\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;AAGA;AACA;AACA;AAFA,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAKe;EACdC,IAAI,EAAE,gBAAgB;EACtBC,SAASA,CAAE;IAAEC,QAAQ;IAAEC,OAAO;IAAEC;EAAS,CAAC,EAAG;IAC5C,MAAMC,IAAI,GAAGH,QAAQ,CACnBI,MAAM,CAAEC,eAAc,CAAC,CACvBC,qBAAqB,CACrB,UAAU,EACVL,OAAO,EAAEM,QAAQ,EACjBN,OAAO,EAAEO,MACV,CAAC,EAAEL,IAAI;IACR,MAAMM,SAAS,GAAG,CAAC,CAAC;IACpB,KAAM,MAAM,CAAEC,aAAa,EAAEC,MAAM,CAAE,IAAIC,MAAM,CAACC,OAAO,CAAEX,QAAS,CAAC,EAAG;MACrE;MACAO,SAAS,CAAEC,aAAa,CAAE,GACzBP,IAAI,GAAIQ,MAAM,CAACG,IAAI,CAACC,GAAG,CAAE,IAAIJ,MAAM,CAACG,IAAI,CAACC,GAAG;IAC9C;I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AAG;MAC7B,OAAO,KAAK;IACb;;IAEA;IACA,MAAMG,WAAW,GAAG9B,MAAM,CAAEC,eAAc,CAAC,CAAC8B,OAAO,CAAE,QAAQ,EAAE;MAC9DC,IAAI,EAAE,UAAU;MAChBtC,IAAI,EAAEG,OAAO,EAAEM,QAAQ;MACvB8B,EAAE,EAAEpC,OAAO,EAAEO;IACd,CAAE,CAAC;IACH,IAAK,CAAE0B,WAAW,EAAG;MACpB,OAAO,KAAK;IACb;IAEA,OAAO,IAAI;EACZ,CAAC;EACDI,aAAaA,CAAE;IAAEtC,QAAQ;IAAEC;EAAQ,CAAC,EAAG;IACtC,MAAMsC,UAAU,GAAGvC,QAAQ,CACzBI,MAAM,CAAEC,eAAc,CAAC,CACvBC,qBAAqB,CACrB,UAAU,EACVL,OAAO,EAAEM,QAAQ,EACjBN,OAAO,EAAEO,MACV,CAAC,CAACL,IAAI;IAEP,IAAK,CAAEoC,UAAU,IAAI,CAAE3B,MAAM,CAAC4B,IAAI,CAAED,UAAW,CAAC,CAACE,MAAM,EAAG;MACzD,OAAO,IAAI;IACZ;;IAEA;IACA,OAAO7B,MAAM,CAAC8B,WAAW,CACxB9B,MAAM,CAACC,OAAO,CAAE0B,UAAW,CAAC,CAACI,MAAM,CAClC,CAAE,CAAE5B,GAAG,CAAE,KAAMA,GAAG,KAAK,WAAW,IAAIA,GAAG,CAAC6B,MAAM,CAAE,CAAE,CAAC,KAAK,GAC3D,CACD,CAAC;EACF;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_coreData","require","_store","_default","exports","default","name","getValues","registry","context","bindings","meta","select","coreDataStore","getEditedEntityRecord","postType","postId","newValues","attributeName","source","Object","entries","_meta$source$args$key","args","key","setValues","newMeta","values","forEach","newValue","dispatch","editEntityRecord","canUserEditValue","query","queryId","editorStore","getCurrentPostType","fieldValue","getEntityRecord","undefined","areCustomFieldsEnabled","getEditorSettings","enableCustomFields","canUserEdit","canUser","kind","id","getFieldsList","metaFields","keys","length","fromEntries","filter","charAt"],"sources":["@wordpress/editor/src/bindings/post-meta.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\nexport default {\n\tname: 'core/post-meta',\n\tgetValues( { registry, context, bindings } ) {\n\t\tconst meta = registry\n\t\t\t.select( coreDataStore )\n\t\t\t.getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcontext?.postType,\n\t\t\t\tcontext?.postId\n\t\t\t)?.meta;\n\t\tconst newValues = {};\n\t\tfor ( const [ attributeName, source ] of Object.entries( bindings ) ) {\n\t\t\t// Use the key if the value is not set.\n\t\t\tnewValues[ attributeName ] =\n\t\t\t\tmeta?.[ source.args.key ] ?? source.args.key;\n\t\t}\n\t\treturn newValues;\n\t},\n\tsetValues( { registry, context, bindings } ) {\n\t\tconst newMeta = {};\n\t\tObject.values( bindings ).forEach( ( { args, newValue } ) => {\n\t\t\tnewMeta[ args.key ] = newValue;\n\t\t} );\n\t\tregistry\n\t\t\t.dispatch( coreDataStore )\n\t\t\t.editEntityRecord( 'postType', context?.postType, context?.postId, {\n\t\t\t\tmeta: newMeta,\n\t\t\t} );\n\t},\n\tcanUserEditValue( { select, context, args } ) {\n\t\t// Lock editing in query loop.\n\t\tif ( context?.query || context?.queryId ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst postType =\n\t\t\tcontext?.postType || select( editorStore ).getCurrentPostType();\n\n\t\t// Check that editing is happening in the post editor and not a template.\n\t\tif ( postType === 'wp_template' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check that the custom field is not protected and available in the REST API.\n\t\t// Empty string or `false` could be a valid value, so we need to check if the field value is undefined.\n\t\tconst fieldValue = select( coreDataStore ).getEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType,\n\t\t\tcontext?.postId\n\t\t)?.meta?.[ args.key ];\n\n\t\tif ( fieldValue === undefined ) {\n\t\t\treturn false;\n\t\t}\n\t\t// Check that custom fields metabox is not enabled.\n\t\tconst areCustomFieldsEnabled =\n\t\t\tselect( editorStore ).getEditorSettings().enableCustomFields;\n\t\tif ( areCustomFieldsEnabled ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check that the user has the capability to edit post meta.\n\t\tconst canUserEdit = select( coreDataStore ).canUser( 'update', {\n\t\t\tkind: 'postType',\n\t\t\tname: context?.postType,\n\t\t\tid: context?.postId,\n\t\t} );\n\t\tif ( ! canUserEdit ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t},\n\tgetFieldsList( { registry, context } ) {\n\t\tconst metaFields = registry\n\t\t\t.select( coreDataStore )\n\t\t\t.getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tcontext?.postType,\n\t\t\t\tcontext?.postId\n\t\t\t).meta;\n\n\t\tif ( ! metaFields || ! Object.keys( metaFields ).length ) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Remove footnotes or private keys from the list of fields.\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries( metaFields ).filter(\n\t\t\t\t( [ key ] ) => key !== 'footnotes' && key.charAt( 0 ) !== '_'\n\t\t\t)\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;AAGA;AACA;AACA;AAFA,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAKe;EACdC,IAAI,EAAE,gBAAgB;EACtBC,SAASA,CAAE;IAAEC,QAAQ;IAAEC,OAAO;IAAEC;EAAS,CAAC,EAAG;IAC5C,MAAMC,IAAI,GAAGH,QAAQ,CACnBI,MAAM,CAAEC,eAAc,CAAC,CACvBC,qBAAqB,CACrB,UAAU,EACVL,OAAO,EAAEM,QAAQ,EACjBN,OAAO,EAAEO,MACV,CAAC,EAAEL,IAAI;IACR,MAAMM,SAAS,GAAG,CAAC,CAAC;IACpB,KAAM,MAAM,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+66,10 @@ function Editor({
66
66
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_editorInterface.default, {
67
67
  ...props,
68
68
  children: extraContent
69
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebar.default, {
69
+ }), children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebar.default, {
70
70
  onActionPerformed: onActionPerformed,
71
71
  extraPanels: extraSidebarPanels
72
- }), children]
72
+ })]
73
73
  })]
74
74
  });
75
75
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_components","_i18n","_constants","_editorInterface","_interopRequireDefault","_provider","_sidebar","_jsxRuntime","Editor","postType","postId","templateId","settings","children","initialEdits","onActionPerformed","extraContent","extraSidebarPanels","props","post","template","hasLoadedPost","useSelect","select","getEntityRecord","hasFinishedResolution","coreStore","TEMPLATE_POST_TYPE","undefined","jsxs","Fragment","jsx","Notice","status","isDismissible","__","ExperimentalEditorProvider","__unstableTemplate","useSubRegistry","default","extraPanels","_default","exports"],"sources":["@wordpress/editor/src/components/editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport EditorInterface from '../editor-interface';\nimport { ExperimentalEditorProvider } from '../provider';\nimport Sidebar from '../sidebar';\n\nfunction Editor( {\n\tpostType,\n\tpostId,\n\ttemplateId,\n\tsettings,\n\tchildren,\n\tinitialEdits,\n\n\t// This could be part of the settings.\n\tonActionPerformed,\n\n\t// The following abstractions are not ideal but necessary\n\t// to account for site editor and post editor differences for now.\n\textraContent,\n\textraSidebarPanels,\n\t...props\n} ) {\n\tconst { post, template, hasLoadedPost } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\treturn {\n\t\t\t\tpost: getEntityRecord( 'postType', postType, postId ),\n\t\t\t\ttemplate: templateId\n\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t\ttemplateId\n\t\t\t\t\t )\n\t\t\t\t\t: undefined,\n\t\t\t\thasLoadedPost: hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, templateId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ hasLoadedPost && ! post && (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t) }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ !! post && (\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tpost={ post }\n\t\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<EditorInterface { ...props }>\n\t\t\t\t\t\t{ extraContent }\n\t\t\t\t\t</EditorInterface>\n\t\t\t\t\t<Sidebar\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraPanels={ extraSidebarPanels }\n\t\t\t\t\t/>\n\t\t\t\t\t{ children }\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,UAAA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AEhB,IAAI,iBACR,IAAAZ,WAAA,CAAAsB,IAAA,EAACxB,SAAA,CAAA+B,0BAA0B;MAC1BjB,IAAI,EAAGA,IAAM;MACbkB,kBAAkB,EAAGjB,QAAU;MAC/BR,QAAQ,EAAGA,QAAU;MACrBE,YAAY,EAAGA,YAAc;MAC7BwB,cAAc,EAAG,KAAO;MAAAzB,QAAA,gBAExB,IAAAN,WAAA,CAAAwB,GAAA,EAAC5B,gBAAA,CAAAoC,OAAe;QAAA,GAAMrB,KAAK;QAAAL,QAAA,EACxBG;MAAY,CACE,CAAC,eAClB,IAAAT,WAAA,CAAAwB,GAAA,EAACzB,QAAA,CAAAiC,OAAO;QACPxB,iBAAiB,EAAGA,iBAAmB;QACvCyB,WAAW,EAAGvB;MAAoB,CAClC,CAAC,EACAJ,QAAQ;IAAA,CACiB,CAC5B;EAAA,CACA,CAAC;AAEL;AAAC,IAAA4B,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEc/B,MAAM","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_coreData","_components","_i18n","_constants","_editorInterface","_interopRequireDefault","_provider","_sidebar","_jsxRuntime","Editor","postType","postId","templateId","settings","children","initialEdits","onActionPerformed","extraContent","extraSidebarPanels","props","post","template","hasLoadedPost","useSelect","select","getEntityRecord","hasFinishedResolution","coreStore","TEMPLATE_POST_TYPE","undefined","jsxs","Fragment","jsx","Notice","status","isDismissible","__","ExperimentalEditorProvider","__unstableTemplate","useSubRegistry","default","extraPanels","_default","exports"],"sources":["@wordpress/editor/src/components/editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport EditorInterface from '../editor-interface';\nimport { ExperimentalEditorProvider } from '../provider';\nimport Sidebar from '../sidebar';\n\nfunction Editor( {\n\tpostType,\n\tpostId,\n\ttemplateId,\n\tsettings,\n\tchildren,\n\tinitialEdits,\n\n\t// This could be part of the settings.\n\tonActionPerformed,\n\n\t// The following abstractions are not ideal but necessary\n\t// to account for site editor and post editor differences for now.\n\textraContent,\n\textraSidebarPanels,\n\t...props\n} ) {\n\tconst { post, template, hasLoadedPost } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\treturn {\n\t\t\t\tpost: getEntityRecord( 'postType', postType, postId ),\n\t\t\t\ttemplate: templateId\n\t\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t\ttemplateId\n\t\t\t\t\t )\n\t\t\t\t\t: undefined,\n\t\t\t\thasLoadedPost: hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, templateId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ hasLoadedPost && ! post && (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t) }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ !! post && (\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tpost={ post }\n\t\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<EditorInterface { ...props }>\n\t\t\t\t\t\t{ extraContent }\n\t\t\t\t\t</EditorInterface>\n\t\t\t\t\t{ children }\n\t\t\t\t\t<Sidebar\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraPanels={ extraSidebarPanels }\n\t\t\t\t\t/>\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAF,sBAAA,CAAAN,OAAA;AAAiC,IAAAS,WAAA,GAAAT,OAAA;AAdjC;AACA;AACA;;AAMA;AACA;AACA;;AAMA,SAASU,MAAMA,CAAE;EAChBC,QAAQ;EACRC,MAAM;EACNC,UAAU;EACVC,QAAQ;EACRC,QAAQ;EACRC,YAAY;EAEZ;EACAC,iBAAiB;EAEjB;EACA;EACAC,YAAY;EACZC,kBAAkB;EAClB,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM;IAAEC,IAAI;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAG,IAAAC,eAAS,EAChDC,MAAM,IAAM;IACb,MAAM;MAAEC,eAAe;MAAEC;IAAsB,CAAC,GAC/CF,MAAM,CAAEG,eAAU,CAAC;IACpB,OAAO;MACNP,IAAI,EAAEK,eAAe,CAAE,UAAU,EAAEf,QAAQ,EAAEC,MAAO,CAAC;MACrDU,QAAQ,EAAET,UAAU,GACjBa,eAAe,CACf,UAAU,EACVG,6BAAkB,EAClBhB,UACA,CAAC,GACDiB,SAAS;MACZP,aAAa,EAAEI,qBAAqB,CAAE,iBAAiB,EAAE,CACxD,UAAU,EACVhB,QAAQ,EACRC,MAAM,CACL;IACH,CAAC;EACF,CAAC,EACD,CAAED,QAAQ,EAAEC,MAAM,EAAEC,UAAU,CAC/B,CAAC;EAED,oBACC,IAAAJ,WAAA,CAAAsB,IAAA,EAAAtB,WAAA,CAAAuB,QAAA;IAAAjB,QAAA,GACGQ,aAAa,IAAI,CAAEF,IAAI,iBACxB,IAAAZ,WAAA,CAAAwB,GAAA,EAAC/B,WAAA,CAAAgC,MAAM;MAACC,MAAM,EAAC,SAAS;MAACC,aAAa,EAAG,KAAO;MAAArB,QAAA,EAC7C,IAAAsB,QAAE,EACH,2EACD;IAAC,CACM,CACR,EACC,CAAC,CAAEhB,IAAI,iBACR,IAAAZ,WAAA,CAAAsB,IAAA,EAACxB,SAAA,CAAA+B,0BAA0B;MAC1BjB,IAAI,EAAGA,IAAM;MACbkB,kBAAkB,EAAGjB,QAAU;MAC/BR,QAAQ,EAAGA,QAAU;MACrBE,YAAY,EAAGA,YAAc;MAC7BwB,cAAc,EAAG,KAAO;MAAAzB,QAAA,gBAExB,IAAAN,WAAA,CAAAwB,GAAA,EAAC5B,gBAAA,CAAAoC,OAAe;QAAA,GAAMrB,KAAK;QAAAL,QAAA,EACxBG;MAAY,CACE,CAAC,EAChBH,QAAQ,eACV,IAAAN,WAAA,CAAAwB,GAAA,EAACzB,QAAA,CAAAiC,OAAO;QACPxB,iBAAiB,EAAGA,iBAAmB;QACvCyB,WAAW,EAAGvB;MAAoB,CAClC,CAAC;IAAA,CACyB,CAC5B;EAAA,CACA,CAAC;AAEL;AAAC,IAAAwB,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEc/B,MAAM","ignoreList":[]}
@@ -124,12 +124,11 @@ function useGlobalStylesBaseConfig() {
124
124
  const baseConfig = (0, _data.useSelect)(select => {
125
125
  const {
126
126
  __experimentalGetCurrentThemeBaseGlobalStyles,
127
+ getCurrentTheme,
127
128
  canUser
128
129
  } = select(_coreData.store);
129
- return canUser('read', {
130
- kind: 'root',
131
- name: 'theme'
132
- }) && __experimentalGetCurrentThemeBaseGlobalStyles();
130
+ const currentTheme = getCurrentTheme();
131
+ return currentTheme && canUser('read', 'global-styles/themes', currentTheme.stylesheet) ? __experimentalGetCurrentThemeBaseGlobalStyles() : undefined;
133
132
  }, []);
134
133
  return [!!baseConfig, baseConfig];
135
134
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_deepmerge","_interopRequireDefault","require","_isPlainObject","_blockEditor","_coreData","_data","_element","_lockUnlock","_jsxRuntime","GlobalStylesContext","cleanEmptyObject","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","base","user","deepmerge","isMergeableObject","isPlainObject","customMerge","key","baseConfig","userConfig","undefined","useGlobalStylesUserConfig","globalStylesId","isReady","settings","styles","_links","useSelect","select","getEditedEntityRecord","hasFinishedResolution","canUser","coreStore","_globalStylesId","__experimentalGetCurrentGlobalStylesId","record","kind","name","id","hasResolved","editEntityRecord","useDispatch","config","useMemo","setConfig","useCallback","callbackOrObject","options","_record$styles","_record$settings","_record$_links","currentConfig","updatedConfig","useGlobalStylesBaseConfig","__experimentalGetCurrentThemeBaseGlobalStyles","useGlobalStylesContext","isUserConfigReady","setUserConfig","isBaseConfigReady","mergedConfig","context","merged","GlobalStylesProvider","children","jsx","Provider","value"],"sources":["@wordpress/editor/src/components/global-styles-provider/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, cleanEmptyObject } = unlock(\n\tblockEditorPrivateApis\n);\n\nexport function mergeBaseAndUserConfigs( base, user ) {\n\treturn deepmerge( base, user, {\n\t\t/*\n\t\t * We only pass as arrays the presets,\n\t\t * in which case we want the new array of values\n\t\t * to override the old array (no merging).\n\t\t */\n\t\tisMergeableObject: isPlainObject,\n\t\t/*\n\t\t * Exceptions to the above rule.\n\t\t * Background images should be replaced, not merged,\n\t\t * as they themselves are specific object definitions for the style.\n\t\t */\n\t\tcustomMerge: ( key ) => {\n\t\t\tif ( key === 'backgroundImage' ) {\n\t\t\t\treturn ( baseConfig, userConfig ) => userConfig;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t} );\n}\n\nfunction useGlobalStylesUserConfig() {\n\tconst { globalStylesId, isReady, settings, styles, _links } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _globalStylesId =\n\t\t\t\tselect( coreStore ).__experimentalGetCurrentGlobalStylesId();\n\n\t\t\tconst record =\n\t\t\t\t_globalStylesId &&\n\t\t\t\tcanUser( 'read', {\n\t\t\t\t\tkind: 'root',\n\t\t\t\t\tname: 'globalStyles',\n\t\t\t\t\tid: _globalStylesId,\n\t\t\t\t} )\n\t\t\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t_globalStylesId\n\t\t\t\t\t )\n\t\t\t\t\t: undefined;\n\n\t\t\tlet hasResolved = false;\n\t\t\tif (\n\t\t\t\thasFinishedResolution(\n\t\t\t\t\t'__experimentalGetCurrentGlobalStylesId'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\thasResolved = _globalStylesId\n\t\t\t\t\t? hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t ] )\n\t\t\t\t\t: true;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tglobalStylesId: _globalStylesId,\n\t\t\t\tisReady: hasResolved,\n\t\t\t\tsettings: record?.settings,\n\t\t\t\tstyles: record?.styles,\n\t\t\t\t_links: record?._links,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { getEditedEntityRecord } = useSelect( coreStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst config = useMemo( () => {\n\t\treturn {\n\t\t\tsettings: settings ?? {},\n\t\t\tstyles: styles ?? {},\n\t\t\t_links: _links ?? {},\n\t\t};\n\t}, [ settings, styles, _links ] );\n\n\tconst setConfig = useCallback(\n\t\t/**\n\t\t * Set the global styles config.\n\t\t * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.\n\t\t * Otherwise, overwrite the current config with the incoming object.\n\t\t * @param {Object} options Options for editEntityRecord Core selector.\n\t\t */\n\t\t( callbackOrObject, options = {} ) => {\n\t\t\tconst record = getEditedEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId\n\t\t\t);\n\n\t\t\tconst currentConfig = {\n\t\t\t\tstyles: record?.styles ?? {},\n\t\t\t\tsettings: record?.settings ?? {},\n\t\t\t\t_links: record?._links ?? {},\n\t\t\t};\n\n\t\t\tconst updatedConfig =\n\t\t\t\ttypeof callbackOrObject === 'function'\n\t\t\t\t\t? callbackOrObject( currentConfig )\n\t\t\t\t\t: callbackOrObject;\n\n\t\t\teditEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId,\n\t\t\t\t{\n\t\t\t\t\tstyles: cleanEmptyObject( updatedConfig.styles ) || {},\n\t\t\t\t\tsettings: cleanEmptyObject( updatedConfig.settings ) || {},\n\t\t\t\t\t_links: cleanEmptyObject( updatedConfig._links ) || {},\n\t\t\t\t},\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\t\t[ globalStylesId, editEntityRecord, getEditedEntityRecord ]\n\t);\n\n\treturn [ isReady, config, setConfig ];\n}\n\nfunction useGlobalStylesBaseConfig() {\n\tconst baseConfig = useSelect( ( select ) => {\n\t\tconst { __experimentalGetCurrentThemeBaseGlobalStyles, canUser } =\n\t\t\tselect( coreStore );\n\n\t\treturn (\n\t\t\tcanUser( 'read', { kind: 'root', name: 'theme' } ) &&\n\t\t\t__experimentalGetCurrentThemeBaseGlobalStyles()\n\t\t);\n\t}, [] );\n\n\treturn [ !! baseConfig, baseConfig ];\n}\n\nexport function useGlobalStylesContext() {\n\tconst [ isUserConfigReady, userConfig, setUserConfig ] =\n\t\tuseGlobalStylesUserConfig();\n\tconst [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! baseConfig || ! userConfig ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t}, [ userConfig, baseConfig ] );\n\n\tconst context = useMemo( () => {\n\t\treturn {\n\t\t\tisReady: isUserConfigReady && isBaseConfigReady,\n\t\t\tuser: userConfig,\n\t\t\tbase: baseConfig,\n\t\t\tmerged: mergedConfig,\n\t\t\tsetUserConfig,\n\t\t};\n\t}, [\n\t\tmergedConfig,\n\t\tuserConfig,\n\t\tbaseConfig,\n\t\tsetUserConfig,\n\t\tisUserConfigReady,\n\t\tisBaseConfigReady,\n\t] );\n\n\treturn context;\n}\n\nexport function GlobalStylesProvider( { children } ) {\n\tconst context = useGlobalStylesContext();\n\tif ( ! context.isReady ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AAjB3C;AACA;AACA;;AAIA;AACA;AACA;;AA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CAAC;EAErE,MAAMM,YAAY,GAAG,IAAAhB,gBAAO,EAAE,MAAM;IACnC,IAAK,CAAEzB,UAAU,IAAI,CAAEC,UAAU,EAAG;MACnC,OAAO,CAAC,CAAC;IACV;IAEA,OAAOT,uBAAuB,CAAEQ,UAAU,EAAEC,UAAW,CAAC;EACzD,CAAC,EAAE,CAAEA,UAAU,EAAED,UAAU,CAAG,CAAC;EAE/B,MAAM0C,OAAO,GAAG,IAAAjB,gBAAO,EAAE,MAAM;IAC9B,OAAO;MACNpB,OAAO,EAAEiC,iBAAiB,IAAIE,iBAAiB;MAC/C9C,IAAI,EAAEO,UAAU;MAChBR,IAAI,EAAEO,UAAU;MAChB2C,MAAM,EAAEF,YAAY;MACpBF;IACD,CAAC;EACF,CAAC,EAAE,CACFE,YAAY,EACZxC,UAAU,EACVD,UAAU,EACVuC,aAAa,EACbD,iBAAiB,EACjBE,iBAAiB,CAChB,CAAC;EAEH,OAAOE,OAAO;AACf;AAEO,SAASE,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACpD,MAAMH,OAAO,GAAGL,sBAAsB,CAAC,CAAC;EACxC,IAAK,CAAEK,OAAO,CAACrC,OAAO,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAlB,WAAA,CAAA2D,GAAA,EAAC1D,mBAAmB,CAAC2D,QAAQ;IAACC,KAAK,EAAGN,OAAS;IAAAG,QAAA,EAC5CA;EAAQ,CACmB,CAAC;AAEjC","ignoreList":[]}
1
+ {"version":3,"names":["_deepmerge","_interopRequireDefault","require","_isPlainObject","_blockEditor","_coreData","_data","_element","_lockUnlock","_jsxRuntime","GlobalStylesContext","cleanEmptyObject","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","base","user","deepmerge","isMergeableObject","isPlainObject","customMerge","key","baseConfig","userConfig","undefined","useGlobalStylesUserConfig","globalStylesId","isReady","settings","styles","_links","useSelect","select","getEditedEntityRecord","hasFinishedResolution","canUser","coreStore","_globalStylesId","__experimentalGetCurrentGlobalStylesId","record","kind","name","id","hasResolved","editEntityRecord","useDispatch","config","useMemo","setConfig","useCallback","callbackOrObject","options","_record$styles","_record$settings","_record$_links","currentConfig","updatedConfig","useGlobalStylesBaseConfig","__experimentalGetCurrentThemeBaseGlobalStyles","getCurrentTheme","currentTheme","stylesheet","useGlobalStylesContext","isUserConfigReady","setUserConfig","isBaseConfigReady","mergedConfig","context","merged","GlobalStylesProvider","children","jsx","Provider","value"],"sources":["@wordpress/editor/src/components/global-styles-provider/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, cleanEmptyObject } = unlock(\n\tblockEditorPrivateApis\n);\n\nexport function mergeBaseAndUserConfigs( base, user ) {\n\treturn deepmerge( base, user, {\n\t\t/*\n\t\t * We only pass as arrays the presets,\n\t\t * in which case we want the new array of values\n\t\t * to override the old array (no merging).\n\t\t */\n\t\tisMergeableObject: isPlainObject,\n\t\t/*\n\t\t * Exceptions to the above rule.\n\t\t * Background images should be replaced, not merged,\n\t\t * as they themselves are specific object definitions for the style.\n\t\t */\n\t\tcustomMerge: ( key ) => {\n\t\t\tif ( key === 'backgroundImage' ) {\n\t\t\t\treturn ( baseConfig, userConfig ) => userConfig;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t} );\n}\n\nfunction useGlobalStylesUserConfig() {\n\tconst { globalStylesId, isReady, settings, styles, _links } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _globalStylesId =\n\t\t\t\tselect( coreStore ).__experimentalGetCurrentGlobalStylesId();\n\n\t\t\tconst record =\n\t\t\t\t_globalStylesId &&\n\t\t\t\tcanUser( 'read', {\n\t\t\t\t\tkind: 'root',\n\t\t\t\t\tname: 'globalStyles',\n\t\t\t\t\tid: _globalStylesId,\n\t\t\t\t} )\n\t\t\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t_globalStylesId\n\t\t\t\t\t )\n\t\t\t\t\t: undefined;\n\n\t\t\tlet hasResolved = false;\n\t\t\tif (\n\t\t\t\thasFinishedResolution(\n\t\t\t\t\t'__experimentalGetCurrentGlobalStylesId'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\thasResolved = _globalStylesId\n\t\t\t\t\t? hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t\t\t'root',\n\t\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\t\t_globalStylesId,\n\t\t\t\t\t ] )\n\t\t\t\t\t: true;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tglobalStylesId: _globalStylesId,\n\t\t\t\tisReady: hasResolved,\n\t\t\t\tsettings: record?.settings,\n\t\t\t\tstyles: record?.styles,\n\t\t\t\t_links: record?._links,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { getEditedEntityRecord } = useSelect( coreStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst config = useMemo( () => {\n\t\treturn {\n\t\t\tsettings: settings ?? {},\n\t\t\tstyles: styles ?? {},\n\t\t\t_links: _links ?? {},\n\t\t};\n\t}, [ settings, styles, _links ] );\n\n\tconst setConfig = useCallback(\n\t\t/**\n\t\t * Set the global styles config.\n\t\t * @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.\n\t\t * Otherwise, overwrite the current config with the incoming object.\n\t\t * @param {Object} options Options for editEntityRecord Core selector.\n\t\t */\n\t\t( callbackOrObject, options = {} ) => {\n\t\t\tconst record = getEditedEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId\n\t\t\t);\n\n\t\t\tconst currentConfig = {\n\t\t\t\tstyles: record?.styles ?? {},\n\t\t\t\tsettings: record?.settings ?? {},\n\t\t\t\t_links: record?._links ?? {},\n\t\t\t};\n\n\t\t\tconst updatedConfig =\n\t\t\t\ttypeof callbackOrObject === 'function'\n\t\t\t\t\t? callbackOrObject( currentConfig )\n\t\t\t\t\t: callbackOrObject;\n\n\t\t\teditEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId,\n\t\t\t\t{\n\t\t\t\t\tstyles: cleanEmptyObject( updatedConfig.styles ) || {},\n\t\t\t\t\tsettings: cleanEmptyObject( updatedConfig.settings ) || {},\n\t\t\t\t\t_links: cleanEmptyObject( updatedConfig._links ) || {},\n\t\t\t\t},\n\t\t\t\toptions\n\t\t\t);\n\t\t},\n\t\t[ globalStylesId, editEntityRecord, getEditedEntityRecord ]\n\t);\n\n\treturn [ isReady, config, setConfig ];\n}\n\nfunction useGlobalStylesBaseConfig() {\n\tconst baseConfig = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetCurrentThemeBaseGlobalStyles,\n\t\t\tgetCurrentTheme,\n\t\t\tcanUser,\n\t\t} = select( coreStore );\n\t\tconst currentTheme = getCurrentTheme();\n\n\t\treturn currentTheme &&\n\t\t\tcanUser( 'read', 'global-styles/themes', currentTheme.stylesheet )\n\t\t\t? __experimentalGetCurrentThemeBaseGlobalStyles()\n\t\t\t: undefined;\n\t}, [] );\n\n\treturn [ !! baseConfig, baseConfig ];\n}\n\nexport function useGlobalStylesContext() {\n\tconst [ isUserConfigReady, userConfig, setUserConfig ] =\n\t\tuseGlobalStylesUserConfig();\n\tconst [ isBaseConfigReady, baseConfig ] = useGlobalStylesBaseConfig();\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! baseConfig || ! userConfig ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t}, [ userConfig, baseConfig ] );\n\n\tconst context = useMemo( () => {\n\t\treturn {\n\t\t\tisReady: isUserConfigReady && isBaseConfigReady,\n\t\t\tuser: userConfig,\n\t\t\tbase: baseConfig,\n\t\t\tmerged: mergedConfig,\n\t\t\tsetUserConfig,\n\t\t};\n\t}, [\n\t\tmergedConfig,\n\t\tuserConfig,\n\t\tbaseConfig,\n\t\tsetUserConfig,\n\t\tisUserConfigReady,\n\t\tisBaseConfigReady,\n\t] );\n\n\treturn context;\n}\n\nexport function GlobalStylesProvider( { children } ) {\n\tconst context = useGlobalStylesContext();\n\tif ( ! context.isReady ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AAjB3C;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAM;EAAEQ,mBAAmB;EAAEC;AAAiB,CAAC,GAAG,IAAAC,kBAAM,EACvDC,wBACD,CAAC;AAEM,SAASC,uBAAuBA,CAAEC,IAAI,EAAEC,IAAI,EAAG;EACrD,OAAO,IAAAC,kBAAS,EAAEF,IAAI,EAAEC,IAAI,EAAE;IAC7B;AACF;AACA;AACA;AACA;IACEE,iBAAiB,EAAEC,4BAAa;IAChC;AACF;AACA;AACA;AACA;IACEC,WAAW,EA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E/B,MAAM6C,OAAO,GAAG,IAAApB,gBAAO,EAAE,MAAM;IAC9B,OAAO;MACNpB,OAAO,EAAEoC,iBAAiB,IAAIE,iBAAiB;MAC/CjD,IAAI,EAAEO,UAAU;MAChBR,IAAI,EAAEO,UAAU;MAChB8C,MAAM,EAAEF,YAAY;MACpBF;IACD,CAAC;EACF,CAAC,EAAE,CACFE,YAAY,EACZ3C,UAAU,EACVD,UAAU,EACV0C,aAAa,EACbD,iBAAiB,EACjBE,iBAAiB,CAChB,CAAC;EAEH,OAAOE,OAAO;AACf;AAEO,SAASE,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACpD,MAAMH,OAAO,GAAGL,sBAAsB,CAAC,CAAC;EACxC,IAAK,CAAEK,OAAO,CAACxC,OAAO,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAlB,WAAA,CAAA8D,GAAA,EAAC7D,mBAAmB,CAAC8D,QAAQ;IAACC,KAAK,EAAGN,OAAS;IAAAG,QAAA,EAC5CA;EAAQ,CACmB,CAAC;AAEjC","ignoreList":[]}
@@ -164,12 +164,12 @@ function Header({
164
164
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postPreviewButton.default, {
165
165
  className: "editor-header__post-preview-button",
166
166
  forceIsAutosaveable: forceIsDirty
167
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postViewLink.default, {}), !customSaveButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_postPublishButtonOrToggle.default, {
167
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postViewLink.default, {}), (isWideViewport || !showIconLabels) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_interface.PinnedItems.Slot, {
168
+ scope: "core"
169
+ }), !customSaveButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_postPublishButtonOrToggle.default, {
168
170
  forceIsDirty: forceIsDirty,
169
171
  setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
170
- }), customSaveButton, (isWideViewport || !showIconLabels) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_interface.PinnedItems.Slot, {
171
- scope: "core"
172
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_moreMenu.default, {})]
172
+ }), customSaveButton, /*#__PURE__*/(0, _jsxRuntime.jsx)(_moreMenu.default, {})]
173
173
  })]
174
174
  });
175
175
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_compose","_components","_preferences","_element","_interface","_blockEditor","_backButton","_interopRequireWildcard","_collapsibleBlockToolbar","_interopRequireDefault","_documentBar","_documentTools","_moreMenu","_postPreviewButton","_postPublishButtonOrToggle","_postSavedState","_postViewLink","_previewDropdown","_store","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","toolbarVariations","distractionFreeDisabled","y","distractionFreeHover","distractionFreeHidden","visible","hidden","backButtonVariations","x","Header","customSaveButton","forceIsDirty","forceDisableBlockTools","setEntitiesSavedStatesCallback","title","icon","isWideViewport","useViewportMatch","isLargeViewport","isTooNarrowForDocumentBar","useMediaQuery","isTextEditor","isPublishSidebarOpened","showIconLabels","hasFixedToolbar","isNestedEntity","useSelect","select","getPreference","preferencesStore","getEditorMode","getEditorSettings","_isPublishSidebarOpened","editorStore","__unstableGetEditorMode","blockEditorStore","onNavigateToPreviousEntityRecord","isZoomedOutView","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasCenter","hasBackButton","useHasBackButton","jsxs","className","children","jsx","__unstableMotion","div","variants","transition","type","Slot","disableBlockTools","isCollapsed","onToggle","forceIsAutosaveable","disabled","PinnedItems","scope","_default","exports"],"sources":["@wordpress/editor/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMediaQuery, useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport BackButton, { useHasBackButton } from './back-button';\nimport CollapsibleBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';\nimport PostSavedState from '../post-saved-state';\nimport PostViewLink from '../post-view-link';\nimport PreviewDropdown from '../preview-dropdown';\nimport { store as editorStore } from '../../store';\n\nconst toolbarVariations = {\n\tdistractionFreeDisabled: { y: '-50px' },\n\tdistractionFreeHover: { y: 0 },\n\tdistractionFreeHidden: { y: '-50px' },\n\tvisible: { y: 0 },\n\thidden: { y: 0 },\n};\n\nconst backButtonVariations = {\n\tdistractionFreeDisabled: { x: '-100%' },\n\tdistractionFreeHover: { x: 0 },\n\tdistractionFreeHidden: { x: '-100%' },\n\tvisible: { x: 0 },\n\thidden: { x: 0 },\n};\n\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tforceDisableBlockTools,\n\tsetEntitiesSavedStatesCallback,\n\ttitle,\n\ticon,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );\n\tconst {\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\tisNestedEntity,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetEditorSettings,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\tisNestedEntity:\n\t\t\t\t!! getEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisZoomedOutView: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasCenter = isBlockToolsCollapsed && ! isTooNarrowForDocumentBar;\n\tconst hasBackButton = useHasBackButton();\n\n\t// The edit-post-header classname is only kept for backward compatibilty\n\t// as some plugins might be relying on its presence.\n\treturn (\n\t\t<div className=\"editor-header edit-post-header\">\n\t\t\t{ hasBackButton && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__back-button\"\n\t\t\t\t\tvariants={ backButtonVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<BackButton.Slot />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\tclassName=\"editor-header__toolbar\"\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t>\n\t\t\t\t<DocumentTools\n\t\t\t\t\tdisableBlockTools={ forceDisableBlockTools || isTextEditor }\n\t\t\t\t/>\n\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t<CollapsibleBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t\t{ hasCenter && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__center\"\n\t\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<DocumentBar title={ title } icon={ icon } />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\tclassName=\"editor-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\tdisabled={ isNestedEntity }\n\t\t\t\t/>\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ customSaveButton }\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\t\t\t\t<MoreMenu />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;AAGA,IAAAA,KA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AA5E,OAAA,GAEcuB,MAAM","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_compose","_components","_preferences","_element","_interface","_blockEditor","_backButton","_interopRequireWildcard","_collapsibleBlockToolbar","_interopRequireDefault","_documentBar","_documentTools","_moreMenu","_postPreviewButton","_postPublishButtonOrToggle","_postSavedState","_postViewLink","_previewDropdown","_store","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","toolbarVariations","distractionFreeDisabled","y","distractionFreeHover","distractionFreeHidden","visible","hidden","backButtonVariations","x","Header","customSaveButton","forceIsDirty","forceDisableBlockTools","setEntitiesSavedStatesCallback","title","icon","isWideViewport","useViewportMatch","isLargeViewport","isTooNarrowForDocumentBar","useMediaQuery","isTextEditor","isPublishSidebarOpened","showIconLabels","hasFixedToolbar","isNestedEntity","useSelect","select","getPreference","preferencesStore","getEditorMode","getEditorSettings","_isPublishSidebarOpened","editorStore","__unstableGetEditorMode","blockEditorStore","onNavigateToPreviousEntityRecord","isZoomedOutView","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasCenter","hasBackButton","useHasBackButton","jsxs","className","children","jsx","__unstableMotion","div","variants","transition","type","Slot","disableBlockTools","isCollapsed","onToggle","forceIsAutosaveable","disabled","PinnedItems","scope","_default","exports"],"sources":["@wordpress/editor/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMediaQuery, useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport BackButton, { useHasBackButton } from './back-button';\nimport CollapsibleBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';\nimport PostSavedState from '../post-saved-state';\nimport PostViewLink from '../post-view-link';\nimport PreviewDropdown from '../preview-dropdown';\nimport { store as editorStore } from '../../store';\n\nconst toolbarVariations = {\n\tdistractionFreeDisabled: { y: '-50px' },\n\tdistractionFreeHover: { y: 0 },\n\tdistractionFreeHidden: { y: '-50px' },\n\tvisible: { y: 0 },\n\thidden: { y: 0 },\n};\n\nconst backButtonVariations = {\n\tdistractionFreeDisabled: { x: '-100%' },\n\tdistractionFreeHover: { x: 0 },\n\tdistractionFreeHidden: { x: '-100%' },\n\tvisible: { x: 0 },\n\thidden: { x: 0 },\n};\n\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tforceDisableBlockTools,\n\tsetEntitiesSavedStatesCallback,\n\ttitle,\n\ticon,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );\n\tconst {\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\tisNestedEntity,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetEditorSettings,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\tisNestedEntity:\n\t\t\t\t!! getEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisZoomedOutView: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasCenter = isBlockToolsCollapsed && ! isTooNarrowForDocumentBar;\n\tconst hasBackButton = useHasBackButton();\n\n\t// The edit-post-header classname is only kept for backward compatibilty\n\t// as some plugins might be relying on its presence.\n\treturn (\n\t\t<div className=\"editor-header edit-post-header\">\n\t\t\t{ hasBackButton && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__back-button\"\n\t\t\t\t\tvariants={ backButtonVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<BackButton.Slot />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\tclassName=\"editor-header__toolbar\"\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t>\n\t\t\t\t<DocumentTools\n\t\t\t\t\tdisableBlockTools={ forceDisableBlockTools || isTextEditor }\n\t\t\t\t/>\n\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t<CollapsibleBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t\t{ hasCenter && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__center\"\n\t\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<DocumentBar title={ title } icon={ icon } />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\tclassName=\"editor-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\tdisabled={ isNestedEntity }\n\t\t\t\t/>\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ customSaveButton }\n\t\t\t\t<MoreMenu />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAA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CAAG;MAChCP,SAAS,EAAC,yBAAyB;MAAAC,QAAA,GAEjC,CAAEpC,gBAAgB,IAAI,CAAEY,sBAAsB;MAAA;MAC/C;MACA;MACA;MACA;MACA;MACA,IAAA3C,WAAA,CAAAoE,GAAA,EAACxE,eAAA,CAAAW,OAAc;QAACyB,YAAY,EAAGA;MAAc,CAAE,CAC/C,eACD,IAAAhC,WAAA,CAAAoE,GAAA,EAACtE,gBAAA,CAAAS,OAAe;QACfuE,mBAAmB,EAAG9C,YAAc;QACpC+C,QAAQ,EAAGjC;MAAgB,CAC3B,CAAC,eACF,IAAA9C,WAAA,CAAAoE,GAAA,EAAC1E,kBAAA,CAAAa,OAAiB;QACjB2D,SAAS,EAAC,oCAAoC;QAC9CY,mBAAmB,EAAG9C;MAAc,CACpC,CAAC,eACF,IAAAhC,WAAA,CAAAoE,GAAA,EAACvE,aAAA,CAAAU,OAAY,IAAE,CAAC,EACd,CAAE8B,cAAc,IAAI,CAAEO,cAAc,kBACrC,IAAA5C,WAAA,CAAAoE,GAAA,EAACnF,UAAA,CAAA+F,WAAW,CAACN,IAAI;QAACO,KAAK,EAAC;MAAM,CAAE,CAChC,EACC,CAAElD,gBAAgB,iBACnB,IAAA/B,WAAA,CAAAoE,GAAA,EAACzE,0BAAA,CAAAY,OAAyB;QACzByB,YAAY,EAAGA,YAAc;QAC7BE,8BAA8B,EAC7BA;MACA,CACD,CACD,EACCH,gBAAgB,eAClB,IAAA/B,WAAA,CAAAoE,GAAA,EAAC3E,SAAA,CAAAc,OAAQ,IAAE,CAAC;IAAA,CACD,CAAC;EAAA,CACT,CAAC;AAER;AAAC,IAAA2E,QAAA,GAAAC,OAAA,CAAA5E,OAAA,GAEcuB,MAAM","ignoreList":[]}
@@ -27,7 +27,6 @@ const {
27
27
  } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
28
28
  function InserterSidebar() {
29
29
  const {
30
- blockInsertionPoint,
31
30
  blockSectionRootClientId,
32
31
  inserterSidebarToggleRef,
33
32
  insertionPoint,
@@ -40,7 +39,6 @@ function InserterSidebar() {
40
39
  isPublishSidebarOpened
41
40
  } = (0, _lockUnlock.unlock)(select(_store.store));
42
41
  const {
43
- getBlockInsertionPoint,
44
42
  getBlockRootClientId,
45
43
  __unstableGetEditorMode,
46
44
  getSectionRootClientId
@@ -61,7 +59,6 @@ function InserterSidebar() {
61
59
  return getBlockRootClientId();
62
60
  };
63
61
  return {
64
- blockInsertionPoint: getBlockInsertionPoint(),
65
62
  inserterSidebarToggleRef: getInserterSidebarToggleRef(),
66
63
  insertionPoint: getInsertionPoint(),
67
64
  showMostUsedBlocks: get('core', 'mostUsedBlocks'),
@@ -95,8 +92,8 @@ function InserterSidebar() {
95
92
  showMostUsedBlocks: showMostUsedBlocks,
96
93
  showInserterHelpPanel: true,
97
94
  shouldFocusBlock: isMobileViewport,
98
- rootClientId: blockSectionRootClientId !== null && blockSectionRootClientId !== void 0 ? blockSectionRootClientId : blockInsertionPoint.rootClientId,
99
- __experimentalInsertionIndex: blockInsertionPoint.index,
95
+ rootClientId: blockSectionRootClientId !== null && blockSectionRootClientId !== void 0 ? blockSectionRootClientId : insertionPoint.rootClientId,
96
+ __experimentalInsertionIndex: insertionPoint.insertionIndex,
100
97
  onSelect: insertionPoint.onSelect,
101
98
  __experimentalInitialTab: insertionPoint.tab,
102
99
  __experimentalInitialCategory: insertionPoint.category,
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_blockEditor","_compose","_element","_preferences","_keycodes","_interface","_lockUnlock","_store","_jsxRuntime","PrivateInserterLibrary","unlock","blockEditorPrivateApis","InserterSidebar","blockInsertionPoint","blockSectionRootClientId","inserterSidebarToggleRef","insertionPoint","showMostUsedBlocks","sidebarIsOpened","useSelect","select","getInserterSidebarToggleRef","getInsertionPoint","isPublishSidebarOpened","editorStore","getBlockInsertionPoint","getBlockRootClientId","__unstableGetEditorMode","getSectionRootClientId","blockEditorStore","get","preferencesStore","getActiveComplementaryArea","interfaceStore","getBlockSectionRootClientId","sectionRootClientId","setIsInserterOpened","useDispatch","disableComplementaryArea","isMobileViewport","useViewportMatch","libraryRef","useRef","closeInserterSidebar","useCallback","current","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","inserterContents","jsx","className","children","showInserterHelpPanel","shouldFocusBlock","rootClientId","__experimentalInsertionIndex","index","onSelect","__experimentalInitialTab","tab","__experimentalInitialCategory","category","__experimentalFilterValue","filterValue","onPatternCategorySelection","undefined","ref","onClose","onKeyDown"],"sources":["@wordpress/editor/src/components/inserter-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { PrivateInserterLibrary } = unlock( blockEditorPrivateApis );\n\nexport default function InserterSidebar() {\n\tconst {\n\t\tblockInsertionPoint,\n\t\tblockSectionRootClientId,\n\t\tinserterSidebarToggleRef,\n\t\tinsertionPoint,\n\t\tshowMostUsedBlocks,\n\t\tsidebarIsOpened,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetInsertionPoint,\n\t\t\tisPublishSidebarOpened,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst {\n\t\t\tgetBlockInsertionPoint,\n\t\t\tgetBlockRootClientId,\n\t\t\t__unstableGetEditorMode,\n\t\t\tgetSectionRootClientId,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst getBlockSectionRootClientId = () => {\n\t\t\tif ( __unstableGetEditorMode() === 'zoom-out' ) {\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\tif ( sectionRootClientId ) {\n\t\t\t\t\treturn sectionRootClientId;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn getBlockRootClientId();\n\t\t};\n\t\treturn {\n\t\t\tblockInsertionPoint: getBlockInsertionPoint(),\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tinsertionPoint: getInsertionPoint(),\n\t\t\tshowMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),\n\t\t\tblockSectionRootClientId: getBlockSectionRootClientId(),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tgetActiveComplementaryArea( 'core' ) || isPublishSidebarOpened()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\tconst { disableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst libraryRef = useRef();\n\n\t// When closing the inserter, focus should return to the toggle button.\n\tconst closeInserterSidebar = useCallback( () => {\n\t\tsetIsInserterOpened( false );\n\t\tinserterSidebarToggleRef.current?.focus();\n\t}, [ inserterSidebarToggleRef, setIsInserterOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseInserterSidebar();\n\t\t\t}\n\t\t},\n\t\t[ closeInserterSidebar ]\n\t);\n\n\tconst inserterContents = (\n\t\t<div className=\"editor-inserter-sidebar__content\">\n\t\t\t<PrivateInserterLibrary\n\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\tshowInserterHelpPanel\n\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\trootClientId={\n\t\t\t\t\tblockSectionRootClientId ?? blockInsertionPoint.rootClientId\n\t\t\t\t}\n\t\t\t\t__experimentalInsertionIndex={ blockInsertionPoint.index }\n\t\t\t\tonSelect={ insertionPoint.onSelect }\n\t\t\t\t__experimentalInitialTab={ insertionPoint.tab }\n\t\t\t\t__experimentalInitialCategory={ insertionPoint.category }\n\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\tonPatternCategorySelection={\n\t\t\t\t\tsidebarIsOpened\n\t\t\t\t\t\t? () => disableComplementaryArea( 'core' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tref={ libraryRef }\n\t\t\t\tonClose={ closeInserterSidebar }\n\t\t\t/>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div onKeyDown={ closeOnEscape } className=\"editor-inserter-sidebar\">\n\t\t\t{ inserterContents }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAAmD,IAAAS,WAAA,GAAAT,OAAA;AAlBnD;AACA;AACA;;AAYA;AACA;AACA;;AAIA,MAAM;EAAEU;AAAuB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEpD,SAASC,eAAeA,CAAA,EAAG;EACzC,MAAM;IACLC,mBAAmB;IACnBC,wBAAwB;IACxBC,wBAAwB;IACxBC,cAAc;IACdC,kBAAkB;IAClBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5B,MAAM;MACLC,2BAA2B;MAC3BC,iBAAiB;MACjBC;IACD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AAA8C,GAAA;MAAKmB,SAAS,EAAG1B,aAAe;MAACQ,SAAS,EAAC,yBAAyB;MAAAC,QAAA,EACjEH;IAAgB,CACd;EAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_blockEditor","_compose","_element","_preferences","_keycodes","_interface","_lockUnlock","_store","_jsxRuntime","PrivateInserterLibrary","unlock","blockEditorPrivateApis","InserterSidebar","blockSectionRootClientId","inserterSidebarToggleRef","insertionPoint","showMostUsedBlocks","sidebarIsOpened","useSelect","select","getInserterSidebarToggleRef","getInsertionPoint","isPublishSidebarOpened","editorStore","getBlockRootClientId","__unstableGetEditorMode","getSectionRootClientId","blockEditorStore","get","preferencesStore","getActiveComplementaryArea","interfaceStore","getBlockSectionRootClientId","sectionRootClientId","setIsInserterOpened","useDispatch","disableComplementaryArea","isMobileViewport","useViewportMatch","libraryRef","useRef","closeInserterSidebar","useCallback","current","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","inserterContents","jsx","className","children","showInserterHelpPanel","shouldFocusBlock","rootClientId","__experimentalInsertionIndex","insertionIndex","onSelect","__experimentalInitialTab","tab","__experimentalInitialCategory","category","__experimentalFilterValue","filterValue","onPatternCategorySelection","undefined","ref","onClose","onKeyDown"],"sources":["@wordpress/editor/src/components/inserter-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { PrivateInserterLibrary } = unlock( blockEditorPrivateApis );\n\nexport default function InserterSidebar() {\n\tconst {\n\t\tblockSectionRootClientId,\n\t\tinserterSidebarToggleRef,\n\t\tinsertionPoint,\n\t\tshowMostUsedBlocks,\n\t\tsidebarIsOpened,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetInsertionPoint,\n\t\t\tisPublishSidebarOpened,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\t__unstableGetEditorMode,\n\t\t\tgetSectionRootClientId,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst getBlockSectionRootClientId = () => {\n\t\t\tif ( __unstableGetEditorMode() === 'zoom-out' ) {\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\tif ( sectionRootClientId ) {\n\t\t\t\t\treturn sectionRootClientId;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn getBlockRootClientId();\n\t\t};\n\t\treturn {\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tinsertionPoint: getInsertionPoint(),\n\t\t\tshowMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),\n\t\t\tblockSectionRootClientId: getBlockSectionRootClientId(),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tgetActiveComplementaryArea( 'core' ) || isPublishSidebarOpened()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\tconst { disableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst libraryRef = useRef();\n\n\t// When closing the inserter, focus should return to the toggle button.\n\tconst closeInserterSidebar = useCallback( () => {\n\t\tsetIsInserterOpened( false );\n\t\tinserterSidebarToggleRef.current?.focus();\n\t}, [ inserterSidebarToggleRef, setIsInserterOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseInserterSidebar();\n\t\t\t}\n\t\t},\n\t\t[ closeInserterSidebar ]\n\t);\n\n\tconst inserterContents = (\n\t\t<div className=\"editor-inserter-sidebar__content\">\n\t\t\t<PrivateInserterLibrary\n\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\tshowInserterHelpPanel\n\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\trootClientId={\n\t\t\t\t\tblockSectionRootClientId ?? insertionPoint.rootClientId\n\t\t\t\t}\n\t\t\t\t__experimentalInsertionIndex={ insertionPoint.insertionIndex }\n\t\t\t\tonSelect={ insertionPoint.onSelect }\n\t\t\t\t__experimentalInitialTab={ insertionPoint.tab }\n\t\t\t\t__experimentalInitialCategory={ insertionPoint.category }\n\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\tonPatternCategorySelection={\n\t\t\t\t\tsidebarIsOpened\n\t\t\t\t\t\t? () => disableComplementaryArea( 'core' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tref={ libraryRef }\n\t\t\t\tonClose={ closeInserterSidebar }\n\t\t\t/>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div onKeyDown={ closeOnEscape } className=\"editor-inserter-sidebar\">\n\t\t\t{ inserterContents }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA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G9C,cAAc,CAAC+C,GAAK;MAC/CC,6BAA6B,EAAGhD,cAAc,CAACiD,QAAU;MACzDC,yBAAyB,EAAGlD,cAAc,CAACmD,WAAa;MACxDC,0BAA0B,EACzBlD,eAAe,GACZ,MAAMmB,wBAAwB,CAAE,MAAO,CAAC,GACxCgC,SACH;MACDC,GAAG,EAAG9B,UAAY;MAClB+B,OAAO,EAAG7B;IAAsB,CAChC;EAAC,CACE,CACL;EAED;IAAA;IACC;IACA,IAAAjC,WAAA,CAAA4C,GAAA;MAAKmB,SAAS,EAAG1B,aAAe;MAACQ,SAAS,EAAC,yBAAyB;MAAAC,QAAA,EACjEH;IAAgB,CACd;EAAC;AAER","ignoreList":[]}
@@ -3,18 +3,23 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = PostFormatPanel;
6
+ exports.default = MaybeUploadMediaPanel;
7
7
  var _components = require("@wordpress/components");
8
8
  var _data = require("@wordpress/data");
9
9
  var _i18n = require("@wordpress/i18n");
10
10
  var _blockEditor = require("@wordpress/block-editor");
11
11
  var _element = require("@wordpress/element");
12
12
  var _blob = require("@wordpress/blob");
13
+ var _mediaUtil = require("./media-util");
13
14
  var _jsxRuntime = require("react/jsx-runtime");
14
15
  /**
15
16
  * WordPress dependencies
16
17
  */
17
18
 
19
+ /**
20
+ * Internal dependencies
21
+ */
22
+
18
23
  function flattenBlocks(blocks) {
19
24
  const result = [];
20
25
  blocks.forEach(block => {
@@ -23,7 +28,70 @@ function flattenBlocks(blocks) {
23
28
  });
24
29
  return result;
25
30
  }
26
- function Image(block) {
31
+
32
+ /**
33
+ * Determine whether a block has external media.
34
+ *
35
+ * Different blocks use different attribute names (and potentially
36
+ * different logic as well) in determining whether the media is
37
+ * present, and whether it's external.
38
+ *
39
+ * @param {{name: string, attributes: Object}} block The block.
40
+ * @return {boolean?} Whether the block has external media
41
+ */
42
+ function hasExternalMedia(block) {
43
+ if (block.name === 'core/image' || block.name === 'core/cover') {
44
+ return block.attributes.url && !block.attributes.id;
45
+ }
46
+ if (block.name === 'core/media-text') {
47
+ return block.attributes.mediaUrl && !block.attributes.mediaId;
48
+ }
49
+ return undefined;
50
+ }
51
+
52
+ /**
53
+ * Retrieve media info from a block.
54
+ *
55
+ * Different blocks use different attribute names, so we need this
56
+ * function to normalize things into a consistent naming scheme.
57
+ *
58
+ * @param {{name: string, attributes: Object}} block The block.
59
+ * @return {{url: ?string, alt: ?string, id: ?number}} The media info for the block.
60
+ */
61
+ function getMediaInfo(block) {
62
+ if (block.name === 'core/image' || block.name === 'core/cover') {
63
+ const {
64
+ url,
65
+ alt,
66
+ id
67
+ } = block.attributes;
68
+ return {
69
+ url,
70
+ alt,
71
+ id
72
+ };
73
+ }
74
+ if (block.name === 'core/media-text') {
75
+ const {
76
+ mediaUrl: url,
77
+ mediaAlt: alt,
78
+ mediaId: id
79
+ } = block.attributes;
80
+ return {
81
+ url,
82
+ alt,
83
+ id
84
+ };
85
+ }
86
+ return {};
87
+ }
88
+
89
+ // Image component to represent a single image in the upload dialog.
90
+ function Image({
91
+ clientId,
92
+ alt,
93
+ url
94
+ }) {
27
95
  const {
28
96
  selectBlock
29
97
  } = (0, _data.useDispatch)(_blockEditor.store);
@@ -32,16 +100,16 @@ function Image(block) {
32
100
  role: "button",
33
101
  "aria-label": (0, _i18n.__)('Select image block.'),
34
102
  onClick: () => {
35
- selectBlock(block.clientId);
103
+ selectBlock(clientId);
36
104
  },
37
105
  onKeyDown: event => {
38
106
  if (event.key === 'Enter' || event.key === ' ') {
39
- selectBlock(block.clientId);
107
+ selectBlock(clientId);
40
108
  event.preventDefault();
41
109
  }
42
110
  },
43
- alt: block.attributes.alt,
44
- src: block.attributes.url,
111
+ alt: alt,
112
+ src: url,
45
113
  animate: {
46
114
  opacity: 1
47
115
  },
@@ -59,9 +127,9 @@ function Image(block) {
59
127
  whileHover: {
60
128
  scale: 1.08
61
129
  }
62
- }, block.clientId);
130
+ }, clientId);
63
131
  }
64
- function PostFormatPanel() {
132
+ function MaybeUploadMediaPanel() {
65
133
  const [isUploading, setIsUploading] = (0, _element.useState)(false);
66
134
  const [isAnimating, setIsAnimating] = (0, _element.useState)(false);
67
135
  const [hadUploadError, setHadUploadError] = (0, _element.useState)(false);
@@ -72,40 +140,85 @@ function PostFormatPanel() {
72
140
  editorBlocks: select(_blockEditor.store).getBlocks(),
73
141
  mediaUpload: select(_blockEditor.store).getSettings().mediaUpload
74
142
  }), []);
75
- const externalImages = flattenBlocks(editorBlocks).filter(block => block.name === 'core/image' && block.attributes.url && !block.attributes.id);
143
+
144
+ // Get a list of blocks with external media.
145
+ const blocksWithExternalMedia = flattenBlocks(editorBlocks).filter(block => hasExternalMedia(block));
76
146
  const {
77
147
  updateBlockAttributes
78
148
  } = (0, _data.useDispatch)(_blockEditor.store);
79
- if (!mediaUpload || !externalImages.length) {
149
+ if (!mediaUpload || !blocksWithExternalMedia.length) {
80
150
  return null;
81
151
  }
82
152
  const panelBodyTitle = [(0, _i18n.__)('Suggestion:'), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
83
153
  className: "editor-post-publish-panel__link",
84
154
  children: (0, _i18n.__)('External media')
85
155
  }, "label")];
156
+
157
+ /**
158
+ * Update an individual block to point to newly-added library media.
159
+ *
160
+ * Different blocks use different attribute names, so we need this
161
+ * function to ensure we modify the correct attributes for each type.
162
+ *
163
+ * @param {{name: string, attributes: Object}} block The block.
164
+ * @param {{id: number, url: string}} media Media library file info.
165
+ */
166
+ function updateBlockWithUploadedMedia(block, media) {
167
+ if (block.name === 'core/image' || block.name === 'core/cover') {
168
+ updateBlockAttributes(block.clientId, {
169
+ id: media.id,
170
+ url: media.url
171
+ });
172
+ }
173
+ if (block.name === 'core/media-text') {
174
+ updateBlockAttributes(block.clientId, {
175
+ mediaId: media.id,
176
+ mediaUrl: media.url
177
+ });
178
+ }
179
+ }
180
+
181
+ // Handle fetching and uploading all external media in the post.
86
182
  function uploadImages() {
87
183
  setIsUploading(true);
88
184
  setHadUploadError(false);
89
- Promise.all(externalImages.map(image => window.fetch(image.attributes.url.includes('?') ? image.attributes.url : image.attributes.url + '?').then(response => response.blob()).then(blob => new Promise((resolve, reject) => {
90
- mediaUpload({
91
- filesList: [blob],
92
- onFileChange: ([media]) => {
93
- if ((0, _blob.isBlobURL)(media.url)) {
94
- return;
185
+
186
+ // Multiple blocks can be using the same URL, so we
187
+ // should ensure we only fetch and upload each of them once.
188
+ const mediaUrls = new Set(blocksWithExternalMedia.map(block => {
189
+ const {
190
+ url
191
+ } = getMediaInfo(block);
192
+ return url;
193
+ }));
194
+
195
+ // Create an upload promise for each URL, that we can wait for in all
196
+ // blocks that make use of that media.
197
+ const uploadPromises = Object.fromEntries(Object.entries((0, _mediaUtil.fetchMedia)([...mediaUrls])).map(([url, filePromise]) => {
198
+ const uploadPromise = filePromise.then(blob => new Promise((resolve, reject) => {
199
+ mediaUpload({
200
+ filesList: [blob],
201
+ onFileChange: ([media]) => {
202
+ if ((0, _blob.isBlobURL)(media.url)) {
203
+ return;
204
+ }
205
+ resolve(media);
206
+ },
207
+ onError() {
208
+ reject();
95
209
  }
96
- updateBlockAttributes(image.clientId, {
97
- id: media.id,
98
- url: media.url
99
- });
100
- resolve();
101
- },
102
- onError() {
103
- reject();
104
- }
105
- });
106
- }).then(() => setIsAnimating(true))).catch(() => {
107
- setHadUploadError(true);
108
- }))).finally(() => {
210
+ });
211
+ }));
212
+ return [url, uploadPromise];
213
+ }));
214
+
215
+ // Wait for all blocks to be updated with library media.
216
+ Promise.allSettled(blocksWithExternalMedia.map(block => {
217
+ const {
218
+ url
219
+ } = getMediaInfo(block);
220
+ return uploadPromises[url].then(media => updateBlockWithUploadedMedia(block, media)).then(() => setIsAnimating(true)).catch(() => setHadUploadError(true));
221
+ })).finally(() => {
109
222
  setIsUploading(false);
110
223
  });
111
224
  }
@@ -122,10 +235,16 @@ function PostFormatPanel() {
122
235
  },
123
236
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__unstableAnimatePresence, {
124
237
  onExitComplete: () => setIsAnimating(false),
125
- children: externalImages.map(image => {
238
+ children: blocksWithExternalMedia.map(block => {
239
+ const {
240
+ url,
241
+ alt
242
+ } = getMediaInfo(block);
126
243
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Image, {
127
- ...image
128
- }, image.clientId);
244
+ clientId: block.clientId,
245
+ url: url,
246
+ alt: alt
247
+ }, block.clientId);
129
248
  })
130
249
  }), isUploading || isAnimating ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button
131
250
  // TODO: Switch to `true` (40px size) if possible