@wordpress/edit-site 6.0.0 → 6.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 (145) hide show
  1. package/build/components/add-new-page/index.js +2 -1
  2. package/build/components/add-new-page/index.js.map +1 -1
  3. package/build/components/block-editor/inserter-media-categories.js +1 -1
  4. package/build/components/block-editor/inserter-media-categories.js.map +1 -1
  5. package/build/components/editor/index.js +54 -60
  6. package/build/components/editor/index.js.map +1 -1
  7. package/build/components/editor/use-editor-title.js +39 -0
  8. package/build/components/editor/use-editor-title.js.map +1 -0
  9. package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  10. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  11. package/build/components/global-styles/screen-css.js +1 -1
  12. package/build/components/global-styles/screen-css.js.map +1 -1
  13. package/build/components/global-styles/screen-revisions/index.js +4 -23
  14. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  15. package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  16. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  17. package/build/components/global-styles/shadows-edit-panel.js +1 -0
  18. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  19. package/build/components/global-styles/variations/variation.js +11 -16
  20. package/build/components/global-styles/variations/variation.js.map +1 -1
  21. package/build/components/global-styles/variations/variations-color.js +2 -1
  22. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  23. package/build/components/global-styles/variations/variations-typography.js +1 -0
  24. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  25. package/build/components/global-styles-sidebar/index.js +2 -0
  26. package/build/components/global-styles-sidebar/index.js.map +1 -1
  27. package/build/components/layout/index.js +16 -59
  28. package/build/components/layout/index.js.map +1 -1
  29. package/build/components/page-patterns/index.js +5 -5
  30. package/build/components/page-patterns/index.js.map +1 -1
  31. package/build/components/pagination/index.js +17 -8
  32. package/build/components/pagination/index.js.map +1 -1
  33. package/build/components/sidebar-dataviews/dataview-item.js +6 -2
  34. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  35. package/build/components/sidebar-navigation-screen/index.js +1 -1
  36. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  37. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  38. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  39. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  40. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  41. package/build/components/sidebar-navigation-screen-patterns/category-item.js +1 -1
  42. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  43. package/build/components/sidebar-navigation-screen-patterns/index.js +1 -1
  44. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  45. package/build/components/site-hub/index.js +38 -128
  46. package/build/components/site-hub/index.js.map +1 -1
  47. package/build/deprecated.js +11 -0
  48. package/build/deprecated.js.map +1 -1
  49. package/build/hooks/push-changes-to-global-styles/index.js +3 -2
  50. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  51. package/build/lock-unlock.js +1 -1
  52. package/build/lock-unlock.js.map +1 -1
  53. package/build/store/private-actions.js +33 -18
  54. package/build/store/private-actions.js.map +1 -1
  55. package/build-module/components/add-new-page/index.js +2 -1
  56. package/build-module/components/add-new-page/index.js.map +1 -1
  57. package/build-module/components/block-editor/inserter-media-categories.js +1 -1
  58. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
  59. package/build-module/components/editor/index.js +54 -60
  60. package/build-module/components/editor/index.js.map +1 -1
  61. package/build-module/components/editor/use-editor-title.js +31 -0
  62. package/build-module/components/editor/use-editor-title.js.map +1 -0
  63. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  64. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  65. package/build-module/components/global-styles/screen-css.js +1 -1
  66. package/build-module/components/global-styles/screen-css.js.map +1 -1
  67. package/build-module/components/global-styles/screen-revisions/index.js +4 -23
  68. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  69. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  70. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  71. package/build-module/components/global-styles/shadows-edit-panel.js +1 -0
  72. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  73. package/build-module/components/global-styles/variations/variation.js +11 -16
  74. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  75. package/build-module/components/global-styles/variations/variations-color.js +3 -2
  76. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  77. package/build-module/components/global-styles/variations/variations-typography.js +1 -0
  78. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  79. package/build-module/components/global-styles-sidebar/index.js +2 -0
  80. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  81. package/build-module/components/layout/index.js +18 -61
  82. package/build-module/components/layout/index.js.map +1 -1
  83. package/build-module/components/page-patterns/index.js +5 -5
  84. package/build-module/components/page-patterns/index.js.map +1 -1
  85. package/build-module/components/pagination/index.js +17 -8
  86. package/build-module/components/pagination/index.js.map +1 -1
  87. package/build-module/components/sidebar-dataviews/dataview-item.js +6 -2
  88. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  89. package/build-module/components/sidebar-navigation-screen/index.js +1 -1
  90. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  91. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  92. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  93. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  94. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  95. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -2
  96. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  97. package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -1
  98. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  99. package/build-module/components/site-hub/index.js +40 -130
  100. package/build-module/components/site-hub/index.js.map +1 -1
  101. package/build-module/deprecated.js +11 -0
  102. package/build-module/deprecated.js.map +1 -1
  103. package/build-module/hooks/push-changes-to-global-styles/index.js +3 -2
  104. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  105. package/build-module/lock-unlock.js +1 -1
  106. package/build-module/lock-unlock.js.map +1 -1
  107. package/build-module/store/private-actions.js +33 -18
  108. package/build-module/store/private-actions.js.map +1 -1
  109. package/build-style/style-rtl.css +43 -85
  110. package/build-style/style.css +43 -85
  111. package/package.json +41 -41
  112. package/src/components/add-new-page/index.js +2 -1
  113. package/src/components/block-editor/inserter-media-categories.js +1 -3
  114. package/src/components/block-editor/style.scss +11 -0
  115. package/src/components/editor/index.js +69 -96
  116. package/src/components/editor/style.scss +1 -5
  117. package/src/components/editor/use-editor-title.js +35 -0
  118. package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  119. package/src/components/global-styles/screen-css.js +1 -1
  120. package/src/components/global-styles/screen-revisions/index.js +4 -24
  121. package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  122. package/src/components/global-styles/screen-revisions/style.scss +4 -8
  123. package/src/components/global-styles/shadows-edit-panel.js +1 -0
  124. package/src/components/global-styles/variations/variation.js +14 -19
  125. package/src/components/global-styles/variations/variations-color.js +12 -4
  126. package/src/components/global-styles/variations/variations-typography.js +5 -1
  127. package/src/components/global-styles-sidebar/index.js +2 -0
  128. package/src/components/layout/index.js +17 -67
  129. package/src/components/layout/style.scss +18 -58
  130. package/src/components/page-patterns/index.js +15 -12
  131. package/src/components/pagination/index.js +21 -16
  132. package/src/components/sidebar-dataviews/dataview-item.js +6 -2
  133. package/src/components/sidebar-navigation-screen/index.js +1 -1
  134. package/src/components/sidebar-navigation-screen/style.scss +2 -2
  135. package/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  136. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  137. package/src/components/sidebar-navigation-screen-patterns/category-item.js +11 -2
  138. package/src/components/sidebar-navigation-screen-patterns/index.js +5 -1
  139. package/src/components/site-hub/index.js +55 -146
  140. package/src/components/site-hub/style.scss +1 -4
  141. package/src/components/site-icon/style.scss +0 -4
  142. package/src/deprecated.js +14 -0
  143. package/src/hooks/push-changes-to-global-styles/index.js +3 -2
  144. package/src/lock-unlock.js +1 -1
  145. package/src/store/private-actions.js +58 -30
