@wordpress/edit-site 6.34.1-next.2f1c7c01b.0 → 6.35.1-next.16d95556a.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 +2 -0
- package/build/components/editor/index.js +9 -18
- package/build/components/editor/index.js.map +2 -2
- package/build/components/page-patterns/index.js +1 -1
- package/build/components/page-patterns/index.js.map +2 -2
- package/build/index.js +0 -3
- package/build/index.js.map +2 -2
- package/build-module/components/editor/index.js +9 -18
- package/build-module/components/editor/index.js.map +2 -2
- package/build-module/components/page-patterns/index.js +1 -1
- package/build-module/components/page-patterns/index.js.map +2 -2
- package/build-module/index.js +0 -2
- package/build-module/index.js.map +2 -2
- package/build-style/style-rtl.css +41 -40
- package/build-style/style.css +41 -40
- package/package.json +46 -46
- package/src/components/editor/index.js +11 -27
- package/src/components/page-patterns/index.js +1 -1
- package/src/index.js +0 -4
- package/build/components/posts-app/index.js +0 -51
- package/build/components/posts-app/index.js.map +0 -7
- package/build/components/posts-app-routes/index.js +0 -46
- package/build/components/posts-app-routes/index.js.map +0 -7
- package/build/components/posts-app-routes/post-item.js +0 -61
- package/build/components/posts-app-routes/post-item.js.map +0 -7
- package/build/components/posts-app-routes/posts.js +0 -106
- package/build/components/posts-app-routes/posts.js.map +0 -7
- package/build/posts.js +0 -96
- package/build/posts.js.map +0 -7
- package/build-module/components/posts-app/index.js +0 -20
- package/build-module/components/posts-app/index.js.map +0 -7
- package/build-module/components/posts-app-routes/index.js +0 -21
- package/build-module/components/posts-app-routes/index.js.map +0 -7
- package/build-module/components/posts-app-routes/post-item.js +0 -26
- package/build-module/components/posts-app-routes/post-item.js.map +0 -7
- package/build-module/components/posts-app-routes/posts.js +0 -71
- package/build-module/components/posts-app-routes/posts.js.map +0 -7
- package/build-module/posts.js +0 -68
- package/build-module/posts.js.map +0 -7
- package/build-style/posts-rtl.css +0 -3105
- package/build-style/posts.css +0 -3105
- package/src/components/posts-app/index.js +0 -27
- package/src/components/posts-app-routes/index.js +0 -25
- package/src/components/posts-app-routes/post-item.js +0 -27
- package/src/components/posts-app-routes/posts.js +0 -79
- package/src/posts.js +0 -91
- package/src/posts.scss +0 -57
package/CHANGELOG.md
CHANGED
|
@@ -121,10 +121,7 @@ function getNavigationPath(location, postType) {
|
|
|
121
121
|
}
|
|
122
122
|
return (0, import_url.addQueryArgs)(path, { canvas: void 0 });
|
|
123
123
|
}
|
|
124
|
-
function EditSiteEditor({
|
|
125
|
-
isHomeRoute = false,
|
|
126
|
-
isPostsList = false
|
|
127
|
-
}) {
|
|
124
|
+
function EditSiteEditor({ isHomeRoute = false }) {
|
|
128
125
|
const disableMotion = (0, import_compose.useReducedMotion)();
|
|
129
126
|
const location = useLocation();
|
|
130
127
|
const { canvas = "view" } = location.query;
|
|
@@ -254,21 +251,15 @@ function EditSiteEditor({
|
|
|
254
251
|
tooltipPosition: "middle right",
|
|
255
252
|
onClick: () => {
|
|
256
253
|
resetZoomLevel();
|
|
257
|
-
|
|
258
|
-
|
|
254
|
+
history.navigate(
|
|
255
|
+
getNavigationPath(
|
|
256
|
+
location,
|
|
257
|
+
postWithTemplate ? context.postType : postType
|
|
258
|
+
),
|
|
259
|
+
{
|
|
259
260
|
transition: "canvas-mode-view-transition"
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
history.navigate(
|
|
263
|
-
getNavigationPath(
|
|
264
|
-
location,
|
|
265
|
-
postWithTemplate ? context.postType : postType
|
|
266
|
-
),
|
|
267
|
-
{
|
|
268
|
-
transition: "canvas-mode-view-transition"
|
|
269
|
-
}
|
|
270
|
-
);
|
|
271
|
-
}
|
|
261
|
+
}
|
|
262
|
+
);
|
|
272
263
|
},
|
|
273
264
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
274
265
|
import_components.__unstableMotion.div,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\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 } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, arrowUpLeft } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\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 { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\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';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\nimport SitePreview from './site-preview';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst toggleHomeIconVariants = {\n\tedit: {\n\t\topacity: 0,\n\t\tscale: 0.2,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n};\n\nconst siteIconVariants = {\n\tedit: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n\thover: {\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n\ttap: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n};\n\nfunction getListPathForPostType( postType ) {\n\tswitch ( postType ) {\n\t\tcase 'navigation':\n\t\t\treturn '/navigation';\n\t\tcase 'wp_block':\n\t\t\treturn '/pattern?postType=wp_block';\n\t\tcase 'wp_template_part':\n\t\t\treturn '/pattern?postType=wp_template_part';\n\t\tcase 'wp_template':\n\t\t\treturn '/template';\n\t\tcase 'page':\n\t\t\treturn '/page';\n\t\tcase 'post':\n\t\t\treturn '/';\n\t}\n\tthrow 'Unknown post type';\n}\n\nfunction getNavigationPath( location, postType ) {\n\tconst { path, name } = location;\n\tif (\n\t\t[\n\t\t\t'pattern-item',\n\t\t\t'template-part-item',\n\t\t\t'page-item',\n\t\t\t'template-item',\n\t\t\t'static-template-item',\n\t\t\t'post-item',\n\t\t].includes( name )\n\t) {\n\t\treturn getListPathForPostType( postType );\n\t}\n\treturn addQueryArgs( path, { canvas: undefined } );\n}\n\nexport default function EditSiteEditor( {\n\tisHomeRoute = false,\n\tisPostsList = false,\n} ) {\n\tconst disableMotion = useReducedMotion();\n\tconst location = useLocation();\n\tconst { canvas = 'view' } = location.query;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst { isBlockBasedTheme, hasSiteIcon } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase', undefined );\n\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\thasSiteIcon: !! siteData?.site_icon_url,\n\t\t};\n\t}, [] );\n\tconst postWithTemplate = !! context?.postId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? context.postType : postType,\n\t\tpostWithTemplate ? context.postId : postId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\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.navigate(\n\t\t\t\t\t\t\tgetListPathForPostType(\n\t\t\t\t\t\t\t\tpostWithTemplate ? context.postType : postType\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\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 or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title ) || __( '(no 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.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=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[\n\t\t\tpostType,\n\t\t\tcontext?.postType,\n\t\t\tpostWithTemplate,\n\t\t\thistory,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\tconst isReady = ! isLoading;\n\tconst transition = {\n\t\tduration: disableMotion ? 0 : 0.2,\n\t};\n\n\treturn ! isBlockBasedTheme && isHomeRoute ? (\n\t\t<SitePreview />\n\t) : (\n\t\t<>\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 && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName=\"edit-site-editor__editor-interface\"\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\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\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! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\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<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\t\t\t\t\tanimate=\"edit\"\n\t\t\t\t\t\t\t\t\t\tinitial=\"edit\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\n\t\t\t\t\t\t\t\t\t\t\t\t// TODO: this is a temporary solution to navigate to the posts list if we are\n\t\t\t\t\t\t\t\t\t\t\t\t// come here through `posts list` and are in focus mode editing a template, template part etc..\n\t\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\t\tisPostsList &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.query?.focusMode\n\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate( '/', {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetNavigationPath(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostWithTemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? context.postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}\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\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tvariants={ siteIconVariants }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-editor__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-editor__back-icon',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'has-site-icon':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thasSiteIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvariants={ toggleHomeIconVariants }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ arrowUpLeft } />\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t</motion.div>\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</Editor>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAuC;AACvC,wBAAmD;AACnD,qBAAgD;AAChD,oBAGO;AACP,kBAA4B;AAC5B,uBAAuC;AACvC,2BAAuD;AACvD,qBAA4B;AAC5B,qBAAsC;AACtC,oBAAiD;AACjD,2BAA+B;AAC/B,mBAAkC;AAClC,0BAA0C;AAC1C,iBAA6B;AAK7B,2BAAyB;AACzB,2BAAyB;AACzB,yBAAuB;AACvB,sCAA0C;AAC1C,2CAAuC;AACvC,iCAAkC;AAClC,yBAAuB;AACvB,wBAAsB;AACtB,uBAA+B;AAC/B,uBAAqB;AACrB,qCAAiC;AACjC,8BAA2B;AAC3B,mBAAuC;AACvC,wCAAuC;AACvC,uCAGO;AACP,0BAAwB;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\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 } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, arrowUpLeft } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\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 { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\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';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\nimport SitePreview from './site-preview';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst toggleHomeIconVariants = {\n\tedit: {\n\t\topacity: 0,\n\t\tscale: 0.2,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n};\n\nconst siteIconVariants = {\n\tedit: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n\thover: {\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n\ttap: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n};\n\nfunction getListPathForPostType( postType ) {\n\tswitch ( postType ) {\n\t\tcase 'navigation':\n\t\t\treturn '/navigation';\n\t\tcase 'wp_block':\n\t\t\treturn '/pattern?postType=wp_block';\n\t\tcase 'wp_template_part':\n\t\t\treturn '/pattern?postType=wp_template_part';\n\t\tcase 'wp_template':\n\t\t\treturn '/template';\n\t\tcase 'page':\n\t\t\treturn '/page';\n\t\tcase 'post':\n\t\t\treturn '/';\n\t}\n\tthrow 'Unknown post type';\n}\n\nfunction getNavigationPath( location, postType ) {\n\tconst { path, name } = location;\n\tif (\n\t\t[\n\t\t\t'pattern-item',\n\t\t\t'template-part-item',\n\t\t\t'page-item',\n\t\t\t'template-item',\n\t\t\t'static-template-item',\n\t\t\t'post-item',\n\t\t].includes( name )\n\t) {\n\t\treturn getListPathForPostType( postType );\n\t}\n\treturn addQueryArgs( path, { canvas: undefined } );\n}\n\nexport default function EditSiteEditor( { isHomeRoute = false } ) {\n\tconst disableMotion = useReducedMotion();\n\tconst location = useLocation();\n\tconst { canvas = 'view' } = location.query;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst { isBlockBasedTheme, hasSiteIcon } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase', undefined );\n\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\thasSiteIcon: !! siteData?.site_icon_url,\n\t\t};\n\t}, [] );\n\tconst postWithTemplate = !! context?.postId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? context.postType : postType,\n\t\tpostWithTemplate ? context.postId : postId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\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.navigate(\n\t\t\t\t\t\t\tgetListPathForPostType(\n\t\t\t\t\t\t\t\tpostWithTemplate ? context.postType : postType\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\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 or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title ) || __( '(no 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.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=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[\n\t\t\tpostType,\n\t\t\tcontext?.postType,\n\t\t\tpostWithTemplate,\n\t\t\thistory,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\tconst isReady = ! isLoading;\n\tconst transition = {\n\t\tduration: disableMotion ? 0 : 0.2,\n\t};\n\n\treturn ! isBlockBasedTheme && isHomeRoute ? (\n\t\t<SitePreview />\n\t) : (\n\t\t<>\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 && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName=\"edit-site-editor__editor-interface\"\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\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\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! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\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<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\t\t\t\t\tanimate=\"edit\"\n\t\t\t\t\t\t\t\t\t\tinitial=\"edit\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t\tgetNavigationPath(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostWithTemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? context.postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t);\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\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tvariants={ siteIconVariants }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-editor__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-editor__back-icon',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'has-site-icon':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thasSiteIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvariants={ toggleHomeIconVariants }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ arrowUpLeft } />\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t</motion.div>\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</Editor>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;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D,iBAAO;AAAA,kBAAP;AAAA,oBACA,eAAY,YAAAE;AAAA,sBACX;AAAA,sBACA;AAAA,wBACC,iBACC;AAAA,sBACF;AAAA,oBACD;AAAA,oBACA,UAAW;AAAA,oBAEX,sDAAC,qBAAK,MAAO,0BAAc;AAAA;AAAA,gBAC5B;AAAA;AAAA;AAAA,UACD,GAGH;AAAA,UAED,4CAAC,iBAAAC,SAAA,EAAmB;AAAA;AAAA;AAAA,IACrB;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": ["editorPrivateApis", "routerPrivateApis", "blockLibraryPrivateApis", "coreDataStore", "useEditorTitle", "useEditorIframeProps", "CanvasLoader", "blockEditorStore", "noticesStore", "SitePreview", "WelcomeGuide", "SaveButton", "SavePanel", "PluginTemplateSettingPanel", "motion", "SiteIcon", "clsx", "SiteEditorMoreMenu"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/page-patterns/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Page } from '@wordpress/admin-ui';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useView } from '@wordpress/views';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_DEFAULT_CATEGORY,\n} from '../../utils/constants';\nimport usePatternSettings from './use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\nimport usePatterns, { useAugmentPatternsWithPermissions } from './use-patterns';\nimport PatternsActions from './actions';\nimport { useEditPostAction } from '../dataviews-actions';\nimport {\n\tpatternStatusField,\n\tpreviewField,\n\ttemplatePartAuthorField,\n} from './fields';\nimport { addQueryArgs } from '@wordpress/url';\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\nimport { Button } from '@wordpress/components';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { usePostActions, patternTitleField } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\nconst defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tlayout: {\n\t\t\tstyles: {\n\t\t\t\tauthor: {\n\t\t\t\t\twidth: '1%',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tlayout: {\n\t\t\tbadgeFields: [ 'sync-status' ],\n\t\t},\n\t},\n};\nconst DEFAULT_VIEW = {\n\ttype: LAYOUT_GRID,\n\tperPage: 20,\n\ttitleField: 'title',\n\tmediaField: 'preview',\n\tfields: [ 'sync-status' ],\n\tfilters: [],\n\t...defaultLayouts[ LAYOUT_GRID ],\n};\n\nfunction usePagePatternsHeader( type, categoryId ) {\n\tconst { patternCategories } = usePatternCategories();\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\tlet title, description, patternCategory;\n\tif ( type === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === categoryId\n\t\t);\n\t\ttitle = templatePartArea?.label || __( 'All Template Parts' );\n\t\tdescription =\n\t\t\ttemplatePartArea?.description ||\n\t\t\t__( 'Includes every template part defined for any area.' );\n\t} else if ( type === PATTERN_TYPES.user && !! categoryId ) {\n\t\tpatternCategory = patternCategories.find(\n\t\t\t( category ) => category.name === categoryId\n\t\t);\n\t\ttitle = patternCategory?.label;\n\t\tdescription = patternCategory?.description;\n\t}\n\n\treturn { title, description };\n}\n\nexport default function DataviewsPatterns() {\n\tconst { path, query } = useLocation();\n\tconst { postType = 'wp_block', categoryId: categoryIdFromURL } = query;\n\tconst history = useHistory();\n\tconst categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;\n\tconst { view, updateView, isModified, resetToDefault } = useView( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t\tslug: categoryId,\n\t\tdefaultView: DEFAULT_VIEW,\n\t\tqueryParams: {\n\t\t\tpage:
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAqB;AACrB,kBAAmB;AACnB,qBAAwB;AACxB,0BAAsD;AACtD,uBAAiD;AACjD,uBAAqD;AACrD,oBAAiD;AACjD,oBAAiD;AACjD,mBAAwB;AACxB,kBAA0B;AAK1B,uBAMO;AACP,kCAA+B;AAC/B,yBAAuB;AACvB,0BAA+D;AAC/D,qBAA4B;AAC5B,+BAAkC;AAClC,oBAIO;AACP,iBAA6B;AAC7B,oCAAiC;AACjC,wBAAuB;AA2KlB;AAzKL,IAAM,EAAE,gCAAgC,QAAI,2BAAQ,oBAAAA,WAAuB;AAC3E,IAAM,EAAE,gBAAgB,kBAAkB,QAAI,2BAAQ,cAAAC,WAAkB;AACxE,IAAM,EAAE,aAAa,WAAW,QAAI,2BAAQ,cAAAC,WAAkB;AAE9D,IAAM,cAAc,CAAC;AACrB,IAAM,iBAAiB;AAAA,EACtB,CAAE,6BAAa,GAAG;AAAA,IACjB,QAAQ;AAAA,MACP,QAAQ;AAAA,QACP,QAAQ;AAAA,UACP,OAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,CAAE,4BAAY,GAAG;AAAA,IAChB,QAAQ;AAAA,MACP,aAAa,CAAE,aAAc;AAAA,IAC9B;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-ui';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useView } from '@wordpress/views';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_DEFAULT_CATEGORY,\n} from '../../utils/constants';\nimport usePatternSettings from './use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\nimport usePatterns, { useAugmentPatternsWithPermissions } from './use-patterns';\nimport PatternsActions from './actions';\nimport { useEditPostAction } from '../dataviews-actions';\nimport {\n\tpatternStatusField,\n\tpreviewField,\n\ttemplatePartAuthorField,\n} from './fields';\nimport { addQueryArgs } from '@wordpress/url';\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\nimport { Button } from '@wordpress/components';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { usePostActions, patternTitleField } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\nconst defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tlayout: {\n\t\t\tstyles: {\n\t\t\t\tauthor: {\n\t\t\t\t\twidth: '1%',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tlayout: {\n\t\t\tbadgeFields: [ 'sync-status' ],\n\t\t},\n\t},\n};\nconst DEFAULT_VIEW = {\n\ttype: LAYOUT_GRID,\n\tperPage: 20,\n\ttitleField: 'title',\n\tmediaField: 'preview',\n\tfields: [ 'sync-status' ],\n\tfilters: [],\n\t...defaultLayouts[ LAYOUT_GRID ],\n};\n\nfunction usePagePatternsHeader( type, categoryId ) {\n\tconst { patternCategories } = usePatternCategories();\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\tlet title, description, patternCategory;\n\tif ( type === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === categoryId\n\t\t);\n\t\ttitle = templatePartArea?.label || __( 'All Template Parts' );\n\t\tdescription =\n\t\t\ttemplatePartArea?.description ||\n\t\t\t__( 'Includes every template part defined for any area.' );\n\t} else if ( type === PATTERN_TYPES.user && !! categoryId ) {\n\t\tpatternCategory = patternCategories.find(\n\t\t\t( category ) => category.name === categoryId\n\t\t);\n\t\ttitle = patternCategory?.label;\n\t\tdescription = patternCategory?.description;\n\t}\n\n\treturn { title, description };\n}\n\nexport default function DataviewsPatterns() {\n\tconst { path, query } = useLocation();\n\tconst { postType = 'wp_block', categoryId: categoryIdFromURL } = query;\n\tconst history = useHistory();\n\tconst categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;\n\tconst { view, updateView, isModified, resetToDefault } = useView( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t\tslug: categoryId,\n\t\tdefaultView: DEFAULT_VIEW,\n\t\tqueryParams: {\n\t\t\tpage: query.pageNumber,\n\t\t\tsearch: query.search,\n\t\t},\n\t\tonChangeQueryParams: ( params ) => {\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t...query,\n\t\t\t\t\tpageNumber: params.page,\n\t\t\t\t\tsearch: params.search,\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t} );\n\tconst viewSyncStatus = view.filters?.find(\n\t\t( { field } ) => field === 'sync-status'\n\t)?.value;\n\tconst { patterns, isResolving } = usePatterns( postType, categoryId, {\n\t\tsearch: view.search,\n\t\tsyncStatus: viewSyncStatus,\n\t} );\n\n\tconst { records } = useEntityRecords( 'postType', TEMPLATE_PART_POST_TYPE, {\n\t\tper_page: -1,\n\t} );\n\n\tconst authors = useMemo( () => {\n\t\tif ( ! records ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\tconst authorsSet = new Set();\n\t\trecords.forEach( ( template ) => {\n\t\t\tauthorsSet.add( template.author_text );\n\t\t} );\n\t\treturn Array.from( authorsSet ).map( ( author ) => ( {\n\t\t\tvalue: author,\n\t\t\tlabel: author,\n\t\t} ) );\n\t}, [ records ] );\n\n\tconst fields = useMemo( () => {\n\t\tconst _fields = [ previewField, patternTitleField ];\n\n\t\tif ( postType === PATTERN_TYPES.user ) {\n\t\t\t_fields.push( patternStatusField );\n\t\t} else if ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\t\t_fields.push( {\n\t\t\t\t...templatePartAuthorField,\n\t\t\t\telements: authors,\n\t\t\t} );\n\t\t}\n\n\t\treturn _fields;\n\t}, [ postType, authors ] );\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\t// Search is managed server-side as well as filters for patterns.\n\t\t// However, the author filter in template parts is done client-side.\n\t\tconst viewWithoutFilters = { ...view };\n\t\tdelete viewWithoutFilters.search;\n\t\tif ( postType !== TEMPLATE_PART_POST_TYPE ) {\n\t\t\tviewWithoutFilters.filters = [];\n\t\t}\n\t\treturn filterSortAndPaginate( patterns, viewWithoutFilters, fields );\n\t}, [ patterns, view, fields, postType ] );\n\n\tconst dataWithPermissions = useAugmentPatternsWithPermissions( data );\n\n\tconst templatePartActions = usePostActions( {\n\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\tcontext: 'list',\n\t} );\n\tconst patternActions = usePostActions( {\n\t\tpostType: PATTERN_TYPES.user,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\n\tconst actions = useMemo( () => {\n\t\tif ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\t\treturn [ editAction, ...templatePartActions ].filter( Boolean );\n\t\t}\n\t\treturn [ editAction, ...patternActions ].filter( Boolean );\n\t}, [ editAction, postType, templatePartActions, patternActions ] );\n\tconst settings = usePatternSettings();\n\tconst { title, description } = usePagePatternsHeader(\n\t\tpostType,\n\t\tcategoryId\n\t);\n\n\t// Wrap everything in a block editor provider.\n\t// This ensures 'styles' that are needed for the previews are synced\n\t// from the site editor store to the block editor store.\n\treturn (\n\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t<Page\n\t\t\t\tclassName=\"edit-site-page-patterns-dataviews\"\n\t\t\t\ttitle={ title }\n\t\t\t\tsubTitle={ description }\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isModified && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tonClick={ resetToDefault }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Reset view' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<PatternsActions />\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<DataViews\n\t\t\t\t\tkey={ categoryId + postType }\n\t\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tactions={ actions }\n\t\t\t\t\tdata={ dataWithPermissions || EMPTY_ARRAY }\n\t\t\t\t\tgetItemId={ ( item ) => item.name ?? item.id }\n\t\t\t\t\tisLoading={ isResolving }\n\t\t\t\t\tisItemClickable={ ( item ) =>\n\t\t\t\t\t\titem.type !== PATTERN_TYPES.theme\n\t\t\t\t\t}\n\t\t\t\t\tonClickItem={ ( item ) => {\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t`/${ item.type }/${\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\tPATTERN_TYPES.user,\n\t\t\t\t\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t\t\t\t\t].includes( item.type )\n\t\t\t\t\t\t\t\t\t? item.id\n\t\t\t\t\t\t\t\t\t: item.name\n\t\t\t\t\t\t\t}?canvas=edit`\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t\tview={ view }\n\t\t\t\t\tonChangeView={ updateView }\n\t\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\t/>\n\t\t\t</Page>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAqB;AACrB,kBAAmB;AACnB,qBAAwB;AACxB,0BAAsD;AACtD,uBAAiD;AACjD,uBAAqD;AACrD,oBAAiD;AACjD,oBAAiD;AACjD,mBAAwB;AACxB,kBAA0B;AAK1B,uBAMO;AACP,kCAA+B;AAC/B,yBAAuB;AACvB,0BAA+D;AAC/D,qBAA4B;AAC5B,+BAAkC;AAClC,oBAIO;AACP,iBAA6B;AAC7B,oCAAiC;AACjC,wBAAuB;AA2KlB;AAzKL,IAAM,EAAE,gCAAgC,QAAI,2BAAQ,oBAAAA,WAAuB;AAC3E,IAAM,EAAE,gBAAgB,kBAAkB,QAAI,2BAAQ,cAAAC,WAAkB;AACxE,IAAM,EAAE,aAAa,WAAW,QAAI,2BAAQ,cAAAC,WAAkB;AAE9D,IAAM,cAAc,CAAC;AACrB,IAAM,iBAAiB;AAAA,EACtB,CAAE,6BAAa,GAAG;AAAA,IACjB,QAAQ;AAAA,MACP,QAAQ;AAAA,QACP,QAAQ;AAAA,UACP,OAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,CAAE,4BAAY,GAAG;AAAA,IAChB,QAAQ;AAAA,MACP,aAAa,CAAE,aAAc;AAAA,IAC9B;AAAA,EACD;AACD;AACA,IAAM,eAAe;AAAA,EACpB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AK,IAAK,IACd;AAAA,gBACC,+BAAc;AAAA,gBACd;AAAA,cACD,EAAE,SAAU,KAAK,IAAK,IACnB,KAAK,KACL,KAAK,IACT;AAAA,YACD;AAAA,UACD;AAAA,UACA;AAAA,UACA,cAAe;AAAA,UACf;AAAA;AAAA,QAxBM,aAAa;AAAA,MAyBpB;AAAA;AAAA,EACD,GACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorPrivateApis", "editorPrivateApis", "routerPrivateApis", "usePatternCategories", "coreStore", "usePatterns", "usePatternSettings", "PatternsActions"]
|
|
7
7
|
}
|
package/build/index.js
CHANGED
|
@@ -33,7 +33,6 @@ var index_exports = {};
|
|
|
33
33
|
__export(index_exports, {
|
|
34
34
|
PluginTemplateSettingPanel: () => import_plugin_template_setting_panel.default,
|
|
35
35
|
initializeEditor: () => initializeEditor,
|
|
36
|
-
initializePostsDashboard: () => import_posts.initializePostsDashboard,
|
|
37
36
|
reinitializeEditor: () => reinitializeEditor,
|
|
38
37
|
store: () => import_store2.store
|
|
39
38
|
});
|
|
@@ -52,7 +51,6 @@ var import_app = __toESM(require("./components/app"));
|
|
|
52
51
|
var import_plugin_template_setting_panel = __toESM(require("./components/plugin-template-setting-panel"));
|
|
53
52
|
var import_store2 = require("./store");
|
|
54
53
|
__reExport(index_exports, require("./deprecated"), module.exports);
|
|
55
|
-
var import_posts = require("./posts");
|
|
56
54
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
57
55
|
var { registerCoreBlockBindingsSources } = (0, import_lock_unlock.unlock)(import_editor.privateApis);
|
|
58
56
|
function initializeEditor(id, settings) {
|
|
@@ -116,7 +114,6 @@ function reinitializeEditor() {
|
|
|
116
114
|
0 && (module.exports = {
|
|
117
115
|
PluginTemplateSettingPanel,
|
|
118
116
|
initializeEditor,
|
|
119
|
-
initializePostsDashboard,
|
|
120
117
|
reinitializeEditor,
|
|
121
118
|
store,
|
|
122
119
|
...require("./deprecated")
|
package/build/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from './store';\nimport { unlock } from './lock-unlock';\nimport App from './components/app';\n\nconst { registerCoreBlockBindingsSources } = unlock( editorPrivateApis );\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tregisterCoreBlockBindingsSources();\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\teditorTool: 'edit',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t\tenableChoosePatternModal: true,\n\t} );\n\n\tif ( window.__experimentalMediaProcessing ) {\n\t\tdispatch( preferencesStore ).setDefaults( 'core/media', {\n\t\t\trequireApproval: true,\n\t\t\toptimizeOnUpload: true,\n\t\t} );\n\t}\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<App />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\nexport * from './deprecated';\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from './store';\nimport { unlock } from './lock-unlock';\nimport App from './components/app';\n\nconst { registerCoreBlockBindingsSources } = unlock( editorPrivateApis );\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tregisterCoreBlockBindingsSources();\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\teditorTool: 'edit',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t\tenableChoosePatternModal: true,\n\t} );\n\n\tif ( window.__experimentalMediaProcessing ) {\n\t\tdispatch( preferencesStore ).setDefaults( 'core/media', {\n\t\t\trequireApproval: true,\n\t\t\toptimizeOnUpload: true,\n\t\t} );\n\t}\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<App />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\nexport * from './deprecated';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAqC;AACrC,2BAIO;AACP,kBAAyB;AACzB,wBAAuB;AACvB,qBAAuC;AACvC,oBAAiD;AACjD,yBAA0C;AAC1C,qBAGO;AAKP,mBAAuC;AACvC,yBAAuB;AACvB,iBAAgB;AAkFhB,2CAAsD;AACtD,IAAAA,gBAAsB;AACtB,0BAAc,yBA5Gd;AA4FG;AAlEH,IAAM,EAAE,iCAAiC,QAAI,2BAAQ,cAAAC,WAAkB;AAQhE,SAAS,iBAAkB,IAAI,UAAW;AAChD,QAAM,SAAS,SAAS,eAAgB,EAAG;AAC3C,QAAM,WAAO,2BAAY,MAAO;AAEhC,4BAAU,cAAAC,KAAY,EAAE,wBAAwB;AAChD,QAAM,iBAAa,kDAA4B,EAAE;AAAA,IAChD,CAAE,EAAE,KAAK,MAAO,SAAS;AA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AA,EACV,CAAE;AACH;",
|
|
6
6
|
"names": ["import_store", "editorPrivateApis", "blocksStore", "preferencesStore", "editSiteStore", "App", "deprecated"]
|
|
7
7
|
}
|
|
@@ -93,10 +93,7 @@ function getNavigationPath(location, postType) {
|
|
|
93
93
|
}
|
|
94
94
|
return addQueryArgs(path, { canvas: void 0 });
|
|
95
95
|
}
|
|
96
|
-
function EditSiteEditor({
|
|
97
|
-
isHomeRoute = false,
|
|
98
|
-
isPostsList = false
|
|
99
|
-
}) {
|
|
96
|
+
function EditSiteEditor({ isHomeRoute = false }) {
|
|
100
97
|
const disableMotion = useReducedMotion();
|
|
101
98
|
const location = useLocation();
|
|
102
99
|
const { canvas = "view" } = location.query;
|
|
@@ -226,21 +223,15 @@ function EditSiteEditor({
|
|
|
226
223
|
tooltipPosition: "middle right",
|
|
227
224
|
onClick: () => {
|
|
228
225
|
resetZoomLevel();
|
|
229
|
-
|
|
230
|
-
|
|
226
|
+
history.navigate(
|
|
227
|
+
getNavigationPath(
|
|
228
|
+
location,
|
|
229
|
+
postWithTemplate ? context.postType : postType
|
|
230
|
+
),
|
|
231
|
+
{
|
|
231
232
|
transition: "canvas-mode-view-transition"
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
history.navigate(
|
|
235
|
-
getNavigationPath(
|
|
236
|
-
location,
|
|
237
|
-
postWithTemplate ? context.postType : postType
|
|
238
|
-
),
|
|
239
|
-
{
|
|
240
|
-
transition: "canvas-mode-view-transition"
|
|
241
|
-
}
|
|
242
|
-
);
|
|
243
|
-
}
|
|
233
|
+
}
|
|
234
|
+
);
|
|
244
235
|
},
|
|
245
236
|
children: /* @__PURE__ */ jsx(
|
|
246
237
|
motion.div,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\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 } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, arrowUpLeft } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\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 { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\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';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\nimport SitePreview from './site-preview';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst toggleHomeIconVariants = {\n\tedit: {\n\t\topacity: 0,\n\t\tscale: 0.2,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n};\n\nconst siteIconVariants = {\n\tedit: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n\thover: {\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n\ttap: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n};\n\nfunction getListPathForPostType( postType ) {\n\tswitch ( postType ) {\n\t\tcase 'navigation':\n\t\t\treturn '/navigation';\n\t\tcase 'wp_block':\n\t\t\treturn '/pattern?postType=wp_block';\n\t\tcase 'wp_template_part':\n\t\t\treturn '/pattern?postType=wp_template_part';\n\t\tcase 'wp_template':\n\t\t\treturn '/template';\n\t\tcase 'page':\n\t\t\treturn '/page';\n\t\tcase 'post':\n\t\t\treturn '/';\n\t}\n\tthrow 'Unknown post type';\n}\n\nfunction getNavigationPath( location, postType ) {\n\tconst { path, name } = location;\n\tif (\n\t\t[\n\t\t\t'pattern-item',\n\t\t\t'template-part-item',\n\t\t\t'page-item',\n\t\t\t'template-item',\n\t\t\t'static-template-item',\n\t\t\t'post-item',\n\t\t].includes( name )\n\t) {\n\t\treturn getListPathForPostType( postType );\n\t}\n\treturn addQueryArgs( path, { canvas: undefined } );\n}\n\nexport default function EditSiteEditor( {\n\tisHomeRoute = false,\n\tisPostsList = false,\n} ) {\n\tconst disableMotion = useReducedMotion();\n\tconst location = useLocation();\n\tconst { canvas = 'view' } = location.query;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst { isBlockBasedTheme, hasSiteIcon } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase', undefined );\n\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\thasSiteIcon: !! siteData?.site_icon_url,\n\t\t};\n\t}, [] );\n\tconst postWithTemplate = !! context?.postId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? context.postType : postType,\n\t\tpostWithTemplate ? context.postId : postId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\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.navigate(\n\t\t\t\t\t\t\tgetListPathForPostType(\n\t\t\t\t\t\t\t\tpostWithTemplate ? context.postType : postType\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\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 or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title ) || __( '(no 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.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=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[\n\t\t\tpostType,\n\t\t\tcontext?.postType,\n\t\t\tpostWithTemplate,\n\t\t\thistory,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\tconst isReady = ! isLoading;\n\tconst transition = {\n\t\tduration: disableMotion ? 0 : 0.2,\n\t};\n\n\treturn ! isBlockBasedTheme && isHomeRoute ? (\n\t\t<SitePreview />\n\t) : (\n\t\t<>\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 && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName=\"edit-site-editor__editor-interface\"\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\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\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! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\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<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\t\t\t\t\tanimate=\"edit\"\n\t\t\t\t\t\t\t\t\t\tinitial=\"edit\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\n\t\t\t\t\t\t\t\t\t\t\t\t// TODO: this is a temporary solution to navigate to the posts list if we are\n\t\t\t\t\t\t\t\t\t\t\t\t// come here through `posts list` and are in focus mode editing a template, template part etc..\n\t\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\t\tisPostsList &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.query?.focusMode\n\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate( '/', {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetNavigationPath(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostWithTemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? context.postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}\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\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tvariants={ siteIconVariants }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-editor__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-editor__back-icon',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'has-site-icon':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thasSiteIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvariants={ toggleHomeIconVariants }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ arrowUpLeft } />\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t</motion.div>\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</Editor>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,aAAa,iBAAiB;AACvC,SAAS,QAAQ,oBAAoB,cAAc;AACnD,SAAS,eAAe,wBAAwB;AAChD;AAAA,EACC;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,IAAI,eAAe;AAC5B,SAAS,SAAS,qBAAqB;AACvC,SAAS,eAAe,+BAA+B;AACvD,SAAS,mBAAmB;AAC5B,SAAS,SAAS,oBAAoB;AACtC,SAAS,eAAe,yBAAyB;AACjD,SAAS,sBAAsB;AAC/B,SAAS,MAAM,mBAAmB;AAClC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,oBAAoB;AAK7B,OAAO,kBAAkB;AACzB,OAAO,kBAAkB;AACzB,SAAS,cAAc;AACvB,SAAS,iCAAiC;AAC1C,OAAO,gCAAgC;AACvC,SAAS,yBAAyB;AAClC,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,wBAAwB;AAC/B,OAAO,cAAc;AACrB,OAAO,0BAA0B;AACjC,OAAO,oBAAoB;AAC3B,SAAS,8BAA8B;AACvC,SAAS,8BAA8B;AACvC;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,OAAO,iBAAiB;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\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 } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, arrowUpLeft } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\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 { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\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';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\nimport SitePreview from './site-preview';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst toggleHomeIconVariants = {\n\tedit: {\n\t\topacity: 0,\n\t\tscale: 0.2,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n};\n\nconst siteIconVariants = {\n\tedit: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n\thover: {\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n\ttap: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n};\n\nfunction getListPathForPostType( postType ) {\n\tswitch ( postType ) {\n\t\tcase 'navigation':\n\t\t\treturn '/navigation';\n\t\tcase 'wp_block':\n\t\t\treturn '/pattern?postType=wp_block';\n\t\tcase 'wp_template_part':\n\t\t\treturn '/pattern?postType=wp_template_part';\n\t\tcase 'wp_template':\n\t\t\treturn '/template';\n\t\tcase 'page':\n\t\t\treturn '/page';\n\t\tcase 'post':\n\t\t\treturn '/';\n\t}\n\tthrow 'Unknown post type';\n}\n\nfunction getNavigationPath( location, postType ) {\n\tconst { path, name } = location;\n\tif (\n\t\t[\n\t\t\t'pattern-item',\n\t\t\t'template-part-item',\n\t\t\t'page-item',\n\t\t\t'template-item',\n\t\t\t'static-template-item',\n\t\t\t'post-item',\n\t\t].includes( name )\n\t) {\n\t\treturn getListPathForPostType( postType );\n\t}\n\treturn addQueryArgs( path, { canvas: undefined } );\n}\n\nexport default function EditSiteEditor( { isHomeRoute = false } ) {\n\tconst disableMotion = useReducedMotion();\n\tconst location = useLocation();\n\tconst { canvas = 'view' } = location.query;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst { isBlockBasedTheme, hasSiteIcon } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase', undefined );\n\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\thasSiteIcon: !! siteData?.site_icon_url,\n\t\t};\n\t}, [] );\n\tconst postWithTemplate = !! context?.postId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? context.postType : postType,\n\t\tpostWithTemplate ? context.postId : postId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\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.navigate(\n\t\t\t\t\t\t\tgetListPathForPostType(\n\t\t\t\t\t\t\t\tpostWithTemplate ? context.postType : postType\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\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 or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title ) || __( '(no 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.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=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[\n\t\t\tpostType,\n\t\t\tcontext?.postType,\n\t\t\tpostWithTemplate,\n\t\t\thistory,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\tconst isReady = ! isLoading;\n\tconst transition = {\n\t\tduration: disableMotion ? 0 : 0.2,\n\t};\n\n\treturn ! isBlockBasedTheme && isHomeRoute ? (\n\t\t<SitePreview />\n\t) : (\n\t\t<>\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 && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName=\"edit-site-editor__editor-interface\"\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\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\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! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\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<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\t\t\t\t\tanimate=\"edit\"\n\t\t\t\t\t\t\t\t\t\tinitial=\"edit\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t\tgetNavigationPath(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostWithTemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? context.postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t);\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\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tvariants={ siteIconVariants }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-editor__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-editor__back-icon',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'has-site-icon':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thasSiteIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvariants={ toggleHomeIconVariants }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ arrowUpLeft } />\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\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AAA,oBACD;AAAA,oBAEA;AAAA,sBAAC,OAAO;AAAA,sBAAP;AAAA,wBACA,UAAW;AAAA,wBAEX,8BAAC,YAAS,WAAU,2CAA0C;AAAA;AAAA,oBAC/D;AAAA;AAAA,gBACD;AAAA,gBACA;AAAA,kBAAC,OAAO;AAAA,kBAAP;AAAA,oBACA,WAAY;AAAA,sBACX;AAAA,sBACA;AAAA,wBACC,iBACC;AAAA,sBACF;AAAA,oBACD;AAAA,oBACA,UAAW;AAAA,oBAEX,8BAAC,QAAK,MAAO,aAAc;AAAA;AAAA,gBAC5B;AAAA;AAAA;AAAA,UACD,GAGH;AAAA,UAED,oBAAC,sBAAmB;AAAA;AAAA;AAAA,IACrB;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/page-patterns/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Page } from '@wordpress/admin-ui';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useView } from '@wordpress/views';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_DEFAULT_CATEGORY,\n} from '../../utils/constants';\nimport usePatternSettings from './use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\nimport usePatterns, { useAugmentPatternsWithPermissions } from './use-patterns';\nimport PatternsActions from './actions';\nimport { useEditPostAction } from '../dataviews-actions';\nimport {\n\tpatternStatusField,\n\tpreviewField,\n\ttemplatePartAuthorField,\n} from './fields';\nimport { addQueryArgs } from '@wordpress/url';\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\nimport { Button } from '@wordpress/components';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { usePostActions, patternTitleField } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\nconst defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tlayout: {\n\t\t\tstyles: {\n\t\t\t\tauthor: {\n\t\t\t\t\twidth: '1%',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tlayout: {\n\t\t\tbadgeFields: [ 'sync-status' ],\n\t\t},\n\t},\n};\nconst DEFAULT_VIEW = {\n\ttype: LAYOUT_GRID,\n\tperPage: 20,\n\ttitleField: 'title',\n\tmediaField: 'preview',\n\tfields: [ 'sync-status' ],\n\tfilters: [],\n\t...defaultLayouts[ LAYOUT_GRID ],\n};\n\nfunction usePagePatternsHeader( type, categoryId ) {\n\tconst { patternCategories } = usePatternCategories();\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\tlet title, description, patternCategory;\n\tif ( type === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === categoryId\n\t\t);\n\t\ttitle = templatePartArea?.label || __( 'All Template Parts' );\n\t\tdescription =\n\t\t\ttemplatePartArea?.description ||\n\t\t\t__( 'Includes every template part defined for any area.' );\n\t} else if ( type === PATTERN_TYPES.user && !! categoryId ) {\n\t\tpatternCategory = patternCategories.find(\n\t\t\t( category ) => category.name === categoryId\n\t\t);\n\t\ttitle = patternCategory?.label;\n\t\tdescription = patternCategory?.description;\n\t}\n\n\treturn { title, description };\n}\n\nexport default function DataviewsPatterns() {\n\tconst { path, query } = useLocation();\n\tconst { postType = 'wp_block', categoryId: categoryIdFromURL } = query;\n\tconst history = useHistory();\n\tconst categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;\n\tconst { view, updateView, isModified, resetToDefault } = useView( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t\tslug: categoryId,\n\t\tdefaultView: DEFAULT_VIEW,\n\t\tqueryParams: {\n\t\t\tpage:
|
|
5
|
-
"mappings": ";AAGA,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,eAAe;AACxB,SAAS,eAAe,8BAA8B;AACtD,SAAS,WAAW,6BAA6B;AACjD,SAAS,kBAAkB,SAAS,iBAAiB;AACrD,SAAS,eAAe,yBAAyB;AACjD,SAAS,eAAe,yBAAyB;AACjD,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAK1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,wBAAwB;AAC/B,SAAS,cAAc;AACvB,OAAO,eAAe,yCAAyC;AAC/D,OAAO,qBAAqB;AAC5B,SAAS,yBAAyB;AAClC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,oBAAoB;AAC7B,OAAO,0BAA0B;AACjC,SAAS,cAAc;AA2KlB,mBAEE,KAFF;AAzKL,IAAM,EAAE,gCAAgC,IAAI,OAAQ,sBAAuB;AAC3E,IAAM,EAAE,gBAAgB,kBAAkB,IAAI,OAAQ,iBAAkB;AACxE,IAAM,EAAE,aAAa,WAAW,IAAI,OAAQ,iBAAkB;AAE9D,IAAM,cAAc,CAAC;AACrB,IAAM,iBAAiB;AAAA,EACtB,CAAE,YAAa,GAAG;AAAA,IACjB,QAAQ;AAAA,MACP,QAAQ;AAAA,QACP,QAAQ;AAAA,UACP,OAAO;AAAA,QACR;AAAA,MACD;AA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a;AAAA,MACZ,MAAM,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Page } from '@wordpress/admin-ui';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useView } from '@wordpress/views';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_DEFAULT_CATEGORY,\n} from '../../utils/constants';\nimport usePatternSettings from './use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\nimport usePatterns, { useAugmentPatternsWithPermissions } from './use-patterns';\nimport PatternsActions from './actions';\nimport { useEditPostAction } from '../dataviews-actions';\nimport {\n\tpatternStatusField,\n\tpreviewField,\n\ttemplatePartAuthorField,\n} from './fields';\nimport { addQueryArgs } from '@wordpress/url';\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\nimport { Button } from '@wordpress/components';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { usePostActions, patternTitleField } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nconst EMPTY_ARRAY = [];\nconst defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tlayout: {\n\t\t\tstyles: {\n\t\t\t\tauthor: {\n\t\t\t\t\twidth: '1%',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tlayout: {\n\t\t\tbadgeFields: [ 'sync-status' ],\n\t\t},\n\t},\n};\nconst DEFAULT_VIEW = {\n\ttype: LAYOUT_GRID,\n\tperPage: 20,\n\ttitleField: 'title',\n\tmediaField: 'preview',\n\tfields: [ 'sync-status' ],\n\tfilters: [],\n\t...defaultLayouts[ LAYOUT_GRID ],\n};\n\nfunction usePagePatternsHeader( type, categoryId ) {\n\tconst { patternCategories } = usePatternCategories();\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\tlet title, description, patternCategory;\n\tif ( type === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === categoryId\n\t\t);\n\t\ttitle = templatePartArea?.label || __( 'All Template Parts' );\n\t\tdescription =\n\t\t\ttemplatePartArea?.description ||\n\t\t\t__( 'Includes every template part defined for any area.' );\n\t} else if ( type === PATTERN_TYPES.user && !! categoryId ) {\n\t\tpatternCategory = patternCategories.find(\n\t\t\t( category ) => category.name === categoryId\n\t\t);\n\t\ttitle = patternCategory?.label;\n\t\tdescription = patternCategory?.description;\n\t}\n\n\treturn { title, description };\n}\n\nexport default function DataviewsPatterns() {\n\tconst { path, query } = useLocation();\n\tconst { postType = 'wp_block', categoryId: categoryIdFromURL } = query;\n\tconst history = useHistory();\n\tconst categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;\n\tconst { view, updateView, isModified, resetToDefault } = useView( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t\tslug: categoryId,\n\t\tdefaultView: DEFAULT_VIEW,\n\t\tqueryParams: {\n\t\t\tpage: query.pageNumber,\n\t\t\tsearch: query.search,\n\t\t},\n\t\tonChangeQueryParams: ( params ) => {\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t...query,\n\t\t\t\t\tpageNumber: params.page,\n\t\t\t\t\tsearch: params.search,\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t} );\n\tconst viewSyncStatus = view.filters?.find(\n\t\t( { field } ) => field === 'sync-status'\n\t)?.value;\n\tconst { patterns, isResolving } = usePatterns( postType, categoryId, {\n\t\tsearch: view.search,\n\t\tsyncStatus: viewSyncStatus,\n\t} );\n\n\tconst { records } = useEntityRecords( 'postType', TEMPLATE_PART_POST_TYPE, {\n\t\tper_page: -1,\n\t} );\n\n\tconst authors = useMemo( () => {\n\t\tif ( ! records ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\tconst authorsSet = new Set();\n\t\trecords.forEach( ( template ) => {\n\t\t\tauthorsSet.add( template.author_text );\n\t\t} );\n\t\treturn Array.from( authorsSet ).map( ( author ) => ( {\n\t\t\tvalue: author,\n\t\t\tlabel: author,\n\t\t} ) );\n\t}, [ records ] );\n\n\tconst fields = useMemo( () => {\n\t\tconst _fields = [ previewField, patternTitleField ];\n\n\t\tif ( postType === PATTERN_TYPES.user ) {\n\t\t\t_fields.push( patternStatusField );\n\t\t} else if ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\t\t_fields.push( {\n\t\t\t\t...templatePartAuthorField,\n\t\t\t\telements: authors,\n\t\t\t} );\n\t\t}\n\n\t\treturn _fields;\n\t}, [ postType, authors ] );\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\t// Search is managed server-side as well as filters for patterns.\n\t\t// However, the author filter in template parts is done client-side.\n\t\tconst viewWithoutFilters = { ...view };\n\t\tdelete viewWithoutFilters.search;\n\t\tif ( postType !== TEMPLATE_PART_POST_TYPE ) {\n\t\t\tviewWithoutFilters.filters = [];\n\t\t}\n\t\treturn filterSortAndPaginate( patterns, viewWithoutFilters, fields );\n\t}, [ patterns, view, fields, postType ] );\n\n\tconst dataWithPermissions = useAugmentPatternsWithPermissions( data );\n\n\tconst templatePartActions = usePostActions( {\n\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\tcontext: 'list',\n\t} );\n\tconst patternActions = usePostActions( {\n\t\tpostType: PATTERN_TYPES.user,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\n\tconst actions = useMemo( () => {\n\t\tif ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\t\treturn [ editAction, ...templatePartActions ].filter( Boolean );\n\t\t}\n\t\treturn [ editAction, ...patternActions ].filter( Boolean );\n\t}, [ editAction, postType, templatePartActions, patternActions ] );\n\tconst settings = usePatternSettings();\n\tconst { title, description } = usePagePatternsHeader(\n\t\tpostType,\n\t\tcategoryId\n\t);\n\n\t// Wrap everything in a block editor provider.\n\t// This ensures 'styles' that are needed for the previews are synced\n\t// from the site editor store to the block editor store.\n\treturn (\n\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t<Page\n\t\t\t\tclassName=\"edit-site-page-patterns-dataviews\"\n\t\t\t\ttitle={ title }\n\t\t\t\tsubTitle={ description }\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isModified && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tonClick={ resetToDefault }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Reset view' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<PatternsActions />\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<DataViews\n\t\t\t\t\tkey={ categoryId + postType }\n\t\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tactions={ actions }\n\t\t\t\t\tdata={ dataWithPermissions || EMPTY_ARRAY }\n\t\t\t\t\tgetItemId={ ( item ) => item.name ?? item.id }\n\t\t\t\t\tisLoading={ isResolving }\n\t\t\t\t\tisItemClickable={ ( item ) =>\n\t\t\t\t\t\titem.type !== PATTERN_TYPES.theme\n\t\t\t\t\t}\n\t\t\t\t\tonClickItem={ ( item ) => {\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t`/${ item.type }/${\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\tPATTERN_TYPES.user,\n\t\t\t\t\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t\t\t\t\t].includes( item.type )\n\t\t\t\t\t\t\t\t\t? item.id\n\t\t\t\t\t\t\t\t\t: item.name\n\t\t\t\t\t\t\t}?canvas=edit`\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t\tview={ view }\n\t\t\t\t\tonChangeView={ updateView }\n\t\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\t/>\n\t\t\t</Page>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,eAAe;AACxB,SAAS,eAAe,8BAA8B;AACtD,SAAS,WAAW,6BAA6B;AACjD,SAAS,kBAAkB,SAAS,iBAAiB;AACrD,SAAS,eAAe,yBAAyB;AACjD,SAAS,eAAe,yBAAyB;AACjD,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAK1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,wBAAwB;AAC/B,SAAS,cAAc;AACvB,OAAO,eAAe,yCAAyC;AAC/D,OAAO,qBAAqB;AAC5B,SAAS,yBAAyB;AAClC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,oBAAoB;AAC7B,OAAO,0BAA0B;AACjC,SAAS,cAAc;AA2KlB,mBAEE,KAFF;AAzKL,IAAM,EAAE,gCAAgC,IAAI,OAAQ,sBAAuB;AAC3E,IAAM,EAAE,gBAAgB,kBAAkB,IAAI,OAAQ,iBAAkB;AACxE,IAAM,EAAE,aAAa,WAAW,IAAI,OAAQ,iBAAkB;AAE9D,IAAM,cAAc,CAAC;AACrB,IAAM,iBAAiB;AAAA,EACtB,CAAE,YAAa,GAAG;AAAA,I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AC9B,WAAY,CAAE,SAAU,KAAK,QAAQ,KAAK;AAAA,UAC1C,WAAY;AAAA,UACZ,iBAAkB,CAAE,SACnB,KAAK,SAAS,cAAc;AAAA,UAE7B,aAAc,CAAE,SAAU;AACzB,oBAAQ;AAAA,cACP,IAAK,KAAK,IAAK,IACd;AAAA,gBACC,cAAc;AAAA,gBACd;AAAA,cACD,EAAE,SAAU,KAAK,IAAK,IACnB,KAAK,KACL,KAAK,IACT;AAAA,YACD;AAAA,UACD;AAAA,UACA;AAAA,UACA,cAAe;AAAA,UACf;AAAA;AAAA,QAxBM,aAAa;AAAA,MAyBpB;AAAA;AAAA,EACD,GACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build-module/index.js
CHANGED
|
@@ -20,7 +20,6 @@ import App from "./components/app";
|
|
|
20
20
|
import { default as default2 } from "./components/plugin-template-setting-panel";
|
|
21
21
|
import { store } from "./store";
|
|
22
22
|
export * from "./deprecated";
|
|
23
|
-
import { initializePostsDashboard } from "./posts";
|
|
24
23
|
import { jsx } from "react/jsx-runtime";
|
|
25
24
|
var { registerCoreBlockBindingsSources } = unlock(editorPrivateApis);
|
|
26
25
|
function initializeEditor(id, settings) {
|
|
@@ -83,7 +82,6 @@ function reinitializeEditor() {
|
|
|
83
82
|
export {
|
|
84
83
|
default2 as PluginTemplateSettingPanel,
|
|
85
84
|
initializeEditor,
|
|
86
|
-
initializePostsDashboard,
|
|
87
85
|
reinitializeEditor,
|
|
88
86
|
store
|
|
89
87
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from './store';\nimport { unlock } from './lock-unlock';\nimport App from './components/app';\n\nconst { registerCoreBlockBindingsSources } = unlock( editorPrivateApis );\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tregisterCoreBlockBindingsSources();\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\teditorTool: 'edit',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t\tenableChoosePatternModal: true,\n\t} );\n\n\tif ( window.__experimentalMediaProcessing ) {\n\t\tdispatch( preferencesStore ).setDefaults( 'core/media', {\n\t\t\trequireApproval: true,\n\t\t\toptimizeOnUpload: true,\n\t\t} );\n\t}\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<App />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\nexport * from './deprecated';\n
|
|
5
|
-
"mappings": ";AAGA,SAAS,SAAS,mBAAmB;AACrC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,gBAAgB;AACzB,OAAO,gBAAgB;AACvB,SAAS,YAAY,kBAAkB;AACvC,SAAS,eAAe,yBAAyB;AACjD,SAAS,SAAS,wBAAwB;AAC1C;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAKP,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AACvB,OAAO,SAAS;AAkFhB,SAAoB,WAAXA,gBAA6C;AACtD,SAAS,aAAa;AACtB,cAAc;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from './store';\nimport { unlock } from './lock-unlock';\nimport App from './components/app';\n\nconst { registerCoreBlockBindingsSources } = unlock( editorPrivateApis );\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tregisterCoreBlockBindingsSources();\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\teditorTool: 'edit',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t\tenableChoosePatternModal: true,\n\t} );\n\n\tif ( window.__experimentalMediaProcessing ) {\n\t\tdispatch( preferencesStore ).setDefaults( 'core/media', {\n\t\t\trequireApproval: true,\n\t\t\toptimizeOnUpload: true,\n\t\t} );\n\t}\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<App />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\nexport * from './deprecated';\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,SAAS,mBAAmB;AACrC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,gBAAgB;AACzB,OAAO,gBAAgB;AACvB,SAAS,YAAY,kBAAkB;AACvC,SAAS,eAAe,yBAAyB;AACjD,SAAS,SAAS,wBAAwB;AAC1C;AAAA,EACC;AAAA,EACA;AAAA,OACM;AAKP,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AACvB,OAAO,SAAS;AAkFhB,SAAoB,WAAXA,gBAA6C;AACtD,SAAS,aAAa;AACtB,cAAc;AAhBX;AAlEH,IAAM,EAAE,iCAAiC,IAAI,OAAQ,iBAAkB;AAQhE,SAAS,iBAAkB,IAAI,UAAW;AAChD,QAAM,SAAS,SAAS,eAAgB,EAAG;AAC3C,QAAM,OAAO,WAAY,MAAO;AAEhC,WAAU,WAAY,EAAE,wBAAwB;AAChD,QAAM,aAAa,4BAA4B,EAAE;AAAA,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