@wordpress/edit-site 3.0.26 → 3.0.29
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/build/components/add-new-template/new-template-part.js +4 -1
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/editor/global-styles-renderer.js +7 -3
- package/build/components/editor/global-styles-renderer.js.map +1 -1
- package/build/components/error-boundary/index.js +11 -27
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/error-boundary/warning.js +70 -0
- package/build/components/error-boundary/warning.js.map +1 -0
- package/build/components/global-styles/screen-background-color.js +8 -9
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +6 -10
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +6 -10
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/header/more-menu/index.js +68 -39
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/{plugins → components/header/more-menu}/site-export.js +0 -0
- package/build/components/header/more-menu/site-export.js.map +1 -0
- package/build/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/header/tools-more-menu-group/index.js +1 -5
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +45 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +56 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/index.js +137 -0
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +65 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +9 -0
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list/added-by.js +51 -50
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/table.js +3 -1
- package/build/components/list/table.js.map +1 -1
- package/build/components/routes/redirect-to-homepage.js +106 -0
- package/build/components/routes/redirect-to-homepage.js.map +1 -0
- package/build/components/template-part-converter/convert-to-template-part.js +4 -1
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/url-query-controller/index.js +1 -38
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/index.js +23 -4
- package/build/index.js.map +1 -1
- package/build/store/actions.js +7 -25
- package/build/store/actions.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +4 -1
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/editor/global-styles-renderer.js +6 -3
- package/build-module/components/editor/global-styles-renderer.js.map +1 -1
- package/build-module/components/error-boundary/index.js +9 -26
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/error-boundary/warning.js +60 -0
- package/build-module/components/error-boundary/warning.js.map +1 -0
- package/build-module/components/global-styles/screen-background-color.js +8 -10
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +7 -11
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +7 -11
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +65 -40
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/{plugins → components/header/more-menu}/site-export.js +0 -0
- package/build-module/components/header/more-menu/site-export.js.map +1 -0
- package/build-module/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/header/tools-more-menu-group/index.js +2 -5
- package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +36 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +44 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js +120 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +9 -0
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list/added-by.js +52 -51
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/table.js +2 -1
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/routes/redirect-to-homepage.js +94 -0
- package/build-module/components/routes/redirect-to-homepage.js.map +1 -0
- package/build-module/components/template-part-converter/convert-to-template-part.js +4 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +3 -40
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/index.js +20 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +7 -23
- package/build-module/store/actions.js.map +1 -1
- package/build-style/style-rtl.css +51 -0
- package/build-style/style.css +51 -0
- package/package.json +13 -13
- package/src/components/add-new-template/new-template-part.js +7 -1
- package/src/components/editor/global-styles-renderer.js +7 -1
- package/src/components/error-boundary/index.js +11 -28
- package/src/components/error-boundary/warning.js +59 -0
- package/src/components/global-styles/screen-background-color.js +6 -9
- package/src/components/global-styles/screen-link-color.js +6 -14
- package/src/components/global-styles/screen-text-color.js +6 -14
- package/src/components/header/more-menu/index.js +103 -44
- package/src/{plugins → components/header/more-menu}/site-export.js +0 -0
- package/src/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
- package/src/components/header/tools-more-menu-group/index.js +2 -7
- package/src/components/keyboard-shortcut-help-modal/config.js +27 -0
- package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
- package/src/components/keyboard-shortcut-help-modal/index.js +135 -0
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +73 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +66 -0
- package/src/components/keyboard-shortcuts/index.js +10 -0
- package/src/components/list/added-by.js +57 -63
- package/src/components/list/table.js +5 -2
- package/src/components/routes/redirect-to-homepage.js +94 -0
- package/src/components/template-part-converter/convert-to-template-part.js +6 -1
- package/src/components/url-query-controller/index.js +3 -35
- package/src/index.js +25 -2
- package/src/store/actions.js +7 -35
- package/src/store/test/actions.js +0 -90
- package/src/style.scss +1 -0
- package/build/plugins/index.js +0 -28
- package/build/plugins/index.js.map +0 -1
- package/build/plugins/site-export.js.map +0 -1
- package/build/plugins/welcome-guide-menu-item.js.map +0 -1
- package/build-module/plugins/index.js +0 -20
- package/build-module/plugins/index.js.map +0 -1
- package/build-module/plugins/site-export.js.map +0 -1
- package/build-module/plugins/welcome-guide-menu-item.js.map +0 -1
- package/src/plugins/index.js +0 -24
|
@@ -50,8 +50,11 @@ export default function NewTemplatePart(_ref) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
try {
|
|
53
|
+
// Currently template parts only allow latin chars.
|
|
54
|
+
// Fallback slug will receive suffix by default.
|
|
55
|
+
const cleanSlug = kebabCase(title).replace(/[^\w-]+/g, '') || 'wp-custom-part';
|
|
53
56
|
const templatePart = await saveEntityRecord('postType', 'wp_template_part', {
|
|
54
|
-
slug:
|
|
57
|
+
slug: cleanSlug,
|
|
55
58
|
title,
|
|
56
59
|
content: '',
|
|
57
60
|
area
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template-part.js"],"names":["kebabCase","useState","useSelect","useDispatch","Button","__","store","noticesStore","coreStore","useHistory","CreateTemplatePartModal","NewTemplatePart","postType","history","isModalOpen","setIsModalOpen","createErrorNotice","saveEntityRecord","getLastEntitySaveError","createTemplatePart","title","area","type","templatePart","slug","content","lastEntitySaveError","id","push","postId","error","errorMessage","message","code","labels","add_new"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AAEA,eAAe,SAASC,eAAT,OAAyC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACvD,QAAMC,OAAO,GAAGJ,UAAU,EAA1B;AACA,QAAM,CAAEK,WAAF,EAAeC,cAAf,IAAkCd,QAAQ,CAAE,KAAF,CAAhD;AACA,QAAM;AAAEe,IAAAA;AAAF,MAAwBb,WAAW,CAAEI,YAAF,CAAzC;AACA,QAAM;AAAEU,IAAAA;AAAF,MAAuBd,WAAW,CAAEK,SAAF,CAAxC;AACA,QAAM;AAAEU,IAAAA;AAAF,MAA6BhB,SAAS,CAAEM,SAAF,CAA5C;;AAEA,iBAAeW,kBAAf,QAAqD;AAAA,QAAlB;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,KAAkB;;AACpD,QAAK,CAAED,KAAP,EAAe;AACdJ,MAAAA,iBAAiB,CAAEX,EAAE,CAAE,uBAAF,CAAJ,EAAiC;AACjDiB,QAAAA,IAAI,EAAE;AAD2C,OAAjC,CAAjB;AAGA;AACA;;AAED,QAAI;AACH,YAAMC,YAAY,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template-part.js"],"names":["kebabCase","useState","useSelect","useDispatch","Button","__","store","noticesStore","coreStore","useHistory","CreateTemplatePartModal","NewTemplatePart","postType","history","isModalOpen","setIsModalOpen","createErrorNotice","saveEntityRecord","getLastEntitySaveError","createTemplatePart","title","area","type","cleanSlug","replace","templatePart","slug","content","lastEntitySaveError","id","push","postId","error","errorMessage","message","code","labels","add_new"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AAEA,eAAe,SAASC,eAAT,OAAyC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACvD,QAAMC,OAAO,GAAGJ,UAAU,EAA1B;AACA,QAAM,CAAEK,WAAF,EAAeC,cAAf,IAAkCd,QAAQ,CAAE,KAAF,CAAhD;AACA,QAAM;AAAEe,IAAAA;AAAF,MAAwBb,WAAW,CAAEI,YAAF,CAAzC;AACA,QAAM;AAAEU,IAAAA;AAAF,MAAuBd,WAAW,CAAEK,SAAF,CAAxC;AACA,QAAM;AAAEU,IAAAA;AAAF,MAA6BhB,SAAS,CAAEM,SAAF,CAA5C;;AAEA,iBAAeW,kBAAf,QAAqD;AAAA,QAAlB;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,KAAkB;;AACpD,QAAK,CAAED,KAAP,EAAe;AACdJ,MAAAA,iBAAiB,CAAEX,EAAE,CAAE,uBAAF,CAAJ,EAAiC;AACjDiB,QAAAA,IAAI,EAAE;AAD2C,OAAjC,CAAjB;AAGA;AACA;;AAED,QAAI;AACH;AACA;AACA,YAAMC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CADlC;AAEC,IAAA,QAAQ,EAAGI;AAFZ,IAVF,CADD;AAkBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useHistory } from '../routes';\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function NewTemplatePart( { postType } ) {\n\tconst history = useHistory();\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { getLastEntitySaveError } = useSelect( coreStore );\n\n\tasync function createTemplatePart( { title, area } ) {\n\t\tif ( ! title ) {\n\t\t\tcreateErrorNotice( __( 'Title is not defined.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Currently template parts only allow latin chars.\n\t\t\t// Fallback slug will receive suffix by default.\n\t\t\tconst cleanSlug =\n\t\t\t\tkebabCase( title ).replace( /[^\\w-]+/g, '' ) ||\n\t\t\t\t'wp-custom-part';\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle,\n\t\t\t\t\tcontent: '',\n\t\t\t\t\tarea,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst lastEntitySaveError = getLastEntitySaveError(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePart.id\n\t\t\t);\n\t\t\tif ( lastEntitySaveError ) {\n\t\t\t\tthrow lastEntitySaveError;\n\t\t\t}\n\n\t\t\tsetIsModalOpen( false );\n\n\t\t\t// Navigate to the created template part editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: templatePart.id,\n\t\t\t\tpostType: templatePart.type,\n\t\t\t} );\n\n\t\t\t// TODO: Add a success notice?\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: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tsetIsModalOpen( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new }\n\t\t\t</Button>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setIsModalOpen( false ) }\n\t\t\t\t\tonCreate={ createTemplatePart }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { filter } from 'lodash';
|
|
1
5
|
/**
|
|
2
6
|
* WordPress dependencies
|
|
3
7
|
*/
|
|
8
|
+
|
|
4
9
|
import { useEffect } from '@wordpress/element';
|
|
5
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
11
|
/**
|
|
@@ -23,14 +28,12 @@ function useGlobalStylesRenderer() {
|
|
|
23
28
|
updateSettings
|
|
24
29
|
} = useDispatch(editSiteStore);
|
|
25
30
|
useEffect(() => {
|
|
26
|
-
var _currentStoreSettings;
|
|
27
|
-
|
|
28
31
|
if (!styles || !settings) {
|
|
29
32
|
return;
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
const currentStoreSettings = getSettings();
|
|
33
|
-
const nonGlobalStyles =
|
|
36
|
+
const nonGlobalStyles = filter(currentStoreSettings.styles, style => !style.isGlobalStyles);
|
|
34
37
|
updateSettings({ ...currentStoreSettings,
|
|
35
38
|
styles: [...nonGlobalStyles, ...styles],
|
|
36
39
|
__experimentalFeatures: settings
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/editor/global-styles-renderer.js"],"names":["useEffect","useSelect","useDispatch","store","editSiteStore","useGlobalStylesOutput","useGlobalStylesRenderer","styles","settings","getSettings","updateSettings","currentStoreSettings","nonGlobalStyles","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/editor/global-styles-renderer.js"],"names":["filter","useEffect","useSelect","useDispatch","store","editSiteStore","useGlobalStylesOutput","useGlobalStylesRenderer","styles","settings","getSettings","updateSettings","currentStoreSettings","nonGlobalStyles","style","isGlobalStyles","__experimentalFeatures","GlobalStylesRenderer"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,QAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA;AACA;AACA;;AACA,SAASC,qBAAT,QAAsC,2CAAtC;;AAEA,SAASC,uBAAT,GAAmC;AAClC,QAAM,CAAEC,MAAF,EAAUC,QAAV,IAAuBH,qBAAqB,EAAlD;AACA,QAAM;AAAEI,IAAAA;AAAF,MAAkBR,SAAS,CAAEG,aAAF,CAAjC;AACA,QAAM;AAAEM,IAAAA;AAAF,MAAqBR,WAAW,CAAEE,aAAF,CAAtC;AAEAJ,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAK,CAAEO,MAAF,IAAY,CAAEC,QAAnB,EAA8B;AAC7B;AACA;;AAED,UAAMG,oBAAoB,GAAGF,WAAW,EAAxC;AACA,UAAMG,eAAe,GAAGb,MAAM,CAC7BY,oBAAoB,CAACJ,MADQ,EAE3BM,KAAF,IAAa,CAAEA,KAAK,CAACC,cAFQ,CAA9B;AAIAJ,IAAAA,cAAc,CAAE,EACf,GAAGC,oBADY;AAEfJ,MAAAA,MAAM,EAAE,CAAE,GAAGK,eAAL,EAAsB,GAAGL,MAAzB,CAFO;AAGfQ,MAAAA,sBAAsB,EAAEP;AAHT,KAAF,CAAd;AAKA,GAfQ,EAeN,CAAED,MAAF,EAAUC,QAAV,CAfM,CAAT;AAgBA;;AAED,OAAO,SAASQ,oBAAT,GAAgC;AACtCV,EAAAA,uBAAuB;AAEvB,SAAO,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { filter } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\n/**\n * Internal dependencies\n */\nimport { useGlobalStylesOutput } from '../global-styles/use-global-styles-output';\n\nfunction useGlobalStylesRenderer() {\n\tconst [ styles, settings ] = useGlobalStylesOutput();\n\tconst { getSettings } = useSelect( editSiteStore );\n\tconst { updateSettings } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( ! styles || ! settings ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentStoreSettings = getSettings();\n\t\tconst nonGlobalStyles = filter(\n\t\t\tcurrentStoreSettings.styles,\n\t\t\t( style ) => ! style.isGlobalStyles\n\t\t);\n\t\tupdateSettings( {\n\t\t\t...currentStoreSettings,\n\t\t\tstyles: [ ...nonGlobalStyles, ...styles ],\n\t\t\t__experimentalFeatures: settings,\n\t\t} );\n\t}, [ styles, settings ] );\n}\n\nexport function GlobalStylesRenderer() {\n\tuseGlobalStylesRenderer();\n\n\treturn null;\n}\n"]}
|
|
@@ -5,22 +5,11 @@ import { createElement } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { Component } from '@wordpress/element';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function CopyButton(_ref) {
|
|
13
|
-
let {
|
|
14
|
-
text,
|
|
15
|
-
children
|
|
16
|
-
} = _ref;
|
|
17
|
-
const ref = useCopyToClipboard(text);
|
|
18
|
-
return createElement(Button, {
|
|
19
|
-
variant: "secondary",
|
|
20
|
-
ref: ref
|
|
21
|
-
}, children);
|
|
22
|
-
}
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
23
11
|
|
|
12
|
+
import ErrorBoundaryWarning from './warning';
|
|
24
13
|
export default class ErrorBoundary extends Component {
|
|
25
14
|
constructor() {
|
|
26
15
|
super(...arguments);
|
|
@@ -49,17 +38,11 @@ export default class ErrorBoundary extends Component {
|
|
|
49
38
|
return this.props.children;
|
|
50
39
|
}
|
|
51
40
|
|
|
52
|
-
return createElement(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
variant: "secondary"
|
|
58
|
-
}, __('Attempt Recovery')), createElement(CopyButton, {
|
|
59
|
-
key: "copy-error",
|
|
60
|
-
text: error.stack
|
|
61
|
-
}, __('Copy Error'))]
|
|
62
|
-
}, __('The editor has encountered an unexpected error.'));
|
|
41
|
+
return createElement(ErrorBoundaryWarning, {
|
|
42
|
+
message: __('The editor has encountered an unexpected error.'),
|
|
43
|
+
error: error,
|
|
44
|
+
reboot: this.reboot
|
|
45
|
+
});
|
|
63
46
|
}
|
|
64
47
|
|
|
65
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/error-boundary/index.js"],"names":["Component","__","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/error-boundary/index.js"],"names":["Component","__","ErrorBoundaryWarning","ErrorBoundary","constructor","arguments","reboot","bind","state","error","getDerivedStateFromError","props","onError","render","children"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,WAAjC;AAEA,eAAe,MAAMC,aAAN,SAA4BH,SAA5B,CAAsC;AACpDI,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AAEA,SAAKC,MAAL,GAAc,KAAKA,MAAL,CAAYC,IAAZ,CAAkB,IAAlB,CAAd;AAEA,SAAKC,KAAL,GAAa;AACZC,MAAAA,KAAK,EAAE;AADK,KAAb;AAGA;;AAE8B,SAAxBC,wBAAwB,CAAED,KAAF,EAAU;AACxC,WAAO;AAAEA,MAAAA;AAAF,KAAP;AACA;;AAEDH,EAAAA,MAAM,GAAG;AACR,SAAKK,KAAL,CAAWC,OAAX;AACA;;AAEDC,EAAAA,MAAM,GAAG;AACR,UAAM;AAAEJ,MAAAA;AAAF,QAAY,KAAKD,KAAvB;;AACA,QAAK,CAAEC,KAAP,EAAe;AACd,aAAO,KAAKE,KAAL,CAAWG,QAAlB;AACA;;AAED,WACC,cAAC,oBAAD;AACC,MAAA,OAAO,EAAGb,EAAE,CACX,iDADW,CADb;AAIC,MAAA,KAAK,EAAGQ,KAJT;AAKC,MAAA,MAAM,EAAG,KAAKH;AALf,MADD;AASA;;AAlCmD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ErrorBoundaryWarning from './warning';\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.reboot = this.reboot.bind( this );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\treboot() {\n\t\tthis.props.onError();\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor has encountered an unexpected error.'\n\t\t\t\t) }\n\t\t\t\terror={ error }\n\t\t\t\treboot={ this.reboot }\n\t\t\t/>\n\t\t);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { Button } from '@wordpress/components';
|
|
8
|
+
import { Warning } from '@wordpress/block-editor';
|
|
9
|
+
import { useCopyToClipboard } from '@wordpress/compose';
|
|
10
|
+
|
|
11
|
+
function CopyButton(_ref) {
|
|
12
|
+
let {
|
|
13
|
+
text,
|
|
14
|
+
children
|
|
15
|
+
} = _ref;
|
|
16
|
+
const ref = useCopyToClipboard(text);
|
|
17
|
+
return createElement(Button, {
|
|
18
|
+
variant: "secondary",
|
|
19
|
+
ref: ref
|
|
20
|
+
}, children);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function ErrorBoundaryWarning(_ref2) {
|
|
24
|
+
let {
|
|
25
|
+
message,
|
|
26
|
+
error,
|
|
27
|
+
reboot,
|
|
28
|
+
dashboardLink
|
|
29
|
+
} = _ref2;
|
|
30
|
+
const actions = [];
|
|
31
|
+
|
|
32
|
+
if (reboot) {
|
|
33
|
+
actions.push(createElement(Button, {
|
|
34
|
+
key: "recovery",
|
|
35
|
+
onClick: reboot,
|
|
36
|
+
variant: "secondary"
|
|
37
|
+
}, __('Attempt Recovery')));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (error) {
|
|
41
|
+
actions.push(createElement(CopyButton, {
|
|
42
|
+
key: "copy-error",
|
|
43
|
+
text: error.stack
|
|
44
|
+
}, __('Copy Error')));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (dashboardLink) {
|
|
48
|
+
actions.push(createElement(Button, {
|
|
49
|
+
key: "back-to-dashboard",
|
|
50
|
+
variant: "secondary",
|
|
51
|
+
href: dashboardLink
|
|
52
|
+
}, __('Back to dashboard')));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return createElement(Warning, {
|
|
56
|
+
className: "editor-error-boundary",
|
|
57
|
+
actions: actions
|
|
58
|
+
}, message);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=warning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/error-boundary/warning.js"],"names":["__","Button","Warning","useCopyToClipboard","CopyButton","text","children","ref","ErrorBoundaryWarning","message","error","reboot","dashboardLink","actions","push","stack"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,OAAT,QAAwB,yBAAxB;AACA,SAASC,kBAAT,QAAmC,oBAAnC;;AAEA,SAASC,UAAT,OAA0C;AAAA,MAArB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAqB;AACzC,QAAMC,GAAG,GAAGJ,kBAAkB,CAAEE,IAAF,CAA9B;AACA,SACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,WAAhB;AAA4B,IAAA,GAAG,EAAGE;AAAlC,KACGD,QADH,CADD;AAKA;;AAED,eAAe,SAASE,oBAAT,QAKX;AAAA,MAL0C;AAC7CC,IAAAA,OAD6C;AAE7CC,IAAAA,KAF6C;AAG7CC,IAAAA,MAH6C;AAI7CC,IAAAA;AAJ6C,GAK1C;AACH,QAAMC,OAAO,GAAG,EAAhB;;AAEA,MAAKF,MAAL,EAAc;AACbE,IAAAA,OAAO,CAACC,IAAR,CACC,cAAC,MAAD;AAAQ,MAAA,GAAG,EAAC,UAAZ;AAAuB,MAAA,OAAO,EAAGH,MAAjC;AAA0C,MAAA,OAAO,EAAC;AAAlD,OACGX,EAAE,CAAE,kBAAF,CADL,CADD;AAKA;;AAED,MAAKU,KAAL,EAAa;AACZG,IAAAA,OAAO,CAACC,IAAR,CACC,cAAC,UAAD;AAAY,MAAA,GAAG,EAAC,YAAhB;AAA6B,MAAA,IAAI,EAAGJ,KAAK,CAACK;AAA1C,OACGf,EAAE,CAAE,YAAF,CADL,CADD;AAKA;;AAED,MAAKY,aAAL,EAAqB;AACpBC,IAAAA,OAAO,CAACC,IAAR,CACC,cAAC,MAAD;AACC,MAAA,GAAG,EAAC,mBADL;AAEC,MAAA,OAAO,EAAC,WAFT;AAGC,MAAA,IAAI,EAAGF;AAHR,OAKGZ,EAAE,CAAE,mBAAF,CALL,CADD;AASA;;AAED,SACC,cAAC,OAAD;AAAS,IAAA,SAAS,EAAC,uBAAnB;AAA2C,IAAA,OAAO,EAAGa;AAArD,KACGJ,OADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default function ErrorBoundaryWarning( {\n\tmessage,\n\terror,\n\treboot,\n\tdashboardLink,\n} ) {\n\tconst actions = [];\n\n\tif ( reboot ) {\n\t\tactions.push(\n\t\t\t<Button key=\"recovery\" onClick={ reboot } variant=\"secondary\">\n\t\t\t\t{ __( 'Attempt Recovery' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\tif ( error ) {\n\t\tactions.push(\n\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t</CopyButton>\n\t\t);\n\t}\n\n\tif ( dashboardLink ) {\n\t\tactions.push(\n\t\t\t<Button\n\t\t\t\tkey=\"back-to-dashboard\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\thref={ dashboardLink }\n\t\t\t>\n\t\t\t\t{ __( 'Back to dashboard' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Warning className=\"editor-error-boundary\" actions={ actions }>\n\t\t\t{ message }\n\t\t</Warning>\n\t);\n}\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* WordPress dependencies
|
|
5
6
|
*/
|
|
6
7
|
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import {
|
|
8
|
+
import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
|
|
8
9
|
/**
|
|
9
10
|
* Internal dependencies
|
|
10
11
|
*/
|
|
@@ -36,7 +37,6 @@ function ScreenBackgroundColor(_ref) {
|
|
|
36
37
|
return null;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
const settings = [];
|
|
40
40
|
let backgroundSettings = {};
|
|
41
41
|
|
|
42
42
|
if (hasBackgroundColor) {
|
|
@@ -63,17 +63,15 @@ function ScreenBackgroundColor(_ref) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
...gradientSettings
|
|
68
|
-
|
|
69
|
-
});
|
|
66
|
+
const controlProps = { ...backgroundSettings,
|
|
67
|
+
...gradientSettings
|
|
68
|
+
};
|
|
70
69
|
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
71
70
|
back: parentMenu + '/colors',
|
|
72
71
|
title: __('Background'),
|
|
73
72
|
description: __('Set a background color or gradient for the whole website.')
|
|
74
|
-
}), createElement(
|
|
75
|
-
|
|
76
|
-
settings: settings,
|
|
73
|
+
}), createElement(ColorGradientControl, _extends({
|
|
74
|
+
className: "edit-site-screen-background-color__control",
|
|
77
75
|
colors: colorsPerOrigin,
|
|
78
76
|
gradients: gradientsPerOrigin,
|
|
79
77
|
disableCustomColors: !areCustomSolidsEnabled,
|
|
@@ -82,7 +80,7 @@ function ScreenBackgroundColor(_ref) {
|
|
|
82
80
|
showTitle: false,
|
|
83
81
|
enableAlpha: true,
|
|
84
82
|
__experimentalIsRenderedInSidebar: true
|
|
85
|
-
}));
|
|
83
|
+
}, controlProps)));
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
export default ScreenBackgroundColor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-background-color.js"],"names":["__","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-background-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","ScreenHeader","getSupportedGlobalStylesPanels","useColorsPerOrigin","useGradientsPerOrigin","useSetting","useStyle","ScreenBackgroundColor","name","parentMenu","undefined","supports","solids","gradients","areCustomSolidsEnabled","areCustomGradientsEnabled","colorsPerOrigin","gradientsPerOrigin","isBackgroundEnabled","hasBackgroundColor","includes","length","hasGradientColor","backgroundColor","setBackgroundColor","userBackgroundColor","gradient","setGradient","userGradient","backgroundSettings","colorValue","onColorChange","clearable","gradientSettings","gradientValue","onGradientChange","controlProps"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,yBAA3E;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,kBAFD,EAGCC,qBAHD,EAICC,UAJD,EAKCC,QALD,QAMO,SANP;;AAQA,SAASC,qBAAT,OAA2C;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAC1C,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAAr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{ __ } from '@wordpress/i18n';\nimport { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseColorsPerOrigin,\n\tuseGradientsPerOrigin,\n\tuseSetting,\n\tuseStyle,\n} from './hooks';\n\nfunction ScreenBackgroundColor( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ gradients ] = useSetting( 'color.gradients', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\tconst [ areCustomGradientsEnabled ] = useSetting(\n\t\t'color.customGradient',\n\t\tname\n\t);\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\tconst gradientsPerOrigin = useGradientsPerOrigin( name );\n\n\tconst [ isBackgroundEnabled ] = useSetting( 'color.background', name );\n\n\tconst hasBackgroundColor =\n\t\tsupports.includes( 'backgroundColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasGradientColor =\n\t\tsupports.includes( 'background' ) &&\n\t\t( gradients.length > 0 || areCustomGradientsEnabled );\n\tconst [ backgroundColor, setBackgroundColor ] = useStyle(\n\t\t'color.background',\n\t\tname\n\t);\n\tconst [ userBackgroundColor ] = useStyle(\n\t\t'color.background',\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ gradient, setGradient ] = useStyle( 'color.gradient', name );\n\tconst [ userGradient ] = useStyle( 'color.gradient', name, 'user' );\n\n\tif ( ! hasBackgroundColor && ! hasGradientColor ) {\n\t\treturn null;\n\t}\n\n\tlet backgroundSettings = {};\n\tif ( hasBackgroundColor ) {\n\t\tbackgroundSettings = {\n\t\t\tcolorValue: backgroundColor,\n\t\t\tonColorChange: setBackgroundColor,\n\t\t};\n\t\tif ( backgroundColor ) {\n\t\t\tbackgroundSettings.clearable =\n\t\t\t\tbackgroundColor === userBackgroundColor;\n\t\t}\n\t}\n\n\tlet gradientSettings = {};\n\tif ( hasGradientColor ) {\n\t\tgradientSettings = {\n\t\t\tgradientValue: gradient,\n\t\t\tonGradientChange: setGradient,\n\t\t};\n\t\tif ( gradient ) {\n\t\t\tgradientSettings.clearable = gradient === userGradient;\n\t\t}\n\t}\n\n\tconst controlProps = {\n\t\t...backgroundSettings,\n\t\t...gradientSettings,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu + '/colors' }\n\t\t\t\ttitle={ __( 'Background' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set a background color or gradient for the whole website.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-background-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tgradients={ gradientsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\tdisableCustomGradients={ ! areCustomGradientsEnabled }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t{ ...controlProps }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenBackgroundColor;\n"]}
|
|
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import {
|
|
7
|
+
import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
@@ -30,25 +30,21 @@ function ScreenLinkColor(_ref) {
|
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const settings = [{
|
|
34
|
-
colorValue: linkColor,
|
|
35
|
-
onColorChange: setLinkColor,
|
|
36
|
-
label: __('Link color'),
|
|
37
|
-
clearable: linkColor === userLinkColor
|
|
38
|
-
}];
|
|
39
33
|
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
40
34
|
back: parentMenu + '/colors',
|
|
41
35
|
title: __('Links'),
|
|
42
36
|
description: __('Set the default color used for links across the site.')
|
|
43
|
-
}), createElement(
|
|
44
|
-
|
|
45
|
-
settings: settings,
|
|
37
|
+
}), createElement(ColorGradientControl, {
|
|
38
|
+
className: "edit-site-screen-link-color__control",
|
|
46
39
|
colors: colorsPerOrigin,
|
|
47
40
|
disableCustomColors: !areCustomSolidsEnabled,
|
|
48
41
|
__experimentalHasMultipleOrigins: true,
|
|
49
42
|
showTitle: false,
|
|
50
43
|
enableAlpha: true,
|
|
51
|
-
__experimentalIsRenderedInSidebar: true
|
|
44
|
+
__experimentalIsRenderedInSidebar: true,
|
|
45
|
+
colorValue: linkColor,
|
|
46
|
+
onColorChange: setLinkColor,
|
|
47
|
+
clearable: linkColor === userLinkColor
|
|
52
48
|
}));
|
|
53
49
|
}
|
|
54
50
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-link-color.js"],"names":["__","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-link-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenLinkColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","colorsPerOrigin","isLinkEnabled","hasLinkColor","includes","length","linkColor","setLinkColor","userLinkColor"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,yBAA3E;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;A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C,MAJjC;AAKC,IAAA,SAAS,EAAG,KALb;AAMC,IAAA,WAAW,MANZ;AAOC,IAAA,iCAAiC,MAPlC;AAQC,IAAA,UAAU,EAAGM,SARd;AASC,IAAA,aAAa,EAAGC,YATjB;AAUC,IAAA,SAAS,EAAGD,SAAS,KAAKE;AAV3B,IARD,CADD;AAuBA;;AAED,eAAed,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseSetting,\n\tuseStyle,\n\tuseColorsPerOrigin,\n} from './hooks';\n\nfunction ScreenLinkColor( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst [ isLinkEnabled ] = useSetting( 'color.link', name );\n\n\tconst hasLinkColor =\n\t\tsupports.includes( 'linkColor' ) &&\n\t\tisLinkEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ linkColor, setLinkColor ] = useStyle(\n\t\t'elements.link.color.text',\n\t\tname\n\t);\n\tconst [ userLinkColor ] = useStyle(\n\t\t'elements.link.color.text',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasLinkColor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu + '/colors' }\n\t\t\t\ttitle={ __( 'Links' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for links across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-link-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\tcolorValue={ linkColor }\n\t\t\t\tonColorChange={ setLinkColor }\n\t\t\t\tclearable={ linkColor === userLinkColor }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenLinkColor;\n"]}
|
|
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import {
|
|
7
|
+
import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
@@ -30,25 +30,21 @@ function ScreenTextColor(_ref) {
|
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const settings = [{
|
|
34
|
-
colorValue: color,
|
|
35
|
-
onColorChange: setColor,
|
|
36
|
-
label: __('Text color'),
|
|
37
|
-
clearable: color === userColor
|
|
38
|
-
}];
|
|
39
33
|
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
40
34
|
back: parentMenu + '/colors',
|
|
41
35
|
title: __('Text'),
|
|
42
36
|
description: __('Set the default color used for text across the site.')
|
|
43
|
-
}), createElement(
|
|
44
|
-
|
|
45
|
-
settings: settings,
|
|
37
|
+
}), createElement(ColorGradientControl, {
|
|
38
|
+
className: "edit-site-screen-text-color__control",
|
|
46
39
|
colors: colorsPerOrigin,
|
|
47
40
|
disableCustomColors: !areCustomSolidsEnabled,
|
|
48
41
|
__experimentalHasMultipleOrigins: true,
|
|
49
42
|
showTitle: false,
|
|
50
43
|
enableAlpha: true,
|
|
51
|
-
__experimentalIsRenderedInSidebar: true
|
|
44
|
+
__experimentalIsRenderedInSidebar: true,
|
|
45
|
+
colorValue: color,
|
|
46
|
+
onColorChange: setColor,
|
|
47
|
+
clearable: color === userColor
|
|
52
48
|
}));
|
|
53
49
|
}
|
|
54
50
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-text-color.js"],"names":["__","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-text-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenTextColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","isTextEnabled","colorsPerOrigin","hasTextColor","includes","length","color","setColor","userColor"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,yBAA3E;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,UAFD,EAGCC,QAHD,EAICC,kBAJD,QAKO,SALP;;AAOA,SAASC,eAAT,OAAqC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACpC,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAArB,GAA0B,aAAaF,IAA1D;AACA,QAAMG,QAAQ,GAAGR,8BAA8B,CAAEK,IAAF,CAA/C;AACA,QAAM,CAAEI,MAAF,IAAaR,UAAU,CAAE,eAAF,EAAmBI,IAAnB,CAA7B;AACA,QAAM,CAAEK,sBAAF,IAA6BT,UAAU,CAAE,cAAF,EAAkBI,IAAlB,CAA7C;AACA,QAAM,CAAEM,aAAF,IAAoBV,UAAU,CAAE,YAAF,EAAgBI,IAAhB,CAApC;AAEA,QAAMO,eAAe,GAAGT,kBAAkB,CAAEE,IAAF,CAA1C;AAEA,QAAMQ,YAAY,GACjBL,QAAQ,CAACM,QAAT,CAAmB,OAAnB,KACAH,aADA,KAEEF,MAAM,CAACM,MAAP,GAAgB,CAAhB,IAAqBL,sBAFvB,CADD;AAKA,QAAM,CAAEM,KAAF,EAASC,QAAT,IAAsBf,QAAQ,CAAE,YAAF,EAAgBG,IAAhB,CAApC;AACA,QAAM,CAAEa,SAAF,IAAgBhB,QAAQ,CAAE,YAAF,EAAgBG,IAAhB,EAAsB,MAAtB,CAA9B;;AAEA,MAAK,CAAEQ,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,8BACC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGP,UAAU,GAAG,SADrB;AAEC,IAAA,KAAK,EAAGV,EAAE,CAAE,MAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,sDADe;AAHjB,IADD,EAQC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,MAAM,EAAGgB,eAFV;AAGC,IAAA,mBAAmB,EAAG,CAAEF,sBAHzB;AAIC,IAAA,gCAAgC,MAJjC;AAKC,IAAA,SAAS,EAAG,KALb;AAMC,IAAA,WAAW,MANZ;AAOC,IAAA,iCAAiC,MAPlC;AAQC,IAAA,UAAU,EAAGM,KARd;AASC,IAAA,aAAa,EAAGC,QATjB;AAUC,IAAA,SAAS,EAAGD,KAAK,KAAKE;AAVvB,IARD,CADD;AAuBA;;AAED,eAAed,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseSetting,\n\tuseStyle,\n\tuseColorsPerOrigin,\n} from './hooks';\n\nfunction ScreenTextColor( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\tconst [ isTextEnabled ] = useSetting( 'color.text', name );\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ color, setColor ] = useStyle( 'color.text', name );\n\tconst [ userColor ] = useStyle( 'color.text', name, 'user' );\n\n\tif ( ! hasTextColor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu + '/colors' }\n\t\t\t\ttitle={ __( 'Text' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for text across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-text-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\tcolorValue={ color }\n\t\t\t\tonColorChange={ setColor }\n\t\t\t\tclearable={ color === userColor }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenTextColor;\n"]}
|
|
@@ -4,15 +4,21 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { __, _x } from '@wordpress/i18n';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useReducer } from '@wordpress/element';
|
|
8
|
+
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
9
|
+
import { displayShortcut } from '@wordpress/keycodes';
|
|
10
|
+
import { external, moreVertical } from '@wordpress/icons';
|
|
11
|
+
import { DropdownMenu, MenuGroup, MenuItem, VisuallyHidden } from '@wordpress/components';
|
|
9
12
|
import { ActionItem } from '@wordpress/interface';
|
|
10
13
|
/**
|
|
11
14
|
* Internal dependencies
|
|
12
15
|
*/
|
|
13
16
|
|
|
17
|
+
import KeyboardShortcutHelpModal from '../../keyboard-shortcut-help-modal';
|
|
14
18
|
import FeatureToggle from '../feature-toggle';
|
|
15
19
|
import ToolsMoreMenuGroup from '../tools-more-menu-group';
|
|
20
|
+
import SiteExport from './site-export';
|
|
21
|
+
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
16
22
|
const POPOVER_PROPS = {
|
|
17
23
|
className: 'edit-site-more-menu__content',
|
|
18
24
|
position: 'bottom left'
|
|
@@ -20,44 +26,63 @@ const POPOVER_PROPS = {
|
|
|
20
26
|
const TOGGLE_PROPS = {
|
|
21
27
|
tooltipPosition: 'bottom'
|
|
22
28
|
};
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return createElement(Fragment, null, createElement(MenuGroup, {
|
|
35
|
-
label: _x('View', 'noun')
|
|
36
|
-
}, createElement(FeatureToggle, {
|
|
37
|
-
feature: "fixedToolbar",
|
|
38
|
-
label: __('Top toolbar'),
|
|
39
|
-
info: __('Access all block and document tools in a single place'),
|
|
40
|
-
messageActivated: __('Top toolbar activated'),
|
|
41
|
-
messageDeactivated: __('Top toolbar deactivated')
|
|
42
|
-
}), createElement(FeatureToggle, {
|
|
43
|
-
feature: "focusMode",
|
|
44
|
-
label: __('Spotlight mode'),
|
|
45
|
-
info: __('Focus on one block at a time'),
|
|
46
|
-
messageActivated: __('Spotlight mode activated'),
|
|
47
|
-
messageDeactivated: __('Spotlight mode deactivated')
|
|
48
|
-
}), createElement(ActionItem.Slot, {
|
|
49
|
-
name: "core/edit-site/plugin-more-menu",
|
|
50
|
-
label: __('Plugins'),
|
|
51
|
-
as: MenuGroup,
|
|
52
|
-
fillProps: {
|
|
53
|
-
onClick: onClose
|
|
54
|
-
}
|
|
55
|
-
})), createElement(ToolsMoreMenuGroup.Slot, {
|
|
56
|
-
fillProps: {
|
|
29
|
+
export default function MoreMenu() {
|
|
30
|
+
const [isModalActive, toggleModal] = useReducer(isActive => !isActive, false);
|
|
31
|
+
useShortcut('core/edit-site/keyboard-shortcuts', toggleModal);
|
|
32
|
+
return createElement(Fragment, null, createElement(DropdownMenu, {
|
|
33
|
+
className: "edit-site-more-menu",
|
|
34
|
+
icon: moreVertical,
|
|
35
|
+
label: __('More tools & options'),
|
|
36
|
+
popoverProps: POPOVER_PROPS,
|
|
37
|
+
toggleProps: TOGGLE_PROPS
|
|
38
|
+
}, _ref => {
|
|
39
|
+
let {
|
|
57
40
|
onClose
|
|
58
|
-
}
|
|
41
|
+
} = _ref;
|
|
42
|
+
return createElement(Fragment, null, createElement(MenuGroup, {
|
|
43
|
+
label: _x('View', 'noun')
|
|
44
|
+
}, createElement(FeatureToggle, {
|
|
45
|
+
feature: "fixedToolbar",
|
|
46
|
+
label: __('Top toolbar'),
|
|
47
|
+
info: __('Access all block and document tools in a single place'),
|
|
48
|
+
messageActivated: __('Top toolbar activated'),
|
|
49
|
+
messageDeactivated: __('Top toolbar deactivated')
|
|
50
|
+
}), createElement(FeatureToggle, {
|
|
51
|
+
feature: "focusMode",
|
|
52
|
+
label: __('Spotlight mode'),
|
|
53
|
+
info: __('Focus on one block at a time'),
|
|
54
|
+
messageActivated: __('Spotlight mode activated'),
|
|
55
|
+
messageDeactivated: __('Spotlight mode deactivated')
|
|
56
|
+
}), createElement(ActionItem.Slot, {
|
|
57
|
+
name: "core/edit-site/plugin-more-menu",
|
|
58
|
+
label: __('Plugins'),
|
|
59
|
+
as: MenuGroup,
|
|
60
|
+
fillProps: {
|
|
61
|
+
onClick: onClose
|
|
62
|
+
}
|
|
63
|
+
})), createElement(MenuGroup, {
|
|
64
|
+
label: __('Tools')
|
|
65
|
+
}, createElement(SiteExport, null), createElement(MenuItem, {
|
|
66
|
+
onClick: toggleModal,
|
|
67
|
+
shortcut: displayShortcut.access('h')
|
|
68
|
+
}, __('Keyboard shortcuts')), createElement(WelcomeGuideMenuItem, null), createElement(MenuItem, {
|
|
69
|
+
icon: external,
|
|
70
|
+
role: "menuitem",
|
|
71
|
+
href: __('https://wordpress.org/support/article/site-editor/'),
|
|
72
|
+
target: "_blank",
|
|
73
|
+
rel: "noopener noreferrer"
|
|
74
|
+
}, __('Help'), createElement(VisuallyHidden, {
|
|
75
|
+
as: "span"
|
|
76
|
+
},
|
|
77
|
+
/* translators: accessibility text */
|
|
78
|
+
__('(opens in a new tab)'))), createElement(ToolsMoreMenuGroup.Slot, {
|
|
79
|
+
fillProps: {
|
|
80
|
+
onClose
|
|
81
|
+
}
|
|
82
|
+
})));
|
|
83
|
+
}), createElement(KeyboardShortcutHelpModal, {
|
|
84
|
+
isModalActive: isModalActive,
|
|
85
|
+
toggleModal: toggleModal
|
|
59
86
|
}));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default MoreMenu;
|
|
87
|
+
}
|
|
63
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/header/more-menu/index.js"],"names":["__","_x","moreVertical","DropdownMenu","MenuGroup","ActionItem","FeatureToggle","ToolsMoreMenuGroup","POPOVER_PROPS","className","position","TOGGLE_PROPS","tooltipPosition","MoreMenu","onClose","onClick"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/header/more-menu/index.js"],"names":["__","_x","useReducer","useShortcut","displayShortcut","external","moreVertical","DropdownMenu","MenuGroup","MenuItem","VisuallyHidden","ActionItem","KeyboardShortcutHelpModal","FeatureToggle","ToolsMoreMenuGroup","SiteExport","WelcomeGuideMenuItem","POPOVER_PROPS","className","position","TOGGLE_PROPS","tooltipPosition","MoreMenu","isModalActive","toggleModal","isActive","onClose","onClick","access"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,WAAT,QAA4B,+BAA5B;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,SAASC,QAAT,EAAmBC,YAAnB,QAAuC,kBAAvC;AACA,SACCC,YADD,EAECC,SAFD,EAGCC,QAHD,EAICC,cAJD,QAKO,uBALP;AAMA,SAASC,UAAT,QAA2B,sBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,yBAAP,MAAsC,oCAAtC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,kBAAP,MAA+B,0BAA/B;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AAEA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,SAAS,EAAE,8BADU;AAErBC,EAAAA,QAAQ,EAAE;AAFW,CAAtB;AAIA,MAAMC,YAAY,GAAG;AACpBC,EAAAA,eAAe,EAAE;AADG,CAArB;AAIA,eAAe,SAASC,QAAT,GAAoB;AAClC,QAAM,CAAEC,aAAF,EAAiBC,WAAjB,IAAiCtB,UAAU,CAC9CuB,QAAF,IAAgB,CAAEA,QAD8B,EAEhD,KAFgD,CAAjD;AAKAtB,EAAAA,WAAW,CAAE,mCAAF,EAAuCqB,WAAvC,CAAX;AAEA,SACC,8BACC,cAAC,YAAD;AACC,IAAA,SAAS,EAAC,qBADX;AAEC,IAAA,IAAI,EAAGlB,YAFR;AAGC,IAAA,KAAK,EAAGN,EAAE,CAAE,sBAAF,CAHX;AAIC,IAAA,YAAY,EAAGiB,aAJhB;AAKC,IAAA,WAAW,EAAGG;AALf,KAOG;AAAA,QAAE;AAAEM,MAAAA;AAAF,KAAF;AAAA,WACD,8BACC,cAAC,SAAD;AAAW,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G,EAAC;AAPL,OASGA,EAAE,CAAE,MAAF,CATL,EAUC,cAAC,cAAD;AAAgB,MAAA,EAAE,EAAC;AAAnB;AAEE;AACAA,IAAAA,EAAE,CAAE,sBAAF,CAHJ,CAVD,CATD,EA0BC,cAAC,kBAAD,CAAoB,IAApB;AACC,MAAA,SAAS,EAAG;AAAE0B,QAAAA;AAAF;AADb,MA1BD,CAjCD,CADC;AAAA,GAPH,CADD,EA2EC,cAAC,yBAAD;AACC,IAAA,aAAa,EAAGH,aADjB;AAEC,IAAA,WAAW,EAAGC;AAFf,IA3ED,CADD;AAkFA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useReducer } from '@wordpress/element';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { external, moreVertical } from '@wordpress/icons';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcutHelpModal from '../../keyboard-shortcut-help-modal';\nimport FeatureToggle from '../feature-toggle';\nimport ToolsMoreMenuGroup from '../tools-more-menu-group';\nimport SiteExport from './site-export';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nconst POPOVER_PROPS = {\n\tclassName: 'edit-site-more-menu__content',\n\tposition: 'bottom left',\n};\nconst TOGGLE_PROPS = {\n\ttooltipPosition: 'bottom',\n};\n\nexport default function MoreMenu() {\n\tconst [ isModalActive, toggleModal ] = useReducer(\n\t\t( isActive ) => ! isActive,\n\t\tfalse\n\t);\n\n\tuseShortcut( 'core/edit-site/keyboard-shortcuts', toggleModal );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tclassName=\"edit-site-more-menu\"\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'More tools & options' ) }\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\ttoggleProps={ TOGGLE_PROPS }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<FeatureToggle\n\t\t\t\t\t\t\t\tfeature=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<FeatureToggle\n\t\t\t\t\t\t\t\tfeature=\"focusMode\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\t\t\tinfo={ __( 'Focus on one block at a time' ) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\t\t\tname=\"core/edit-site/plugin-more-menu\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Plugins' ) }\n\t\t\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<SiteExport />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ toggleModal }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/site-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<ToolsMoreMenuGroup.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isModalActive }\n\t\t\t\ttoggleModal={ toggleModal }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/header/more-menu/site-export.js"],"names":["downloadjs","__","_x","MenuItem","apiFetch","download","useDispatch","store","noticesStore","SiteExport","createErrorNotice","handleExport","response","path","parse","blob","errorResponse","error","json","e","errorMessage","message","code","type"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,OAAOC,QAAP,MAAqB,sBAArB;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AAEA,eAAe,SAASC,UAAT,GAAsB;AACpC,QAAM;AAAEC,IAAAA;AAAF,MAAwBJ,WAAW,CAAEE,YAAF,CAAzC;;AAEA,iBAAeG,YAAf,GAA8B;AAC7B,QAAI;AACH,YAAMC,QAAQ,GAAG,MAAMR,QAAQ,CAAE;AAChCS,QAAAA,IAAI,EAAE,4BAD0B;AAEhCC,QAAAA,KAAK,EAAE;AAFyB,OAAF,CAA/B;AAIA,YAAMC,IAAI,GAAG,MAAMH,QAAQ,CAACG,IAAT,EAAnB;AAEAf,MAAAA,UAAU,CAAEe,IAAF,EAAQ,sBAAR,EAAgC,iBAAhC,CAAV;AACA,KARD,CAQE,OAAQC,aAAR,EAAwB;AACzB,UAAIC,KAAK,GAAG,EAAZ;;AACA,UAAI;AACHA,QAAAA,KAAK,GAAG,MAAMD,aAAa,CAACE,IAAd,EAAd;AACA,OAFD,CAEE,OAAQC,CAAR,EAAY,CAAE;;AAChB,YAAMC,YAAY,GACjBH,KAAK,CAACI,OAAN,IAAiBJ,KAAK,CAACK,IAAN,KAAe,eAAhC,GACGL,KAAK,CAACI,OADT,GAEGpB,EAAE,CAAE,mDAAF,CAHN;AAKAS,MAAAA,iBAAiB,CAAEU,YAAF,EAAgB;AAAEG,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AACA;AACD;;AAED,SACC,cAAC,QAAD;AACC,IAAA,IAAI,EAAC,UADN;AAEC,IAAA,IAAI,EAAGlB,QAFR;AAGC,IAAA,OAAO,EAAGM,YAHX;AAIC,IAAA,IAAI,EAAGV,EAAE,CAAE,6CAAF;AAJV,KAMGC,EAAE,CAAE,QAAF,EAAY,yBAAZ,CANL,CADD;AAUA","sourcesContent":["/**\n * External dependencies\n */\nimport downloadjs from 'downloadjs';\n\n/**\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 { 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} );\n\t\t\tconst blob = await response.blob();\n\n\t\t\tdownloadjs( blob, 'edit-site-export.zip', '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={ __( 'Download your templates and template parts.' ) }\n\t\t>\n\t\t\t{ _x( 'Export', 'site exporter menu item' ) }\n\t\t</MenuItem>\n\t);\n}\n"]}
|