@wordpress/edit-site 6.22.0 → 6.23.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 6.23.0 (2025-05-07)
6
+
5
7
  ## 6.22.0 (2025-04-11)
6
8
 
7
9
  ## 6.21.0 (2025-03-27)
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = MoreMenu;
8
- var _data = require("@wordpress/data");
9
- var _coreData = require("@wordpress/core-data");
10
8
  var _editor = require("@wordpress/editor");
11
9
  var _siteExport = _interopRequireDefault(require("./site-export"));
12
10
  var _welcomeGuideMenuItem = _interopRequireDefault(require("./welcome-guide-menu-item"));
@@ -25,12 +23,9 @@ const {
25
23
  PreferencesModal
26
24
  } = (0, _lockUnlock.unlock)(_editor.privateApis);
27
25
  function MoreMenu() {
28
- const isBlockBasedTheme = (0, _data.useSelect)(select => {
29
- return select(_coreData.store).getCurrentTheme().is_block_theme;
30
- }, []);
31
26
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
32
27
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(ToolsMoreMenuGroup, {
33
- children: [isBlockBasedTheme && /*#__PURE__*/(0, _jsxRuntime.jsx)(_siteExport.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_welcomeGuideMenuItem.default, {})]
28
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_siteExport.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_welcomeGuideMenuItem.default, {})]
34
29
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(PreferencesModal, {})]
35
30
  });
