@wordpress/edit-post 7.1.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/LICENSE.md +1 -1
- package/build/components/header/template-title/delete-template.js +5 -8
- package/build/components/header/template-title/delete-template.js.map +1 -1
- package/build/components/sidebar/post-template/form.js +1 -0
- package/build/components/sidebar/post-template/form.js.map +1 -1
- package/build/components/visual-editor/index.js +2 -16
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/plugins/index.js +1 -3
- package/build/plugins/index.js.map +1 -1
- package/build-module/components/header/template-title/delete-template.js +5 -7
- package/build-module/components/header/template-title/delete-template.js.map +1 -1
- package/build-module/components/sidebar/post-template/form.js +1 -0
- package/build-module/components/sidebar/post-template/form.js.map +1 -1
- package/build-module/components/visual-editor/index.js +3 -16
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/plugins/index.js +1 -2
- package/build-module/plugins/index.js.map +1 -1
- package/build-style/style-rtl.css +3 -0
- package/build-style/style.css +3 -0
- package/package.json +28 -28
- package/src/components/header/template-title/delete-template.js +4 -10
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +1 -0
- package/src/components/sidebar/post-template/form.js +1 -0
- package/src/components/visual-editor/index.js +10 -31
- package/src/plugins/index.js +0 -2
- package/build/plugins/navigation-list-view-menu-item.js +0 -48
- package/build/plugins/navigation-list-view-menu-item.js.map +0 -1
- package/build-module/plugins/navigation-list-view-menu-item.js +0 -40
- package/build-module/plugins/navigation-list-view-menu-item.js.map +0 -1
- package/src/plugins/navigation-list-view-menu-item.js +0 -56
package/CHANGELOG.md
CHANGED
package/LICENSE.md
CHANGED
|
@@ -7,8 +7,6 @@ exports.default = DeleteTemplate;
|
|
|
7
7
|
|
|
8
8
|
var _element = require("@wordpress/element");
|
|
9
9
|
|
|
10
|
-
var _lodash = require("lodash");
|
|
11
|
-
|
|
12
10
|
var _i18n = require("@wordpress/i18n");
|
|
13
11
|
|
|
14
12
|
var _components = require("@wordpress/components");
|
|
@@ -23,10 +21,6 @@ var _coreData = require("@wordpress/core-data");
|
|
|
23
21
|
|
|
24
22
|
var _store = require("../../../store");
|
|
25
23
|
|
|
26
|
-
/**
|
|
27
|
-
* External dependencies
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
24
|
/**
|
|
31
25
|
* WordPress dependencies
|
|
32
26
|
*/
|
|
@@ -80,6 +74,8 @@ function DeleteTemplate() {
|
|
|
80
74
|
const isRevertable = template === null || template === void 0 ? void 0 : template.has_theme_file;
|
|
81
75
|
|
|
82
76
|
const onDelete = () => {
|
|
77
|
+
var _settings$availableTe;
|
|
78
|
+
|
|
83
79
|
clearSelectedBlock();
|
|
84
80
|
setIsEditingTemplate(false);
|
|
85
81
|
setShowConfirmDialog(false);
|
|
@@ -87,9 +83,10 @@ function DeleteTemplate() {
|
|
|
87
83
|
template: ''
|
|
88
84
|
});
|
|
89
85
|
const settings = getEditorSettings();
|
|
90
|
-
const newAvailableTemplates = (
|
|
86
|
+
const newAvailableTemplates = Object.fromEntries(Object.entries((_settings$availableTe = settings.availableTemplates) !== null && _settings$availableTe !== void 0 ? _settings$availableTe : {}).filter(_ref => {
|
|
87
|
+
let [id] = _ref;
|
|
91
88
|
return id !== template.slug;
|
|
92
|
-
});
|
|
89
|
+
}));
|
|
93
90
|
updateEditorSettings({ ...settings,
|
|
94
91
|
availableTemplates: newAvailableTemplates
|
|
95
92
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/delete-template.js"],"names":["DeleteTemplate","clearSelectedBlock","blockEditorStore","setIsEditingTemplate","editPostStore","getEditorSettings","editorStore","updateEditorSettings","editPost","deleteEntityRecord","coreStore","template","select","isEditingTemplate","getEditedPostTemplate","_isEditing","showConfirmDialog","setShowConfirmDialog","wp_id","templateTitle","slug","title","isRevertable","has_theme_file","onDelete","settings","newAvailableTemplates","availableTemplates","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/delete-template.js"],"names":["DeleteTemplate","clearSelectedBlock","blockEditorStore","setIsEditingTemplate","editPostStore","getEditorSettings","editorStore","updateEditorSettings","editPost","deleteEntityRecord","coreStore","template","select","isEditingTemplate","getEditedPostTemplate","_isEditing","showConfirmDialog","setShowConfirmDialog","wp_id","templateTitle","slug","title","isRevertable","has_theme_file","onDelete","settings","newAvailableTemplates","Object","fromEntries","entries","availableTemplates","filter","id","throwOnError","undefined"],"mappings":";;;;;;;AAaA;;AAVA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAMA;;AAlBA;AACA;AACA;;AAaA;AACA;AACA;AAGe,SAASA,cAAT,GAA0B;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAyB,uBAAaC,kBAAb,CAA/B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA2B,uBAAaC,YAAb,CAAjC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAwB,qBAAWC,aAAX,CAA9B;AACA,QAAM;AAAEC,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MAAqC,uBAAaF,aAAb,CAA3C;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAyB,uBAAaC,eAAb,CAA/B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAe,qBAAaC,MAAF,IAAc;AAC7C,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QACLF,MAAM,CAAER,YAAF,CADP;;AAEA,UAAMW,UAAU,GAAGF,iBAAiB,EAApC;;AACA,WAAO;AACNF,MAAAA,QAAQ,EAAEI,UAAU,GAAGD,qBAAqB,EAAxB,GAA6B;AAD3C,KAAP;AAGA,GAPoB,EAOlB,EAPkB,CAArB;AAQA,QAAM,CAAEE,iBAAF,EAAqBC,oBAArB,IAA8C,uBAAU,KAAV,CAApD;;AAEA,MAAK,CAAEN,QAAF,IAAc,CAAEA,QAAQ,CAACO,KAA9B,EAAsC;AACrC,WAAO,IAA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AAMC,IAAA,IAAI,EACHK,YAAY,GACT,cAAI,4CAAJ,CADS,GAETY;AATL,KAYGZ,YAAY,GACX,cAAI,sBAAJ,CADW,GAEX,cAAI,iBAAJ,CAdJ,CADD,EAiBC,4BAAC,uCAAD;AACC,IAAA,MAAM,EAAGN,iBADV;AAEC,IAAA,SAAS,EAAGQ,QAFb;AAGC,IAAA,QAAQ,EAAG,MAAM;AAChBP,MAAAA,oBAAoB,CAAE,KAAF,CAApB;AACA;AALF,KAOG;AACD;AACA,gBACC,0FADD,CAFC,EAKDE,aALC,CAPH,CAjBD,CADD,CADD;AAqCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nexport default function DeleteTemplate() {\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst { getEditorSettings } = useSelect( editorStore );\n\tconst { updateEditorSettings, editPost } = useDispatch( editorStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\tconst { template } = useSelect( ( select ) => {\n\t\tconst { isEditingTemplate, getEditedPostTemplate } =\n\t\t\tselect( editPostStore );\n\t\tconst _isEditing = isEditingTemplate();\n\t\treturn {\n\t\t\ttemplate: _isEditing ? getEditedPostTemplate() : null,\n\t\t};\n\t}, [] );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( ! template || ! template.wp_id ) {\n\t\treturn null;\n\t}\n\tlet templateTitle = template.slug;\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t}\n\n\tconst isRevertable = template?.has_theme_file;\n\n\tconst onDelete = () => {\n\t\tclearSelectedBlock();\n\t\tsetIsEditingTemplate( false );\n\t\tsetShowConfirmDialog( false );\n\n\t\teditPost( {\n\t\t\ttemplate: '',\n\t\t} );\n\t\tconst settings = getEditorSettings();\n\t\tconst newAvailableTemplates = Object.fromEntries(\n\t\t\tObject.entries( settings.availableTemplates ?? {} ).filter(\n\t\t\t\t( [ id ] ) => id !== template.slug\n\t\t\t)\n\t\t);\n\t\tupdateEditorSettings( {\n\t\t\t...settings,\n\t\t\tavailableTemplates: newAvailableTemplates,\n\t\t} );\n\t\tdeleteEntityRecord( 'postType', 'wp_template', template.id, {\n\t\t\tthrowOnError: true,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<MenuGroup className=\"edit-post-template-top-area__second-menu-group\">\n\t\t\t<>\n\t\t\t\t<MenuItem\n\t\t\t\t\tclassName=\"edit-post-template-top-area__delete-template-button\"\n\t\t\t\t\tisDestructive={ ! isRevertable }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t\t\t} }\n\t\t\t\t\tinfo={\n\t\t\t\t\t\tisRevertable\n\t\t\t\t\t\t\t? __( 'Use the template as supplied by the theme.' )\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isRevertable\n\t\t\t\t\t\t? __( 'Clear customizations' )\n\t\t\t\t\t\t: __( 'Delete template' ) }\n\t\t\t\t</MenuItem>\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\t\tonConfirm={ onDelete }\n\t\t\t\t\tonCancel={ () => {\n\t\t\t\t\t\tsetShowConfirmDialog( false );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: template name */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Are you sure you want to delete the %s template? It may be used by other pages or posts.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttemplateTitle\n\t\t\t\t\t) }\n\t\t\t\t</ConfirmDialog>\n\t\t\t</>\n\t\t</MenuGroup>\n\t);\n}\n"]}
|
|
@@ -111,6 +111,7 @@ function PostTemplateForm(_ref) {
|
|
|
111
111
|
status: "warning",
|
|
112
112
|
isDismissible: false
|
|
113
113
|
}, (0, _i18n.__)('The posts page template cannot be changed.')) : (0, _element.createElement)(_components.SelectControl, {
|
|
114
|
+
__nextHasNoMarginBottom: true,
|
|
114
115
|
hideLabelFromVision: true,
|
|
115
116
|
label: (0, _i18n.__)('Template'),
|
|
116
117
|
value: (_selectedOption$value = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) !== null && _selectedOption$value !== void 0 ? _selectedOption$value : '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-template/form.js"],"names":["PostTemplateForm","onClose","isPostsPage","availableTemplates","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","select","canUser","getEntityRecord","getEntityRecords","coreStore","editorSettings","editorStore","getEditorSettings","siteSettings","undefined","_isPostsPage","getCurrentPostId","page_for_posts","canCreateTemplates","post_type","getCurrentPostType","per_page","getEditedPostAttribute","supportsTemplateMode","editPostStore","getEditedPostTemplate","options","Object","entries","fromEntries","map","slug","title","rendered","value","label","selectedOption","find","option","editPost","__unstableSwitchToTemplateMode","isCreateModalOpen","setIsCreateModalOpen","icon","addTemplate","onClick","template"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIe,SAASA,gBAAT,OAAyC;AAAA;;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AACvD,QAAM;AACLC,IAAAA,WADK;AAELC,IAAAA,kBAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA,oBAJK;AA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;AAGCU,MAAAA,OAAO,EAAE,MAAMH,oBAAoB,CAAE,IAAF;AAHpC,KADA,CADM,GAQN,EAdL;AAgBC,IAAA,OAAO,EAAG5C;AAhBX,IADD,EAmBGC,WAAW,GACZ,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,MAAM,EAAC,SAFR;AAGC,IAAA,aAAa,EAAG;AAHjB,KAKG,cAAI,4CAAJ,CALH,CADY,GASZ,4BAAC,yBAAD;AACC,IAAA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-template/form.js"],"names":["PostTemplateForm","onClose","isPostsPage","availableTemplates","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","select","canUser","getEntityRecord","getEntityRecords","coreStore","editorSettings","editorStore","getEditorSettings","siteSettings","undefined","_isPostsPage","getCurrentPostId","page_for_posts","canCreateTemplates","post_type","getCurrentPostType","per_page","getEditedPostAttribute","supportsTemplateMode","editPostStore","getEditedPostTemplate","options","Object","entries","fromEntries","map","slug","title","rendered","value","label","selectedOption","find","option","editPost","__unstableSwitchToTemplateMode","isCreateModalOpen","setIsCreateModalOpen","icon","addTemplate","onClick","template"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIe,SAASA,gBAAT,OAAyC;AAAA;;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AACvD,QAAM;AACLC,IAAAA,WADK;AAELC,IAAAA,kBAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA,oBAJK;AAKLC,IAAAA,SALK;AAMLC,IAAAA;AANK,MAOF,qBAAaC,MAAF,IAAc;AAC5B,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA,eAAX;AAA4BC,MAAAA;AAA5B,QACLH,MAAM,CAAEI,eAAF,CADP;AAEA,UAAMC,cAAc,GAAGL,MAAM,CAAEM,aAAF,C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;AAGC,IAAA,aAAa,EAAG;AAHjB,KAKG,cAAI,4CAAJ,CALH,CADY,GASZ,4BAAC,yBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,mBAAmB,MAFpB;AAGC,IAAA,KAAK,EAAG,cAAI,UAAJ,CAHT;AAIC,IAAA,KAAK,2BAAGqC,cAAH,aAAGA,cAAH,uBAAGA,cAAc,CAAEF,KAAnB,yEAA4B,EAJlC;AAKC,IAAA,OAAO,EAAGR,OALX;AAMC,IAAA,QAAQ,EAAKK,IAAF,IACVQ,QAAQ,CAAE;AAAEO,MAAAA,QAAQ,EAAEf,IAAI,IAAI;AAApB,KAAF;AAPV,IA5BF,EAuCG3B,OAAO,IACR,uCACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,MADT;AAEC,IAAA,OAAO,EAAG,MAAMoC,8BAA8B;AAF/C,KAIG,cAAI,eAAJ,CAJH,CADD,CAxCF,EAiDGC,iBAAiB,IAClB,4BAAC,oBAAD;AACC,IAAA,OAAO,EAAG,MAAMC,oBAAoB,CAAE,KAAF;AADrC,IAlDF,CADD;AAyDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { addTemplate } from '@wordpress/icons';\nimport { Notice, SelectControl, Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport PostTemplateCreateModal from './create-modal';\n\nexport default function PostTemplateForm( { onClose } ) {\n\tconst {\n\t\tisPostsPage,\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tselectedTemplateSlug,\n\t\tcanCreate,\n\t\tcanEdit,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEntityRecords } =\n\t\t\tselect( coreStore );\n\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst _isPostsPage =\n\t\t\tselect( editorStore ).getCurrentPostId() ===\n\t\t\tsiteSettings?.page_for_posts;\n\t\tconst canCreateTemplates = canUser( 'create', 'templates' );\n\n\t\treturn {\n\t\t\tisPostsPage: _isPostsPage,\n\t\t\tavailableTemplates: editorSettings.availableTemplates,\n\t\t\tfetchedTemplates: canCreateTemplates\n\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\tpost_type: select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t } )\n\t\t\t\t: undefined,\n\t\t\tselectedTemplateSlug:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' ),\n\t\t\tcanCreate:\n\t\t\t\tcanCreateTemplates &&\n\t\t\t\t! _isPostsPage &&\n\t\t\t\teditorSettings.supportsTemplateMode,\n\t\t\tcanEdit:\n\t\t\t\tcanCreateTemplates &&\n\t\t\t\teditorSettings.supportsTemplateMode &&\n\t\t\t\t!! select( editPostStore ).getEditedPostTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst options = useMemo(\n\t\t() =>\n\t\t\tObject.entries( {\n\t\t\t\t...availableTemplates,\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t( fetchedTemplates ?? [] ).map( ( { slug, title } ) => [\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\ttitle.rendered,\n\t\t\t\t\t] )\n\t\t\t\t),\n\t\t\t} ).map( ( [ slug, title ] ) => ( { value: slug, label: title } ) ),\n\t\t[ availableTemplates, fetchedTemplates ]\n\t);\n\n\tconst selectedOption =\n\t\toptions.find( ( option ) => option.value === selectedTemplateSlug ) ??\n\t\toptions.find( ( option ) => ! option.value ); // The default option has '' value.\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { __unstableSwitchToTemplateMode } = useDispatch( editPostStore );\n\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\n\treturn (\n\t\t<div className=\"edit-post-post-template__form\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Template' ) }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Templates define the way content is displayed when viewing your site.'\n\t\t\t\t) }\n\t\t\t\tactions={\n\t\t\t\t\tcanCreate\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ticon: addTemplate,\n\t\t\t\t\t\t\t\t\tlabel: __( 'Add template' ),\n\t\t\t\t\t\t\t\t\tonClick: () => setIsCreateModalOpen( true ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: []\n\t\t\t\t}\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t{ isPostsPage ? (\n\t\t\t\t<Notice\n\t\t\t\t\tclassName=\"edit-post-post-template__notice\"\n\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\tisDismissible={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'The posts page template cannot be changed.' ) }\n\t\t\t\t</Notice>\n\t\t\t) : (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ __( 'Template' ) }\n\t\t\t\t\tvalue={ selectedOption?.value ?? '' }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\teditPost( { template: slug || '' } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canEdit && (\n\t\t\t\t<p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => __unstableSwitchToTemplateMode() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<PostTemplateCreateModal\n\t\t\t\t\tonClose={ () => setIsCreateModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -29,8 +29,6 @@ var _blocks = require("@wordpress/blocks");
|
|
|
29
29
|
|
|
30
30
|
var _coreData = require("@wordpress/core-data");
|
|
31
31
|
|
|
32
|
-
var _blockInspectorButton = _interopRequireDefault(require("./block-inspector-button"));
|
|
33
|
-
|
|
34
32
|
var _store = require("../../store");
|
|
35
33
|
|
|
36
34
|
/**
|
|
@@ -50,7 +48,6 @@ function MaybeIframe(_ref) {
|
|
|
50
48
|
contentRef,
|
|
51
49
|
shouldIframe,
|
|
52
50
|
styles,
|
|
53
|
-
assets,
|
|
54
51
|
style
|
|
55
52
|
} = _ref;
|
|
56
53
|
const ref = (0, _blockEditor.__unstableUseMouseMoveTypingReset)();
|
|
@@ -73,7 +70,6 @@ function MaybeIframe(_ref) {
|
|
|
73
70
|
head: (0, _element.createElement)(_blockEditor.__unstableEditorStyles, {
|
|
74
71
|
styles: styles
|
|
75
72
|
}),
|
|
76
|
-
assets: assets,
|
|
77
73
|
ref: ref,
|
|
78
74
|
contentRef: contentRef,
|
|
79
75
|
style: {
|
|
@@ -169,7 +165,6 @@ function VisualEditor(_ref2) {
|
|
|
169
165
|
const {
|
|
170
166
|
themeHasDisabledLayoutStyles,
|
|
171
167
|
themeSupportsLayout,
|
|
172
|
-
assets,
|
|
173
168
|
isFocusMode
|
|
174
169
|
} = (0, _data.useSelect)(select => {
|
|
175
170
|
const _settings = select(_blockEditor.store).getSettings();
|
|
@@ -177,7 +172,6 @@ function VisualEditor(_ref2) {
|
|
|
177
172
|
return {
|
|
178
173
|
themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
|
|
179
174
|
themeSupportsLayout: _settings.supportsLayout,
|
|
180
|
-
assets: _settings.__unstableResolvedAssets,
|
|
181
175
|
isFocusMode: _settings.focusMode
|
|
182
176
|
};
|
|
183
177
|
}, []);
|
|
@@ -312,8 +306,7 @@ function VisualEditor(_ref2) {
|
|
|
312
306
|
}, (0, _element.createElement)(MaybeIframe, {
|
|
313
307
|
shouldIframe: isBlockBasedTheme && !hasMetaBoxes || isTemplateMode || deviceType === 'Tablet' || deviceType === 'Mobile',
|
|
314
308
|
contentRef: contentRef,
|
|
315
|
-
styles: styles
|
|
316
|
-
assets: assets
|
|
309
|
+
styles: styles
|
|
317
310
|
}, themeSupportsLayout && !themeHasDisabledLayoutStyles && !isTemplateMode && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.__experimentalLayoutStyle, {
|
|
318
311
|
selector: ".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container",
|
|
319
312
|
layout: fallbackLayout,
|
|
@@ -338,13 +331,6 @@ function VisualEditor(_ref2) {
|
|
|
338
331
|
className: isTemplateMode ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.
|
|
339
332
|
,
|
|
340
333
|
__experimentalLayout: blockListLayout
|
|
341
|
-
})))))
|
|
342
|
-
let {
|
|
343
|
-
onClose
|
|
344
|
-
} = _ref3;
|
|
345
|
-
return (0, _element.createElement)(_blockInspectorButton.default, {
|
|
346
|
-
onClick: onClose
|
|
347
|
-
});
|
|
348
|
-
}));
|
|
334
|
+
}))))));
|
|
349
335
|
}
|
|
350
336
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["MaybeIframe","children","contentRef","shouldIframe","styles","assets","style","ref","flex","width","height","display","findPostContent","blocks","i","length","name","innerBlocks","nestedPostContent","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","select","isFeatureActive","isEditingTemplate","__experimentalGetPreviewDeviceType","getEditedPostTemplate","editPostStore","getCurrentPostId","getCurrentPostType","getEditorSettings","editorStore","_isTemplateMode","_wrapperBlockName","editorSettings","supportsTemplateMode","canEditTemplate","coreStore","canUser","undefined","__unstableIsBlockBasedTheme","isCleanNewPost","hasMetaBoxes","themeHasDisabledLayoutStyles","themeSupportsLayout","isFocusMode","_settings","blockEditorStore","getSettings","disableLayoutStyles","supportsLayout","__unstableResolvedAssets","focusMode","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","globalLayoutSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","fallbackLayout","type","postContentBlock","parseableContent","content","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","layout","attributes","postContentLayout","inherit","contentSize","wideSize","blockListLayout","titleRef","current","focus","css","padding","arrowLeft","definitions","onClose"],"mappings":";;;;;;;;;AAiCA;;AA9BA;;AAKA;;AAKA;;AAqBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AA9CA;AACA;AACA;;AAGA;AACA;AACA;;AAmCA;AACA;AACA;AAIA,SAASA,WAAT,OAOI;AAAA,MAPkB;AACrBC,IAAAA,QADqB;AAErBC,IAAAA,UAFqB;AAGrBC,IAAAA,YAHqB;AAIrBC,IAAAA,MAJqB;AAKrBC,IAAAA,MALqB;AAMrBC,IAAAA;AANqB,GAOlB;AACH,QAAMC,GAAG,GAAG,qDAAZ;;AAEA,MAAK,CAAEJ,YAAP,EAAsB;AACrB,WACC,qDACC,4BAAC,mCAAD;AAAc,MAAA,MAAM,EAAGC;AAAvB,MADD,EAEC,4BAAC,wBAAD;AACC,MAAA,GAAG,EAAGF,UADP;AAEC,MAAA,SAAS,EAAC,uBAFX;AAGC,MAAA,KAAK,EAAG;AAAEM,QAAAA,IAAI,EAAE,GAAR;AAAa,WAA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,SAAS,EACRH,cAAc,GACX,gBADW,GAEV,GAAG2D,oBAAsB,wBAHrB,CAG6C;AAJvD;AAMC,IAAA,oBAAoB,EAAGQ;AANxB,IAJD,CAnDD,CALD,CAnBD,CAPD,EAkGC,4BAAC,iDAAD,QACG;AAAA,QAAE;AAAEQ,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,6BAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CAlGD,CADD;AA0GA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentaluseLayoutClasses as useLayoutClasses,\n\t__experimentaluseLayoutStyles as useLayoutStyles,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from './block-inspector-button';\nimport { store as editPostStore } from '../../store';\n\nfunction MaybeIframe( {\n\tchildren,\n\tcontentRef,\n\tshouldIframe,\n\tstyles,\n\tassets,\n\tstyle,\n} ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\thead={ <EditorStyles styles={ styles } /> }\n\t\t\tassets={ assets }\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t\tname=\"editor-canvas\"\n\t\t>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object} The Post Content block.\n */\nfunction findPostContent( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ];\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = findPostContent(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tisBlockBasedTheme,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetEditedPostTemplate,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst canEditTemplate = select( coreStore ).canUser(\n\t\t\t'create',\n\t\t\t'templates'\n\t\t);\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so we check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tsupportsTemplateMode && canEditTemplate\n\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst {\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t\tassets,\n\t\tisFocusMode,\n\t} = useSelect( ( select ) => {\n\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\tassets: _settings.__unstableResolvedAssets,\n\t\t\tisFocusMode: _settings.focusMode,\n\t\t};\n\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst globalLayoutSettings = useSetting( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [ isTemplateMode, themeSupportsLayout, globalLayoutSettings ] );\n\n\tconst postContentBlock = useMemo( () => {\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn findPostContent( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn findPostContent( parse( parseableContent ) ) || {};\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst postContentLayoutClasses = useLayoutClasses( postContentBlock );\n\n\tconst blockListLayoutClass = classnames(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tpostContentBlock,\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\tconst layout = postContentBlock?.attributes?.layout || {};\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentBlock\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible, isCleanNewPost ] );\n\n\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss:\n\t\t\t\t\t`.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` +\n\t\t\t\t\t( paddingBottom\n\t\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t\t: '' ),\n\t\t\t},\n\t\t],\n\t\t[ styles ]\n\t);\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : '0',\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\t( isBlockBasedTheme && ! hasMetaBoxes ) ||\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\tassets={ assets }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\t\t! isTemplateMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\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{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t// This wrapper div should have the same\n\t\t\t\t\t\t\t\t\t// classes as the block list beneath.\n\t\t\t\t\t\t\t\t\t'is-root-container',\n\t\t\t\t\t\t\t\t\t'block-editor-block-list__layout',\n\t\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tblockListLayoutClass\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__experimentalLayout={ blockListLayout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</MaybeIframe>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</BlockTools>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["MaybeIframe","children","contentRef","shouldIframe","styles","style","ref","flex","width","height","display","findPostContent","blocks","i","length","name","innerBlocks","nestedPostContent","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","select","isFeatureActive","isEditingTemplate","__experimentalGetPreviewDeviceType","getEditedPostTemplate","editPostStore","getCurrentPostId","getCurrentPostType","getEditorSettings","editorStore","_isTemplateMode","_wrapperBlockName","editorSettings","supportsTemplateMode","canEditTemplate","coreStore","canUser","undefined","__unstableIsBlockBasedTheme","isCleanNewPost","hasMetaBoxes","themeHasDisabledLayoutStyles","themeSupportsLayout","isFocusMode","_settings","blockEditorStore","getSettings","disableLayoutStyles","supportsLayout","focusMode","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","globalLayoutSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","fallbackLayout","type","postContentBlock","parseableContent","content","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","layout","attributes","postContentLayout","inherit","contentSize","wideSize","blockListLayout","titleRef","current","focus","css","padding","arrowLeft","definitions"],"mappings":";;;;;;;;;AAgCA;;AA7BA;;AAKA;;AAKA;;AAoBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AA5CA;AACA;AACA;;AAGA;AACA;AACA;;AAkCA;AACA;AACA;AAGA,SAASA,WAAT,OAA8E;AAAA,MAAxD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,UAAZ;AAAwBC,IAAAA,YAAxB;AAAsCC,IAAAA,MAAtC;AAA8CC,IAAAA;AAA9C,GAAwD;AAC7E,QAAMC,GAAG,GA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AGS;AAAjB,IAdD,CAjCF,EAkDC,4BAAC,4CAAD;AACC,IAAA,SAAS,EAAGjE,gBADb;AAEC,IAAA,QAAQ,EAAGC;AAFZ,KAIC,4BAAC,sBAAD;AACC,IAAA,SAAS,EACRH,cAAc,GACX,gBADW,GAEV,GAAG0D,oBAAsB,wBAHrB,CAG6C;AAJvD;AAMC,IAAA,oBAAoB,EAAGQ;AANxB,IAJD,CAlDD,CALD,CAnBD,CAPD,CADD;AAoGA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentaluseLayoutClasses as useLayoutClasses,\n\t__experimentaluseLayoutStyles as useLayoutStyles,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\thead={ <EditorStyles styles={ styles } /> }\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t\tname=\"editor-canvas\"\n\t\t>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object} The Post Content block.\n */\nfunction findPostContent( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ];\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = findPostContent(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tisBlockBasedTheme,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetEditedPostTemplate,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst canEditTemplate = select( coreStore ).canUser(\n\t\t\t'create',\n\t\t\t'templates'\n\t\t);\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so we check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tsupportsTemplateMode && canEditTemplate\n\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst { themeHasDisabledLayoutStyles, themeSupportsLayout, isFocusMode } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\t\treturn {\n\t\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\t\tisFocusMode: _settings.focusMode,\n\t\t\t};\n\t\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst globalLayoutSettings = useSetting( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [ isTemplateMode, themeSupportsLayout, globalLayoutSettings ] );\n\n\tconst postContentBlock = useMemo( () => {\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn findPostContent( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn findPostContent( parse( parseableContent ) ) || {};\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst postContentLayoutClasses = useLayoutClasses( postContentBlock );\n\n\tconst blockListLayoutClass = classnames(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tpostContentBlock,\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\tconst layout = postContentBlock?.attributes?.layout || {};\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentBlock\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible, isCleanNewPost ] );\n\n\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss:\n\t\t\t\t\t`.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` +\n\t\t\t\t\t( paddingBottom\n\t\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t\t: '' ),\n\t\t\t},\n\t\t],\n\t\t[ styles ]\n\t);\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : '0',\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\t( isBlockBasedTheme && ! hasMetaBoxes ) ||\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\t\t! isTemplateMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\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{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t// This wrapper div should have the same\n\t\t\t\t\t\t\t\t\t// classes as the block list beneath.\n\t\t\t\t\t\t\t\t\t'is-root-container',\n\t\t\t\t\t\t\t\t\t'block-editor-block-list__layout',\n\t\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tblockListLayoutClass\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__experimentalLayout={ blockListLayout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</MaybeIframe>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t</BlockTools>\n\t);\n}\n"]}
|
package/build/plugins/index.js
CHANGED
|
@@ -22,8 +22,6 @@ var _toolsMoreMenuGroup = _interopRequireDefault(require("../components/header/t
|
|
|
22
22
|
|
|
23
23
|
var _welcomeGuideMenuItem = _interopRequireDefault(require("./welcome-guide-menu-item"));
|
|
24
24
|
|
|
25
|
-
var _navigationListViewMenuItem = _interopRequireDefault(require("./navigation-list-view-menu-item"));
|
|
26
|
-
|
|
27
25
|
/**
|
|
28
26
|
* WordPress dependencies
|
|
29
27
|
*/
|
|
@@ -55,7 +53,7 @@ var _navigationListViewMenuItem = _interopRequireDefault(require("./navigation-l
|
|
|
55
53
|
},
|
|
56
54
|
/* translators: accessibility text */
|
|
57
55
|
(0, _i18n.__)('(opens in a new tab)'))));
|
|
58
|
-
})
|
|
56
|
+
}));
|
|
59
57
|
}
|
|
60
58
|
|
|
61
59
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["render","onClose","post_type","external"],"mappings":";;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["render","onClose","post_type","external"],"mappings":";;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAfA;AACA;AACA;;AAOA;AACA;AACA;AAMA,6BAAgB,WAAhB,EAA6B;AAC5BA,EAAAA,MAAM,GAAG;AACR,WACC,qDACC,4BAAC,2BAAD,QACG;AAAA,UAAE;AAAEC,QAAAA;AAAF,OAAF;AAAA,aACD,qDACC,4BAAC,oBAAD;AACC,QAAA,IAAI,EAAC,UADN;AAEC,QAAA,IAAI,EAAG,uBAAc,UAAd,EAA0B;AAChCC,UAAAA,SAAS,EAAE;AADqB,SAA1B;AAFR,SAMG,cAAI,wBAAJ,CANH,CADD,EASC,4BAAC,sCAAD;AACC,QAAA,QAAQ,EAAGD;AADZ,QATD,EAYC,4BAAC,6BAAD,OAZD,EAaC,4BAAC,4BAAD,OAbD,EAcC,4BAAC,oBAAD;AACC,QAAA,IAAI,EAAC,UADN;AAEC,QAAA,IAAI,EAAGE,eAFR;AAGC,QAAA,IAAI,EAAG,cACN,yDADM,CAHR;AAMC,QAAA,MAAM,EAAC,QANR;AAOC,QAAA,GAAG,EAAC;AAPL,SASG,cAAI,MAAJ,CATH,EAUC,4BAAC,0BAAD;AAAgB,QAAA,EAAE,EAAC;AAAnB;AAEE;AACA,oBAAI,sBAAJ,CAHF,CAVD,CAdD,CADC;AAAA,KADH,CADD,CADD;AAwCA;;AA1C2B,CAA7B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nregisterPlugin( 'edit-post', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\thref={ addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\t\t\tpost_type: 'wp_block',\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Manage Reusable blocks' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<KeyboardShortcutsHelpMenuItem\n\t\t\t\t\t\t\t\tonSelect={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/wordpress-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsMoreMenuGroup>\n\t\t\t</>\n\t\t);\n\t},\n} );\n"]}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { pickBy } from 'lodash';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
6
|
import { __, sprintf } from '@wordpress/i18n';
|
|
12
7
|
import { MenuGroup, MenuItem, __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';
|
|
13
8
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
@@ -66,6 +61,8 @@ export default function DeleteTemplate() {
|
|
|
66
61
|
const isRevertable = template === null || template === void 0 ? void 0 : template.has_theme_file;
|
|
67
62
|
|
|
68
63
|
const onDelete = () => {
|
|
64
|
+
var _settings$availableTe;
|
|
65
|
+
|
|
69
66
|
clearSelectedBlock();
|
|
70
67
|
setIsEditingTemplate(false);
|
|
71
68
|
setShowConfirmDialog(false);
|
|
@@ -73,9 +70,10 @@ export default function DeleteTemplate() {
|
|
|
73
70
|
template: ''
|
|
74
71
|
});
|
|
75
72
|
const settings = getEditorSettings();
|
|
76
|
-
const newAvailableTemplates =
|
|
73
|
+
const newAvailableTemplates = Object.fromEntries(Object.entries((_settings$availableTe = settings.availableTemplates) !== null && _settings$availableTe !== void 0 ? _settings$availableTe : {}).filter(_ref => {
|
|
74
|
+
let [id] = _ref;
|
|
77
75
|
return id !== template.slug;
|
|
78
|
-
});
|
|
76
|
+
}));
|
|
79
77
|
updateEditorSettings({ ...settings,
|
|
80
78
|
availableTemplates: newAvailableTemplates
|
|
81
79
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/delete-template.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/delete-template.js"],"names":["__","sprintf","MenuGroup","MenuItem","__experimentalConfirmDialog","ConfirmDialog","store","blockEditorStore","useDispatch","useSelect","editorStore","coreStore","useState","editPostStore","DeleteTemplate","clearSelectedBlock","setIsEditingTemplate","getEditorSettings","updateEditorSettings","editPost","deleteEntityRecord","template","select","isEditingTemplate","getEditedPostTemplate","_isEditing","showConfirmDialog","setShowConfirmDialog","wp_id","templateTitle","slug","title","isRevertable","has_theme_file","onDelete","settings","newAvailableTemplates","Object","fromEntries","entries","availableTemplates","filter","id","throwOnError","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,SADD,EAECC,QAFD,EAGCC,2BAA2B,IAAIC,aAHhC,QAIO,uBAJP;AAKA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASH,KAAK,IAAII,WAAlB,QAAqC,mBAArC;AACA,SAASJ,KAAK,IAAIK,SAAlB,QAAmC,sBAAnC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,SAASN,KAAK,IAAIO,aAAlB,QAAuC,gBAAvC;AAEA,eAAe,SAASC,cAAT,GAA0B;AACxC,QAAM;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AqCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nexport default function DeleteTemplate() {\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst { getEditorSettings } = useSelect( editorStore );\n\tconst { updateEditorSettings, editPost } = useDispatch( editorStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\tconst { template } = useSelect( ( select ) => {\n\t\tconst { isEditingTemplate, getEditedPostTemplate } =\n\t\t\tselect( editPostStore );\n\t\tconst _isEditing = isEditingTemplate();\n\t\treturn {\n\t\t\ttemplate: _isEditing ? getEditedPostTemplate() : null,\n\t\t};\n\t}, [] );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( ! template || ! template.wp_id ) {\n\t\treturn null;\n\t}\n\tlet templateTitle = template.slug;\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t}\n\n\tconst isRevertable = template?.has_theme_file;\n\n\tconst onDelete = () => {\n\t\tclearSelectedBlock();\n\t\tsetIsEditingTemplate( false );\n\t\tsetShowConfirmDialog( false );\n\n\t\teditPost( {\n\t\t\ttemplate: '',\n\t\t} );\n\t\tconst settings = getEditorSettings();\n\t\tconst newAvailableTemplates = Object.fromEntries(\n\t\t\tObject.entries( settings.availableTemplates ?? {} ).filter(\n\t\t\t\t( [ id ] ) => id !== template.slug\n\t\t\t)\n\t\t);\n\t\tupdateEditorSettings( {\n\t\t\t...settings,\n\t\t\tavailableTemplates: newAvailableTemplates,\n\t\t} );\n\t\tdeleteEntityRecord( 'postType', 'wp_template', template.id, {\n\t\t\tthrowOnError: true,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<MenuGroup className=\"edit-post-template-top-area__second-menu-group\">\n\t\t\t<>\n\t\t\t\t<MenuItem\n\t\t\t\t\tclassName=\"edit-post-template-top-area__delete-template-button\"\n\t\t\t\t\tisDestructive={ ! isRevertable }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t\t\t} }\n\t\t\t\t\tinfo={\n\t\t\t\t\t\tisRevertable\n\t\t\t\t\t\t\t? __( 'Use the template as supplied by the theme.' )\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isRevertable\n\t\t\t\t\t\t? __( 'Clear customizations' )\n\t\t\t\t\t\t: __( 'Delete template' ) }\n\t\t\t\t</MenuItem>\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\t\tonConfirm={ onDelete }\n\t\t\t\t\tonCancel={ () => {\n\t\t\t\t\t\tsetShowConfirmDialog( false );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: template name */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Are you sure you want to delete the %s template? It may be used by other pages or posts.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttemplateTitle\n\t\t\t\t\t) }\n\t\t\t\t</ConfirmDialog>\n\t\t\t</>\n\t\t</MenuGroup>\n\t);\n}\n"]}
|
|
@@ -94,6 +94,7 @@ export default function PostTemplateForm(_ref) {
|
|
|
94
94
|
status: "warning",
|
|
95
95
|
isDismissible: false
|
|
96
96
|
}, __('The posts page template cannot be changed.')) : createElement(SelectControl, {
|
|
97
|
+
__nextHasNoMarginBottom: true,
|
|
97
98
|
hideLabelFromVision: true,
|
|
98
99
|
label: __('Template'),
|
|
99
100
|
value: (_selectedOption$value = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) !== null && _selectedOption$value !== void 0 ? _selectedOption$value : '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-template/form.js"],"names":["useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","__","addTemplate","Notice","SelectControl","Button","useSelect","useDispatch","store","editorStore","coreStore","editPostStore","PostTemplateCreateModal","PostTemplateForm","onClose","isPostsPage","availableTemplates","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","select","canUser","getEntityRecord","getEntityRecords","editorSettings","getEditorSettings","siteSettings","undefined","_isPostsPage","getCurrentPostId","page_for_posts","canCreateTemplates","post_type","getCurrentPostType","per_page","getEditedPostAttribute","supportsTemplateMode","getEditedPostTemplate","options","Object","entries","fromEntries","map","slug","title","rendered","value","label","selectedOption","find","option","editPost","__unstableSwitchToTemplateMode","isCreateModalOpen","setIsCreateModalOpen","icon","onClick","template"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,oCAAoC,IAAIC,sBAAjD,QAA+E,yBAA/E;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,SAASC,MAAT,EAAiBC,aAAjB,EAAgCC,MAAhC,QAA8C,uBAA9C;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,gBAAvC;AACA,OAAOC,uBAAP,MAAoC,gBAApC;AAEA,eAAe,SAASC,gBAAT,OAAyC;AAAA;;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AACvD,QAAM;AACLC,IAAAA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R,uEADQ,CAFV;AAKC,IAAA,OAAO,EACNkB,SAAS,GACN,CACA;AACCqC,MAAAA,IAAI,EAAEtD,WADP;AAEC8C,MAAAA,KAAK,EAAE/C,EAAE,CAAE,cAAF,CAFV;AAGCwD,MAAAA,OAAO,EAAE,MAAMF,oBAAoB,CAAE,IAAF;AAHpC,KADA,CADM,GAQN,EAdL;AAgBC,IAAA,OAAO,EAAGzC;AAhBX,IADD,EAmBGC,WAAW,GACZ,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,MAAM,EAAC,SAFR;AAGC,IAAA,aAAa,EAAG;AAHjB,KAKGd,EAAE,CAAE,4CAAF,CALL,CADY,GASZ,cAAC,aAAD;AACC,IAAA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-template/form.js"],"names":["useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","__","addTemplate","Notice","SelectControl","Button","useSelect","useDispatch","store","editorStore","coreStore","editPostStore","PostTemplateCreateModal","PostTemplateForm","onClose","isPostsPage","availableTemplates","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","select","canUser","getEntityRecord","getEntityRecords","editorSettings","getEditorSettings","siteSettings","undefined","_isPostsPage","getCurrentPostId","page_for_posts","canCreateTemplates","post_type","getCurrentPostType","per_page","getEditedPostAttribute","supportsTemplateMode","getEditedPostTemplate","options","Object","entries","fromEntries","map","slug","title","rendered","value","label","selectedOption","find","option","editPost","__unstableSwitchToTemplateMode","isCreateModalOpen","setIsCreateModalOpen","icon","onClick","template"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,oCAAoC,IAAIC,sBAAjD,QAA+E,yBAA/E;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,SAASC,MAAT,EAAiBC,aAAjB,EAAgCC,MAAhC,QAA8C,uBAA9C;AACA,SA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C,KAIGpD,EAAE,CAAE,eAAF,CAJL,CADD,CAxCF,EAiDGqD,iBAAiB,IAClB,cAAC,uBAAD;AACC,IAAA,OAAO,EAAG,MAAMC,oBAAoB,CAAE,KAAF;AADrC,IAlDF,CADD;AAyDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { addTemplate } from '@wordpress/icons';\nimport { Notice, SelectControl, Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport PostTemplateCreateModal from './create-modal';\n\nexport default function PostTemplateForm( { onClose } ) {\n\tconst {\n\t\tisPostsPage,\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tselectedTemplateSlug,\n\t\tcanCreate,\n\t\tcanEdit,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEntityRecords } =\n\t\t\tselect( coreStore );\n\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst _isPostsPage =\n\t\t\tselect( editorStore ).getCurrentPostId() ===\n\t\t\tsiteSettings?.page_for_posts;\n\t\tconst canCreateTemplates = canUser( 'create', 'templates' );\n\n\t\treturn {\n\t\t\tisPostsPage: _isPostsPage,\n\t\t\tavailableTemplates: editorSettings.availableTemplates,\n\t\t\tfetchedTemplates: canCreateTemplates\n\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\tpost_type: select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t } )\n\t\t\t\t: undefined,\n\t\t\tselectedTemplateSlug:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' ),\n\t\t\tcanCreate:\n\t\t\t\tcanCreateTemplates &&\n\t\t\t\t! _isPostsPage &&\n\t\t\t\teditorSettings.supportsTemplateMode,\n\t\t\tcanEdit:\n\t\t\t\tcanCreateTemplates &&\n\t\t\t\teditorSettings.supportsTemplateMode &&\n\t\t\t\t!! select( editPostStore ).getEditedPostTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst options = useMemo(\n\t\t() =>\n\t\t\tObject.entries( {\n\t\t\t\t...availableTemplates,\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t( fetchedTemplates ?? [] ).map( ( { slug, title } ) => [\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\ttitle.rendered,\n\t\t\t\t\t] )\n\t\t\t\t),\n\t\t\t} ).map( ( [ slug, title ] ) => ( { value: slug, label: title } ) ),\n\t\t[ availableTemplates, fetchedTemplates ]\n\t);\n\n\tconst selectedOption =\n\t\toptions.find( ( option ) => option.value === selectedTemplateSlug ) ??\n\t\toptions.find( ( option ) => ! option.value ); // The default option has '' value.\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { __unstableSwitchToTemplateMode } = useDispatch( editPostStore );\n\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\n\treturn (\n\t\t<div className=\"edit-post-post-template__form\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Template' ) }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Templates define the way content is displayed when viewing your site.'\n\t\t\t\t) }\n\t\t\t\tactions={\n\t\t\t\t\tcanCreate\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ticon: addTemplate,\n\t\t\t\t\t\t\t\t\tlabel: __( 'Add template' ),\n\t\t\t\t\t\t\t\t\tonClick: () => setIsCreateModalOpen( true ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: []\n\t\t\t\t}\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t{ isPostsPage ? (\n\t\t\t\t<Notice\n\t\t\t\t\tclassName=\"edit-post-post-template__notice\"\n\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\tisDismissible={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'The posts page template cannot be changed.' ) }\n\t\t\t\t</Notice>\n\t\t\t) : (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ __( 'Template' ) }\n\t\t\t\t\tvalue={ selectedOption?.value ?? '' }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\teditPost( { template: slug || '' } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canEdit && (\n\t\t\t\t<p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => __unstableSwitchToTemplateMode() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<PostTemplateCreateModal\n\t\t\t\t\tonClose={ () => setIsCreateModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -9,7 +9,7 @@ import classnames from 'classnames';
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { VisualEditorGlobalKeyboardShortcuts, PostTitle, store as editorStore } from '@wordpress/editor';
|
|
12
|
-
import { WritingFlow, BlockList, BlockTools, store as blockEditorStore, __unstableUseBlockSelectionClearer as useBlockSelectionClearer, __unstableUseTypewriter as useTypewriter, __unstableUseClipboardHandler as useClipboardHandler, __unstableUseTypingObserver as useTypingObserver,
|
|
12
|
+
import { WritingFlow, BlockList, BlockTools, store as blockEditorStore, __unstableUseBlockSelectionClearer as useBlockSelectionClearer, __unstableUseTypewriter as useTypewriter, __unstableUseClipboardHandler as useClipboardHandler, __unstableUseTypingObserver as useTypingObserver, __experimentalUseResizeCanvas as useResizeCanvas, __unstableEditorStyles as EditorStyles, useSetting, __experimentalLayoutStyle as LayoutStyle, __unstableUseMouseMoveTypingReset as useMouseMoveTypingReset, __unstableIframe as Iframe, __experimentalRecursionProvider as RecursionProvider, __experimentaluseLayoutClasses as useLayoutClasses, __experimentaluseLayoutStyles as useLayoutStyles } from '@wordpress/block-editor';
|
|
13
13
|
import { useEffect, useRef, useMemo } from '@wordpress/element';
|
|
14
14
|
import { Button, __unstableMotion as motion } from '@wordpress/components';
|
|
15
15
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
@@ -22,7 +22,6 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
22
22
|
* Internal dependencies
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import BlockInspectorButton from './block-inspector-button';
|
|
26
25
|
import { store as editPostStore } from '../../store';
|
|
27
26
|
|
|
28
27
|
function MaybeIframe(_ref) {
|
|
@@ -31,7 +30,6 @@ function MaybeIframe(_ref) {
|
|
|
31
30
|
contentRef,
|
|
32
31
|
shouldIframe,
|
|
33
32
|
styles,
|
|
34
|
-
assets,
|
|
35
33
|
style
|
|
36
34
|
} = _ref;
|
|
37
35
|
const ref = useMouseMoveTypingReset();
|
|
@@ -54,7 +52,6 @@ function MaybeIframe(_ref) {
|
|
|
54
52
|
head: createElement(EditorStyles, {
|
|
55
53
|
styles: styles
|
|
56
54
|
}),
|
|
57
|
-
assets: assets,
|
|
58
55
|
ref: ref,
|
|
59
56
|
contentRef: contentRef,
|
|
60
57
|
style: {
|
|
@@ -150,7 +147,6 @@ export default function VisualEditor(_ref2) {
|
|
|
150
147
|
const {
|
|
151
148
|
themeHasDisabledLayoutStyles,
|
|
152
149
|
themeSupportsLayout,
|
|
153
|
-
assets,
|
|
154
150
|
isFocusMode
|
|
155
151
|
} = useSelect(select => {
|
|
156
152
|
const _settings = select(blockEditorStore).getSettings();
|
|
@@ -158,7 +154,6 @@ export default function VisualEditor(_ref2) {
|
|
|
158
154
|
return {
|
|
159
155
|
themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
|
|
160
156
|
themeSupportsLayout: _settings.supportsLayout,
|
|
161
|
-
assets: _settings.__unstableResolvedAssets,
|
|
162
157
|
isFocusMode: _settings.focusMode
|
|
163
158
|
};
|
|
164
159
|
}, []);
|
|
@@ -293,8 +288,7 @@ export default function VisualEditor(_ref2) {
|
|
|
293
288
|
}, createElement(MaybeIframe, {
|
|
294
289
|
shouldIframe: isBlockBasedTheme && !hasMetaBoxes || isTemplateMode || deviceType === 'Tablet' || deviceType === 'Mobile',
|
|
295
290
|
contentRef: contentRef,
|
|
296
|
-
styles: styles
|
|
297
|
-
assets: assets
|
|
291
|
+
styles: styles
|
|
298
292
|
}, themeSupportsLayout && !themeHasDisabledLayoutStyles && !isTemplateMode && createElement(Fragment, null, createElement(LayoutStyle, {
|
|
299
293
|
selector: ".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container",
|
|
300
294
|
layout: fallbackLayout,
|
|
@@ -319,13 +313,6 @@ export default function VisualEditor(_ref2) {
|
|
|
319
313
|
className: isTemplateMode ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.
|
|
320
314
|
,
|
|
321
315
|
__experimentalLayout: blockListLayout
|
|
322
|
-
})))))
|
|
323
|
-
let {
|
|
324
|
-
onClose
|
|
325
|
-
} = _ref3;
|
|
326
|
-
return createElement(BlockInspectorButton, {
|
|
327
|
-
onClick: onClose
|
|
328
|
-
});
|
|
329
|
-
}));
|
|
316
|
+
}))))));
|
|
330
317
|
}
|
|
331
318
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["classnames","VisualEditorGlobalKeyboardShortcuts","PostTitle","store","editorStore","WritingFlow","BlockList","BlockTools","blockEditorStore","__unstableUseBlockSelectionClearer","useBlockSelectionClearer","__unstableUseTypewriter","useTypewriter","__unstableUseClipboardHandler","useClipboardHandler","__unstableUseTypingObserver","useTypingObserver","__unstableBlockSettingsMenuFirstItem","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","useSetting","__experimentalLayoutStyle","LayoutStyle","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","__unstableIframe","Iframe","__experimentalRecursionProvider","RecursionProvider","__experimentaluseLayoutClasses","useLayoutClasses","__experimentaluseLayoutStyles","useLayoutStyles","useEffect","useRef","useMemo","Button","__unstableMotion","motion","useSelect","useDispatch","useMergeRefs","arrowLeft","__","parse","coreStore","BlockInspectorButton","editPostStore","MaybeIframe","children","contentRef","shouldIframe","styles","assets","style","ref","flex","width","height","display","findPostContent","blocks","i","length","name","innerBlocks","nestedPostContent","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","select","isFeatureActive","isEditingTemplate","__experimentalGetPreviewDeviceType","getEditedPostTemplate","getCurrentPostId","getCurrentPostType","getEditorSettings","_isTemplateMode","_wrapperBlockName","editorSettings","supportsTemplateMode","canEditTemplate","canUser","undefined","__unstableIsBlockBasedTheme","isCleanNewPost","hasMetaBoxes","themeHasDisabledLayoutStyles","themeSupportsLayout","isFocusMode","_settings","getSettings","disableLayoutStyles","supportsLayout","__unstableResolvedAssets","focusMode","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","globalLayoutSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","fallbackLayout","type","postContentBlock","parseableContent","content","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","layout","attributes","postContentLayout","inherit","contentSize","wideSize","blockListLayout","titleRef","current","focus","css","padding","definitions","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,mCADD,EAECC,SAFD,EAGCC,KAAK,IAAIC,WAHV,QAIO,mBAJP;AAKA,SACCC,WADD,EAECC,SAFD,EAGCC,UAHD,EAICJ,KAAK,IAAIK,gBAJV,EAKCC,kCAAkC,IAAIC,wBALvC,EAMCC,uBAAuB,IAAIC,aAN5B,EAOCC,6BAA6B,IAAIC,mBAPlC,EAQCC,2BAA2B,IAAIC,iBARhC,EASCC,oCATD,EAUCC,6BAA6B,IAAIC,eAVlC,EAWCC,sBAAsB,IAAIC,YAX3B,EAYCC,UAZD,EAaCC,yBAAyB,IAAIC,WAb9B,EAcCC,iCAAiC,IAAIC,uBAdtC,EAeCC,gBAAgB,IAAIC,MAfrB,EAgBCC,+BAA+B,IAAIC,iBAhBpC,EAiBCC,8BAA8B,IAAIC,gBAjBnC,EAkBCC,6BAA6B,IAAIC,eAlBlC,QAmBO,yBAnBP;AAoBA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,OAA5B,QAA2C,oBAA3C;AACA,SAASC,MAAT,EAAiBC,gBAAgB,IAAIC,MAArC,QAAmD,uBAAnD;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,oBAA7B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,mBAAtB;AACA,SAAS3C,KAAK,IAAI4C,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,SAAS7C,KAAK,IAAI8C,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,WAAT,OAOI;AAAA,MAPkB;AACrBC,IAAAA,QADqB;AAErBC,IAAAA,UAFqB;AAGrBC,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ADgB,uBAChBA,oBAAoB,CAAE0B;AAJxB,IADD,EAQGb,uBAAuB,IACxB,cAAC,WAAD;AACC,IAAA,MAAM,EAAGG,iBADV;AAEC,IAAA,GAAG,EAAGH,uBAFP;AAGC,IAAA,iBAAiB,EAChBb,oBADgB,aAChBA,oBADgB,uBAChBA,oBAAoB,CAAE0B;AAJxB,IATF,CAdH,EAiCG,CAAErE,cAAF,IACD;AACC,IAAA,SAAS,EAAGxE,UAAU,EACrB;AACA;AACA,uBAHqB,EAIrB,iCAJqB,EAKrB,6CALqB,EAMrB;AACC,uBAAiBiG;AADlB,KANqB,EASrB8B,oBATqB,CADvB;AAYC,IAAA,eAAe,EAAG;AAZnB,KAcC,cAAC,SAAD;AAAW,IAAA,GAAG,EAAGS;AAAjB,IAdD,CAlCF,EAmDC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAG9D,gBADb;AAEC,IAAA,QAAQ,EAAGC;AAFZ,KAIC,cAAC,SAAD;AACC,IAAA,SAAS,EACRH,cAAc,GACX,gBADW,GAEV,GAAGuD,oBAAsB,wBAHrB,CAG6C;AAJvD;AAMC,IAAA,oBAAoB,EAAGQ;AANxB,IAJD,CAnDD,CALD,CAnBD,CAPD,EAkGC,cAAC,oCAAD,QACG;AAAA,QAAE;AAAEO,MAAAA;AAAF,KAAF;AAAA,WACD,cAAC,oBAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CAlGD,CADD;AA0GA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentaluseLayoutClasses as useLayoutClasses,\n\t__experimentaluseLayoutStyles as useLayoutStyles,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from './block-inspector-button';\nimport { store as editPostStore } from '../../store';\n\nfunction MaybeIframe( {\n\tchildren,\n\tcontentRef,\n\tshouldIframe,\n\tstyles,\n\tassets,\n\tstyle,\n} ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\thead={ <EditorStyles styles={ styles } /> }\n\t\t\tassets={ assets }\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t\tname=\"editor-canvas\"\n\t\t>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object} The Post Content block.\n */\nfunction findPostContent( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ];\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = findPostContent(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tisBlockBasedTheme,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetEditedPostTemplate,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst canEditTemplate = select( coreStore ).canUser(\n\t\t\t'create',\n\t\t\t'templates'\n\t\t);\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so we check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tsupportsTemplateMode && canEditTemplate\n\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst {\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t\tassets,\n\t\tisFocusMode,\n\t} = useSelect( ( select ) => {\n\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\tassets: _settings.__unstableResolvedAssets,\n\t\t\tisFocusMode: _settings.focusMode,\n\t\t};\n\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst globalLayoutSettings = useSetting( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [ isTemplateMode, themeSupportsLayout, globalLayoutSettings ] );\n\n\tconst postContentBlock = useMemo( () => {\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn findPostContent( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn findPostContent( parse( parseableContent ) ) || {};\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst postContentLayoutClasses = useLayoutClasses( postContentBlock );\n\n\tconst blockListLayoutClass = classnames(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tpostContentBlock,\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\tconst layout = postContentBlock?.attributes?.layout || {};\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentBlock\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible, isCleanNewPost ] );\n\n\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss:\n\t\t\t\t\t`.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` +\n\t\t\t\t\t( paddingBottom\n\t\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t\t: '' ),\n\t\t\t},\n\t\t],\n\t\t[ styles ]\n\t);\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : '0',\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\t( isBlockBasedTheme && ! hasMetaBoxes ) ||\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\tassets={ assets }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\t\t! isTemplateMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\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{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t// This wrapper div should have the same\n\t\t\t\t\t\t\t\t\t// classes as the block list beneath.\n\t\t\t\t\t\t\t\t\t'is-root-container',\n\t\t\t\t\t\t\t\t\t'block-editor-block-list__layout',\n\t\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tblockListLayoutClass\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__experimentalLayout={ blockListLayout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</MaybeIframe>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</BlockTools>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["classnames","VisualEditorGlobalKeyboardShortcuts","PostTitle","store","editorStore","WritingFlow","BlockList","BlockTools","blockEditorStore","__unstableUseBlockSelectionClearer","useBlockSelectionClearer","__unstableUseTypewriter","useTypewriter","__unstableUseClipboardHandler","useClipboardHandler","__unstableUseTypingObserver","useTypingObserver","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","useSetting","__experimentalLayoutStyle","LayoutStyle","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","__unstableIframe","Iframe","__experimentalRecursionProvider","RecursionProvider","__experimentaluseLayoutClasses","useLayoutClasses","__experimentaluseLayoutStyles","useLayoutStyles","useEffect","useRef","useMemo","Button","__unstableMotion","motion","useSelect","useDispatch","useMergeRefs","arrowLeft","__","parse","coreStore","editPostStore","MaybeIframe","children","contentRef","shouldIframe","styles","style","ref","flex","width","height","display","findPostContent","blocks","i","length","name","innerBlocks","nestedPostContent","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","select","isFeatureActive","isEditingTemplate","__experimentalGetPreviewDeviceType","getEditedPostTemplate","getCurrentPostId","getCurrentPostType","getEditorSettings","_isTemplateMode","_wrapperBlockName","editorSettings","supportsTemplateMode","canEditTemplate","canUser","undefined","__unstableIsBlockBasedTheme","isCleanNewPost","hasMetaBoxes","themeHasDisabledLayoutStyles","themeSupportsLayout","isFocusMode","_settings","getSettings","disableLayoutStyles","supportsLayout","focusMode","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","globalLayoutSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","fallbackLayout","type","postContentBlock","parseableContent","content","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","layout","attributes","postContentLayout","inherit","contentSize","wideSize","blockListLayout","titleRef","current","focus","css","padding","definitions"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,mCADD,EAECC,SAFD,EAGCC,KAAK,IAAIC,WAHV,QAIO,mBAJP;AAKA,SACCC,WADD,EAECC,SAFD,EAGCC,UAHD,EAICJ,KAAK,IAAIK,gBAJV,EAKCC,kCAAkC,IAAIC,wBALvC,EAMCC,uBAAuB,IAAIC,aAN5B,EAOCC,6BAA6B,IAAIC,mBAPlC,EAQCC,2BAA2B,IAAIC,iBARhC,EASCC,6BAA6B,IAAIC,eATlC,EAUCC,sBAAsB,IAAIC,YAV3B,EAWCC,UAXD,EAYCC,yBAAyB,IAAIC,WAZ9B,EAaCC,iCAAiC,IAAIC,uBAbtC,EAcCC,gBAAgB,IAAIC,MAdrB,EAeCC,+BA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A","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentaluseLayoutClasses as useLayoutClasses,\n\t__experimentaluseLayoutStyles as useLayoutStyles,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\thead={ <EditorStyles styles={ styles } /> }\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t\tname=\"editor-canvas\"\n\t\t>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object} The Post Content block.\n */\nfunction findPostContent( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ];\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = findPostContent(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tisBlockBasedTheme,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetEditedPostTemplate,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst canEditTemplate = select( coreStore ).canUser(\n\t\t\t'create',\n\t\t\t'templates'\n\t\t);\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so we check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tsupportsTemplateMode && canEditTemplate\n\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst { themeHasDisabledLayoutStyles, themeSupportsLayout, isFocusMode } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\t\treturn {\n\t\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\t\tisFocusMode: _settings.focusMode,\n\t\t\t};\n\t\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst globalLayoutSettings = useSetting( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [ isTemplateMode, themeSupportsLayout, globalLayoutSettings ] );\n\n\tconst postContentBlock = useMemo( () => {\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn findPostContent( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn findPostContent( parse( parseableContent ) ) || {};\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst postContentLayoutClasses = useLayoutClasses( postContentBlock );\n\n\tconst blockListLayoutClass = classnames(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tpostContentBlock,\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\tconst layout = postContentBlock?.attributes?.layout || {};\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentBlock\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible, isCleanNewPost ] );\n\n\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss:\n\t\t\t\t\t`.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` +\n\t\t\t\t\t( paddingBottom\n\t\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t\t: '' ),\n\t\t\t},\n\t\t],\n\t\t[ styles ]\n\t);\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : '0',\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\t( isBlockBasedTheme && ! hasMetaBoxes ) ||\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\t\t! isTemplateMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\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{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t// This wrapper div should have the same\n\t\t\t\t\t\t\t\t\t// classes as the block list beneath.\n\t\t\t\t\t\t\t\t\t'is-root-container',\n\t\t\t\t\t\t\t\t\t'block-editor-block-list__layout',\n\t\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tblockListLayoutClass\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__experimentalLayout={ blockListLayout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</MaybeIframe>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t</BlockTools>\n\t);\n}\n"]}
|
|
@@ -16,7 +16,6 @@ import CopyContentMenuItem from './copy-content-menu-item';
|
|
|
16
16
|
import KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';
|
|
17
17
|
import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';
|
|
18
18
|
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
19
|
-
import NavigationListViewMenuItem from './navigation-list-view-menu-item';
|
|
20
19
|
registerPlugin('edit-post', {
|
|
21
20
|
render() {
|
|
22
21
|
return createElement(Fragment, null, createElement(ToolsMoreMenuGroup, null, _ref => {
|
|
@@ -41,7 +40,7 @@ registerPlugin('edit-post', {
|
|
|
41
40
|
},
|
|
42
41
|
/* translators: accessibility text */
|
|
43
42
|
__('(opens in a new tab)'))));
|
|
44
|
-
})
|
|
43
|
+
}));
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["MenuItem","VisuallyHidden","external","__","registerPlugin","addQueryArgs","CopyContentMenuItem","KeyboardShortcutsHelpMenuItem","ToolsMoreMenuGroup","WelcomeGuideMenuItem","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["MenuItem","VisuallyHidden","external","__","registerPlugin","addQueryArgs","CopyContentMenuItem","KeyboardShortcutsHelpMenuItem","ToolsMoreMenuGroup","WelcomeGuideMenuItem","render","onClose","post_type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,cAAnB,QAAyC,uBAAzC;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,OAAOC,6BAAP,MAA0C,qCAA1C;AACA,OAAOC,kBAAP,MAA+B,4CAA/B;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AAEAL,cAAc,CAAE,WAAF,EAAe;AAC5BM,EAAAA,MAAM,GAAG;AACR,WACC,8BACC,cAAC,kBAAD,QACG;AAAA,UAAE;AAAEC,QAAAA;AAAF,OAAF;AAAA,aACD,8BACC,cAAC,QAAD;AACC,QAAA,IAAI,EAAC,UADN;AAEC,QAAA,IAAI,EAAGN,YAAY,CAAE,UAAF,EAAc;AAChCO,UAAAA,SAAS,EAAE;AADqB,SAAd;AAFpB,SAMGT,EAAE,CAAE,wBAAF,CANL,CADD,EASC,cAAC,6BAAD;AACC,QAAA,QAAQ,EAAGQ;AADZ,QATD,EAYC,cAAC,oBAAD,OAZD,EAaC,cAAC,mBAAD,OAbD,EAcC,cAAC,QAAD;AACC,QAAA,IAAI,EAAC,UADN;AAEC,QAAA,IAAI,EAAGT,QAFR;AAGC,QAAA,IAAI,EAAGC,EAAE,CACR,yDADQ,CAHV;AAMC,QAAA,MAAM,EAAC,QANR;AAOC,QAAA,GAAG,EAAC;AAPL,SASGA,EAAE,CAAE,MAAF,CATL,EAUC,cAAC,cAAD;AAAgB,QAAA,EAAE,EAAC;AAAnB;AAEE;AACAA,MAAAA,EAAE,CAAE,sBAAF,CAHJ,CAVD,CAdD,CADC;AAAA,KADH,CADD,CADD;AAwCA;;AA1C2B,CAAf,CAAd","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nregisterPlugin( 'edit-post', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\thref={ addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\t\t\tpost_type: 'wp_block',\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Manage Reusable blocks' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<KeyboardShortcutsHelpMenuItem\n\t\t\t\t\t\t\t\tonSelect={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/wordpress-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsMoreMenuGroup>\n\t\t\t</>\n\t\t);\n\t},\n} );\n"]}
|
|
@@ -501,6 +501,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
501
501
|
box-shadow: none;
|
|
502
502
|
font-weight: 500;
|
|
503
503
|
}
|
|
504
|
+
.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active::after {
|
|
505
|
+
content: none;
|
|
506
|
+
}
|
|
504
507
|
.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) {
|
|
505
508
|
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
506
509
|
}
|
package/build-style/style.css
CHANGED
|
@@ -501,6 +501,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
501
501
|
box-shadow: none;
|
|
502
502
|
font-weight: 500;
|
|
503
503
|
}
|
|
504
|
+
.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active::after {
|
|
505
|
+
content: none;
|
|
506
|
+
}
|
|
504
507
|
.interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) {
|
|
505
508
|
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
506
509
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,32 +27,32 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^3.
|
|
31
|
-
"@wordpress/api-fetch": "^6.
|
|
32
|
-
"@wordpress/block-editor": "^11.
|
|
33
|
-
"@wordpress/block-library": "^8.
|
|
34
|
-
"@wordpress/blocks": "^12.
|
|
35
|
-
"@wordpress/components": "^23.
|
|
36
|
-
"@wordpress/compose": "^6.
|
|
37
|
-
"@wordpress/core-data": "^6.
|
|
38
|
-
"@wordpress/data": "^8.
|
|
39
|
-
"@wordpress/deprecated": "^3.
|
|
40
|
-
"@wordpress/editor": "^13.
|
|
41
|
-
"@wordpress/element": "^5.
|
|
42
|
-
"@wordpress/hooks": "^3.
|
|
43
|
-
"@wordpress/i18n": "^4.
|
|
44
|
-
"@wordpress/icons": "^9.
|
|
45
|
-
"@wordpress/interface": "^5.
|
|
46
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
47
|
-
"@wordpress/keycodes": "^3.
|
|
48
|
-
"@wordpress/media-utils": "^4.
|
|
49
|
-
"@wordpress/notices": "^3.
|
|
50
|
-
"@wordpress/plugins": "^5.
|
|
51
|
-
"@wordpress/preferences": "^3.
|
|
52
|
-
"@wordpress/url": "^3.
|
|
53
|
-
"@wordpress/viewport": "^5.
|
|
54
|
-
"@wordpress/warning": "^2.
|
|
55
|
-
"@wordpress/widgets": "^3.
|
|
30
|
+
"@wordpress/a11y": "^3.25.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.22.0",
|
|
32
|
+
"@wordpress/block-editor": "^11.2.0",
|
|
33
|
+
"@wordpress/block-library": "^8.2.0",
|
|
34
|
+
"@wordpress/blocks": "^12.2.0",
|
|
35
|
+
"@wordpress/components": "^23.2.0",
|
|
36
|
+
"@wordpress/compose": "^6.2.0",
|
|
37
|
+
"@wordpress/core-data": "^6.2.0",
|
|
38
|
+
"@wordpress/data": "^8.2.0",
|
|
39
|
+
"@wordpress/deprecated": "^3.25.0",
|
|
40
|
+
"@wordpress/editor": "^13.2.0",
|
|
41
|
+
"@wordpress/element": "^5.2.0",
|
|
42
|
+
"@wordpress/hooks": "^3.25.0",
|
|
43
|
+
"@wordpress/i18n": "^4.25.0",
|
|
44
|
+
"@wordpress/icons": "^9.16.0",
|
|
45
|
+
"@wordpress/interface": "^5.2.0",
|
|
46
|
+
"@wordpress/keyboard-shortcuts": "^4.2.0",
|
|
47
|
+
"@wordpress/keycodes": "^3.25.0",
|
|
48
|
+
"@wordpress/media-utils": "^4.16.0",
|
|
49
|
+
"@wordpress/notices": "^3.25.0",
|
|
50
|
+
"@wordpress/plugins": "^5.2.0",
|
|
51
|
+
"@wordpress/preferences": "^3.2.0",
|
|
52
|
+
"@wordpress/url": "^3.26.0",
|
|
53
|
+
"@wordpress/viewport": "^5.2.0",
|
|
54
|
+
"@wordpress/warning": "^2.25.0",
|
|
55
|
+
"@wordpress/widgets": "^3.2.0",
|
|
56
56
|
"classnames": "^2.3.1",
|
|
57
57
|
"lodash": "^4.17.21",
|
|
58
58
|
"memize": "^1.1.0",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "204c880ff65295768e9695dfee6c7a9fee1fdd05"
|
|
69
69
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { pickBy } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -58,11 +53,10 @@ export default function DeleteTemplate() {
|
|
|
58
53
|
template: '',
|
|
59
54
|
} );
|
|
60
55
|
const settings = getEditorSettings();
|
|
61
|
-
const newAvailableTemplates =
|
|
62
|
-
settings.availableTemplates
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
56
|
+
const newAvailableTemplates = Object.fromEntries(
|
|
57
|
+
Object.entries( settings.availableTemplates ?? {} ).filter(
|
|
58
|
+
( [ id ] ) => id !== template.slug
|
|
59
|
+
)
|
|
66
60
|
);
|
|
67
61
|
updateEditorSettings( {
|
|
68
62
|
...settings,
|
|
@@ -597,6 +597,7 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
597
597
|
background: none;
|
|
598
598
|
text-align: start;
|
|
599
599
|
padding: calc((36px - calc(13px * 1.2) - 2px) / 2) 12px;
|
|
600
|
+
box-sizing: border-box;
|
|
600
601
|
width: 100%;
|
|
601
602
|
display: block;
|
|
602
603
|
margin: 0;
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
__unstableUseTypewriter as useTypewriter,
|
|
21
21
|
__unstableUseClipboardHandler as useClipboardHandler,
|
|
22
22
|
__unstableUseTypingObserver as useTypingObserver,
|
|
23
|
-
__unstableBlockSettingsMenuFirstItem,
|
|
24
23
|
__experimentalUseResizeCanvas as useResizeCanvas,
|
|
25
24
|
__unstableEditorStyles as EditorStyles,
|
|
26
25
|
useSetting,
|
|
@@ -43,17 +42,9 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
43
42
|
/**
|
|
44
43
|
* Internal dependencies
|
|
45
44
|
*/
|
|
46
|
-
import BlockInspectorButton from './block-inspector-button';
|
|
47
45
|
import { store as editPostStore } from '../../store';
|
|
48
46
|
|
|
49
|
-
function MaybeIframe( {
|
|
50
|
-
children,
|
|
51
|
-
contentRef,
|
|
52
|
-
shouldIframe,
|
|
53
|
-
styles,
|
|
54
|
-
assets,
|
|
55
|
-
style,
|
|
56
|
-
} ) {
|
|
47
|
+
function MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {
|
|
57
48
|
const ref = useMouseMoveTypingReset();
|
|
58
49
|
|
|
59
50
|
if ( ! shouldIframe ) {
|
|
@@ -75,7 +66,6 @@ function MaybeIframe( {
|
|
|
75
66
|
return (
|
|
76
67
|
<Iframe
|
|
77
68
|
head={ <EditorStyles styles={ styles } /> }
|
|
78
|
-
assets={ assets }
|
|
79
69
|
ref={ ref }
|
|
80
70
|
contentRef={ contentRef }
|
|
81
71
|
style={ { width: '100%', height: '100%', display: 'block' } }
|
|
@@ -165,20 +155,15 @@ export default function VisualEditor( { styles } ) {
|
|
|
165
155
|
( select ) => select( editPostStore ).hasMetaBoxes(),
|
|
166
156
|
[]
|
|
167
157
|
);
|
|
168
|
-
const {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
themeSupportsLayout: _settings.supportsLayout,
|
|
178
|
-
assets: _settings.__unstableResolvedAssets,
|
|
179
|
-
isFocusMode: _settings.focusMode,
|
|
180
|
-
};
|
|
181
|
-
}, [] );
|
|
158
|
+
const { themeHasDisabledLayoutStyles, themeSupportsLayout, isFocusMode } =
|
|
159
|
+
useSelect( ( select ) => {
|
|
160
|
+
const _settings = select( blockEditorStore ).getSettings();
|
|
161
|
+
return {
|
|
162
|
+
themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
|
|
163
|
+
themeSupportsLayout: _settings.supportsLayout,
|
|
164
|
+
isFocusMode: _settings.focusMode,
|
|
165
|
+
};
|
|
166
|
+
}, [] );
|
|
182
167
|
const { clearSelectedBlock } = useDispatch( blockEditorStore );
|
|
183
168
|
const { setIsEditingTemplate } = useDispatch( editPostStore );
|
|
184
169
|
const desktopCanvasStyles = {
|
|
@@ -361,7 +346,6 @@ export default function VisualEditor( { styles } ) {
|
|
|
361
346
|
}
|
|
362
347
|
contentRef={ contentRef }
|
|
363
348
|
styles={ styles }
|
|
364
|
-
assets={ assets }
|
|
365
349
|
>
|
|
366
350
|
{ themeSupportsLayout &&
|
|
367
351
|
! themeHasDisabledLayoutStyles &&
|
|
@@ -419,11 +403,6 @@ export default function VisualEditor( { styles } ) {
|
|
|
419
403
|
</MaybeIframe>
|
|
420
404
|
</motion.div>
|
|
421
405
|
</motion.div>
|
|
422
|
-
<__unstableBlockSettingsMenuFirstItem>
|
|
423
|
-
{ ( { onClose } ) => (
|
|
424
|
-
<BlockInspectorButton onClick={ onClose } />
|
|
425
|
-
) }
|
|
426
|
-
</__unstableBlockSettingsMenuFirstItem>
|
|
427
406
|
</BlockTools>
|
|
428
407
|
);
|
|
429
408
|
}
|
package/src/plugins/index.js
CHANGED
|
@@ -14,7 +14,6 @@ import CopyContentMenuItem from './copy-content-menu-item';
|
|
|
14
14
|
import KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';
|
|
15
15
|
import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';
|
|
16
16
|
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
17
|
-
import NavigationListViewMenuItem from './navigation-list-view-menu-item';
|
|
18
17
|
|
|
19
18
|
registerPlugin( 'edit-post', {
|
|
20
19
|
render() {
|
|
@@ -56,7 +55,6 @@ registerPlugin( 'edit-post', {
|
|
|
56
55
|
</>
|
|
57
56
|
) }
|
|
58
57
|
</ToolsMoreMenuGroup>
|
|
59
|
-
<NavigationListViewMenuItem />
|
|
60
58
|
</>
|
|
61
59
|
);
|
|
62
60
|
},
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
-
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
|
-
var _data = require("@wordpress/data");
|
|
15
|
-
|
|
16
|
-
var _i18n = require("@wordpress/i18n");
|
|
17
|
-
|
|
18
|
-
var _icons = require("@wordpress/icons");
|
|
19
|
-
|
|
20
|
-
var _window;
|
|
21
|
-
|
|
22
|
-
const NavMenuSidebarToggle = () => {
|
|
23
|
-
// eslint-disable-next-line @wordpress/data-no-store-string-literals
|
|
24
|
-
const {
|
|
25
|
-
openGeneralSidebar
|
|
26
|
-
} = (0, _data.useDispatch)('core/edit-post');
|
|
27
|
-
return (0, _element.createElement)(_components.ToolbarGroup, null, (0, _element.createElement)(_components.ToolbarButton, {
|
|
28
|
-
className: "components-toolbar__control",
|
|
29
|
-
label: (0, _i18n.__)('Open navigation list view'),
|
|
30
|
-
onClick: () => openGeneralSidebar('edit-post/block'),
|
|
31
|
-
icon: _icons.listView
|
|
32
|
-
}));
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
let MaybeNavMenuSidebarToggle = _element.Fragment;
|
|
36
|
-
const isOffCanvasNavigationEditorEnabled = ((_window = window) === null || _window === void 0 ? void 0 : _window.__experimentalEnableOffCanvasNavigationEditor) === true;
|
|
37
|
-
|
|
38
|
-
if (isOffCanvasNavigationEditorEnabled) {
|
|
39
|
-
MaybeNavMenuSidebarToggle = NavMenuSidebarToggle;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const NavigationEditMenuItem = () => {
|
|
43
|
-
return (0, _element.createElement)(_blockEditor.BlockEditorProvider, null, (0, _element.createElement)(_blockEditor.__unstableBlockToolbarLastItem, null, (0, _element.createElement)(_blockEditor.__unstableBlockNameContext.Consumer, null, blockName => blockName === 'core/navigation' && (0, _element.createElement)(MaybeNavMenuSidebarToggle, null))));
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
var _default = NavigationEditMenuItem;
|
|
47
|
-
exports.default = _default;
|
|
48
|
-
//# sourceMappingURL=navigation-list-view-menu-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/plugins/navigation-list-view-menu-item.js"],"names":["NavMenuSidebarToggle","openGeneralSidebar","listView","MaybeNavMenuSidebarToggle","Fragment","isOffCanvasNavigationEditorEnabled","window","__experimentalEnableOffCanvasNavigationEditor","NavigationEditMenuItem","blockName"],"mappings":";;;;;;;AAUA;;AAPA;;AAKA;;AACA;;AAEA;;AACA;;;;AAEA,MAAMA,oBAAoB,GAAG,MAAM;AAClC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAyB,uBAAa,gBAAb,CAA/B;AAEA,SACC,4BAAC,wBAAD,QACC,4BAAC,yBAAD;AACC,IAAA,SAAS,EAAC,6BADX;AAEC,IAAA,KAAK,EAAG,cAAI,2BAAJ,CAFT;AAGC,IAAA,OAAO,EAAG,MAAMA,kBAAkB,CAAE,iBAAF,CAHnC;AAIC,IAAA,IAAI,EAAGC;AAJR,IADD,CADD;AAUA,CAdD;;AAgBA,IAAIC,yBAAyB,GAAGC,iBAAhC;AAEA,MAAMC,kCAAkC,GACvC,YAAAC,MAAM,UAAN,0CAAQC,6CAAR,MAA0D,IAD3D;;AAGA,IAAKF,kCAAL,EAA0C;AACzCF,EAAAA,yBAAyB,GAAGH,oBAA5B;AACA;;AAED,MAAMQ,sBAAsB,GAAG,MAAM;AACpC,SACC,4BAAC,gCAAD,QACC,4BAAC,2CAAD,QACC,4BAAC,uCAAD,CAA4B,QAA5B,QACKC,SAAF,IACDA,SAAS,KAAK,iBAAd,IACC,4BAAC,yBAAD,OAHH,CADD,CADD,CADD;AAaA,CAdD;;eAgBeD,sB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockEditorProvider,\n\t__unstableBlockToolbarLastItem,\n\t__unstableBlockNameContext,\n} from '@wordpress/block-editor';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { Fragment } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { listView } from '@wordpress/icons';\n\nconst NavMenuSidebarToggle = () => {\n\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\tconst { openGeneralSidebar } = useDispatch( 'core/edit-post' );\n\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ __( 'Open navigation list view' ) }\n\t\t\t\tonClick={ () => openGeneralSidebar( 'edit-post/block' ) }\n\t\t\t\ticon={ listView }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n};\n\nlet MaybeNavMenuSidebarToggle = Fragment;\n\nconst isOffCanvasNavigationEditorEnabled =\n\twindow?.__experimentalEnableOffCanvasNavigationEditor === true;\n\nif ( isOffCanvasNavigationEditorEnabled ) {\n\tMaybeNavMenuSidebarToggle = NavMenuSidebarToggle;\n}\n\nconst NavigationEditMenuItem = () => {\n\treturn (\n\t\t<BlockEditorProvider>\n\t\t\t<__unstableBlockToolbarLastItem>\n\t\t\t\t<__unstableBlockNameContext.Consumer>\n\t\t\t\t\t{ ( blockName ) =>\n\t\t\t\t\t\tblockName === 'core/navigation' && (\n\t\t\t\t\t\t\t<MaybeNavMenuSidebarToggle />\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t</__unstableBlockNameContext.Consumer>\n\t\t\t</__unstableBlockToolbarLastItem>\n\t\t</BlockEditorProvider>\n\t);\n};\n\nexport default NavigationEditMenuItem;\n"]}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
var _window;
|
|
2
|
-
|
|
3
|
-
import { createElement } from "@wordpress/element";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* WordPress dependencies
|
|
7
|
-
*/
|
|
8
|
-
import { BlockEditorProvider, __unstableBlockToolbarLastItem, __unstableBlockNameContext } from '@wordpress/block-editor';
|
|
9
|
-
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
10
|
-
import { useDispatch } from '@wordpress/data';
|
|
11
|
-
import { Fragment } from '@wordpress/element';
|
|
12
|
-
import { __ } from '@wordpress/i18n';
|
|
13
|
-
import { listView } from '@wordpress/icons';
|
|
14
|
-
|
|
15
|
-
const NavMenuSidebarToggle = () => {
|
|
16
|
-
// eslint-disable-next-line @wordpress/data-no-store-string-literals
|
|
17
|
-
const {
|
|
18
|
-
openGeneralSidebar
|
|
19
|
-
} = useDispatch('core/edit-post');
|
|
20
|
-
return createElement(ToolbarGroup, null, createElement(ToolbarButton, {
|
|
21
|
-
className: "components-toolbar__control",
|
|
22
|
-
label: __('Open navigation list view'),
|
|
23
|
-
onClick: () => openGeneralSidebar('edit-post/block'),
|
|
24
|
-
icon: listView
|
|
25
|
-
}));
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
let MaybeNavMenuSidebarToggle = Fragment;
|
|
29
|
-
const isOffCanvasNavigationEditorEnabled = ((_window = window) === null || _window === void 0 ? void 0 : _window.__experimentalEnableOffCanvasNavigationEditor) === true;
|
|
30
|
-
|
|
31
|
-
if (isOffCanvasNavigationEditorEnabled) {
|
|
32
|
-
MaybeNavMenuSidebarToggle = NavMenuSidebarToggle;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const NavigationEditMenuItem = () => {
|
|
36
|
-
return createElement(BlockEditorProvider, null, createElement(__unstableBlockToolbarLastItem, null, createElement(__unstableBlockNameContext.Consumer, null, blockName => blockName === 'core/navigation' && createElement(MaybeNavMenuSidebarToggle, null))));
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default NavigationEditMenuItem;
|
|
40
|
-
//# sourceMappingURL=navigation-list-view-menu-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/plugins/navigation-list-view-menu-item.js"],"names":["BlockEditorProvider","__unstableBlockToolbarLastItem","__unstableBlockNameContext","ToolbarButton","ToolbarGroup","useDispatch","Fragment","__","listView","NavMenuSidebarToggle","openGeneralSidebar","MaybeNavMenuSidebarToggle","isOffCanvasNavigationEditorEnabled","window","__experimentalEnableOffCanvasNavigationEditor","NavigationEditMenuItem","blockName"],"mappings":";;;;AAAA;AACA;AACA;AACA,SACCA,mBADD,EAECC,8BAFD,EAGCC,0BAHD,QAIO,yBAJP;AAKA,SAASC,aAAT,EAAwBC,YAAxB,QAA4C,uBAA5C;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,kBAAzB;;AAEA,MAAMC,oBAAoB,GAAG,MAAM;AAClC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAyBL,WAAW,CAAE,gBAAF,CAA1C;AAEA,SACC,cAAC,YAAD,QACC,cAAC,aAAD;AACC,IAAA,SAAS,EAAC,6BADX;AAEC,IAAA,KAAK,EAAGE,EAAE,CAAE,2BAAF,CAFX;AAGC,IAAA,OAAO,EAAG,MAAMG,kBAAkB,CAAE,iBAAF,CAHnC;AAIC,IAAA,IAAI,EAAGF;AAJR,IADD,CADD;AAUA,CAdD;;AAgBA,IAAIG,yBAAyB,GAAGL,QAAhC;AAEA,MAAMM,kCAAkC,GACvC,YAAAC,MAAM,UAAN,0CAAQC,6CAAR,MAA0D,IAD3D;;AAGA,IAAKF,kCAAL,EAA0C;AACzCD,EAAAA,yBAAyB,GAAGF,oBAA5B;AACA;;AAED,MAAMM,sBAAsB,GAAG,MAAM;AACpC,SACC,cAAC,mBAAD,QACC,cAAC,8BAAD,QACC,cAAC,0BAAD,CAA4B,QAA5B,QACKC,SAAF,IACDA,SAAS,KAAK,iBAAd,IACC,cAAC,yBAAD,OAHH,CADD,CADD,CADD;AAaA,CAdD;;AAgBA,eAAeD,sBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockEditorProvider,\n\t__unstableBlockToolbarLastItem,\n\t__unstableBlockNameContext,\n} from '@wordpress/block-editor';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { Fragment } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { listView } from '@wordpress/icons';\n\nconst NavMenuSidebarToggle = () => {\n\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\tconst { openGeneralSidebar } = useDispatch( 'core/edit-post' );\n\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ __( 'Open navigation list view' ) }\n\t\t\t\tonClick={ () => openGeneralSidebar( 'edit-post/block' ) }\n\t\t\t\ticon={ listView }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n};\n\nlet MaybeNavMenuSidebarToggle = Fragment;\n\nconst isOffCanvasNavigationEditorEnabled =\n\twindow?.__experimentalEnableOffCanvasNavigationEditor === true;\n\nif ( isOffCanvasNavigationEditorEnabled ) {\n\tMaybeNavMenuSidebarToggle = NavMenuSidebarToggle;\n}\n\nconst NavigationEditMenuItem = () => {\n\treturn (\n\t\t<BlockEditorProvider>\n\t\t\t<__unstableBlockToolbarLastItem>\n\t\t\t\t<__unstableBlockNameContext.Consumer>\n\t\t\t\t\t{ ( blockName ) =>\n\t\t\t\t\t\tblockName === 'core/navigation' && (\n\t\t\t\t\t\t\t<MaybeNavMenuSidebarToggle />\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t</__unstableBlockNameContext.Consumer>\n\t\t\t</__unstableBlockToolbarLastItem>\n\t\t</BlockEditorProvider>\n\t);\n};\n\nexport default NavigationEditMenuItem;\n"]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
BlockEditorProvider,
|
|
6
|
-
__unstableBlockToolbarLastItem,
|
|
7
|
-
__unstableBlockNameContext,
|
|
8
|
-
} from '@wordpress/block-editor';
|
|
9
|
-
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
10
|
-
import { useDispatch } from '@wordpress/data';
|
|
11
|
-
import { Fragment } from '@wordpress/element';
|
|
12
|
-
import { __ } from '@wordpress/i18n';
|
|
13
|
-
import { listView } from '@wordpress/icons';
|
|
14
|
-
|
|
15
|
-
const NavMenuSidebarToggle = () => {
|
|
16
|
-
// eslint-disable-next-line @wordpress/data-no-store-string-literals
|
|
17
|
-
const { openGeneralSidebar } = useDispatch( 'core/edit-post' );
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<ToolbarGroup>
|
|
21
|
-
<ToolbarButton
|
|
22
|
-
className="components-toolbar__control"
|
|
23
|
-
label={ __( 'Open navigation list view' ) }
|
|
24
|
-
onClick={ () => openGeneralSidebar( 'edit-post/block' ) }
|
|
25
|
-
icon={ listView }
|
|
26
|
-
/>
|
|
27
|
-
</ToolbarGroup>
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
let MaybeNavMenuSidebarToggle = Fragment;
|
|
32
|
-
|
|
33
|
-
const isOffCanvasNavigationEditorEnabled =
|
|
34
|
-
window?.__experimentalEnableOffCanvasNavigationEditor === true;
|
|
35
|
-
|
|
36
|
-
if ( isOffCanvasNavigationEditorEnabled ) {
|
|
37
|
-
MaybeNavMenuSidebarToggle = NavMenuSidebarToggle;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const NavigationEditMenuItem = () => {
|
|
41
|
-
return (
|
|
42
|
-
<BlockEditorProvider>
|
|
43
|
-
<__unstableBlockToolbarLastItem>
|
|
44
|
-
<__unstableBlockNameContext.Consumer>
|
|
45
|
-
{ ( blockName ) =>
|
|
46
|
-
blockName === 'core/navigation' && (
|
|
47
|
-
<MaybeNavMenuSidebarToggle />
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
</__unstableBlockNameContext.Consumer>
|
|
51
|
-
</__unstableBlockToolbarLastItem>
|
|
52
|
-
</BlockEditorProvider>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export default NavigationEditMenuItem;
|