@@ -10,6 +10,7 @@ var _data = require("@wordpress/data");
10
10
  var _element = require("@wordpress/element");
11
11
  var _coreData = require("@wordpress/core-data");
12
12
  var _notices = require("@wordpress/notices");
13
+ var _htmlEntities = require("@wordpress/html-entities");
13
14
  var _jsxRuntime = require("react/jsx-runtime");
14
15
  /**
15
16
  * WordPress dependencies
@@ -45,7 +46,7 @@ function AddNewPageModal({
45
46
  onSave(newPage);
46
47
  createSuccessNotice((0, _i18n.sprintf)(
47
48
  // translators: %s: Title of the created template e.g: "Category".
48
- (0, _i18n.__)('"%s" successfully created.'), newPage.title?.rendered || title), {
49
+ (0, _i18n.__)('"%s" successfully created.'), (0, _htmlEntities.decodeEntities)(newPage.title?.rendered || title)), {
49
50
  type: 'snackbar'
50
51
  });
51
52
  } catch (error) {
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_notices","_jsxRuntime","AddNewPageModal","onSave","onClose","isCreatingPage","setIsCreatingPage","useState","title","setTitle","saveEntityRecord","useDispatch","coreStore","createErrorNotice","createSuccessNotice","noticesStore","createPage","event","preventDefault","newPage","status","slug","__","throwOnError","sprintf","rendered","type","error","errorMessage","message","code","jsx","Modal","onRequestClose","children","onSubmit","jsxs","__experimentalVStack","spacing","TextControl","__next40pxDefaultSize","label","onChange","placeholder","value","__experimentalHStack","justify","Button","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function AddNewPageModal( { onSave, onClose } ) {\n\tconst [ isCreatingPage, setIsCreatingPage ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function createPage( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPage ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPage( true );\n\t\ttry {\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tnewPage.title?.rendered || title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the page.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingPage( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal title={ __( 'Draft a new page' ) } onRequestClose={ onClose }>\n\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Page title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPage }\n\t\t\t\t\t\t\taria-disabled={ isCreatingPage }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create draft' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAA2D,IAAAM,WAAA,GAAAN,OAAA;AAd3D;AACA;AACA;;AAce,SAASO,eA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C;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_notices","_htmlEntities","_jsxRuntime","AddNewPageModal","onSave","onClose","isCreatingPage","setIsCreatingPage","useState","title","setTitle","saveEntityRecord","useDispatch","coreStore","createErrorNotice","createSuccessNotice","noticesStore","createPage","event","preventDefault","newPage","status","slug","__","throwOnError","sprintf","decodeEntities","rendered","type","error","errorMessage","message","code","jsx","Modal","onRequestClose","children","onSubmit","jsxs","__experimentalVStack","spacing","TextControl","__next40pxDefaultSize","label","onChange","placeholder","value","__experimentalHStack","justify","Button","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\n\nexport default function AddNewPageModal( { onSave, onClose } ) {\n\tconst [ isCreatingPage, setIsCreatingPage ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function createPage( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPage ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPage( true );\n\t\ttry {\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newPage.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the page.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingPage( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal title={ __( 'Draft a new page' ) } onRequestClose={ onClose }>\n\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Page title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingP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AA,CAAAqD,oBAAM;UAACP,OAAO,EAAG,CAAG;UAACQ,OAAO,EAAC,KAAK;UAAAZ,QAAA,gBAClC,IAAAlC,WAAA,CAAA+B,GAAA,EAACvC,WAAA,CAAAuD,MAAM;YACNP,qBAAqB;YACrBQ,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAG9C,OAAS;YAAA+B,QAAA,EAEjB,IAAAb,QAAE,EAAE,QAAS;UAAC,CACT,CAAC,eACT,IAAArB,WAAA,CAAA+B,GAAA,EAACvC,WAAA,CAAAuD,MAAM;YACNP,qBAAqB;YACrBQ,OAAO,EAAC,SAAS;YACjBtB,IAAI,EAAC,QAAQ;YACbwB,MAAM,EAAG9C,cAAgB;YACzB,iBAAgBA,cAAgB;YAAA8B,QAAA,EAE9B,IAAAb,QAAE,EAAE,cAAe;UAAC,CACf,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
@@ -151,7 +151,7 @@ const inserterMediaCategories = [{
151
151
  per_page: 'page_size',
152
152
  search: 'q'
153
153
  };
154
- const url = new URL('https://api.openverse.engineering/v1/images/');
154
+ const url = new URL('https://api.openverse.org/v1/images/');
155
155
  Object.entries(finalQuery).forEach(([key, value]) => {
156
156
  const queryKey = mapFromInserterMediaRequest[key] || key;
157
157
  url.searchParams.set(queryKey, value);
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_data","_htmlEntities","_coreData","getExternalLink","url","text","getExternalLinkAttributes","getOpenverseLicense","license","licenseVersion","licenseName","trim","toUpperCase","replace","includes","getOpenverseCaption","item","title","foreign_landing_url","foreignLandingUrl","creator","creator_url","creatorUrl","license_version","license_url","licenseUrl","fullLicense","_creator","decodeEntities","_caption","sprintf","_x","coreMediaFetch","query","mediaItems","resolveSelect","coreStore","getMediaItems","orderBy","search","map","mediaItem","alt","alt_text","source_url","previewUrl","media_details","sizes","medium","caption","raw","inserterMediaCategories","name","labels","__","search_items","mediaType","fetch","media_type","defaultArgs","mature","excluded_source","finalQuery","mapFromInserterMediaRequest","per_page","URL","Object","entries","forEach","key","value","queryKey","searchParams","set","response","window","headers","jsonResponse","json","results","result","toLowerCase","startsWith","slice","sourceId","id","undefined","thumbnail","getReportUrl","isExternalResource","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/block-editor/inserter-media-categories.js"],"sourcesContent":["/**\n * The `edit-site` settings here need to be in sync with the corresponding ones in `site-editor` package.\n * See `packages/edit-site/src/components/block-editor/inserter-media-categories.js`.\n *\n * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.\n * The rest of the settings would still need to be in sync though.\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */\n/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */\n/** @typedef {import('@wordpress/block-editor').InserterMediaCategory} InserterMediaCategory */\n\nconst getExternalLink = ( url, text ) =>\n\t`<a ${ getExternalLinkAttributes( url ) }>${ text }</a>`;\n\nconst getExternalLinkAttributes = ( url ) =>\n\t`href=\"${ url }\" target=\"_blank\" rel=\"noreferrer noopener\"`;\n\nconst getOpenverseLicense = ( license, licenseVersion ) => {\n\tlet licenseName = license.trim();\n\t// PDM has no abbreviation\n\tif ( license !== 'pdm' ) {\n\t\tlicenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );\n\t}\n\t// If version is known, append version to the name.\n\t// The license has to have a version to be valid. Only\n\t// PDM (public domain mark) doesn't have a version.\n\tif ( licenseVersion ) {\n\t\tlicenseName += ` ${ licenseVersion }`;\n\t}\n\t// For licenses other than public-domain marks, prepend 'CC' to the name.\n\tif ( ! [ 'pdm', 'cc0' ].includes( license ) ) {\n\t\tlicenseName = `CC ${ licenseName }`;\n\t}\n\treturn licenseName;\n};\n\nconst getOpenverseCaption = ( item ) => {\n\tconst {\n\t\ttitle,\n\t\tforeign_landing_url: foreignLandingUrl,\n\t\tcreator,\n\t\tcreator_url: creatorUrl,\n\t\tlicense,\n\t\tlicense_version: licenseVersion,\n\t\tlicense_url: licenseUrl,\n\t} = item;\n\tconst fullLicense = getOpenverseLicense( license, licenseVersion );\n\tconst _creator = decodeEntities( creator );\n\tlet _caption;\n\tif ( _creator ) {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\" by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a> by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t} else {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\"/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a>/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t}\n\treturn _caption.replace( /\\s{2}/g, ' ' );\n};\n\nconst coreMediaFetch = async ( query = {} ) => {\n\tconst mediaItems = await resolveSelect( coreStore ).getMediaItems( {\n\t\t...query,\n\t\torderBy: !! query?.search ? 'relevance' : 'date',\n\t} );\n\treturn mediaItems.map( ( mediaItem ) => ( {\n\t\t...mediaItem,\n\t\talt: mediaItem.alt_text,\n\t\turl: mediaItem.source_url,\n\t\tpreviewUrl: mediaItem.media_details?.sizes?.medium?.source_url,\n\t\tcaption: mediaItem.caption?.raw,\n\t} ) );\n};\n\n/** @type {InserterMediaCategory[]} */\nconst inserterMediaCategories = [\n\t{\n\t\tname: 'images',\n\t\tlabels: {\n\t\t\tname: __( 'Images' ),\n\t\t\tsearch_items: __( 'Search images' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'image' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'videos',\n\t\tlabels: {\n\t\t\tname: __( 'Videos' ),\n\t\t\tsearch_items: __( 'Search videos' ),\n\t\t},\n\t\tmediaType: 'video',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'video' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'audio',\n\t\tlabels: {\n\t\t\tname: __( 'Audio' ),\n\t\t\tsearch_items: __( 'Search audio' ),\n\t\t},\n\t\tmediaType: 'audio',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'audio' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'openverse',\n\t\tlabels: {\n\t\t\tname: __( 'Openverse' ),\n\t\t\tsearch_items: __( 'Search Openverse' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\tconst defaultArgs = {\n\t\t\t\tmature: false,\n\t\t\t\texcluded_source: 'flickr,inaturalist,wikimedia',\n\t\t\t\tlicense: 'pdm,cc0',\n\t\t\t};\n\t\t\tconst finalQuery = { ...query, ...defaultArgs };\n\t\t\tconst mapFromInserterMediaRequest = {\n\t\t\t\tper_page: 'page_size',\n\t\t\t\tsearch: 'q',\n\t\t\t};\n\t\t\tconst url = new URL(\n\t\t\t\t'https://api.openverse.engineering/v1/images/'\n\t\t\t);\n\t\t\tObject.entries( finalQuery ).forEach( ( [ key, value ] ) => {\n\t\t\t\tconst queryKey = mapFromInserterMediaRequest[ key ] || key;\n\t\t\t\turl.searchParams.set( queryKey, value );\n\t\t\t} );\n\t\t\tconst response = await window.fetch( url, {\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': 'WordPress/inserter-media-fetch',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst jsonResponse = await response.json();\n\t\t\tconst results = jsonResponse.results;\n\t\t\treturn results.map( ( result ) => ( {\n\t\t\t\t...result,\n\t\t\t\t// This is a temp solution for better titles, until Openverse API\n\t\t\t\t// completes the cleaning up of some titles of their upstream data.\n\t\t\t\ttitle: result.title?.toLowerCase().startsWith( 'file:' )\n\t\t\t\t\t? result.title.slice( 5 )\n\t\t\t\t\t: result.title,\n\t\t\t\tsourceId: result.id,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: getOpenverseCaption( result ),\n\t\t\t\tpreviewUrl: result.thumbnail,\n\t\t\t} ) );\n\t\t},\n\t\tgetReportUrl: ( { sourceId } ) =>\n\t\t\t`https://wordpress.org/openverse/image/${ sourceId }/report/`,\n\t\tisExternalResource: true,\n\t},\n];\n\nexport default inserterMediaCategories;\n"],"mappings":";;;;;;AAWA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAKA,IAAAG,SAAA,GAAAH,OAAA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;;AAEA,MAAMI,eAAe,GAAGA,CAAEC,GAAG,EAAEC,IAAI,KACjC,MAAMC,yBAAyB,CAAEF,GAAI,CAAG,IAAIC,IAAM,MAAK;AAEzD,MAAMC,yBAAyB,GAAKF,GAAG,IACrC,SAASA,GAAK,6CAA4C;AAE5D,MAAMG,mBAAmB,GAAGA,CAAEC,OAAO,EAAEC,cAAc,KAAM;EAC1D,IAAIC,WAAW,GAAGF,OAAO,CAACG,IAAI,CAAC,CAAC;EAChC;EACA,IAAKH,OAAO,KAAK,KAAK,EAAG;IACxBE,WAAW,GAAGF,OAAO,CAACI,WAAW,CAAC,CAAC,CAACC,OAAO,CAAE,UAAU,EAAE,UAAW,CAAC;EACtE;EACA;EACA;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O;IACpB,CAAC,CAAG,CAAC;EACN,CAAC;EACDC,YAAY,EAAEA,CAAE;IAAEJ;EAAS,CAAC,KAC1B,yCAAyCA,QAAU,UAAS;EAC9DK,kBAAkB,EAAE;AACrB,CAAC,CACD;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEazC,uBAAuB","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_data","_htmlEntities","_coreData","getExternalLink","url","text","getExternalLinkAttributes","getOpenverseLicense","license","licenseVersion","licenseName","trim","toUpperCase","replace","includes","getOpenverseCaption","item","title","foreign_landing_url","foreignLandingUrl","creator","creator_url","creatorUrl","license_version","license_url","licenseUrl","fullLicense","_creator","decodeEntities","_caption","sprintf","_x","coreMediaFetch","query","mediaItems","resolveSelect","coreStore","getMediaItems","orderBy","search","map","mediaItem","alt","alt_text","source_url","previewUrl","media_details","sizes","medium","caption","raw","inserterMediaCategories","name","labels","__","search_items","mediaType","fetch","media_type","defaultArgs","mature","excluded_source","finalQuery","mapFromInserterMediaRequest","per_page","URL","Object","entries","forEach","key","value","queryKey","searchParams","set","response","window","headers","jsonResponse","json","results","result","toLowerCase","startsWith","slice","sourceId","id","undefined","thumbnail","getReportUrl","isExternalResource","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/block-editor/inserter-media-categories.js"],"sourcesContent":["/**\n * The `edit-site` settings here need to be in sync with the corresponding ones in `site-editor` package.\n * See `packages/edit-site/src/components/block-editor/inserter-media-categories.js`.\n *\n * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.\n * The rest of the settings would still need to be in sync though.\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */\n/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */\n/** @typedef {import('@wordpress/block-editor').InserterMediaCategory} InserterMediaCategory */\n\nconst getExternalLink = ( url, text ) =>\n\t`<a ${ getExternalLinkAttributes( url ) }>${ text }</a>`;\n\nconst getExternalLinkAttributes = ( url ) =>\n\t`href=\"${ url }\" target=\"_blank\" rel=\"noreferrer noopener\"`;\n\nconst getOpenverseLicense = ( license, licenseVersion ) => {\n\tlet licenseName = license.trim();\n\t// PDM has no abbreviation\n\tif ( license !== 'pdm' ) {\n\t\tlicenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );\n\t}\n\t// If version is known, append version to the name.\n\t// The license has to have a version to be valid. Only\n\t// PDM (public domain mark) doesn't have a version.\n\tif ( licenseVersion ) {\n\t\tlicenseName += ` ${ licenseVersion }`;\n\t}\n\t// For licenses other than public-domain marks, prepend 'CC' to the name.\n\tif ( ! [ 'pdm', 'cc0' ].includes( license ) ) {\n\t\tlicenseName = `CC ${ licenseName }`;\n\t}\n\treturn licenseName;\n};\n\nconst getOpenverseCaption = ( item ) => {\n\tconst {\n\t\ttitle,\n\t\tforeign_landing_url: foreignLandingUrl,\n\t\tcreator,\n\t\tcreator_url: creatorUrl,\n\t\tlicense,\n\t\tlicense_version: licenseVersion,\n\t\tlicense_url: licenseUrl,\n\t} = item;\n\tconst fullLicense = getOpenverseLicense( license, licenseVersion );\n\tconst _creator = decodeEntities( creator );\n\tlet _caption;\n\tif ( _creator ) {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\" by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a> by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t} else {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\"/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a>/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t}\n\treturn _caption.replace( /\\s{2}/g, ' ' );\n};\n\nconst coreMediaFetch = async ( query = {} ) => {\n\tconst mediaItems = await resolveSelect( coreStore ).getMediaItems( {\n\t\t...query,\n\t\torderBy: !! query?.search ? 'relevance' : 'date',\n\t} );\n\treturn mediaItems.map( ( mediaItem ) => ( {\n\t\t...mediaItem,\n\t\talt: mediaItem.alt_text,\n\t\turl: mediaItem.source_url,\n\t\tpreviewUrl: mediaItem.media_details?.sizes?.medium?.source_url,\n\t\tcaption: mediaItem.caption?.raw,\n\t} ) );\n};\n\n/** @type {InserterMediaCategory[]} */\nconst inserterMediaCategories = [\n\t{\n\t\tname: 'images',\n\t\tlabels: {\n\t\t\tname: __( 'Images' ),\n\t\t\tsearch_items: __( 'Search images' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'image' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'videos',\n\t\tlabels: {\n\t\t\tname: __( 'Videos' ),\n\t\t\tsearch_items: __( 'Search videos' ),\n\t\t},\n\t\tmediaType: 'video',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'video' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'audio',\n\t\tlabels: {\n\t\t\tname: __( 'Audio' ),\n\t\t\tsearch_items: __( 'Search audio' ),\n\t\t},\n\t\tmediaType: 'audio',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'audio' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'openverse',\n\t\tlabels: {\n\t\t\tname: __( 'Openverse' ),\n\t\t\tsearch_items: __( 'Search Openverse' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\tconst defaultArgs = {\n\t\t\t\tmature: false,\n\t\t\t\texcluded_source: 'flickr,inaturalist,wikimedia',\n\t\t\t\tlicense: 'pdm,cc0',\n\t\t\t};\n\t\t\tconst finalQuery = { ...query, ...defaultArgs };\n\t\t\tconst mapFromInserterMediaRequest = {\n\t\t\t\tper_page: 'page_size',\n\t\t\t\tsearch: 'q',\n\t\t\t};\n\t\t\tconst url = new URL( 'https://api.openverse.org/v1/images/' );\n\t\t\tObject.entries( finalQuery ).forEach( ( [ key, value ] ) => {\n\t\t\t\tconst queryKey = mapFromInserterMediaRequest[ key ] || key;\n\t\t\t\turl.searchParams.set( queryKey, value );\n\t\t\t} );\n\t\t\tconst response = await window.fetch( url, {\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': 'WordPress/inserter-media-fetch',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst jsonResponse = await response.json();\n\t\t\tconst results = jsonResponse.results;\n\t\t\treturn results.map( ( result ) => ( {\n\t\t\t\t...result,\n\t\t\t\t// This is a temp solution for better titles, until Openverse API\n\t\t\t\t// completes the cleaning up of some titles of their upstream data.\n\t\t\t\ttitle: result.title?.toLowerCase().startsWith( 'file:' )\n\t\t\t\t\t? result.title.slice( 5 )\n\t\t\t\t\t: result.title,\n\t\t\t\tsourceId: result.id,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: getOpenverseCaption( result ),\n\t\t\t\tpreviewUrl: result.thumbnail,\n\t\t\t} ) );\n\t\t},\n\t\tgetReportUrl: ( { sourceId } ) =>\n\t\t\t`https://wordpress.org/openverse/image/${ sourceId }/report/`,\n\t\tisExternalResource: true,\n\t},\n];\n\nexport default inserterMediaCategories;\n"],"mappings":";;;;;;AAWA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAA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wE,OAAO,EAAE;QACR,YAAY,EAAE;MACf;IACD,CAAE,CAAC;IACH,MAAMC,YAAY,GAAG,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC;IAC1C,MAAMC,OAAO,GAAGF,YAAY,CAACE,OAAO;IACpC,OAAOA,OAAO,CAACvC,GAAG,CAAIwC,MAAM,KAAQ;MACnC,GAAGA,MAAM;MACT;MACA;MACA/D,KAAK,EAAE+D,MAAM,CAAC/D,KAAK,EAAEgE,WAAW,CAAC,CAAC,CAACC,UAAU,CAAE,OAAQ,CAAC,GACrDF,MAAM,CAAC/D,KAAK,CAACkE,KAAK,CAAE,CAAE,CAAC,GACvBH,MAAM,CAAC/D,KAAK;MACfmE,QAAQ,EAAEJ,MAAM,CAACK,EAAE;MACnBA,EAAE,EAAEC,SAAS;MACbrC,OAAO,EAAElC,mBAAmB,CAAEiE,MAAO,CAAC;MACtCnC,UAAU,EAAEmC,MAAM,CAACO;IACpB,CAAC,CAAG,CAAC;EACN,CAAC;EACDC,YAAY,EAAEA,CAAE;IAAEJ;EAAS,CAAC,KAC1B,yCAAyCA,QAAU,UAAS;EAC9DK,kBAAkB,EAAE;AACrB,CAAC,CACD;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEazC,uBAAuB","ignoreList":[]}
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = Editor;
7
+ exports.default = EditSiteEditor;
8
8
  var _clsx = _interopRequireDefault(require("clsx"));
9
9
  var _data = require("@wordpress/data");
10
10
  var _components = require("@wordpress/components");
@@ -17,14 +17,12 @@ var _element = require("@wordpress/element");
17
17
  var _notices = require("@wordpress/notices");
18
18
  var _router = require("@wordpress/router");
19
19
  var _preferences = require("@wordpress/preferences");
20
+ var _htmlEntities = require("@wordpress/html-entities");
20
21
  var _welcomeGuide = _interopRequireDefault(require("../welcome-guide"));
21
22
  var _store = require("../../store");
22
23
  var _globalStylesRenderer = require("../global-styles-renderer");
23
- var _useTitle = _interopRequireDefault(require("../routes/use-title"));
24
24
  var _canvasLoader = _interopRequireDefault(require("../canvas-loader"));
25
25
  var _lockUnlock = require("../../lock-unlock");
26
- var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entity-record"));
27
- var _constants = require("../../utils/constants");
28
26
  var _templatePartConverter = _interopRequireDefault(require("../template-part-converter"));
29
27
  var _useSiteEditorSettings = require("../block-editor/use-site-editor-settings");
30
28
  var _pluginTemplateSettingPanel = _interopRequireDefault(require("../plugin-template-setting-panel"));
@@ -33,7 +31,9 @@ var _isPreviewingTheme2 = require("../../utils/is-previewing-theme");
33
31
  var _editorCanvasContainer = require("../editor-canvas-container");
34
32
  var _saveButton = _interopRequireDefault(require("../save-button"));
35
33
  var _moreMenu = _interopRequireDefault(require("../more-menu"));
34
+ var _siteIcon = _interopRequireDefault(require("../site-icon"));
36
35
  var _useEditorIframeProps = _interopRequireDefault(require("../block-editor/use-editor-iframe-props"));
36
+ var _useEditorTitle = _interopRequireDefault(require("./use-editor-title"));
37
37
  var _jsxRuntime = require("react/jsx-runtime");
38
38
  /**
39
39
  * External dependencies
@@ -48,9 +48,8 @@ var _jsxRuntime = require("react/jsx-runtime");
48
48
  */
49
49
 
50
50
  const {
51
- EditorInterface,
52
- ExperimentalEditorProvider: EditorProvider,
53
- Sidebar
51
+ Editor,
52
+ BackButton
54
53
  } = (0, _lockUnlock.unlock)(_editor.privateApis);
55
54
  const {
56
55
  useHistory
@@ -58,20 +57,14 @@ const {
58
57
  const {
59
58
  BlockKeyboardShortcuts
60
59
  } = (0, _lockUnlock.unlock)(_blockLibrary.privateApis);
61
- function Editor({
60
+ function EditSiteEditor({
62
61
  isLoading
63
62
  }) {
64
63
  const {
65
- record: editedPost,
66
- getTitle,
67
- isLoaded: hasLoadedPost
68
- } = (0, _useEditedEntityRecord.default)();
69
- const {
70
- type: editedPostType
71
- } = editedPost;
72
- const {
73
- context,
74
- contextPost,
64
+ editedPostType,
65
+ editedPostId,
66
+ contextPostType,
67
+ contextPostId,
75
68
  editorMode,
76
69
  canvasMode,
77
70
  isEditingPage,
@@ -83,13 +76,14 @@ function Editor({
83
76
  const {
84
77
  getEditedPostContext,
85
78
  getCanvasMode,
86
- isPage
79
+ isPage,
80
+ getEditedPostType,
81
+ getEditedPostId
87
82
  } = (0, _lockUnlock.unlock)(select(_store.store));
88
83
  const {
89
84
  get
90
85
  } = select(_preferences.store);
91
86
  const {
92
- getEntityRecord,
93
87
  getCurrentTheme
94
88
  } = select(_coreData.store);
95
89
  const {
@@ -100,8 +94,10 @@ function Editor({
100
94
  // The currently selected entity to display.
101
95
  // Typically template or template part in the site editor.
102
96
  return {
103
- context: _context,
104
- contextPost: _context?.postId ? getEntityRecord('postType', _context.postType, _context.postId) : undefined,
97
+ editedPostType: getEditedPostType(),
98
+ editedPostId: getEditedPostId(),
99
+ contextPostType: _context?.postId ? _context.postType : undefined,
100
+ contextPostId: _context?.postId ? _context.postId : undefined,
105
101
  editorMode: getEditorMode(),
106
102
  canvasMode: getCanvasMode(),
107
103
  isEditingPage: isPage(),
@@ -111,24 +107,14 @@ function Editor({
111
107
  currentPostIsTrashed: select(_editor.store).getCurrentPostAttribute('status') === 'trash'
112
108
  };
113
109
  }, []);
110
+ (0, _useEditorTitle.default)();
114
111
  const _isPreviewingTheme = (0, _isPreviewingTheme2.isPreviewingTheme)();
115
112
  const hasDefaultEditorCanvasView = !(0, _editorCanvasContainer.useHasEditorCanvasContainer)();
116
113
  const iframeProps = (0, _useEditorIframeProps.default)();
117
114
  const isViewMode = canvasMode === 'view';
118
115
  const isEditMode = canvasMode === 'edit';
119
116
  const showVisualEditor = isViewMode || editorMode === 'visual';
120
- const postWithTemplate = !!context?.postId;
121
- let title;
122
- if (hasLoadedPost) {
123
- var _POST_TYPE_LABELS$edi;
124
- title = (0, _i18n.sprintf)(
125
- // translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).
126
- (0, _i18n.__)('%1$s ‹ %2$s'), getTitle(), (_POST_TYPE_LABELS$edi = _constants.POST_TYPE_LABELS[editedPostType]) !== null && _POST_TYPE_LABELS$edi !== void 0 ? _POST_TYPE_LABELS$edi : _constants.POST_TYPE_LABELS[_constants.TEMPLATE_POST_TYPE]);
127
- }
128
-
129
- // Only announce the title once the editor is ready to prevent "Replace"
130
- // action in <URLQueryController> from double-announcing.
131
- (0, _useTitle.default)(hasLoadedPost && title);
117
+ const postWithTemplate = !!contextPostId;
132
118
  const loadingProgressId = (0, _compose.useInstanceId)(_canvasLoader.default, 'edit-site-editor__loading-progress');
133
119
  const settings = (0, _useSiteEditorSettings.useSpecificEditorSettings)();
134
120
  const styles = (0, _element.useMemo)(() => [...settings.styles, {
@@ -137,6 +123,9 @@ function Editor({
137
123
 
138
124
  css: `body{${canvasMode === 'view' ? `min-height: 100vh; ${currentPostIsTrashed ? '' : 'cursor: pointer;'}` : ''}}}`
139
125
  }], [settings.styles, canvasMode, currentPostIsTrashed]);
126
+ const {
127
+ setCanvasMode
128
+ } = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
140
129
  const {
141
130
  createSuccessNotice
142
131
  } = (0, _data.useDispatch)(_notices.store);
@@ -157,7 +146,7 @@ function Editor({
157
146
  const _title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered;
158
147
  createSuccessNotice((0, _i18n.sprintf)(
159
148
  // translators: %s: Title of the created post e.g: "Post 1".
160
- (0, _i18n.__)('"%s" successfully created.'), _title), {
149
+ (0, _i18n.__)('"%s" successfully created.'), (0, _htmlEntities.decodeEntities)(_title)), {
161
150
  type: 'snackbar',
162
151
  id: 'duplicate-post-action',
163
152
  actions: [{
@@ -175,35 +164,40 @@ function Editor({
175
164
  break;
176
165
  }
177
166
  }, [history, createSuccessNotice]);
178
- const isReady = !isLoading && (postWithTemplate && !!contextPost && !!editedPost || !postWithTemplate && !!editedPost);
167
+ const isReady = !isLoading;
179
168
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
180
169
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_globalStylesRenderer.GlobalStylesRenderer, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.EditorKeyboardShortcutsRegister, {}), isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockKeyboardShortcuts, {}), showVisualEditor && /*#__PURE__*/(0, _jsxRuntime.jsx)(_templatePartConverter.default, {}), !isReady ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_canvasLoader.default, {
181
170
  id: loadingProgressId
182
- }) : null, isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_welcomeGuide.default, {}), hasLoadedPost && !editedPost && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Notice, {
183
- status: "warning",
184
- isDismissible: false,
185
- children: (0, _i18n.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")
186
- }), isReady && /*#__PURE__*/(0, _jsxRuntime.jsxs)(EditorProvider, {
187
- post: postWithTemplate ? contextPost : editedPost,
188
- __unstableTemplate: postWithTemplate ? editedPost : undefined,
171
+ }) : null, isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_welcomeGuide.default, {}), isReady && /*#__PURE__*/(0, _jsxRuntime.jsxs)(Editor, {
172
+ postType: postWithTemplate ? contextPostType : editedPostType,
173
+ postId: postWithTemplate ? contextPostId : editedPostId,
174
+ templateId: postWithTemplate ? editedPostId : undefined,
189
175
  settings: settings,
190
- useSubRegistry: false,
191
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_moreMenu.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(EditorInterface, {
192
- className: (0, _clsx.default)('edit-site-editor__interface-skeleton', {
193
- 'show-icon-labels': showIconLabels
194
- }),
195
- styles: styles,
196
- enableRegionNavigation: false,
197
- customSaveButton: _isPreviewingTheme && /*#__PURE__*/(0, _jsxRuntime.jsx)(_saveButton.default, {
198
- size: "compact"
199
- }),
200
- forceDisableBlockTools: !hasDefaultEditorCanvasView,
201
- title: !hasDefaultEditorCanvasView ? (0, _editorCanvasContainer.getEditorCanvasContainerTitle)(editorCanvasView) : undefined,
202
- iframeProps: iframeProps
203
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Sidebar, {
204
- onActionPerformed: onActionPerformed,
205
- extraPanels: !isEditingPage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_pluginTemplateSettingPanel.default.Slot, {})
206
- }), supportsGlobalStyles && /*#__PURE__*/(0, _jsxRuntime.jsx)(_globalStylesSidebar.default, {})]
176
+ className: (0, _clsx.default)('edit-site-editor__editor-interface', {
177
+ 'show-icon-labels': showIconLabels
178
+ }),
179
+ styles: styles,
180
+ enableRegionNavigation: false,
181
+ customSaveButton: _isPreviewingTheme && /*#__PURE__*/(0, _jsxRuntime.jsx)(_saveButton.default, {
182
+ size: "compact"
183
+ }),
184
+ forceDisableBlockTools: !hasDefaultEditorCanvasView,
185
+ title: !hasDefaultEditorCanvasView ? (0, _editorCanvasContainer.getEditorCanvasContainerTitle)(editorCanvasView) : undefined,
186
+ iframeProps: iframeProps,
187
+ onActionPerformed: onActionPerformed,
188
+ extraSidebarPanels: !isEditingPage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_pluginTemplateSettingPanel.default.Slot, {}),
189
+ children: [isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(BackButton, {
190
+ children: ({
191
+ length
192
+ }) => length <= 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
193
+ label: (0, _i18n.__)('Open Navigation'),
194
+ className: "edit-site-layout__view-mode-toggle",
195
+ onClick: () => setCanvasMode('view'),
196
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_siteIcon.default, {
197
+ className: "edit-site-layout__view-mode-toggle-icon"
198
+ })
199
+ })
200
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_moreMenu.default, {}), supportsGlobalStyles && /*#__PURE__*/(0, _jsxRuntime.jsx)(_globalStylesSidebar.default, {})]
207
201
  })]
208
202
  });
209
203
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_components","_compose","_editor","_i18n","_coreData","_blockLibrary","_element","_notices","_router","_preferences","_welcomeGuide","_store","_globalStylesRenderer","_useTitle","_canvasLoader","_lockUnlock","_useEditedEntityRecord","_constants","_templatePartConverter","_useSiteEditorSettings","_pluginTemplateSettingPanel","_globalStylesSidebar","_isPreviewingTheme2","_editorCanvasContainer","_saveButton","_moreMenu","_useEditorIframeProps","_jsxRuntime","EditorInterface","ExperimentalEditorProvider","EditorProvider","Sidebar","unlock","editorPrivateApis","useHistory","routerPrivateApis","BlockKeyboardShortcuts","blockLibraryPrivateApis","Editor","isLoading","record","editedPost","getTitle","isLoaded","hasLoadedPost","useEditedEntityRecord","type","editedPostType","context","contextPost","editorMode","canvasMode","isEditingPage","supportsGlobalStyles","showIconLabels","editorCanvasView","currentPostIsTrashed","useSelect","select","getEditedPostContext","getCanvasMode","isPage","editSiteStore","get","preferencesStore","getEntityRecord","getCurrentTheme","coreDataStore","getEditorMode","editorStore","_context","postId","postType","undefined","is_block_theme","getEditorCanvasContainerView","getCurrentPostAttribute","_isPreviewingTheme","isPreviewingTheme","hasDefaultEditorCanvasView","useHasEditorCanvasContainer","iframeProps","useEditorIframeProps","isViewMode","isEditMode","showVisualEditor","postWithTemplate","title","_POST_TYPE_LABELS$edi","sprintf","__","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","useTitle","loadingProgressId","useInstanceId","CanvasLoader","settings","useSpecificEditorSettings","styles","useMemo","css","createSuccessNotice","useDispatch","noticesStore","history","onActionPerformed","useCallback","actionId","items","push","newItem","_title","rendered","id","actions","label","onClick","canvas","isReady","jsxs","Fragment","children","jsx","GlobalStylesRenderer","EditorKeyboardShortcutsRegister","default","Notice","status","isDismissible","post","__unstableTemplate","useSubRegistry","className","clsx","enableRegionNavigation","customSaveButton","size","forceDisableBlockTools","getEditorCanvasContainerTitle","extraPanels","Slot"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport useTitle from '../routes/use-title';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport TemplatePartConverter from '../template-part-converter';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport SaveButton from '../save-button';\nimport SiteEditorMoreMenu from '../more-menu';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\n\nconst {\n\tEditorInterface,\n\tExperimentalEditorProvider: EditorProvider,\n\tSidebar,\n} = unlock( editorPrivateApis );\nconst { useHistory } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nexport default function Editor( { isLoading } ) {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\tconst { type: editedPostType } = editedPost;\n\tconst {\n\t\tcontext,\n\t\tcontextPost,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tisEditingPage,\n\t\tsupportsGlobalStyles,\n\t\tshowIconLabels,\n\t\teditorCanvasView,\n\t\tcurrentPostIsTrashed,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostContext, getCanvasMode, isPage } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEntityRecord, getCurrentTheme } = select( coreDataStore );\n\t\tconst { getEditorMode } = select( editorStore );\n\t\tconst _context = getEditedPostContext();\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: _context,\n\t\t\tcontextPost: _context?.postId\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t_context.postType,\n\t\t\t\t\t\t_context.postId\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tisEditingPage: isPage(),\n\t\t\tsupportsGlobalStyles: getCurrentTheme()?.is_block_theme,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\teditorCanvasView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t};\n\t}, [] );\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\tconst iframeProps = useEditorIframeProps();\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst postWithTemplate = !! context?.postId;\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s' ),\n\t\t\tgetTitle(),\n\t\t\tPOST_TYPE_LABELS[ editedPostType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst styles = useMemo(\n\t\t() => [\n\t\t\t...settings.styles,\n\t\t\t{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\n\t\t\t\tcss: `body{${\n\t\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t\t? `min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }`\n\t\t\t\t\t\t: ''\n\t\t\t\t}}}`,\n\t\t\t},\n\t\t],\n\t\t[ settings.styles, canvasMode, currentPostIsTrashed ]\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpostType: items[ 0 ].type,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post e.g: \"Post 1\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\t_title\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: newItem.id,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType: newItem.type,\n\t\t\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ history, createSuccessNotice ]\n\t);\n\n\tconst isReady =\n\t\t! isLoading &&\n\t\t( ( postWithTemplate && !! contextPost && !! editedPost ) ||\n\t\t\t( ! postWithTemplate && !! editedPost ) );\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesRenderer />\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ showVisualEditor && <TemplatePartConverter /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t{ hasLoadedPost && ! editedPost && (\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{ isReady && (\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ postWithTemplate ? contextPost : editedPost }\n\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\tpostWithTemplate ? editedPost : undefined\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<SiteEditorMoreMenu />\n\t\t\t\t\t<EditorInterface\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'edit-site-editor__interface-skeleton',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t\t}\n\t\t\t\t\t\tforceDisableBlockTools={ ! hasDefaultEditorCanvasView }\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\t! hasDefaultEditorCanvasView\n\t\t\t\t\t\t\t\t? getEditorCanvasContainerTitle(\n\t\t\t\t\t\t\t\t\t\teditorCanvasView\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\t/>\n\t\t\t\t\t<Sidebar\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\textraPanels={\n\t\t\t\t\t\t\t! isEditingPage && (\n\t\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t\t\t</EditorProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAX,OAAA;AAKA,IAAAY,aAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,qBAAA,GAAAd,OAAA;AACA,IAAAe,SAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,aAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IAAAiB,WAAA,GAAAjB,OAAA;AACA,IAAAkB,sBAAA,GAAAnB,sBAAA,CAAAC,OAAA;AACA,IAAAmB,UAAA,GAAAnB,OAAA;AACA,IAAAoB,sBAAA,GAAArB,sBAAA,CAAAC,OAAA;AACA,IAAAqB,sBAAA,GAAArB,OAAA;AACA,IAAAsB,2BAAA,G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BACA,CAAC,GACDkB,SACH;QACDQ,WAAW,EAAGA;MAAa,CAC3B,CAAC,eACF,IAAAtD,WAAA,CAAAgG,GAAA,EAAC5F,OAAO;QACP2E,iBAAiB,EAAGA,iBAAmB;QACvCkC,WAAW,EACV,CAAExF,aAAa,iBACd,IAAAzB,WAAA,CAAAgG,GAAA,EAACvG,2BAAA,CAAA0G,OAA0B,CAACe,IAAI,IAAE;MAEnC,CACD,CAAC,EACAxF,oBAAoB,iBAAI,IAAA1B,WAAA,CAAAgG,GAAA,EAACtG,oBAAA,CAAAyG,OAAmB,IAAE,CAAC;IAAA,CAClC,CAChB;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_components","_compose","_editor","_i18n","_coreData","_blockLibrary","_element","_notices","_router","_preferences","_htmlEntities","_welcomeGuide","_store","_globalStylesRenderer","_canvasLoader","_lockUnlock","_templatePartConverter","_useSiteEditorSettings","_pluginTemplateSettingPanel","_globalStylesSidebar","_isPreviewingTheme2","_editorCanvasContainer","_saveButton","_moreMenu","_siteIcon","_useEditorIframeProps","_useEditorTitle","_jsxRuntime","Editor","BackButton","unlock","editorPrivateApis","useHistory","routerPrivateApis","BlockKeyboardShortcuts","blockLibraryPrivateApis","EditSiteEditor","isLoading","editedPostType","editedPostId","contextPostType","contextPostId","editorMode","canvasMode","isEditingPage","supportsGlobalStyles","showIconLabels","editorCanvasView","currentPostIsTrashed","useSelect","select","getEditedPostContext","getCanvasMode","isPage","getEditedPostType","getEditedPostId","editSiteStore","get","preferencesStore","getCurrentTheme","coreDataStore","getEditorMode","editorStore","_context","postId","postType","undefined","is_block_theme","getEditorCanvasContainerView","getCurrentPostAttribute","useEditorTitle","_isPreviewingTheme","isPreviewingTheme","hasDefaultEditorCanvasView","useHasEditorCanvasContainer","iframeProps","useEditorIframeProps","isViewMode","isEditMode","showVisualEditor","postWithTemplate","loadingProgressId","useInstanceId","CanvasLoader","settings","useSpecificEditorSettings","styles","useMemo","css","setCanvasMode","useDispatch","createSuccessNotice","noticesStore","history","onActionPerformed","useCallback","actionId","items","push","type","newItem","_title","title","rendered","sprintf","__","decodeEntities","id","actions","label","onClick","canvas","isReady","jsxs","Fragment","children","jsx","GlobalStylesRenderer","EditorKeyboardShortcutsRegister","default","templateId","className","clsx","enableRegionNavigation","customSaveButton","size","forceDisableBlockTools","getEditorCanvasContainerTitle","extraSidebarPanels","Slot","length","Button"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport TemplatePartConverter from '../template-part-converter';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport SaveButton from '../save-button';\nimport SiteEditorMoreMenu from '../more-menu';\nimport SiteIcon from '../site-icon';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\nimport useEditorTitle from './use-editor-title';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nexport default function EditSiteEditor( { isLoading } ) {\n\tconst {\n\t\teditedPostType,\n\t\teditedPostId,\n\t\tcontextPostType,\n\t\tcontextPostId,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tisEditingPage,\n\t\tsupportsGlobalStyles,\n\t\tshowIconLabels,\n\t\teditorCanvasView,\n\t\tcurrentPostIsTrashed,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostContext,\n\t\t\tgetCanvasMode,\n\t\t\tisPage,\n\t\t\tgetEditedPostType,\n\t\t\tgetEditedPostId,\n\t\t} = unlock( select( editSiteStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getCurrentTheme } = select( coreDataStore );\n\t\tconst { getEditorMode } = select( editorStore );\n\t\tconst _context = getEditedPostContext();\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\teditedPostType: getEditedPostType(),\n\t\t\teditedPostId: getEditedPostId(),\n\t\t\tcontextPostType: _context?.postId ? _context.postType : undefined,\n\t\t\tcontextPostId: _context?.postId ? _context.postId : undefined,\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tisEditingPage: isPage(),\n\t\t\tsupportsGlobalStyles: getCurrentTheme()?.is_block_theme,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\teditorCanvasView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t};\n\t}, [] );\n\tuseEditorTitle();\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst postWithTemplate = !! contextPostId;\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst styles = useMemo(\n\t\t() => [\n\t\t\t...settings.styles,\n\t\t\t{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\n\t\t\t\tcss: `body{${\n\t\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t\t? `min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }`\n\t\t\t\t\t\t: ''\n\t\t\t\t}}}`,\n\t\t\t},\n\t\t],\n\t\t[ settings.styles, canvasMode, currentPostIsTrashed ]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpostType: items[ 0 ].type,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post e.g: \"Post 1\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: newItem.id,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType: newItem.type,\n\t\t\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ history, createSuccessNotice ]\n\t);\n\n\tconst isReady = ! isLoading;\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesRenderer />\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ showVisualEditor && <TemplatePartConverter /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={\n\t\t\t\t\t\tpostWithTemplate ? contextPostType : editedPostType\n\t\t\t\t\t}\n\t\t\t\t\tpostId={ postWithTemplate ? contextPostId : editedPostId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? editedPostId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName={ clsx( 'edit-site-editor__editor-interface', {\n\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t} ) }\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t}\n\t\t\t\t\tforceDisableBlockTools={ ! hasDefaultEditorCanvasView }\n\t\t\t\t\ttitle={\n\t\t\t\t\t\t! hasDefaultEditorCanvasView\n\t\t\t\t\t\t\t? getEditorCanvasContainerTitle( editorCanvasView )\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t! isEditingPage && <PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t<BackButton>\n\t\t\t\t\t\t\t{ ( { length } ) =>\n\t\t\t\t\t\t\t\tlength <= 1 && (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetCanvasMode( 'view' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\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@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _i18n = require("@wordpress/i18n");
9
+ var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entity-record"));
10
+ var _useTitle = _interopRequireDefault(require("../routes/use-title"));
11
+ var _constants = require("../../utils/constants");
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+
20
+ function useEditorTitle() {
21
+ const {
22
+ record: editedPost,
23
+ getTitle,
24
+ isLoaded: hasLoadedPost
25
+ } = (0, _useEditedEntityRecord.default)();
26
+ let title;
27
+ if (hasLoadedPost) {
28
+ var _POST_TYPE_LABELS$edi;
29
+ title = (0, _i18n.sprintf)(
30
+ // translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).
31
+ (0, _i18n.__)('%1$s ‹ %2$s'), getTitle(), (_POST_TYPE_LABELS$edi = _constants.POST_TYPE_LABELS[editedPost.type]) !== null && _POST_TYPE_LABELS$edi !== void 0 ? _POST_TYPE_LABELS$edi : _constants.POST_TYPE_LABELS[_constants.TEMPLATE_POST_TYPE]);
32
+ }
33
+
34
+ // Only announce the title once the editor is ready to prevent "Replace"
35
+ // action in <URLQueryController> from double-announcing.
36
+ (0, _useTitle.default)(hasLoadedPost && title);
37
+ }
38
+ var _default = exports.default = useEditorTitle;
39
+ //# sourceMappingURL=use-editor-title.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_i18n","require","_useEditedEntityRecord","_interopRequireDefault","_useTitle","_constants","useEditorTitle","record","editedPost","getTitle","isLoaded","hasLoadedPost","useEditedEntityRecord","title","_POST_TYPE_LABELS$edi","sprintf","__","POST_TYPE_LABELS","type","TEMPLATE_POST_TYPE","useTitle","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/editor/use-editor-title.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useTitle from '../routes/use-title';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nfunction useEditorTitle() {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s' ),\n\t\t\tgetTitle(),\n\t\t\tPOST_TYPE_LABELS[ editedPost.type ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n}\n\nexport default useEditorTitle;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;AAGA;AACA;AACA;;AAKA,SAASK,cAAcA,CAAA,EAAG;EACzB,MAAM;IACLC,MAAM,EAAEC,UAAU;IAClBC,QAAQ;IACRC,QAAQ,EAAEC;EACX,CAAC,GAAG,IAAAC,8BAAqB,EAAC,CAAC;EAC3B,IAAIC,KAAK;EACT,IAAKF,aAAa,EAAG;IAAA,IAAAG,qBAAA;IACpBD,KAAK,GAAG,IAAAE,aAAO;IACd;IACA,IAAAC,QAAE,EAAE,aAAc,CAAC,EACnBP,QAAQ,CAAC,CAAC,GAAAK,qBAAA,GACVG,2BAAgB,CAAET,UAAU,CAACU,IAAI,CAAE,cAAAJ,qBAAA,cAAAA,qBAAA,GAClCG,2BAAgB,CAAEE,6BAAkB,CACtC,CAAC;EACF;;EAEA;EACA;EACA,IAAAC,iBAAQ,EAAET,aAAa,IAAIE,KAAM,CAAC;AACnC;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcjB,cAAc","ignoreList":[]}
@@ -259,6 +259,7 @@ function ConfirmDeleteDialog({
259
259
  confirmButtonText: (0, _i18n.__)('Delete'),
260
260
  onCancel: handleCancelUninstall,
261
261
  onConfirm: handleConfirmUninstall,
262
+ size: "medium",
262
263
  children: font && (0, _i18n.sprintf)( /* translators: %s: Name of the font. */
263
264
  (0, _i18n.__)('Are you sure you want to delete "%s" font and all its variants and assets?'), font.name)
264
265
  });