36
31
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_editor","_siteExport","_interopRequireDefault","_welcomeGuideMenuItem","_lockUnlock","_jsxRuntime","ToolsMoreMenuGroup","PreferencesModal","unlock","editorPrivateApis","MoreMenu","isBlockBasedTheme","useSelect","select","coreStore","getCurrentTheme","is_block_theme","jsxs","Fragment","children","jsx","default"],"sources":["@wordpress/edit-site/src/components/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport SiteExport from './site-export';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\nimport { unlock } from '../../lock-unlock';\n\nconst { ToolsMoreMenuGroup, PreferencesModal } = unlock( editorPrivateApis );\n\nexport default function MoreMenu() {\n\tconst isBlockBasedTheme = useSelect( ( select ) => {\n\t\treturn select( coreStore ).getCurrentTheme().is_block_theme;\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t{ isBlockBasedTheme && <SiteExport /> }\n\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t</ToolsMoreMenuGroup>\n\t\t\t<PreferencesModal />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AAZ3C;AACA;AACA;;AAKA;AACA;AACA;;AAKA,MAAM;EAAEQ,kBAAkB;EAAEC;AAAiB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE7D,SAASC,QAAQA,CAAA,EAAG;EAClC,MAAMC,iBAAiB,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAClD,OAAOA,MAAM,CAAEC,eAAU,CAAC,CAACC,eAAe,CAAC,CAAC,CAACC,cAAc;EAC5D,CAAC,EAAE,EAAG,CAAC;EAEP,oBACC,IAAAX,WAAA,CAAAY,IAAA,EAAAZ,WAAA,CAAAa,QAAA;IAAAC,QAAA,gBACC,IAAAd,WAAA,CAAAY,IAAA,EAACX,kBAAkB;MAAAa,QAAA,GAChBR,iBAAiB,iBAAI,IAAAN,WAAA,CAAAe,GAAA,EAACnB,WAAA,CAAAoB,OAAU,IAAE,CAAC,eACrC,IAAAhB,WAAA,CAAAe,GAAA,EAACjB,qBAAA,CAAAkB,OAAoB,IAAE,CAAC;IAAA,CACL,CAAC,eACrB,IAAAhB,WAAA,CAAAe,GAAA,EAACb,gBAAgB,IAAE,CAAC;EAAA,CACnB,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_editor","require","_siteExport","_interopRequireDefault","_welcomeGuideMenuItem","_lockUnlock","_jsxRuntime","ToolsMoreMenuGroup","PreferencesModal","unlock","editorPrivateApis","MoreMenu","jsxs","Fragment","children","jsx","default"],"sources":["@wordpress/edit-site/src/components/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport SiteExport from './site-export';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\nimport { unlock } from '../../lock-unlock';\n\nconst { ToolsMoreMenuGroup, PreferencesModal } = unlock( editorPrivateApis );\n\nexport default function MoreMenu() {\n\treturn (\n\t\t<>\n\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t<SiteExport />\n\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t</ToolsMoreMenuGroup>\n\t\t\t<PreferencesModal />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAA2C,IAAAK,WAAA,GAAAL,OAAA;AAV3C;AACA;AACA;;AAGA;AACA;AACA;;AAKA,MAAM;EAAEM,kBAAkB;EAAEC;AAAiB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE7D,SAASC,QAAQA,CAAA,EAAG;EAClC,oBACC,IAAAL,WAAA,CAAAM,IAAA,EAAAN,WAAA,CAAAO,QAAA;IAAAC,QAAA,gBACC,IAAAR,WAAA,CAAAM,IAAA,EAACL,kBAAkB;MAAAO,QAAA,gBAClB,IAAAR,WAAA,CAAAS,GAAA,EAACb,WAAA,CAAAc,OAAU,IAAE,CAAC,eACd,IAAAV,WAAA,CAAAS,GAAA,EAACX,qBAAA,CAAAY,OAAoB,IAAE,CAAC;IAAA,CACL,CAAC,eACrB,IAAAV,WAAA,CAAAS,GAAA,EAACP,gBAAgB,IAAE,CAAC;EAAA,CACnB,CAAC;AAEL","ignoreList":[]}
@@ -11,6 +11,7 @@ var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
11
11
  var _icons = require("@wordpress/icons");
12
12
  var _data = require("@wordpress/data");
13
13
  var _blob = require("@wordpress/blob");
14
+ var _coreData = require("@wordpress/core-data");
14
15
  var _notices = require("@wordpress/notices");
15
16
  var _jsxRuntime = require("react/jsx-runtime");
16
17
  /**
@@ -18,9 +19,17 @@ var _jsxRuntime = require("react/jsx-runtime");
18
19
  */
19
20
 
20
21
  function SiteExport() {
22
+ const canExport = (0, _data.useSelect)(select => {
23
+ var _select$getCurrentThe;
24
+ const targetHints = (_select$getCurrentThe = select(_coreData.store).getCurrentTheme()?._links?.['wp:export-theme']?.[0]?.targetHints) !== null && _select$getCurrentThe !== void 0 ? _select$getCurrentThe : {};
25
+ return !!targetHints.allow?.includes('GET');
26
+ }, []);
21
27
  const {
22
28
  createErrorNotice
23
29
  } = (0, _data.useDispatch)(_notices.store);
30
+ if (!canExport) {
31
+ return null;
32
+ }
24
33
  async function handleExport() {
25
34
  try {
26
35
  const response = await (0, _apiFetch.default)({
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_apiFetch","_interopRequireDefault","_icons","_data","_blob","_notices","_jsxRuntime","SiteExport","createErrorNotice","useDispatch","noticesStore","handleExport","response","apiFetch","path","parse","headers","Accept","blob","contentDisposition","get","contentDispositionMatches","match","fileName","downloadBlob","errorResponse","error","json","e","errorMessage","message","code","__","type","jsx","MenuItem","role","icon","download","onClick","info","children","_x"],"sources":["@wordpress/edit-site/src/components/more-menu/site-export.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport apiFetch from '@wordpress/api-fetch';\nimport { download } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { downloadBlob } from '@wordpress/blob';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function SiteExport() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tasync function handleExport() {\n\t\ttry {\n\t\t\tconst response = await apiFetch( {\n\t\t\t\tpath: '/wp-block-editor/v1/export',\n\t\t\t\tparse: false,\n\t\t\t\theaders: {\n\t\t\t\t\tAccept: 'application/zip',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst blob = await response.blob();\n\t\t\tconst contentDisposition = response.headers.get(\n\t\t\t\t'content-disposition'\n\t\t\t);\n\t\t\tconst contentDispositionMatches =\n\t\t\t\tcontentDisposition.match( /=(.+)\\.zip/ );\n\t\t\tconst fileName = contentDispositionMatches[ 1 ]\n\t\t\t\t? contentDispositionMatches[ 1 ]\n\t\t\t\t: 'edit-site-export';\n\n\t\t\tdownloadBlob( fileName + '.zip', blob, 'application/zip' );\n\t\t} catch ( errorResponse ) {\n\t\t\tlet error = {};\n\t\t\ttry {\n\t\t\t\terror = await errorResponse.json();\n\t\t\t} catch ( e ) {}\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 site export.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\trole=\"menuitem\"\n\t\t\ticon={ download }\n\t\t\tonClick={ handleExport }\n\t\t\tinfo={ __(\n\t\t\t\t'Download your theme with updated templates and styles.'\n\t\t\t) }\n\t\t>\n\t\t\t{ _x( 'Export', 'site exporter menu item' ) }\n\t\t</MenuItem>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAA2D,IAAAQ,WAAA,GAAAR,OAAA;AAT3D;AACA;AACA;;AASe,SAASS,UAAUA,CAAA,EAAG;EACpC,MAAM;IAAEC;EAAkB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,cAAa,CAAC;EAEzD,eAAeC,YAAYA,CAAA,EAAG;IAC7B,IAAI;MACH,MAAMC,QAAQ,GAAG,MAAM,IAAAC,iBAAQ,EAAE;QAChCC,IAAI,EAAE,4BAA4B;QAClCC,KAAK,EAAE,KAAK;QACZC,OAAO,EAAE;UACRC,MAAM,EAAE;QACT;MACD,CAAE,CAAC;MACH,MAAMC,IAAI,GAAG,MAAMN,QAAQ,CAACM,IAAI,CAAC,CAAC;MAClC,MAAMC,kBAAkB,GAAGP,QAAQ,CAACI,OAAO,CAACI,GAAG,CAC9C,qBACD,CAAC;MACD,MAAMC,yBAAyB,GAC9BF,kBAAkB,CAACG,KAAK,CAAE,YAAa,CAAC;MACzC,MAAMC,QAAQ,GAAGF,yBAAyB,CAAE,CAAC,CAAE,GAC5CA,yBAAyB,CAAE,CAAC,CAAE,GAC9B,kBAAkB;MAErB,IAAAG,kBAAY,EAAED,QAAQ,GAAG,MAAM,EAAEL,IAAI,EAAE,iBAAkB,CAAC;IAC3D,CAAC,CAAC,OAAQO,aAAa,EAAG;MACzB,IAAIC,KAAK,GAAG,CAAC,CAAC;MACd,IAAI;QACHA,KAAK,GAAG,MAAMD,aAAa,CAACE,IAAI,CAAC,CAAC;MACnC,CAAC,CAAC,OAAQC,CAAC,EAAG,CAAC;MACf,MAAMC,YAAY,GACjBH,KAAK,CAACI,OAAO,IAAIJ,KAAK,CAACK,IAAI,KAAK,eAAe,GAC5CL,KAAK,CAACI,OAAO,GACb,IAAAE,QAAE,EAAE,mDAAoD,CAAC;MAE7DxB,iBAAiB,CAAEqB,YAAY,EAAE;QAAEI,IAAI,EAAE;MAAW,CAAE,CAAC;IACxD;EACD;EAEA,oBACC,IAAA3B,WAAA,CAAA4B,GAAA,EAACnC,WAAA,CAAAoC,QAAQ;IACRC,IAAI,EAAC,UAAU;IACfC,IAAI,EAAGC,eAAU;IACjBC,OAAO,EAAG5B,YAAc;IACxB6B,IAAI,EAAG,IAAAR,QAAE,EACR,wDACD,CAAG;IAAAS,QAAA,EAED,IAAAC,QAAE,EAAE,QAAQ,EAAE,yBAA0B;EAAC,CAClC,CAAC;AAEb","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_components","_apiFetch","_interopRequireDefault","_icons","_data","_blob","_coreData","_notices","_jsxRuntime","SiteExport","canExport","useSelect","select","_select$getCurrentThe","targetHints","coreStore","getCurrentTheme","_links","allow","includes","createErrorNotice","useDispatch","noticesStore","handleExport","response","apiFetch","path","parse","headers","Accept","blob","contentDisposition","get","contentDispositionMatches","match","fileName","downloadBlob","errorResponse","error","json","e","errorMessage","message","code","__","type","jsx","MenuItem","role","icon","download","onClick","info","children","_x"],"sources":["@wordpress/edit-site/src/components/more-menu/site-export.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport apiFetch from '@wordpress/api-fetch';\nimport { download } from '@wordpress/icons';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { downloadBlob } from '@wordpress/blob';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function SiteExport() {\n\tconst canExport = useSelect( ( select ) => {\n\t\tconst targetHints =\n\t\t\tselect( coreStore ).getCurrentTheme()?._links?.[\n\t\t\t\t'wp:export-theme'\n\t\t\t]?.[ 0 ]?.targetHints ?? {};\n\n\t\treturn !! targetHints.allow?.includes( 'GET' );\n\t}, [] );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tif ( ! canExport ) {\n\t\treturn null;\n\t}\n\n\tasync function handleExport() {\n\t\ttry {\n\t\t\tconst response = await apiFetch( {\n\t\t\t\tpath: '/wp-block-editor/v1/export',\n\t\t\t\tparse: false,\n\t\t\t\theaders: {\n\t\t\t\t\tAccept: 'application/zip',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst blob = await response.blob();\n\t\t\tconst contentDisposition = response.headers.get(\n\t\t\t\t'content-disposition'\n\t\t\t);\n\t\t\tconst contentDispositionMatches =\n\t\t\t\tcontentDisposition.match( /=(.+)\\.zip/ );\n\t\t\tconst fileName = contentDispositionMatches[ 1 ]\n\t\t\t\t? contentDispositionMatches[ 1 ]\n\t\t\t\t: 'edit-site-export';\n\n\t\t\tdownloadBlob( fileName + '.zip', blob, 'application/zip' );\n\t\t} catch ( errorResponse ) {\n\t\t\tlet error = {};\n\t\t\ttry {\n\t\t\t\terror = await errorResponse.json();\n\t\t\t} catch ( e ) {}\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 site export.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\trole=\"menuitem\"\n\t\t\ticon={ download }\n\t\t\tonClick={ handleExport }\n\t\t\tinfo={ __(\n\t\t\t\t'Download your theme with updated templates and styles.'\n\t\t\t) }\n\t\t>\n\t\t\t{ _x( 'Export', 'site exporter menu item' ) }\n\t\t</MenuItem>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAA2D,IAAAS,WAAA,GAAAT,OAAA;AAV3D;AACA;AACA;;AAUe,SAASU,UAAUA,CAAA,EAAG;EACpC,MAAMC,SAAS,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IAC1C,MAAMC,WAAW,IAAAD,qBAAA,GAChBD,MAAM,CAAEG,eAAU,CAAC,CAACC,eAAe,CAAC,CAAC,EAAEC,MAAM,GAC5C,iBAAiB,CACjB,GAAI,CAAC,CAAE,EAAEH,WAAW,cAAAD,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC;IAE5B,OAAO,CAAC,CAAEC,WAAW,CAACI,KAAK,EAAEC,QAAQ,CAAE,KAAM,CAAC;EAC/C,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEC;EAAkB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,cAAa,CAAC;EAEzD,IAAK,CAAEZ,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,eAAea,YAAYA,CAAA,EAAG;IAC7B,IAAI;MACH,MAAMC,QAAQ,GAAG,MAAM,IAAAC,iBAAQ,EAAE;QAChCC,IAAI,EAAE,4BAA4B;QAClCC,KAAK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
- import { useSelect } from '@wordpress/data';
5
- import { store as coreStore } from '@wordpress/core-data';
6
4
  import { privateApis as editorPrivateApis } from '@wordpress/editor';
7
5
 
8
6
  /**
@@ -17,12 +15,9 @@ const {
17
15
  PreferencesModal
18
16
  } = unlock(editorPrivateApis);
19
17
  export default function MoreMenu() {
20
- const isBlockBasedTheme = useSelect(select => {
21
- return select(coreStore).getCurrentTheme().is_block_theme;
22
- }, []);
23
18
  return /*#__PURE__*/_jsxs(_Fragment, {
24
19
  children: [/*#__PURE__*/_jsxs(ToolsMoreMenuGroup, {
25
- children: [isBlockBasedTheme && /*#__PURE__*/_jsx(SiteExport, {}), /*#__PURE__*/_jsx(WelcomeGuideMenuItem, {})]
20
+ children: [/*#__PURE__*/_jsx(SiteExport, {}), /*#__PURE__*/_jsx(WelcomeGuideMenuItem, {})]
26
21
  }), /*#__PURE__*/_jsx(PreferencesModal, {})]
27
22
  });
28
23
  }
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","store","coreStore","privateApis","editorPrivateApis","SiteExport","WelcomeGuideMenuItem","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ToolsMoreMenuGroup","PreferencesModal","MoreMenu","isBlockBasedTheme","select","getCurrentTheme","is_block_theme","children"],"sources":["@wordpress/edit-site/src/components/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport SiteExport from './site-export';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\nimport { unlock } from '../../lock-unlock';\n\nconst { ToolsMoreMenuGroup, PreferencesModal } = unlock( editorPrivateApis );\n\nexport default function MoreMenu() {\n\tconst isBlockBasedTheme = useSelect( ( select ) => {\n\t\treturn select( coreStore ).getCurrentTheme().is_block_theme;\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t{ isBlockBasedTheme && <SiteExport /> }\n\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t</ToolsMoreMenuGroup>\n\t\t\t<PreferencesModal />\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAE3C,MAAM;EAAEC,kBAAkB;EAAEC;AAAiB,CAAC,GAAGR,MAAM,CAAEH,iBAAkB,CAAC;AAE5E,eAAe,SAASY,QAAQA,CAAA,EAAG;EAClC,MAAMC,iBAAiB,GAAGjB,SAAS,CAAIkB,MAAM,IAAM;IAClD,OAAOA,MAAM,CAAEhB,SAAU,CAAC,CAACiB,eAAe,CAAC,CAAC,CAACC,cAAc;EAC5D,CAAC,EAAE,EAAG,CAAC;EAEP,oBACCT,KAAA,CAAAE,SAAA;IAAAQ,QAAA,gBACCV,KAAA,CAACG,kBAAkB;MAAAO,QAAA,GAChBJ,iBAAiB,iBAAIR,IAAA,CAACJ,UAAU,IAAE,CAAC,eACrCI,IAAA,CAACH,oBAAoB,IAAE,CAAC;IAAA,CACL,CAAC,eACrBG,IAAA,CAACM,gBAAgB,IAAE,CAAC;EAAA,CACnB,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["privateApis","editorPrivateApis","SiteExport","WelcomeGuideMenuItem","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ToolsMoreMenuGroup","PreferencesModal","MoreMenu","children"],"sources":["@wordpress/edit-site/src/components/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport SiteExport from './site-export';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\nimport { unlock } from '../../lock-unlock';\n\nconst { ToolsMoreMenuGroup, PreferencesModal } = unlock( editorPrivateApis );\n\nexport default function MoreMenu() {\n\treturn (\n\t\t<>\n\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t<SiteExport />\n\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t</ToolsMoreMenuGroup>\n\t\t\t<PreferencesModal />\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAE3C,MAAM;EAAEC,kBAAkB;EAAEC;AAAiB,CAAC,GAAGR,MAAM,CAAEH,iBAAkB,CAAC;AAE5E,eAAe,SAASY,QAAQA,CAAA,EAAG;EAClC,oBACCL,KAAA,CAAAE,SAAA;IAAAI,QAAA,gBACCN,KAAA,CAACG,kBAAkB;MAAAG,QAAA,gBAClBR,IAAA,CAACJ,UAAU,IAAE,CAAC,eACdI,IAAA,CAACH,oBAAoB,IAAE,CAAC;IAAA,CACL,CAAC,eACrBG,IAAA,CAACM,gBAAgB,IAAE,CAAC;EAAA,CACnB,CAAC;AAEL","ignoreList":[]}
@@ -5,14 +5,23 @@ import { __, _x } from '@wordpress/i18n';
5
5
  import { MenuItem } from '@wordpress/components';
6
6
  import apiFetch from '@wordpress/api-fetch';
7
7
  import { download } from '@wordpress/icons';
8
- import { useDispatch } from '@wordpress/data';
8
+ import { useDispatch, useSelect } from '@wordpress/data';
9
9
  import { downloadBlob } from '@wordpress/blob';
10
+ import { store as coreStore } from '@wordpress/core-data';
10
11
  import { store as noticesStore } from '@wordpress/notices';
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
  export default function SiteExport() {
14
+ const canExport = useSelect(select => {
15
+ var _select$getCurrentThe;
16
+ const targetHints = (_select$getCurrentThe = select(coreStore).getCurrentTheme()?._links?.['wp:export-theme']?.[0]?.targetHints) !== null && _select$getCurrentThe !== void 0 ? _select$getCurrentThe : {};
17
+ return !!targetHints.allow?.includes('GET');
18
+ }, []);
13
19
  const {
14
20
  createErrorNotice
15
21
  } = useDispatch(noticesStore);
22
+ if (!canExport) {
23
+ return null;
24
+ }
16
25
  async function handleExport() {
17
26
  try {
18
27
  const response = await apiFetch({
@@ -1 +1 @@
1
- {"version":3,"names":["__","_x","MenuItem","apiFetch","download","useDispatch","downloadBlob","store","noticesStore","jsx","_jsx","SiteExport","createErrorNotice","handleExport","response","path","parse","headers","Accept","blob","contentDisposition","get","contentDispositionMatches","match","fileName","errorResponse","error","json","e","errorMessage","message","code","type","role","icon","onClick","info","children"],"sources":["@wordpress/edit-site/src/components/more-menu/site-export.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport apiFetch from '@wordpress/api-fetch';\nimport { download } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { downloadBlob } from '@wordpress/blob';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function SiteExport() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tasync function handleExport() {\n\t\ttry {\n\t\t\tconst response = await apiFetch( {\n\t\t\t\tpath: '/wp-block-editor/v1/export',\n\t\t\t\tparse: false,\n\t\t\t\theaders: {\n\t\t\t\t\tAccept: 'application/zip',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst blob = await response.blob();\n\t\t\tconst contentDisposition = response.headers.get(\n\t\t\t\t'content-disposition'\n\t\t\t);\n\t\t\tconst contentDispositionMatches =\n\t\t\t\tcontentDisposition.match( /=(.+)\\.zip/ );\n\t\t\tconst fileName = contentDispositionMatches[ 1 ]\n\t\t\t\t? contentDispositionMatches[ 1 ]\n\t\t\t\t: 'edit-site-export';\n\n\t\t\tdownloadBlob( fileName + '.zip', blob, 'application/zip' );\n\t\t} catch ( errorResponse ) {\n\t\t\tlet error = {};\n\t\t\ttry {\n\t\t\t\terror = await errorResponse.json();\n\t\t\t} catch ( e ) {}\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 site export.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\trole=\"menuitem\"\n\t\t\ticon={ download }\n\t\t\tonClick={ handleExport }\n\t\t\tinfo={ __(\n\t\t\t\t'Download your theme with updated templates and styles.'\n\t\t\t) }\n\t\t>\n\t\t\t{ _x( 'Export', 'site exporter menu item' ) }\n\t\t</MenuItem>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3D,eAAe,SAASC,UAAUA,CAAA,EAAG;EACpC,MAAM;IAAEC;EAAkB,CAAC,GAAGP,WAAW,CAAEG,YAAa,CAAC;EAEzD,eAAeK,YAAYA,CAAA,EAAG;IAC7B,IAAI;MACH,MAAMC,QAAQ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useDispatch","useSelect","downloadBlob","store","coreStore","noticesStore","jsx","_jsx","SiteExport","canExport","select","_select$getCurrentThe","targetHints","getCurrentTheme","_links","allow","includes","createErrorNotice","handleExport","response","path","parse","headers","Accept","blob","contentDisposition","get","contentDispositionMatches","match","fileName","errorResponse","error","json","e","errorMessage","message","code","type","role","icon","onClick","info","children"],"sources":["@wordpress/edit-site/src/components/more-menu/site-export.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport apiFetch from '@wordpress/api-fetch';\nimport { download } from '@wordpress/icons';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { downloadBlob } from '@wordpress/blob';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function SiteExport() {\n\tconst canExport = useSelect( ( select ) => {\n\t\tconst targetHints =\n\t\t\tselect( coreStore ).getCurrentTheme()?._links?.[\n\t\t\t\t'wp:export-theme'\n\t\t\t]?.[ 0 ]?.targetHints ?? {};\n\n\t\treturn !! targetHints.allow?.includes( 'GET' );\n\t}, [] );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tif ( ! canExport ) {\n\t\treturn null;\n\t}\n\n\tasync function handleExport() {\n\t\ttry {\n\t\t\tconst response = await apiFetch( {\n\t\t\t\tpath: '/wp-block-editor/v1/export',\n\t\t\t\tparse: false,\n\t\t\t\theaders: {\n\t\t\t\t\tAccept: 'application/zip',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst blob = await response.blob();\n\t\t\tconst contentDisposition = response.headers.get(\n\t\t\t\t'content-disposition'\n\t\t\t);\n\t\t\tconst contentDispositionMatches =\n\t\t\t\tcontentDisposition.match( /=(.+)\\.zip/ );\n\t\t\tconst fileName = contentDispositionMatches[ 1 ]\n\t\t\t\t? contentDispositionMatches[ 1 ]\n\t\t\t\t: 'edit-site-export';\n\n\t\t\tdownloadBlob( fileName + '.zip', blob, 'application/zip' );\n\t\t} catch ( errorResponse ) {\n\t\t\tlet error = {};\n\t\t\ttry {\n\t\t\t\terror = await errorResponse.json();\n\t\t\t} catch ( e ) {}\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 site export.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\trole=\"menuitem\"\n\t\t\ticon={ download }\n\t\t\tonClick={ handleExport }\n\t\t\tinfo={ __(\n\t\t\t\t'Download your theme with updated templates and styles.'\n\t\t\t) }\n\t\t>\n\t\t\t{ _x( 'Export', 'site exporter menu item' ) }\n\t\t</MenuItem>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,YAAY,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3D,eAAe,SAASC,UAAUA,CAAA,EAAG;EACpC,MAAMC,SAAS,GAAGR,SAAS,CAAIS,MAAM,IAAM;IAAA,IAAAC,qBAAA;IAC1C,MAAMC,WAAW,IAAAD,qBAAA,GAChBD,MAAM,CAAEN,SAAU,CAAC,CAACS,eAAe,CAAC,CAAC,EAAEC,MAAM,GAC5C,iBAAiB,CACjB,GAAI,CAAC,CAAE,EAAEF,WAAW,cAAAD,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC;IAE5B,OAAO,CAAC,CAAEC,WAAW,CAAC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;IACRyC,IAAI,EAAC,UAAU;IACfC,IAAI,EAAGxC,QAAU;IACjByC,OAAO,EAAGtB,YAAc;IACxBuB,IAAI,EAAG9C,EAAE,CACR,wDACD,CAAG;IAAA+C,QAAA,EAED9C,EAAE,CAAE,QAAQ,EAAE,yBAA0B;EAAC,CAClC,CAAC;AAEb","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "6.22.0",
3
+ "version": "6.23.0",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -30,46 +30,46 @@
30
30
  "dependencies": {
31
31
  "@babel/runtime": "7.25.7",
32
32
  "@react-spring/web": "^9.4.5",
33
- "@wordpress/a11y": "^4.22.0",
34
- "@wordpress/api-fetch": "^7.22.0",
35
- "@wordpress/blob": "^4.22.0",
36
- "@wordpress/block-editor": "^14.17.0",
37
- "@wordpress/block-library": "^9.22.0",
38
- "@wordpress/blocks": "^14.11.0",
39
- "@wordpress/commands": "^1.22.0",
40
- "@wordpress/components": "^29.8.0",
41
- "@wordpress/compose": "^7.22.0",
42
- "@wordpress/core-commands": "^1.22.0",
43
- "@wordpress/core-data": "^7.22.0",
44
- "@wordpress/data": "^10.22.0",
45
- "@wordpress/dataviews": "^4.18.0",
46
- "@wordpress/date": "^5.22.0",
47
- "@wordpress/deprecated": "^4.22.0",
48
- "@wordpress/dom": "^4.22.0",
49
- "@wordpress/editor": "^14.22.0",
50
- "@wordpress/element": "^6.22.0",
51
- "@wordpress/escape-html": "^3.22.0",
52
- "@wordpress/fields": "^0.14.0",
53
- "@wordpress/hooks": "^4.22.0",
54
- "@wordpress/html-entities": "^4.22.0",
55
- "@wordpress/i18n": "^5.22.0",
56
- "@wordpress/icons": "^10.22.0",
57
- "@wordpress/keyboard-shortcuts": "^5.22.0",
58
- "@wordpress/keycodes": "^4.22.0",
59
- "@wordpress/media-utils": "^5.22.0",
60
- "@wordpress/notices": "^5.22.0",
61
- "@wordpress/patterns": "^2.22.0",
62
- "@wordpress/plugins": "^7.22.0",
63
- "@wordpress/preferences": "^4.22.0",
64
- "@wordpress/primitives": "^4.22.0",
65
- "@wordpress/private-apis": "^1.22.0",
66
- "@wordpress/reusable-blocks": "^5.22.0",
67
- "@wordpress/router": "^1.22.0",
68
- "@wordpress/style-engine": "^2.22.0",
69
- "@wordpress/url": "^4.22.0",
70
- "@wordpress/viewport": "^6.22.0",
71
- "@wordpress/widgets": "^4.22.0",
72
- "@wordpress/wordcount": "^4.22.0",
33
+ "@wordpress/a11y": "^4.23.0",
34
+ "@wordpress/api-fetch": "^7.23.0",
35
+ "@wordpress/blob": "^4.23.0",
36
+ "@wordpress/block-editor": "^14.18.0",
37
+ "@wordpress/block-library": "^9.23.0",
38
+ "@wordpress/blocks": "^14.12.0",
39
+ "@wordpress/commands": "^1.23.0",
40
+ "@wordpress/components": "^29.9.0",
41
+ "@wordpress/compose": "^7.23.0",
42
+ "@wordpress/core-commands": "^1.23.0",
43
+ "@wordpress/core-data": "^7.23.0",
44
+ "@wordpress/data": "^10.23.0",
45
+ "@wordpress/dataviews": "^4.19.0",
46
+ "@wordpress/date": "^5.23.0",
47
+ "@wordpress/deprecated": "^4.23.0",
48
+ "@wordpress/dom": "^4.23.0",
49
+ "@wordpress/editor": "^14.23.0",
50
+ "@wordpress/element": "^6.23.0",
51
+ "@wordpress/escape-html": "^3.23.0",
52
+ "@wordpress/fields": "^0.15.0",
53
+ "@wordpress/hooks": "^4.23.0",
54
+ "@wordpress/html-entities": "^4.23.0",
55
+ "@wordpress/i18n": "^5.23.0",
56
+ "@wordpress/icons": "^10.23.0",
57
+ "@wordpress/keyboard-shortcuts": "^5.23.0",
58
+ "@wordpress/keycodes": "^4.23.0",
59
+ "@wordpress/media-utils": "^5.23.0",
60
+ "@wordpress/notices": "^5.23.0",
61
+ "@wordpress/patterns": "^2.23.0",
62
+ "@wordpress/plugins": "^7.23.0",
63
+ "@wordpress/preferences": "^4.23.0",
64
+ "@wordpress/primitives": "^4.23.0",
65
+ "@wordpress/private-apis": "^1.23.0",
66
+ "@wordpress/reusable-blocks": "^5.23.0",
67
+ "@wordpress/router": "^1.23.0",
68
+ "@wordpress/style-engine": "^2.23.0",
69
+ "@wordpress/url": "^4.23.0",
70
+ "@wordpress/viewport": "^6.23.0",
71
+ "@wordpress/widgets": "^4.23.0",
72
+ "@wordpress/wordcount": "^4.23.0",
73
73
  "change-case": "^4.1.2",
74
74
  "clsx": "^2.1.1",
75
75
  "colord": "^2.9.2",
@@ -84,5 +84,5 @@
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  },
87
- "gitHead": "01a314d7e46a50101e328fdb11959c441e49372d"
87
+ "gitHead": "ab5c79cd40adbb68898536c50e035b0a734338ea"
88
88
  }
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useSelect } from '@wordpress/data';
5
- import { store as coreStore } from '@wordpress/core-data';
6
4
  import { privateApis as editorPrivateApis } from '@wordpress/editor';
7
5
 
8
6
  /**
@@ -15,14 +13,10 @@ import { unlock } from '../../lock-unlock';
15
13
  const { ToolsMoreMenuGroup, PreferencesModal } = unlock( editorPrivateApis );
16
14
 
17
15
  export default function MoreMenu() {
18
- const isBlockBasedTheme = useSelect( ( select ) => {
19
- return select( coreStore ).getCurrentTheme().is_block_theme;
20
- }, [] );
21
-
22
16
  return (
23
17
  <>
24
18
  <ToolsMoreMenuGroup>
25
- { isBlockBasedTheme && <SiteExport /> }
19
+ <SiteExport />
26
20
  <WelcomeGuideMenuItem />
27
21
  </ToolsMoreMenuGroup>
28
22
  <PreferencesModal />
@@ -5,13 +5,26 @@ import { __, _x } from '@wordpress/i18n';
5
5
  import { MenuItem } from '@wordpress/components';
6
6
  import apiFetch from '@wordpress/api-fetch';
7
7
  import { download } from '@wordpress/icons';
8
- import { useDispatch } from '@wordpress/data';
8
+ import { useDispatch, useSelect } from '@wordpress/data';
9
9
  import { downloadBlob } from '@wordpress/blob';
10
+ import { store as coreStore } from '@wordpress/core-data';
10
11
  import { store as noticesStore } from '@wordpress/notices';
11
12
 
12
13
  export default function SiteExport() {
14
+ const canExport = useSelect( ( select ) => {
15
+ const targetHints =
16
+ select( coreStore ).getCurrentTheme()?._links?.[
17
+ 'wp:export-theme'
18
+ ]?.[ 0 ]?.targetHints ?? {};
19
+
20
+ return !! targetHints.allow?.includes( 'GET' );
21
+ }, [] );
13
22
  const { createErrorNotice } = useDispatch( noticesStore );
14
23
 
24
+ if ( ! canExport ) {
25
+ return null;
26
+ }
27
+
15
28
  async function handleExport() {
16
29
  try {
17
30
  const response = await apiFetch( {