@wordpress/edit-site 6.0.4 → 6.2.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 +10 -6
- package/build/components/add-new-page/index.js +2 -0
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +1 -0
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/app/index.js +17 -1
- package/build/components/app/index.js.map +1 -1
- package/build/components/editor/index.js +12 -13
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +18 -7
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/font-families.js +17 -17
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +2 -2
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +25 -19
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +1 -0
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +1 -0
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/layout/index.js +8 -37
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -0
- package/build/components/page/header.js.map +1 -1
- package/build/components/page-patterns/header.js +2 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/rename-category-menu-item.js +3 -1
- package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build/components/posts-app/index.js +50 -0
- package/build/components/posts-app/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/hooks/commands/use-set-command-context.js +64 -0
- package/build/hooks/commands/use-set-command-context.js.map +1 -0
- package/build/index.js +15 -2
- package/build/index.js.map +1 -1
- package/build/posts.js +34 -0
- package/build/posts.js.map +1 -0
- package/build-module/components/add-new-page/index.js +2 -0
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +1 -0
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/app/index.js +17 -1
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/editor/index.js +13 -14
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +19 -8
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +18 -18
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +2 -2
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +25 -19
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +1 -0
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +1 -0
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/layout/index.js +10 -39
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -0
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page-patterns/header.js +2 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js +3 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build-module/components/posts-app/index.js +43 -0
- package/build-module/components/posts-app/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/hooks/commands/use-set-command-context.js +57 -0
- package/build-module/hooks/commands/use-set-command-context.js.map +1 -0
- package/build-module/index.js +8 -2
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +27 -0
- package/build-module/posts.js.map +1 -0
- package/build-style/posts-rtl.css +1707 -0
- package/build-style/posts.css +1707 -0
- package/build-style/style-rtl.css +18 -20
- package/build-style/style.css +18 -20
- package/lib/inflate.js +3188 -3937
- package/lib/lib-font.browser.js +32 -2
- package/lib/unbrotli.js +1818 -2458
- package/package.json +41 -41
- package/src/components/add-new-page/index.js +6 -1
- package/src/components/add-new-pattern/index.js +1 -0
- package/src/components/app/index.js +17 -1
- package/src/components/editor/index.js +13 -22
- package/src/components/editor-canvas-container/index.js +20 -8
- package/src/components/global-styles/font-families.js +28 -19
- package/src/components/global-styles/font-library-modal/context.js +2 -2
- package/src/components/global-styles/style.scss +3 -8
- package/src/components/global-styles/variations/variation.js +37 -22
- package/src/components/global-styles/variations/variations-color.js +1 -0
- package/src/components/global-styles/variations/variations-typography.js +1 -0
- package/src/components/global-styles-sidebar/style.scss +0 -1
- package/src/components/layout/index.js +24 -70
- package/src/components/page/header.js +1 -0
- package/src/components/page/style.scss +6 -0
- package/src/components/page-patterns/header.js +8 -2
- package/src/components/page-patterns/rename-category-menu-item.js +2 -0
- package/src/components/page-patterns/style.scss +6 -0
- package/src/components/posts-app/index.js +39 -0
- package/src/components/sidebar/style.scss +4 -4
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +6 -1
- package/src/hooks/commands/use-set-command-context.js +49 -0
- package/src/index.js +10 -2
- package/src/posts.js +29 -0
- package/src/posts.scss +46 -0
- package/build/components/block-editor/block-inspector-button.js +0 -57
- package/build/components/block-editor/block-inspector-button.js.map +0 -1
- package/build/components/block-editor/inserter-media-categories.js +0 -183
- package/build/components/block-editor/inserter-media-categories.js.map +0 -1
- package/build/components/template-part-converter/convert-to-regular.js +0 -38
- package/build/components/template-part-converter/convert-to-regular.js.map +0 -1
- package/build/components/template-part-converter/convert-to-template-part.js +0 -84
- package/build/components/template-part-converter/convert-to-template-part.js.map +0 -1
- package/build/components/template-part-converter/index.js +0 -67
- package/build/components/template-part-converter/index.js.map +0 -1
- package/build-module/components/block-editor/block-inspector-button.js +0 -50
- package/build-module/components/block-editor/block-inspector-button.js.map +0 -1
- package/build-module/components/block-editor/inserter-media-categories.js +0 -177
- package/build-module/components/block-editor/inserter-media-categories.js.map +0 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +0 -31
- package/build-module/components/template-part-converter/convert-to-regular.js.map +0 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +0 -79
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +0 -1
- package/build-module/components/template-part-converter/index.js +0 -59
- package/build-module/components/template-part-converter/index.js.map +0 -1
- package/src/components/block-editor/block-inspector-button.js +0 -60
- package/src/components/block-editor/inserter-media-categories.js +0 -225
- package/src/components/template-part-converter/convert-to-regular.js +0 -32
- package/src/components/template-part-converter/convert-to-template-part.js +0 -78
- package/src/components/template-part-converter/index.js +0 -59
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 6.2.0 (2024-06-26)
|
|
6
|
+
|
|
7
|
+
## 6.1.0 (2024-06-15)
|
|
8
|
+
|
|
5
9
|
## 6.0.0 (2024-05-31)
|
|
6
10
|
|
|
7
11
|
### Breaking Changes
|
|
@@ -85,7 +89,7 @@
|
|
|
85
89
|
|
|
86
90
|
## 5.3.0 (2023-02-01)
|
|
87
91
|
|
|
88
|
-
### Bug
|
|
92
|
+
### Bug Fixes
|
|
89
93
|
|
|
90
94
|
- Force visual editor in browse mode ([#47329](https://github.com/WordPress/gutenberg/pull/47329)).
|
|
91
95
|
- Style Book: Exclude blocks that are not allowed to insert ([#47461](https://github.com/WordPress/gutenberg/pull/47461)).
|
|
@@ -104,7 +108,7 @@
|
|
|
104
108
|
|
|
105
109
|
- Fluid typography: add configurable fluid typography settings for minimum font size to theme.json ([#42489](https://github.com/WordPress/gutenberg/pull/42489)).
|
|
106
110
|
|
|
107
|
-
### Bug
|
|
111
|
+
### Bug Fixes
|
|
108
112
|
|
|
109
113
|
- Don't show block inserter when the canvas is view mode ([#46763](https://github.com/WordPress/gutenberg/pull/46763)).
|
|
110
114
|
|
|
@@ -148,11 +152,11 @@
|
|
|
148
152
|
|
|
149
153
|
## 4.0.0 (2022-02-10)
|
|
150
154
|
|
|
151
|
-
### Breaking
|
|
155
|
+
### Breaking Changes
|
|
152
156
|
|
|
153
157
|
- The `GUTENBERG_PHASE` environment variable has been renamed to `IS_GUTENBERG_PLUGIN` and is now a boolean ([#38202](https://github.com/WordPress/gutenberg/pull/38202)).
|
|
154
158
|
|
|
155
|
-
### Bug
|
|
159
|
+
### Bug Fixes
|
|
156
160
|
|
|
157
161
|
- Removed unused `@wordpress/primitives`, `file-saver` and `jszip` dependencies ([#38388](https://github.com/WordPress/gutenberg/pull/38388)).
|
|
158
162
|
|
|
@@ -160,7 +164,7 @@
|
|
|
160
164
|
|
|
161
165
|
## 3.0.0 (2021-07-29)
|
|
162
166
|
|
|
163
|
-
### Breaking
|
|
167
|
+
### Breaking Changes
|
|
164
168
|
|
|
165
169
|
- Upgraded React components to work with v17.0 ([#29118](https://github.com/WordPress/gutenberg/pull/29118)). There are no new features in React v17.0 as explained in the [blog post](https://reactjs.org/blog/2020/10/20/react-v17.html).
|
|
166
170
|
|
|
@@ -179,6 +183,6 @@
|
|
|
179
183
|
|
|
180
184
|
## 1.0.0 (2020-01-13)
|
|
181
185
|
|
|
182
|
-
### New
|
|
186
|
+
### New Features
|
|
183
187
|
|
|
184
188
|
- Initial version of the package.
|
|
@@ -67,6 +67,8 @@ function AddNewPageModal({
|
|
|
67
67
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Modal, {
|
|
68
68
|
title: (0, _i18n.__)('Draft a new page'),
|
|
69
69
|
onRequestClose: onClose,
|
|
70
|
+
focusOnMount: "firstContentElement",
|
|
71
|
+
size: "small",
|
|
70
72
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("form", {
|
|
71
73
|
onSubmit: createPage,
|
|
72
74
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_notices","_htmlEntities","_blocks","_jsxRuntime","AddNewPageModal","onSave","onClose","isCreatingPage","setIsCreatingPage","useState","title","setTitle","saveEntityRecord","useDispatch","coreStore","createErrorNotice","createSuccessNotice","noticesStore","resolveSelect","useRegistry","createPage","event","preventDefault","pagePostType","getPostType","newPage","status","slug","__","content","template","length","serialize","synchronizeBlocksWithTemplate","undefined","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, useRegistry } 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';\nimport { serialize, synchronizeBlocksWithTemplate } from '@wordpress/blocks';\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\tconst { resolveSelect } = useRegistry();\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 pagePostType =\n\t\t\t\tawait resolveSelect( coreStore ).getPostType( 'page' );\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\tcontent:\n\t\t\t\t\t\t!! pagePostType.template && pagePostType.template.length\n\t\t\t\t\t\t\t? serialize(\n\t\t\t\t\t\t\t\t\tsynchronizeBlocksWithTemplate(\n\t\t\t\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\t\t\t\tpagePostType.template\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: undefined,\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
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_notices","_htmlEntities","_blocks","_jsxRuntime","AddNewPageModal","onSave","onClose","isCreatingPage","setIsCreatingPage","useState","title","setTitle","saveEntityRecord","useDispatch","coreStore","createErrorNotice","createSuccessNotice","noticesStore","resolveSelect","useRegistry","createPage","event","preventDefault","pagePostType","getPostType","newPage","status","slug","__","content","template","length","serialize","synchronizeBlocksWithTemplate","undefined","throwOnError","sprintf","decodeEntities","rendered","type","error","errorMessage","message","code","jsx","Modal","onRequestClose","focusOnMount","size","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, useRegistry } 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';\nimport { serialize, synchronizeBlocksWithTemplate } from '@wordpress/blocks';\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\tconst { resolveSelect } = useRegistry();\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 pagePostType =\n\t\t\t\tawait resolveSelect( coreStore ).getPostType( 'page' );\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\tcontent:\n\t\t\t\t\t\t!! pagePostType.template && pagePostType.template.length\n\t\t\t\t\t\t\t? serialize(\n\t\t\t\t\t\t\t\t\tsynchronizeBlocksWithTemplate(\n\t\t\t\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\t\t\t\tpagePostType.template\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: undefined,\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\n\t\t\ttitle={ __( 'Draft a new page' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\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;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAA6E,IAAAQ,WAAA,GAAAR,OAAA;AAhB7E;AACA;AACA;;AAgBe,SAASS,eAAeA,CAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAG;EAC9D,MAAM,CAAEC,cAAc,EAAEC,iBAAiB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAC/D,MAAM,CAAEC,KAAK,EAAEC,QAAQ,CAAE,GAAG,IAAAF,iBAAQ,EAAE,EAAG,CAAC;EAE1C,MAAM;IAAEG;EAAiB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,eAAU,CAAC;EACrD,MAAM;IAAEC,iBAAiB;IAAEC;EAAoB,CAAC,GAC/C,IAAAH,iBAAW,EAAEI,cAAa,CAAC;EAC5B,MAAM;IAAEC;EAAc,CAAC,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CACf,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
|
|
@@ -64,6 +64,7 @@ function AddNewPattern() {
|
|
|
64
64
|
isBlockBasedTheme: getCurrentTheme()?.is_block_theme,
|
|
65
65
|
addNewPatternLabel: getPostType(_constants.PATTERN_TYPES.user)?.labels?.add_new_item,
|
|
66
66
|
addNewTemplatePartLabel: getPostType(_constants.TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item,
|
|
67
|
+
// Blocks refers to the wp_block post type, this checks the ability to create a post of that type.
|
|
67
68
|
canCreatePattern: canUser('create', 'blocks'),
|
|
68
69
|
canCreateTemplatePart: canUser('create', 'template-parts')
|
|
69
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_element","_i18n","_icons","_data","_router","_patterns","_notices","_coreData","_editor","_lockUnlock","_constants","_jsxRuntime","useHistory","unlock","routerPrivateApis","CreatePatternModal","useAddPatternCategory","editPatternsPrivateApis","CreateTemplatePartModal","editorPrivateApis","AddNewPattern","history","showPatternModal","setShowPatternModal","useState","showTemplatePartModal","setShowTemplatePartModal","createPatternFromFile","useDispatch","patternsStore","createSuccessNotice","createErrorNotice","noticesStore","patternUploadInputRef","useRef","isBlockBasedTheme","addNewPatternLabel","addNewTemplatePartLabel","canCreatePattern","canCreateTemplatePart","useSelect","select","getCurrentTheme","getPostType","canUser","coreStore","is_block_theme","PATTERN_TYPES","user","labels","add_new_item","TEMPLATE_PART_POST_TYPE","handleCreatePattern","pattern","push","postId","id","postType","canvas","handleCreateTemplatePart","templatePart","handleError","controls","icon","symbol","onClick","title","symbolFilled","upload","current","click","__","categoryMap","findOrCreateTerm","length","jsxs","Fragment","children","jsx","DropdownMenu","toggleProps","variant","showTooltip","__next40pxDefaultSize","text","label","onClose","onSuccess","onError","closeModal","blocks","onCreate","type","accept","hidden","ref","onChange","event","file","target","files","params","categoryId","getLocationWithParams","currentCategoryId","currentCategory","values","find","term","name","undefined","PATTERN_DEFAULT_CATEGORY","sprintf","raw","err","message","value"],"sources":["@wordpress/edit-site/src/components/add-new-pattern/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu } from '@wordpress/components';\nimport { useState, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { symbol, symbolFilled, upload } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tprivateApis as editPatternsPrivateApis,\n\tstore as patternsStore,\n} from '@wordpress/patterns';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\n\nconst { useHistory } = unlock( routerPrivateApis );\nconst { CreatePatternModal, useAddPatternCategory } = unlock(\n\teditPatternsPrivateApis\n);\nconst { CreateTemplatePartModal } = unlock( editorPrivateApis );\n\nexport default function AddNewPattern() {\n\tconst history = useHistory();\n\tconst [ showPatternModal, setShowPatternModal ] = useState( false );\n\tconst [ showTemplatePartModal, setShowTemplatePartModal ] =\n\t\tuseState( false );\n\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\tconst { createPatternFromFile } = unlock( useDispatch( patternsStore ) );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst patternUploadInputRef = useRef();\n\tconst {\n\t\tisBlockBasedTheme,\n\t\taddNewPatternLabel,\n\t\taddNewTemplatePartLabel,\n\t\tcanCreatePattern,\n\t\tcanCreateTemplatePart,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getPostType, canUser } = select( coreStore );\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\taddNewPatternLabel: getPostType( PATTERN_TYPES.user )?.labels\n\t\t\t\t?.add_new_item,\n\t\t\taddNewTemplatePartLabel: getPostType( TEMPLATE_PART_POST_TYPE )\n\t\t\t\t?.labels?.add_new_item,\n\t\t\tcanCreatePattern: canUser( 'create', 'blocks' ),\n\t\t\tcanCreateTemplatePart: canUser( 'create', 'template-parts' ),\n\t\t};\n\t}, [] );\n\n\tfunction handleCreatePattern( { pattern } ) {\n\t\tsetShowPatternModal( false );\n\n\t\thistory.push( {\n\t\t\tpostId: pattern.id,\n\t\t\tpostType: PATTERN_TYPES.user,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleCreateTemplatePart( templatePart ) {\n\t\tsetShowTemplatePartModal( false );\n\n\t\t// Navigate to the created template part editor.\n\t\thistory.push( {\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleError() {\n\t\tsetShowPatternModal( false );\n\t\tsetShowTemplatePartModal( false );\n\t}\n\n\tconst controls = [];\n\tif ( canCreatePattern ) {\n\t\tcontrols.push( {\n\t\t\ticon: symbol,\n\t\t\tonClick: () => setShowPatternModal( true ),\n\t\t\ttitle: addNewPatternLabel,\n\t\t} );\n\t}\n\n\tif ( isBlockBasedTheme && canCreateTemplatePart ) {\n\t\tcontrols.push( {\n\t\t\ticon: symbolFilled,\n\t\t\tonClick: () => setShowTemplatePartModal( true ),\n\t\t\ttitle: addNewTemplatePartLabel,\n\t\t} );\n\t}\n\n\tif ( canCreatePattern ) {\n\t\tcontrols.push( {\n\t\t\ticon: upload,\n\t\t\tonClick: () => {\n\t\t\t\tpatternUploadInputRef.current.click();\n\t\t\t},\n\t\t\ttitle: __( 'Import pattern from JSON' ),\n\t\t} );\n\t}\n\n\tconst { categoryMap, findOrCreateTerm } = useAddPatternCategory();\n\tif ( controls.length === 0 ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ addNewPatternLabel && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\tcontrols={ controls }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tvariant: 'primary',\n\t\t\t\t\t\tshowTooltip: false,\n\t\t\t\t\t\t__next40pxDefaultSize: true,\n\t\t\t\t\t} }\n\t\t\t\t\ttext={ addNewPatternLabel }\n\t\t\t\t\tlabel={ addNewPatternLabel }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showPatternModal && (\n\t\t\t\t<CreatePatternModal\n\t\t\t\t\tonClose={ () => setShowPatternModal( false ) }\n\t\t\t\t\tonSuccess={ handleCreatePattern }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showTemplatePartModal && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setShowTemplatePartModal( false ) }\n\t\t\t\t\tblocks={ [] }\n\t\t\t\t\tonCreate={ handleCreateTemplatePart }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<input\n\t\t\t\ttype=\"file\"\n\t\t\t\taccept=\".json\"\n\t\t\t\thidden\n\t\t\t\tref={ patternUploadInputRef }\n\t\t\t\tonChange={ async ( event ) => {\n\t\t\t\t\tconst file = event.target.files?.[ 0 ];\n\t\t\t\t\tif ( ! file ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\tparams: { postType, categoryId },\n\t\t\t\t\t\t} = history.getLocationWithParams();\n\t\t\t\t\t\tlet currentCategoryId;\n\t\t\t\t\t\t// When we're not handling template parts, we should\n\t\t\t\t\t\t// add or create the proper pattern category.\n\t\t\t\t\t\tif ( postType !== TEMPLATE_PART_POST_TYPE ) {\n\t\t\t\t\t\t\tconst currentCategory = categoryMap\n\t\t\t\t\t\t\t\t.values()\n\t\t\t\t\t\t\t\t.find( ( term ) => term.name === categoryId );\n\t\t\t\t\t\t\tif ( currentCategory ) {\n\t\t\t\t\t\t\t\tcurrentCategoryId =\n\t\t\t\t\t\t\t\t\tcurrentCategory.id ||\n\t\t\t\t\t\t\t\t\t( await findOrCreateTerm(\n\t\t\t\t\t\t\t\t\t\tcurrentCategory.label\n\t\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\tconst pattern = await createPatternFromFile(\n\t\t\t\t\t\t\tfile,\n\t\t\t\t\t\t\tcurrentCategoryId\n\t\t\t\t\t\t\t\t? [ currentCategoryId ]\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Navigate to the All patterns category for the newly created pattern\n\t\t\t\t\t\t// if we're not on that page already and if we're not in the `my-patterns`\n\t\t\t\t\t\t// category.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! currentCategoryId &&\n\t\t\t\t\t\t\tcategoryId !== 'my-patterns'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\tpostType: PATTERN_TYPES.user,\n\t\t\t\t\t\t\t\tcategoryId: PATTERN_DEFAULT_CATEGORY,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\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: The imported pattern's title.\n\t\t\t\t\t\t\t\t__( 'Imported \"%s\" from JSON.' ),\n\t\t\t\t\t\t\t\tpattern.title.raw\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: 'import-pattern-success',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch ( err ) {\n\t\t\t\t\t\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iB,GAChBC,eAAe,CAACjD,EAAE,KAChB,MAAMiB,gBAAgB,CACvBgC,eAAe,CAACpB,KACjB,CAAC,CAAE;YACL;UACD;UACA,MAAMhC,OAAO,GAAG,MAAM1B,qBAAqB,CAC1CuE,IAAI,EACJM,iBAAiB,GACd,CAAEA,iBAAiB,CAAE,GACrBM,SACJ,CAAC;;UAED;UACA;UACA;UACA,IACC,CAAEN,iBAAiB,IACnBF,UAAU,KAAK,aAAa,EAC3B;YACDjF,OAAO,CAACiC,IAAI,CAAE;cACbG,QAAQ,EAAEV,wBAAa,CAACC,IAAI;cAC5BsD,UAAU,EAAES;YACb,CAAE,CAAC;UACJ;UAEAjF,mBAAmB,CAClB,IAAAkF,aAAO;UACN;UACA,IAAAzC,QAAE,EAAE,0BAA2B,CAAC,EAChClB,OAAO,CAACa,KAAK,CAAC+C,GACf,CAAC,EACD;YACCrB,IAAI,EAAE,UAAU;YAChBpC,EAAE,EAAE;UACL,CACD,CAAC;QACF,CAAC,CAAC,OAAQ0D,GAAG,EAAG;UACfnF,iBAAiB,CAAEmF,GAAG,CAACC,OAAO,EAAE;YAC/BvB,IAAI,EAAE,UAAU;YAChBpC,EAAE,EAAE;UACL,CAAE,CAAC;QACJ,CAAC,SAAS;UACTyC,KAAK,CAACE,MAAM,CAACiB,KAAK,GAAG,EAAE;QACxB;MACD;IAAG,CACH,CAAC;EAAA,CACD,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_components","require","_element","_i18n","_icons","_data","_router","_patterns","_notices","_coreData","_editor","_lockUnlock","_constants","_jsxRuntime","useHistory","unlock","routerPrivateApis","CreatePatternModal","useAddPatternCategory","editPatternsPrivateApis","CreateTemplatePartModal","editorPrivateApis","AddNewPattern","history","showPatternModal","setShowPatternModal","useState","showTemplatePartModal","setShowTemplatePartModal","createPatternFromFile","useDispatch","patternsStore","createSuccessNotice","createErrorNotice","noticesStore","patternUploadInputRef","useRef","isBlockBasedTheme","addNewPatternLabel","addNewTemplatePartLabel","canCreatePattern","canCreateTemplatePart","useSelect","select","getCurrentTheme","getPostType","canUser","coreStore","is_block_theme","PATTERN_TYPES","user","labels","add_new_item","TEMPLATE_PART_POST_TYPE","handleCreatePattern","pattern","push","postId","id","postType","canvas","handleCreateTemplatePart","templatePart","handleError","controls","icon","symbol","onClick","title","symbolFilled","upload","current","click","__","categoryMap","findOrCreateTerm","length","jsxs","Fragment","children","jsx","DropdownMenu","toggleProps","variant","showTooltip","__next40pxDefaultSize","text","label","onClose","onSuccess","onError","closeModal","blocks","onCreate","type","accept","hidden","ref","onChange","event","file","target","files","params","categoryId","getLocationWithParams","currentCategoryId","currentCategory","values","find","term","name","undefined","PATTERN_DEFAULT_CATEGORY","sprintf","raw","err","message","value"],"sources":["@wordpress/edit-site/src/components/add-new-pattern/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu } from '@wordpress/components';\nimport { useState, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { symbol, symbolFilled, upload } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tprivateApis as editPatternsPrivateApis,\n\tstore as patternsStore,\n} from '@wordpress/patterns';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\n\nconst { useHistory } = unlock( routerPrivateApis );\nconst { CreatePatternModal, useAddPatternCategory } = unlock(\n\teditPatternsPrivateApis\n);\nconst { CreateTemplatePartModal } = unlock( editorPrivateApis );\n\nexport default function AddNewPattern() {\n\tconst history = useHistory();\n\tconst [ showPatternModal, setShowPatternModal ] = useState( false );\n\tconst [ showTemplatePartModal, setShowTemplatePartModal ] =\n\t\tuseState( false );\n\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\tconst { createPatternFromFile } = unlock( useDispatch( patternsStore ) );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst patternUploadInputRef = useRef();\n\tconst {\n\t\tisBlockBasedTheme,\n\t\taddNewPatternLabel,\n\t\taddNewTemplatePartLabel,\n\t\tcanCreatePattern,\n\t\tcanCreateTemplatePart,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getPostType, canUser } = select( coreStore );\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\taddNewPatternLabel: getPostType( PATTERN_TYPES.user )?.labels\n\t\t\t\t?.add_new_item,\n\t\t\taddNewTemplatePartLabel: getPostType( TEMPLATE_PART_POST_TYPE )\n\t\t\t\t?.labels?.add_new_item,\n\t\t\t// Blocks refers to the wp_block post type, this checks the ability to create a post of that type.\n\t\t\tcanCreatePattern: canUser( 'create', 'blocks' ),\n\t\t\tcanCreateTemplatePart: canUser( 'create', 'template-parts' ),\n\t\t};\n\t}, [] );\n\n\tfunction handleCreatePattern( { pattern } ) {\n\t\tsetShowPatternModal( false );\n\n\t\thistory.push( {\n\t\t\tpostId: pattern.id,\n\t\t\tpostType: PATTERN_TYPES.user,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleCreateTemplatePart( templatePart ) {\n\t\tsetShowTemplatePartModal( false );\n\n\t\t// Navigate to the created template part editor.\n\t\thistory.push( {\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleError() {\n\t\tsetShowPatternModal( false );\n\t\tsetShowTemplatePartModal( false );\n\t}\n\n\tconst controls = [];\n\tif ( canCreatePattern ) {\n\t\tcontrols.push( {\n\t\t\ticon: symbol,\n\t\t\tonClick: () => setShowPatternModal( true ),\n\t\t\ttitle: addNewPatternLabel,\n\t\t} );\n\t}\n\n\tif ( isBlockBasedTheme && canCreateTemplatePart ) {\n\t\tcontrols.push( {\n\t\t\ticon: symbolFilled,\n\t\t\tonClick: () => setShowTemplatePartModal( true ),\n\t\t\ttitle: addNewTemplatePartLabel,\n\t\t} );\n\t}\n\n\tif ( canCreatePattern ) {\n\t\tcontrols.push( {\n\t\t\ticon: upload,\n\t\t\tonClick: () => {\n\t\t\t\tpatternUploadInputRef.current.click();\n\t\t\t},\n\t\t\ttitle: __( 'Import pattern from JSON' ),\n\t\t} );\n\t}\n\n\tconst { categoryMap, findOrCreateTerm } = useAddPatternCategory();\n\tif ( controls.length === 0 ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ addNewPatternLabel && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\tcontrols={ controls }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tvariant: 'primary',\n\t\t\t\t\t\tshowTooltip: false,\n\t\t\t\t\t\t__next40pxDefaultSize: true,\n\t\t\t\t\t} }\n\t\t\t\t\ttext={ addNewPatternLabel }\n\t\t\t\t\tlabel={ addNewPatternLabel }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showPatternModal && (\n\t\t\t\t<CreatePatternModal\n\t\t\t\t\tonClose={ () => setShowPatternModal( false ) }\n\t\t\t\t\tonSuccess={ handleCreatePattern }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showTemplatePartModal && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setShowTemplatePartModal( false ) }\n\t\t\t\t\tblocks={ [] }\n\t\t\t\t\tonCreate={ handleCreateTemplatePart }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<input\n\t\t\t\ttype=\"file\"\n\t\t\t\taccept=\".json\"\n\t\t\t\thidden\n\t\t\t\tref={ patternUploadInputRef }\n\t\t\t\tonChange={ async ( event ) => {\n\t\t\t\t\tconst file = event.target.files?.[ 0 ];\n\t\t\t\t\tif ( ! file ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\tparams: { postType, categoryId },\n\t\t\t\t\t\t} = history.getLocationWithParams();\n\t\t\t\t\t\tlet currentCategoryId;\n\t\t\t\t\t\t// When we're not handling template parts, we should\n\t\t\t\t\t\t// add or create the proper pattern category.\n\t\t\t\t\t\tif ( postType !== TEMPLATE_PART_POST_TYPE ) {\n\t\t\t\t\t\t\tconst currentCategory = categoryMap\n\t\t\t\t\t\t\t\t.values()\n\t\t\t\t\t\t\t\t.find( ( term ) => term.name === categoryId );\n\t\t\t\t\t\t\tif ( currentCategory ) {\n\t\t\t\t\t\t\t\tcurrentCategoryId =\n\t\t\t\t\t\t\t\t\tcurrentCategory.id ||\n\t\t\t\t\t\t\t\t\t( await findOrCreateTerm(\n\t\t\t\t\t\t\t\t\t\tcurrentCategory.label\n\t\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\tconst pattern = await createPatternFromFile(\n\t\t\t\t\t\t\tfile,\n\t\t\t\t\t\t\tcurrentCategoryId\n\t\t\t\t\t\t\t\t? [ currentCategoryId ]\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Navigate to the All patterns category for the newly created pattern\n\t\t\t\t\t\t// if we're not on that page already and if we're not in the `my-patterns`\n\t\t\t\t\t\t// category.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! currentCategoryId &&\n\t\t\t\t\t\t\tcategoryId !== 'my-patterns'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\tpostType: PATTERN_TYPES.user,\n\t\t\t\t\t\t\t\tcategoryId: PATTERN_DEFAULT_CATEGORY,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\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: The imported pattern's title.\n\t\t\t\t\t\t\t\t__( 'Imported \"%s\" from JSON.' ),\n\t\t\t\t\t\t\t\tpattern.title.raw\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: 'import-pattern-success',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch ( err ) {\n\t\t\t\t\t\tcreateErrorNotice( err.message, {\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'import-pattern-error',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tevent.target.value = '';\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAIA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAKA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AAI+B,IAAAY,WAAA,GAAAZ,OAAA;AAzB/B;AACA;AACA;;AAeA;AACA;AACA;;AAQA,MAAM;EAAEa;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAClD,MAAM;EAAEC,kBAAkB;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,KAAK,CAACE,MAAM,CAACiB,KAAK,GAAG,EAAE;QACxB;MACD;IAAG,CACH,CAAC;EAAA,CACD,CAAC;AAEL","ignoreList":[]}
|
|
@@ -14,6 +14,11 @@ var _plugins = require("@wordpress/plugins");
|
|
|
14
14
|
var _router = require("@wordpress/router");
|
|
15
15
|
var _layout = _interopRequireDefault(require("../layout"));
|
|
16
16
|
var _lockUnlock = require("../../lock-unlock");
|
|
17
|
+
var _useCommonCommands = require("../../hooks/commands/use-common-commands");
|
|
18
|
+
var _useEditModeCommands = require("../../hooks/commands/use-edit-mode-commands");
|
|
19
|
+
var _useInitEditedEntityFromUrl = _interopRequireDefault(require("../sync-state-with-url/use-init-edited-entity-from-url"));
|
|
20
|
+
var _router2 = _interopRequireDefault(require("../layout/router"));
|
|
21
|
+
var _useSetCommandContext = _interopRequireDefault(require("../../hooks/commands/use-set-command-context"));
|
|
17
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
23
|
/**
|
|
19
24
|
* WordPress dependencies
|
|
@@ -29,6 +34,17 @@ const {
|
|
|
29
34
|
const {
|
|
30
35
|
GlobalStylesProvider
|
|
31
36
|
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
37
|
+
function AppLayout() {
|
|
38
|
+
// This ensures the edited entity id and type are initialized properly.
|
|
39
|
+
(0, _useInitEditedEntityFromUrl.default)();
|
|
40
|
+
(0, _useEditModeCommands.useEditModeCommands)();
|
|
41
|
+
(0, _useCommonCommands.useCommonCommands)();
|
|
42
|
+
(0, _useSetCommandContext.default)();
|
|
43
|
+
const route = (0, _router2.default)();
|
|
44
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_layout.default, {
|
|
45
|
+
route: route
|
|
46
|
+
});
|
|
47
|
+
}
|
|
32
48
|
function App() {
|
|
33
49
|
const {
|
|
34
50
|
createErrorNotice
|
|
@@ -40,7 +56,7 @@ function App() {
|
|
|
40
56
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SlotFillProvider, {
|
|
41
57
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(GlobalStylesProvider, {
|
|
42
58
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.UnsavedChangesWarning, {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(RouterProvider, {
|
|
43
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
59
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(AppLayout, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_plugins.PluginArea, {
|
|
44
60
|
onError: onPluginAreaError
|
|
45
61
|
})]
|
|
46
62
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_editor","_notices","_data","_i18n","_plugins","_router","_layout","_interopRequireDefault","_lockUnlock","_jsxRuntime","RouterProvider","unlock","routerPrivateApis","GlobalStylesProvider","editorPrivateApis","App","createErrorNotice","useDispatch","noticesStore","onPluginAreaError","name","sprintf","__","
|
|
1
|
+
{"version":3,"names":["_components","require","_editor","_notices","_data","_i18n","_plugins","_router","_layout","_interopRequireDefault","_lockUnlock","_useCommonCommands","_useEditModeCommands","_useInitEditedEntityFromUrl","_router2","_useSetCommandContext","_jsxRuntime","RouterProvider","unlock","routerPrivateApis","GlobalStylesProvider","editorPrivateApis","AppLayout","useInitEditedEntityFromURL","useEditModeCommands","useCommonCommands","useSetCommandContext","route","useLayoutAreas","jsx","default","App","createErrorNotice","useDispatch","noticesStore","onPluginAreaError","name","sprintf","__","SlotFillProvider","children","jsxs","UnsavedChangesWarning","PluginArea","onError"],"sources":["@wordpress/edit-site/src/components/app/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport {\n\tUnsavedChangesWarning,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PluginArea } from '@wordpress/plugins';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport Layout from '../layout';\nimport { unlock } from '../../lock-unlock';\nimport { useCommonCommands } from '../../hooks/commands/use-common-commands';\nimport { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport useLayoutAreas from '../layout/router';\nimport useSetCommandContext from '../../hooks/commands/use-set-command-context';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\nconst { GlobalStylesProvider } = unlock( editorPrivateApis );\n\nfunction AppLayout() {\n\t// This ensures the edited entity id and type are initialized properly.\n\tuseInitEditedEntityFromURL();\n\tuseEditModeCommands();\n\tuseCommonCommands();\n\tuseSetCommandContext();\n\tconst route = useLayoutAreas();\n\n\treturn <Layout route={ route } />;\n}\n\nexport default function App() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<GlobalStylesProvider>\n\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t<RouterProvider>\n\t\t\t\t\t<AppLayout />\n\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t</RouterProvider>\n\t\t\t</GlobalStylesProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,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AA,CAAAyB,IAAA,EAACrB,oBAAoB;MAAAoB,QAAA,gBACpB,IAAAxB,WAAA,CAAAa,GAAA,EAAC3B,OAAA,CAAAwC,qBAAqB,IAAE,CAAC,eACzB,IAAA1B,WAAA,CAAAyB,IAAA,EAACxB,cAAc;QAAAuB,QAAA,gBACd,IAAAxB,WAAA,CAAAa,GAAA,EAACP,SAAS,IAAE,CAAC,eACb,IAAAN,WAAA,CAAAa,GAAA,EAACvB,QAAA,CAAAqC,UAAU;UAACC,OAAO,EAAGT;QAAmB,CAAE,CAAC;MAAA,CAC7B,CAAC;IAAA,CACI;EAAC,CACN,CAAC;AAErB","ignoreList":[]}
|
|
@@ -23,7 +23,6 @@ var _store = require("../../store");
|
|
|
23
23
|
var _globalStylesRenderer = require("../global-styles-renderer");
|
|
24
24
|
var _canvasLoader = _interopRequireDefault(require("../canvas-loader"));
|
|
25
25
|
var _lockUnlock = require("../../lock-unlock");
|
|
26
|
-
var _templatePartConverter = _interopRequireDefault(require("../template-part-converter"));
|
|
27
26
|
var _useSiteEditorSettings = require("../block-editor/use-site-editor-settings");
|
|
28
27
|
var _pluginTemplateSettingPanel = _interopRequireDefault(require("../plugin-template-setting-panel"));
|
|
29
28
|
var _globalStylesSidebar = _interopRequireDefault(require("../global-styles-sidebar"));
|
|
@@ -65,7 +64,6 @@ function EditSiteEditor({
|
|
|
65
64
|
editedPostId,
|
|
66
65
|
contextPostType,
|
|
67
66
|
contextPostId,
|
|
68
|
-
editorMode,
|
|
69
67
|
canvasMode,
|
|
70
68
|
isEditingPage,
|
|
71
69
|
supportsGlobalStyles,
|
|
@@ -74,6 +72,7 @@ function EditSiteEditor({
|
|
|
74
72
|
currentPostIsTrashed
|
|
75
73
|
} = (0, _data.useSelect)(select => {
|
|
76
74
|
const {
|
|
75
|
+
getEditorCanvasContainerView,
|
|
77
76
|
getEditedPostContext,
|
|
78
77
|
getCanvasMode,
|
|
79
78
|
isPage,
|
|
@@ -86,9 +85,6 @@ function EditSiteEditor({
|
|
|
86
85
|
const {
|
|
87
86
|
getCurrentTheme
|
|
88
87
|
} = select(_coreData.store);
|
|
89
|
-
const {
|
|
90
|
-
getEditorMode
|
|
91
|
-
} = select(_editor.store);
|
|
92
88
|
const _context = getEditedPostContext();
|
|
93
89
|
|
|
94
90
|
// The currently selected entity to display.
|
|
@@ -98,12 +94,11 @@ function EditSiteEditor({
|
|
|
98
94
|
editedPostId: getEditedPostId(),
|
|
99
95
|
contextPostType: _context?.postId ? _context.postType : undefined,
|
|
100
96
|
contextPostId: _context?.postId ? _context.postId : undefined,
|
|
101
|
-
editorMode: getEditorMode(),
|
|
102
97
|
canvasMode: getCanvasMode(),
|
|
103
98
|
isEditingPage: isPage(),
|
|
104
99
|
supportsGlobalStyles: getCurrentTheme()?.is_block_theme,
|
|
105
100
|
showIconLabels: get('core', 'showIconLabels'),
|
|
106
|
-
editorCanvasView:
|
|
101
|
+
editorCanvasView: getEditorCanvasContainerView(),
|
|
107
102
|
currentPostIsTrashed: select(_editor.store).getCurrentPostAttribute('status') === 'trash'
|
|
108
103
|
};
|
|
109
104
|
}, []);
|
|
@@ -111,17 +106,14 @@ function EditSiteEditor({
|
|
|
111
106
|
const _isPreviewingTheme = (0, _isPreviewingTheme2.isPreviewingTheme)();
|
|
112
107
|
const hasDefaultEditorCanvasView = !(0, _editorCanvasContainer.useHasEditorCanvasContainer)();
|
|
113
108
|
const iframeProps = (0, _useEditorIframeProps.default)();
|
|
114
|
-
const isViewMode = canvasMode === 'view';
|
|
115
109
|
const isEditMode = canvasMode === 'edit';
|
|
116
|
-
const showVisualEditor = isViewMode || editorMode === 'visual';
|
|
117
110
|
const postWithTemplate = !!contextPostId;
|
|
118
111
|
const loadingProgressId = (0, _compose.useInstanceId)(_canvasLoader.default, 'edit-site-editor__loading-progress');
|
|
119
112
|
const settings = (0, _useSiteEditorSettings.useSpecificEditorSettings)();
|
|
120
113
|
const styles = (0, _element.useMemo)(() => [...settings.styles, {
|
|
121
114
|
// Forming a "block formatting context" to prevent margin collapsing.
|
|
122
115
|
// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
|
|
123
|
-
|
|
124
|
-
css: `body{${canvasMode === 'view' ? `min-height: 100vh; ${currentPostIsTrashed ? '' : 'cursor: pointer;'}` : ''}}}`
|
|
116
|
+
css: canvasMode === 'view' ? `body{min-height: 100vh; ${currentPostIsTrashed ? '' : 'cursor: pointer;'}}` : undefined
|
|
125
117
|
}], [settings.styles, canvasMode, currentPostIsTrashed]);
|
|
126
118
|
const {
|
|
127
119
|
setCanvasMode
|
|
@@ -164,9 +156,15 @@ function EditSiteEditor({
|
|
|
164
156
|
break;
|
|
165
157
|
}
|
|
166
158
|
}, [history, createSuccessNotice]);
|
|
159
|
+
|
|
160
|
+
// Replace the title and icon displayed in the DocumentBar when there's an overlay visible.
|
|
161
|
+
const {
|
|
162
|
+
title,
|
|
163
|
+
icon
|
|
164
|
+
} = (0, _editorCanvasContainer.getEditorCanvasContainerTitleAndIcon)(editorCanvasView);
|
|
167
165
|
const isReady = !isLoading;
|
|
168
166
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
169
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_globalStylesRenderer.GlobalStylesRenderer, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.EditorKeyboardShortcutsRegister, {}), isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockKeyboardShortcuts, {}),
|
|
167
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_globalStylesRenderer.GlobalStylesRenderer, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.EditorKeyboardShortcutsRegister, {}), isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockKeyboardShortcuts, {}), !isReady ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_canvasLoader.default, {
|
|
170
168
|
id: loadingProgressId
|
|
171
169
|
}) : null, isEditMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_welcomeGuide.default, {}), isReady && /*#__PURE__*/(0, _jsxRuntime.jsxs)(Editor, {
|
|
172
170
|
postType: postWithTemplate ? contextPostType : editedPostType,
|
|
@@ -182,7 +180,8 @@ function EditSiteEditor({
|
|
|
182
180
|
size: "compact"
|
|
183
181
|
}),
|
|
184
182
|
forceDisableBlockTools: !hasDefaultEditorCanvasView,
|
|
185
|
-
title:
|
|
183
|
+
title: title,
|
|
184
|
+
icon: icon,
|
|
186
185
|
iframeProps: iframeProps,
|
|
187
186
|
onActionPerformed: onActionPerformed,
|
|
188
187
|
extraSidebarPanels: !isEditingPage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_pluginTemplateSettingPanel.default.Slot, {}),
|
|
@@ -1 +1 @@
|
|
|
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\t</Button>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</BackButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<SiteEditorMoreMenu />\n\t\t\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t\t\t</Editor>\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;AACA,IAAAY,aAAA,GAAAZ,OAAA;AAKA,IAAAa,aAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,qBAAA,GAAAf,OAAA;AACA,IAAAgB,aAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IAAAiB,WAAA,GAAAjB,OAAA;AACA,IAAAkB,sBAAA,GAAAnB,sBAAA,CAAAC,OAAA;AACA,IAAAmB,sBAAA,GAAAnB,OAAA;AACA,IAAAoB,2BAAA,GAAArB,sBAAA,CAAAC,OAAA;AACA,IAAAqB,oBAAA,GAAAtB,sBAAA,CAAAC,OAAA;AACA,IAAAsB,mBAAA,GAAAtB,OAAA;AACA,IAAAuB,sBAAA,GAAAvB,OAAA;AAIA,IAAAwB,WAAA,GAAAzB,sBAAA,CAAAC,OAAA;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AAmB,IAAE,CAAC;IAAA,CAC1C,CACR;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","_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","canvasMode","isEditingPage","supportsGlobalStyles","showIconLabels","editorCanvasView","currentPostIsTrashed","useSelect","select","getEditorCanvasContainerView","getEditedPostContext","getCanvasMode","isPage","getEditedPostType","getEditedPostId","editSiteStore","get","preferencesStore","getCurrentTheme","coreDataStore","_context","postId","postType","undefined","is_block_theme","editorStore","getCurrentPostAttribute","useEditorTitle","_isPreviewingTheme","isPreviewingTheme","hasDefaultEditorCanvasView","useHasEditorCanvasContainer","iframeProps","useEditorIframeProps","isEditMode","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","icon","getEditorCanvasContainerTitleAndIcon","isReady","jsxs","Fragment","children","jsx","GlobalStylesRenderer","EditorKeyboardShortcutsRegister","default","templateId","className","clsx","enableRegionNavigation","customSaveButton","size","forceDisableBlockTools","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 { 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\tgetEditorCanvasContainerTitleAndIcon,\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\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\tgetEditorCanvasContainerView,\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 _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\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: 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 isEditMode = canvasMode === 'edit';\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\t\t\t\tcss:\n\t\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t\t? `body{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: undefined,\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\t// Replace the title and icon displayed in the DocumentBar when there's an overlay visible.\n\tconst { title, icon } =\n\t\tgetEditorCanvasContainerTitleAndIcon( editorCanvasView );\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{ ! 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={ title }\n\t\t\t\t\ticon={ icon }\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\t</Button>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</BackButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<SiteEditorMoreMenu />\n\t\t\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t\t\t</Editor>\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,GAA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C,CAAE;QAAC,CACzD;MACR,CAES,CACZ,eACD,IAAA5F,WAAA,CAAAuF,GAAA,EAAC3F,SAAA,CAAA8F,OAAkB,IAAE,CAAC,EACpBzE,oBAAoB,iBAAI,IAAAjB,WAAA,CAAAuF,GAAA,EAAC/F,oBAAA,CAAAkG,OAAmB,IAAE,CAAC;IAAA,CAC1C,CACR;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
exports.
|
|
7
|
+
exports.getEditorCanvasContainerTitleAndIcon = getEditorCanvasContainerTitleAndIcon;
|
|
8
8
|
exports.useHasEditorCanvasContainer = useHasEditorCanvasContainer;
|
|
9
9
|
var _element = require("@wordpress/element");
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
@@ -36,17 +36,26 @@ const {
|
|
|
36
36
|
*
|
|
37
37
|
* @param {string} view Editor canvas container view.
|
|
38
38
|
*
|
|
39
|
-
* @return {
|
|
39
|
+
* @return {Object} Translated string for the view title and associated icon, both defaulting to ''.
|
|
40
40
|
*/
|
|
41
|
-
function
|
|
41
|
+
function getEditorCanvasContainerTitleAndIcon(view) {
|
|
42
42
|
switch (view) {
|
|
43
43
|
case 'style-book':
|
|
44
|
-
return
|
|
44
|
+
return {
|
|
45
|
+
title: (0, _i18n.__)('Style Book'),
|
|
46
|
+
icon: _icons.seen
|
|
47
|
+
};
|
|
45
48
|
case 'global-styles-revisions':
|
|
46
49
|
case 'global-styles-revisions:style-book':
|
|
47
|
-
return
|
|
50
|
+
return {
|
|
51
|
+
title: (0, _i18n.__)('Style Revisions'),
|
|
52
|
+
icon: _icons.backup
|
|
53
|
+
};
|
|
48
54
|
default:
|
|
49
|
-
return
|
|
55
|
+
return {
|
|
56
|
+
title: '',
|
|
57
|
+
icon: ''
|
|
58
|
+
};
|
|
50
59
|
}
|
|
51
60
|
}
|
|
52
61
|
function EditorCanvasContainer({
|
|
@@ -97,7 +106,9 @@ function EditorCanvasContainer({
|
|
|
97
106
|
if (isClosed) {
|
|
98
107
|
return null;
|
|
99
108
|
}
|
|
100
|
-
const
|
|
109
|
+
const {
|
|
110
|
+
title
|
|
111
|
+
} = getEditorCanvasContainerTitleAndIcon(editorCanvasContainerView);
|
|
101
112
|
const shouldShowCloseButton = onClose || closeButtonLabel;
|
|
102
113
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(EditorContentSlotFill.Fill, {
|
|
103
114
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_components","_keycodes","_i18n","_data","_icons","_compose","_preferences","_editor","_lockUnlock","_store","_jsxRuntime","EditorContentSlotFill","ResizableEditor","unlock","editorPrivateApis","
|
|
1
|
+
{"version":3,"names":["_element","require","_components","_keycodes","_i18n","_data","_icons","_compose","_preferences","_editor","_lockUnlock","_store","_jsxRuntime","EditorContentSlotFill","ResizableEditor","unlock","editorPrivateApis","getEditorCanvasContainerTitleAndIcon","view","title","__","icon","seen","backup","EditorCanvasContainer","children","closeButtonLabel","onClose","enableResizing","editorCanvasContainerView","showListViewByDefault","useSelect","select","_editorCanvasContainerView","editSiteStore","getEditorCanvasContainerView","_showListViewByDefault","preferencesStore","get","isClosed","setIsClosed","useState","setEditorCanvasContainerView","useDispatch","setIsListViewOpened","editorStore","focusOnMountRef","useFocusOnMount","sectionFocusReturnRef","useFocusReturn","onCloseContainer","undefined","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","childrenWithProps","Array","isArray","Children","map","child","index","cloneElement","ref","shouldShowCloseButton","jsx","Fill","className","jsxs","onKeyDown","Button","closeSmall","label","onClick","useHasEditorCanvasContainer","fills","useSlotFills","privateKey","length","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/editor-canvas-container/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, useState } from '@wordpress/element';\nimport {\n\tButton,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { backup, closeSmall, seen } from '@wordpress/icons';\nimport { useFocusOnMount, useFocusReturn } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nconst { EditorContentSlotFill, ResizableEditor } = unlock( editorPrivateApis );\n\n/**\n * Returns a translated string for the title of the editor canvas container.\n *\n * @param {string} view Editor canvas container view.\n *\n * @return {Object} Translated string for the view title and associated icon, both defaulting to ''.\n */\nfunction getEditorCanvasContainerTitleAndIcon( view ) {\n\tswitch ( view ) {\n\t\tcase 'style-book':\n\t\t\treturn {\n\t\t\t\ttitle: __( 'Style Book' ),\n\t\t\t\ticon: seen,\n\t\t\t};\n\t\tcase 'global-styles-revisions':\n\t\tcase 'global-styles-revisions:style-book':\n\t\t\treturn {\n\t\t\t\ttitle: __( 'Style Revisions' ),\n\t\t\t\ticon: backup,\n\t\t\t};\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\ttitle: '',\n\t\t\t\ticon: '',\n\t\t\t};\n\t}\n}\n\nfunction EditorCanvasContainer( {\n\tchildren,\n\tcloseButtonLabel,\n\tonClose,\n\tenableResizing = false,\n} ) {\n\tconst { editorCanvasContainerView, showListViewByDefault } = useSelect(\n\t\t( select ) => {\n\t\t\tconst _editorCanvasContainerView = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView();\n\n\t\t\tconst _showListViewByDefault = select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showListViewByDefault'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\teditorCanvasContainerView: _editorCanvasContainerView,\n\t\t\t\tshowListViewByDefault: _showListViewByDefault,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\n\tfunction onCloseContainer() {\n\t\tsetIsListViewOpened( showListViewByDefault );\n\t\tsetEditorCanvasContainerView( undefined );\n\t\tsetIsClosed( true );\n\t\tif ( typeof onClose === 'function' ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonCloseContainer();\n\t\t}\n\t}\n\n\tconst childrenWithProps = Array.isArray( children )\n\t\t? Children.map( children, ( child, index ) =>\n\t\t\t\tindex === 0\n\t\t\t\t\t? cloneElement( child, {\n\t\t\t\t\t\t\tref: sectionFocusReturnRef,\n\t\t\t\t\t } )\n\t\t\t\t\t: child\n\t\t )\n\t\t: cloneElement( children, {\n\t\t\t\tref: sectionFocusReturnRef,\n\t\t } );\n\n\tif ( isClosed ) {\n\t\treturn null;\n\t}\n\n\tconst { title } = getEditorCanvasContainerTitleAndIcon(\n\t\teditorCanvasContainerView\n\t);\n\tconst shouldShowCloseButton = onClose || closeButtonLabel;\n\n\treturn (\n\t\t<EditorContentSlotFill.Fill>\n\t\t\t<div className=\"edit-site-editor-canvas-container\">\n\t\t\t\t<ResizableEditor enableResizing={ enableResizing }>\n\t\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t\t\t<section\n\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__section\"\n\t\t\t\t\t\tref={ shouldShowCloseButton ? focusOnMountRef : null }\n\t\t\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\t\t\taria-label={ title }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ shouldShowCloseButton && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__close-button\"\n\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\tlabel={ closeButtonLabel || __( 'Close' ) }\n\t\t\t\t\t\t\t\tonClick={ onCloseContainer }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ childrenWithProps }\n\t\t\t\t\t</section>\n\t\t\t\t</ResizableEditor>\n\t\t\t</div>\n\t\t</EditorContentSlotFill.Fill>\n\t);\n}\n\nfunction useHasEditorCanvasContainer() {\n\tconst fills = useSlotFills( EditorContentSlotFill.privateKey );\n\treturn !! fills?.length;\n}\n\nexport default EditorCanvasContainer;\nexport { useHasEditorCanvasContainer, getEditorCanvasContainerTitleAndIcon };\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAQA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAAqD,IAAAW,WAAA,GAAAX,OAAA;AAvBrD;AACA;AACA;;AAiBA;AACA;AACA;;AAIA,MAAM;EAAEY,qBAAqB;EAAEC;AAAgB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,oCAAoCA,CAAEC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CAA4C;UACtDJ,GAAG,EAAGC,qBAAqB,GAAGrB,eAAe,GAAG,IAAM;UACtD0B,SAAS,EAAGpB,aAAe;UAC3B,cAAajC,KAAO;UAAAM,QAAA,GAElB0C,qBAAqB,iBACtB,IAAAvD,WAAA,CAAAwD,GAAA,EAAClE,WAAA,CAAAuE,MAAM;YACNH,SAAS,EAAC,iDAAiD;YAC3DjD,IAAI,EAAGqD,iBAAY;YACnBC,KAAK,EAAGjD,gBAAgB,IAAI,IAAAN,QAAE,EAAE,OAAQ,CAAG;YAC3CwD,OAAO,EAAG1B;UAAkB,CAC5B,CACD,EACCQ,iBAAiB;QAAA,CACX;MAAC,CACM;IAAC,CACd;EAAC,CACqB,CAAC;AAE/B;AAEA,SAASmB,2BAA2BA,CAAA,EAAG;EACtC,MAAMC,KAAK,GAAG,IAAAC,sCAAY,EAAElE,qBAAqB,CAACmE,UAAW,CAAC;EAC9D,OAAO,CAAC,CAAEF,KAAK,EAAEG,MAAM;AACxB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc5D,qBAAqB","ignoreList":[]}
|
|
@@ -8,7 +8,6 @@ exports.default = void 0;
|
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
10
|
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
-
var _icons = require("@wordpress/icons");
|
|
12
11
|
var _element = require("@wordpress/element");
|
|
13
12
|
var _context = _interopRequireWildcard(require("./font-library-modal/context"));
|
|
14
13
|
var _fontLibraryModal = _interopRequireDefault(require("./font-library-modal"));
|
|
@@ -49,29 +48,30 @@ function FontFamilies() {
|
|
|
49
48
|
defaultTabId: modalTabOpen
|
|
50
49
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
51
50
|
spacing: 2,
|
|
52
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
53
|
-
|
|
54
|
-
children:
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_subtitle.default, {
|
|
52
|
+
level: 3,
|
|
53
|
+
children: (0, _i18n.__)('Fonts')
|
|
54
|
+
}), hasFonts ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
55
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalItemGroup, {
|
|
56
|
+
isBordered: true,
|
|
57
|
+
isSeparated: true,
|
|
58
|
+
children: [customFonts.map(font => /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontFamilyItem.default, {
|
|
59
|
+
font: font
|
|
60
|
+
}, font.slug)), themeFonts.map(font => /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontFamilyItem.default, {
|
|
61
|
+
font: font
|
|
62
|
+
}, font.slug))]
|
|
57
63
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
64
|
+
className: "edit-site-global-styles-font-families__manage-fonts",
|
|
65
|
+
variant: "secondary",
|
|
66
|
+
__next40pxDefaultSize: true,
|
|
58
67
|
onClick: () => setModalTabOpen('installed-fonts'),
|
|
59
|
-
|
|
60
|
-
icon: _icons.settings,
|
|
61
|
-
size: "small"
|
|
68
|
+
children: (0, _i18n.__)('Manage fonts')
|
|
62
69
|
})]
|
|
63
|
-
}), hasFonts ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalItemGroup, {
|
|
64
|
-
isBordered: true,
|
|
65
|
-
isSeparated: true,
|
|
66
|
-
children: [customFonts.map(font => /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontFamilyItem.default, {
|
|
67
|
-
font: font
|
|
68
|
-
}, font.slug)), themeFonts.map(font => /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontFamilyItem.default, {
|
|
69
|
-
font: font
|
|
70
|
-
}, font.slug))]
|
|
71
70
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
72
71
|
children: [(0, _i18n.__)('No fonts installed.'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
73
72
|
className: "edit-site-global-styles-font-families__add-fonts",
|
|
74
73
|
variant: "secondary",
|
|
74
|
+
__next40pxDefaultSize: true,
|
|
75
75
|
onClick: () => setModalTabOpen('upload-fonts'),
|
|
76
76
|
children: (0, _i18n.__)('Add fonts')
|
|
77
77
|
})]
|