@wordpress/edit-post 7.2.0 → 7.3.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/README.md +1 -11
- package/build/components/block-manager/category.js +12 -8
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/header/index.js +3 -2
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/template-title/edit-template-title.js +1 -0
- package/build/components/header/template-title/edit-template-title.js.map +1 -1
- package/build/components/header/template-title/index.js +3 -1
- package/build/components/header/template-title/index.js.map +1 -1
- package/build/components/layout/index.js +3 -2
- package/build/components/layout/index.js.map +1 -1
- package/build/components/meta-boxes/index.js +1 -7
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +1 -7
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/sidebar/post-schedule/index.js +2 -2
- package/build/components/sidebar/post-schedule/index.js.map +1 -1
- package/build/components/sidebar/post-template/create-modal.js +8 -10
- package/build/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build/components/sidebar/post-template/index.js +2 -2
- package/build/components/sidebar/post-template/index.js.map +1 -1
- package/build/components/sidebar/post-url/index.js +2 -2
- package/build/components/sidebar/post-url/index.js.map +1 -1
- package/build/components/sidebar/post-visibility/index.js +2 -2
- package/build/components/sidebar/post-visibility/index.js.map +1 -1
- package/build/components/start-page-options/index.js +2 -4
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/visual-editor/index.js +1 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +14 -12
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +6 -3
- package/build/editor.native.js.map +1 -1
- package/build/experiments.js +19 -0
- package/build/experiments.js.map +1 -0
- package/build/index.js +17 -31
- package/build/index.js.map +1 -1
- package/build-module/components/block-manager/category.js +12 -7
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/header/index.js +3 -2
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/template-title/edit-template-title.js +1 -0
- package/build-module/components/header/template-title/edit-template-title.js.map +1 -1
- package/build-module/components/header/template-title/index.js +3 -1
- package/build-module/components/header/template-title/index.js.map +1 -1
- package/build-module/components/layout/index.js +3 -2
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/meta-boxes/index.js +1 -6
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js +1 -6
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/sidebar/post-schedule/index.js +2 -2
- package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
- package/build-module/components/sidebar/post-template/create-modal.js +9 -11
- package/build-module/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build-module/components/sidebar/post-template/index.js +2 -2
- package/build-module/components/sidebar/post-template/index.js.map +1 -1
- package/build-module/components/sidebar/post-url/index.js +2 -2
- package/build-module/components/sidebar/post-url/index.js.map +1 -1
- package/build-module/components/sidebar/post-visibility/index.js +2 -2
- package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +2 -4
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +1 -1
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +15 -14
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +6 -2
- package/build-module/editor.native.js.map +1 -1
- package/build-module/experiments.js +9 -0
- package/build-module/experiments.js.map +1 -0
- package/build-module/index.js +16 -31
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +4 -2
- package/build-style/style.css +4 -2
- package/package.json +29 -28
- package/src/components/block-manager/category.js +4 -9
- package/src/components/header/index.js +5 -4
- package/src/components/header/template-title/edit-template-title.js +1 -0
- package/src/components/header/template-title/index.js +1 -1
- package/src/components/header/template-title/style.scss +1 -4
- package/src/components/layout/index.js +5 -4
- package/src/components/meta-boxes/index.js +1 -6
- package/src/components/preferences-modal/meta-boxes-section.js +1 -6
- package/src/components/preferences-modal/options/test/enable-custom-fields.js +3 -11
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +2 -2
- package/src/components/sidebar/post-schedule/index.js +1 -2
- package/src/components/sidebar/post-template/create-modal.js +18 -24
- package/src/components/sidebar/post-template/index.js +1 -2
- package/src/components/sidebar/post-url/index.js +1 -2
- package/src/components/sidebar/post-visibility/index.js +1 -1
- package/src/components/sidebar/settings-header/style.scss +8 -0
- package/src/components/start-page-options/index.js +2 -7
- package/src/components/visual-editor/index.js +1 -1
- package/src/editor.js +25 -38
- package/src/editor.native.js +1 -2
- package/src/experiments.js +10 -0
- package/src/index.js +17 -56
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -478,17 +478,7 @@ _Returns_
|
|
|
478
478
|
|
|
479
479
|
### reinitializeEditor
|
|
480
480
|
|
|
481
|
-
|
|
482
|
-
an unhandled error occurs, replacing previously mounted editor element using
|
|
483
|
-
an initial state from prior to the crash.
|
|
484
|
-
|
|
485
|
-
_Parameters_
|
|
486
|
-
|
|
487
|
-
- _postType_ `Object`: Post type of the post to edit.
|
|
488
|
-
- _postId_ `Object`: ID of the post to edit.
|
|
489
|
-
- _target_ `Element`: DOM node in which editor is rendered.
|
|
490
|
-
- _settings_ `?Object`: Editor settings object.
|
|
491
|
-
- _initialEdits_ `Object`: Programmatic edits to apply initially, to be considered as non-user-initiated (bypass for unsaved changes prompt).
|
|
481
|
+
Used to reinitialize the editor after an error. Now it's a deprecated noop function.
|
|
492
482
|
|
|
493
483
|
### store
|
|
494
484
|
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
12
|
var _data = require("@wordpress/data");
|
|
15
13
|
|
|
16
14
|
var _compose = require("@wordpress/compose");
|
|
@@ -23,10 +21,6 @@ var _checklist = _interopRequireDefault(require("./checklist"));
|
|
|
23
21
|
|
|
24
22
|
var _store = require("../../store");
|
|
25
23
|
|
|
26
|
-
/**
|
|
27
|
-
* External dependencies
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
24
|
/**
|
|
31
25
|
* WordPress dependencies
|
|
32
26
|
*/
|
|
@@ -79,7 +73,12 @@ function BlockManagerCategory(_ref) {
|
|
|
79
73
|
}
|
|
80
74
|
}, []);
|
|
81
75
|
const toggleAllVisible = (0, _element.useCallback)(nextIsChecked => {
|
|
82
|
-
const blockNames =
|
|
76
|
+
const blockNames = blockTypes.map(_ref3 => {
|
|
77
|
+
let {
|
|
78
|
+
name
|
|
79
|
+
} = _ref3;
|
|
80
|
+
return name;
|
|
81
|
+
});
|
|
83
82
|
|
|
84
83
|
if (nextIsChecked) {
|
|
85
84
|
showBlockTypes(blockNames);
|
|
@@ -92,7 +91,12 @@ function BlockManagerCategory(_ref) {
|
|
|
92
91
|
return null;
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
const checkedBlockNames =
|
|
94
|
+
const checkedBlockNames = filteredBlockTypes.map(_ref4 => {
|
|
95
|
+
let {
|
|
96
|
+
name
|
|
97
|
+
} = _ref4;
|
|
98
|
+
return name;
|
|
99
|
+
}).filter(type => !hiddenBlockTypes.includes(type));
|
|
96
100
|
const titleId = 'edit-post-block-manager__category-title-' + instanceId;
|
|
97
101
|
const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
|
|
98
102
|
const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"names":["BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","editorStore","getHiddenBlockTypes","editPostStore","filteredBlockTypes","filter","name","includes","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","length","checkedBlockNames","type","titleId","isAllChecked","isIndeterminate"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"names":["BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","editorStore","getHiddenBlockTypes","editPostStore","filteredBlockTypes","filter","name","includes","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","map","length","checkedBlockNames","type","titleId","isAllChecked","isIndeterminate"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIA,SAASA,oBAAT,OAAuD;AAAA,MAAxB;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAwB;AACtD,QAAMC,UAAU,GAAG,4BAAeH,oBAAf,CAAnB;AACA,QAAM;AAAEI,IAAAA,wBAAF;AAA4BC,IAAAA;AAA5B,MAAiD,qBACpDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAwBD,MAAM,CAAEE,aAAF,CAApC;AACA,UAAM;AAAEC,MAAAA;AAAF,QAA0BH,MAAM,CAAEI,YAAF,CAAtC;AACA,WAAO;AACNN,MAAAA,wBAAwB,EACvBG,iBAAiB,GAAGH,wBAFf;AAGNC,MAAAA,gBAAgB,EAAEI,mBAAmB;AAH/B,KAAP;AAKA,GATqD,EAUtD,EAVsD,CAAvD;AAYA,QAAME,kBAAkB,GAAG,sBAAS,MAAM;AACzC,QAAKP,wBAAwB,KAAK,IAAlC,EAAyC;AACxC,aAAOF,UAAP;AACA;;AACD,WAAOA,UAAU,CAACU,MAAX,CAAmB,SAAgB;AAAA,UAAd;AAAEC,QAAAA;AAAF,OAAc;AACzC,aAAOT,wBAAP,aAAOA,wBAAP,uBAAOA,wBAAwB,CAAEU,QAA1B,CAAoCD,IAApC,CAAP;AACA,KAFM,CAAP;AAGA,G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IAAI,EAAC,OADN;AAEC,uBAAkBG,OAFnB;AAGC,IAAA,SAAS,EAAC;AAHX,KAKC,4BAAC,2BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,OAAO,EAAGC,YAFX;AAGC,IAAA,QAAQ,EAAGP,gBAHZ;AAIC,IAAA,SAAS,EAAC,yCAJX;AAKC,IAAA,aAAa,EAAGQ,eALjB;AAMC,IAAA,KAAK,EAAG;AAAM,MAAA,EAAE,EAAGF;AAAX,OAAuBzB,KAAvB;AANT,IALD,EAaC,4BAAC,kBAAD;AACC,IAAA,UAAU,EAAGU,kBADd;AAEC,IAAA,KAAK,EAAGa,iBAFT;AAGC,IAAA,YAAY,EAAGP;AAHhB,IAbD,CADD;AAqBA;;eAEcjB,oB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tdefaultAllowedBlockTypes:\n\t\t\t\t\tgetEditorSettings().defaultAllowedBlockTypes,\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( defaultAllowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn defaultAllowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ defaultAllowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );\n\tconst toggleVisible = useCallback( ( blockName, nextIsChecked ) => {\n\t\tif ( nextIsChecked ) {\n\t\t\tshowBlockTypes( blockName );\n\t\t} else {\n\t\t\thideBlockTypes( blockName );\n\t\t}\n\t}, [] );\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = filteredBlockTypes\n\t\t.map( ( { name } ) => name )\n\t\t.filter( ( type ) => ! hiddenBlockTypes.includes( type ) );\n\n\tconst titleId = 'edit-post-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\tconst isIndeterminate = ! isAllChecked && checkedBlockNames.length > 0;\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"edit-post-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"edit-post-block-manager__category-title\"\n\t\t\t\tindeterminate={ isIndeterminate }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"]}
|
|
@@ -58,14 +58,15 @@ function Header(_ref) {
|
|
|
58
58
|
isPublishSidebarOpened,
|
|
59
59
|
isSaving,
|
|
60
60
|
showIconLabels,
|
|
61
|
-
|
|
61
|
+
isDistractionFreeMode
|
|
62
62
|
} = (0, _data.useSelect)(select => ({
|
|
63
63
|
hasActiveMetaboxes: select(_store.store).hasMetaBoxes(),
|
|
64
64
|
isPublishSidebarOpened: select(_store.store).isPublishSidebarOpened(),
|
|
65
65
|
isSaving: select(_store.store).isSavingMetaBoxes(),
|
|
66
66
|
showIconLabels: select(_store.store).isFeatureActive('showIconLabels'),
|
|
67
|
-
|
|
67
|
+
isDistractionFreeMode: select(_store.store).isFeatureActive('distractionFree')
|
|
68
68
|
}), []);
|
|
69
|
+
const isDistractionFree = isDistractionFreeMode && isLargeViewport;
|
|
69
70
|
const classes = (0, _classnames.default)('edit-post-header');
|
|
70
71
|
const slideY = {
|
|
71
72
|
hidden: isDistractionFree ? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/index.js"],"names":["Header","setEntitiesSavedStatesCallback","isLargeViewport","hasActiveMetaboxes","isPublishSidebarOpened","isSaving","showIconLabels","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/index.js"],"names":["Header","setEntitiesSavedStatesCallback","isLargeViewport","hasActiveMetaboxes","isPublishSidebarOpened","isSaving","showIconLabels","isDistractionFreeMode","select","editPostStore","hasMetaBoxes","isSavingMetaBoxes","isFeatureActive","isDistractionFree","classes","slideY","hidden","y","hover","transition","type","delay","slideX","x","undefined"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAUA,SAASA,MAAT,OAAsD;AAAA,MAArC;AAAEC,IAAAA;AAAF,GAAqC;AACrD,QAAMC,eA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BADhB;AAEC,IAAA,aAAa,EAAGE,QAFjB;AAGC,IAAA,8BAA8B,EAC7BJ;AAJF,IAtBD,EA6BG,CAAEC,eAAe,IAAI,CAAEI,cAAvB,KACD,qDACC,4BAAC,sBAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IADD,EAEC,4BAAC,iBAAD;AAAU,IAAA,cAAc,EAAGA;AAA3B,IAFD,CA9BF,EAmCGA,cAAc,IAAI,CAAEJ,eAApB,IACD,4BAAC,iBAAD;AAAU,IAAA,cAAc,EAAGI;AAA3B,IApCF,CAjBD,CADD;AA2DA;;eAEcN,M","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { PostSavedState, PostPreviewButton } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport FullscreenModeClose from './fullscreen-mode-close';\nimport HeaderToolbar from './header-toolbar';\nimport MoreMenu from './more-menu';\nimport PostPublishButtonOrToggle from './post-publish-button-or-toggle';\nimport { default as DevicePreview } from '../device-preview';\nimport MainDashboardButton from './main-dashboard-button';\nimport { store as editPostStore } from '../../store';\nimport TemplateTitle from './template-title';\n\nfunction Header( { setEntitiesSavedStatesCallback } ) {\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\tconst {\n\t\thasActiveMetaboxes,\n\t\tisPublishSidebarOpened,\n\t\tisSaving,\n\t\tshowIconLabels,\n\t\tisDistractionFreeMode,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editPostStore ).isPublishSidebarOpened(),\n\t\t\tisSaving: select( editPostStore ).isSavingMetaBoxes(),\n\t\t\tshowIconLabels:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t\tisDistractionFreeMode:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'distractionFree' ),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst isDistractionFree = isDistractionFreeMode && isLargeViewport;\n\n\tconst classes = classnames( 'edit-post-header' );\n\n\tconst slideY = {\n\t\thidden: isDistractionFree ? { y: '-50' } : { y: 0 },\n\t\thover: { y: 0, transition: { type: 'tween', delay: 0.2 } },\n\t};\n\n\tconst slideX = {\n\t\thidden: isDistractionFree ? { x: '-100%' } : { x: 0 },\n\t\thover: { x: 0, transition: { type: 'tween', delay: 0.2 } },\n\t};\n\n\treturn (\n\t\t<div className={ classes }>\n\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ slideX }\n\t\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\t>\n\t\t\t\t\t<FullscreenModeClose showTooltip />\n\t\t\t\t</motion.div>\n\t\t\t</MainDashboardButton.Slot>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__toolbar\"\n\t\t\t>\n\t\t\t\t<HeaderToolbar />\n\t\t\t\t<TemplateTitle />\n\t\t\t</motion.div>\n\t\t\t<motion.div\n\t\t\t\tvariants={ slideY }\n\t\t\t\ttransition={ { type: 'tween', delay: 0.8 } }\n\t\t\t\tclassName=\"edit-post-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState\n\t\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\t\tforceIsSaving={ isSaving }\n\t\t\t\t\t\tshowIconLabels={ showIconLabels }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<DevicePreview />\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t\tforcePreviewLink={ isSaving ? null : undefined }\n\t\t\t\t/>\n\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\t\tforceIsSaving={ isSaving }\n\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isLargeViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-post\" />\n\t\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ showIconLabels && ! isLargeViewport && (\n\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"]}
|
|
@@ -69,6 +69,7 @@ function EditTemplateTitle() {
|
|
|
69
69
|
return (0, _element.createElement)("div", {
|
|
70
70
|
className: "edit-site-template-details__group"
|
|
71
71
|
}, (0, _element.createElement)(_components.TextControl, {
|
|
72
|
+
__nextHasNoMarginBottom: true,
|
|
72
73
|
label: (0, _i18n.__)('Title'),
|
|
73
74
|
value: forceEmpty ? '' : templateTitle,
|
|
74
75
|
help: (0, _i18n.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/edit-template-title.js"],"names":["EditTemplateTitle","forceEmpty","setForceEmpty","template","select","getEditedPostTemplate","editPostStore","editEntityRecord","coreStore","getEditorSettings","editorStore","updateEditorSettings","is_custom","has_theme_file","templateTitle","title","slug","newTitle","settings","newAvailableTemplates","availableTemplates","existingTitle","id"],"mappings":";;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAGe,SAASA,iBAAT,GAA6B;AAC3C,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,uBAAU,KAAV,CAAtC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAe,qBAAaC,MAAF,IAAc;AAC7C,UAAM;AAAEC,MAAAA;AAAF,QAA4BD,MAAM,CAAEE,YAAF,CAAxC;AACA,WAAO;AACNH,MAAAA,QAAQ,EAAEE,qBAAqB;AADzB,KAAP;AAGA,GALoB,EAKlB,EALkB,CAArB;AAOA,QAAM;AAAEE,IAAAA;AAAF,MAAuB,uBAAaC,eAAb,CAA7B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAwB,qBAAWC,aAAX,CAA9B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA2B,uBAAaD,aAAb,CAAjC,CAX2C,CAa3C;;AACA,MAAK,CAAEP,QAAQ,CAACS,SAAX,IAAwBT,QAAQ,CAACU,cAAtC,EAAuD;AACtD,WAAO,IAAP;AACA;;AAED,MAAIC,aAAa,GAAG,cAAI,SAAJ,CAApB;;AACA,MAAKX,QAAL,aAAKA,QAAL,eAAKA,QAAQ,CAAEY,KAAf,EAAuB;AACtBD,IAAAA,aAAa,GAAGX,QAAQ,CAACY,KAAzB;AACA,GAFD,MAEO,IAAK,CAAC,CAAEZ,QAAR,EAAmB;AACzBW,IAAAA,aAAa,GAAGX,QAAQ,CAACa,IAAzB;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/edit-template-title.js"],"names":["EditTemplateTitle","forceEmpty","setForceEmpty","template","select","getEditedPostTemplate","editPostStore","editEntityRecord","coreStore","getEditorSettings","editorStore","updateEditorSettings","is_custom","has_theme_file","templateTitle","title","slug","newTitle","settings","newAvailableTemplates","availableTemplates","existingTitle","id"],"mappings":";;;;;;;AAWA;;AARA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAGe,SAASA,iBAAT,GAA6B;AAC3C,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,uBAAU,KAAV,CAAtC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAe,qBAAaC,MAAF,IAAc;AAC7C,UAAM;AAAEC,MAAAA;AAAF,QAA4BD,MAAM,CAAEE,YAAF,CAAxC;AACA,WAAO;AACNH,MAAAA,QAAQ,EAAEE,qBAAqB;AADzB,KAAP;AAGA,GALoB,EAKlB,EALkB,CAArB;AAOA,QAAM;AAAEE,IAAAA;AAAF,MAAuB,uBAAaC,eAAb,CAA7B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAwB,qBAAWC,aAAX,CAA9B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA2B,uBAAaD,aAAb,CAAjC,CAX2C,CAa3C;;AACA,MAAK,CAAEP,QAAQ,CAACS,SAAX,IAAwBT,QAAQ,CAACU,cAAtC,EAAuD;AACtD,WAAO,IAAP;AACA;;AAED,MAAIC,aAAa,GAAG,cAAI,SAAJ,CAApB;;AACA,MAAKX,QAAL,aAAKA,QAAL,eAAKA,QAAQ,CAAEY,KAAf,EAAuB;AACtBD,IAAAA,aAAa,GAAGX,QAAQ,CAACY,KAAzB;AACA,GAFD,MAEO,IAAK,CAAC,CAAEZ,QAAR,EAAmB;AACzBW,IAAAA,aAAa,GAAGX,QAAQ,CAACa,IAAzB;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,uBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,OAAJ,CAFT;AAGC,IAAA,KAAK,EAAGf,UAAU,GAAG,EAAH,GAAQa,aAH3B;AAIC,IAAA,IAAI,EAAG,cACN,0EADM,CAJR;AAOC,IAAA,QAAQ,EAAKG,QAAF,IAAgB;AAC1B;AACA,UAAK,CAAEA,QAAF,IAAc,CAAEhB,UAArB,EAAkC;AACjCC,QAAAA,aAAa,CAAE,IAAF,CAAb;AACA;AACA;;AACDA,MAAAA,aAAa,CAAE,KAAF,CAAb;AAEA,YAAMgB,QAAQ,GAAGT,iBAAiB,EAAlC;AACA,YAAMU,qBAAqB,GAAG,uBAC7BD,QAAQ,CAACE,kBADoB,EAE7B,CAAEC,aAAF,EAAiBC,EAAjB,KAAyB;AACxB,YAAKA,EAAE,KAAKnB,QAAQ,CAACa,IAArB,EAA4B;AAC3B,iBAAOK,aAAP;AACA;;AACD,eAAOJ,QAAP;AACA,OAP4B,CAA9B;AASAN,MAAAA,oBAAoB,CAAE,EACrB,GAAGO,QADkB;AAErBE,QAAAA,kBAAkB,EAAED;AAFC,OAAF,CAApB;AAIAZ,MAAAA,gBAAgB,CAAE,UAAF,EAAc,aAAd,EAA6BJ,QAAQ,CAACmB,EAAtC,EAA0C;AACzDP,QAAAA,KAAK,EAAEE;AADkD,OAA1C,CAAhB;AAGA,KAhCF;AAiCC,IAAA,MAAM,EAAG,MAAMf,aAAa,CAAE,KAAF;AAjC7B,IADD,CADD;AAuCA","sourcesContent":["/**\n * External dependencies\n */\nimport { mapValues } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\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';\n\nexport default function EditTemplateTitle() {\n\tconst [ forceEmpty, setForceEmpty ] = useState( false );\n\tconst { template } = useSelect( ( select ) => {\n\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\treturn {\n\t\t\ttemplate: getEditedPostTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { getEditorSettings } = useSelect( editorStore );\n\tconst { updateEditorSettings } = useDispatch( editorStore );\n\n\t// Only user-created and non-default templates can change the name.\n\tif ( ! template.is_custom || template.has_theme_file ) {\n\t\treturn null;\n\t}\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\tvalue={ forceEmpty ? '' : templateTitle }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Give the template a title that indicates its purpose, e.g. \"Full Width\".'\n\t\t\t\t) }\n\t\t\t\tonChange={ ( newTitle ) => {\n\t\t\t\t\t// Allow having the field temporarily empty while typing.\n\t\t\t\t\tif ( ! newTitle && ! forceEmpty ) {\n\t\t\t\t\t\tsetForceEmpty( true );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tsetForceEmpty( false );\n\n\t\t\t\t\tconst settings = getEditorSettings();\n\t\t\t\t\tconst newAvailableTemplates = mapValues(\n\t\t\t\t\t\tsettings.availableTemplates,\n\t\t\t\t\t\t( existingTitle, id ) => {\n\t\t\t\t\t\t\tif ( id !== template.slug ) {\n\t\t\t\t\t\t\t\treturn existingTitle;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn newTitle;\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tupdateEditorSettings( {\n\t\t\t\t\t\t...settings,\n\t\t\t\t\t\tavailableTemplates: newAvailableTemplates,\n\t\t\t\t\t} );\n\t\t\t\t\teditEntityRecord( 'postType', 'wp_template', template.id, {\n\t\t\t\t\t\ttitle: newTitle,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tonBlur={ () => setForceEmpty( false ) }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -92,7 +92,9 @@ function TemplateTitle() {
|
|
|
92
92
|
setIsEditingTemplate(false);
|
|
93
93
|
}
|
|
94
94
|
}, title), hasOptions ? (0, _element.createElement)(_components.Dropdown, {
|
|
95
|
-
|
|
95
|
+
popoverProps: {
|
|
96
|
+
placement: 'bottom'
|
|
97
|
+
},
|
|
96
98
|
contentClassName: "edit-post-template-top-area__popover",
|
|
97
99
|
renderToggle: _ref => {
|
|
98
100
|
let {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/index.js"],"names":["TemplateTitle","template","isEditing","title","select","isEditingTemplate","getEditedPostTemplate","editPostStore","getEditedPostAttribute","editorStore","_isEditing","clearSelectedBlock","blockEditorStore","setIsEditingTemplate","templateTitle","slug","hasOptions","custom","wp_id","description","onToggle","chevronDown","lineHeight"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AAUA;AACA;AACA;AAQA,SAASA,aAAT,GAAyB;AACxB,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA;AAAvB,MAAiC,qBAAaC,MAAF,IAAc;AAC/D,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,UAAM;AAAEC,MAAAA;AAAF,QAA6BJ,MAAM,CAAEK,aAAF,CAAzC;;AAEA,UAAMC,UAAU,GAAGL,iBAAiB,EAApC;;AAEA,WAAO;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
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/index.js"],"names":["TemplateTitle","template","isEditing","title","select","isEditingTemplate","getEditedPostTemplate","editPostStore","getEditedPostAttribute","editorStore","_isEditing","clearSelectedBlock","blockEditorStore","setIsEditingTemplate","templateTitle","slug","hasOptions","custom","wp_id","description","placement","onToggle","chevronDown","lineHeight"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AAUA;AACA;AACA;AAQA,SAASA,aAAT,GAAyB;AACxB,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA;AAAvB,MAAiC,qBAAaC,MAAF,IAAc;AAC/D,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,UAAM;AAAEC,MAAAA;AAAF,QAA6BJ,MAAM,CAAEK,aAAF,CAAzC;;AAEA,UAAMC,UAAU,GAAGL,iBAAiB,EAApC;;AAEA,WAAO;AACNJ,MAAAA,QAAQ,EAAES,UAAU,GAAGJ,qBAAqB,EAAxB,GAA6B,IAD3C;AAENJ,MAAAA,SAAS,EAAEQ,UAFL;AAGNP,MAAAA,KAAK,EAAEK,sBAAsB,CAAE,OAAF,CAAtB,GACJA,sBAAsB,CAAE,OAAF,CADlB,GAEJ,cAAI,UAAJ;AALG,KAAP;AAOA,GAdsC,EAcpC,EAdoC,CAAvC;AAgBA,QAAM;AAAEG,IAAAA;AAAF,MAAyB,uBAAaC,kBAAb,CAA/B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA2B,uBAAaN,YAAb,CAAjC;;AAEA,MAAK,CAAEL,SAAF,IAAe,CAAED,QAAtB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,MAAIa,aAAa,GAAG,cAAI,SAAJ,CAApB;;AACA,MAAKb,QAAL,aAAKA,QAAL,eAAKA,QAAQ,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,IAAA,IAAI,EAAC,MAFN;AAGC,IAAA,KAAK,EAAG;AAAES,MAAAA,UAAU,EAAE;AAAd;AAHT,KAKGT,aALH,CA1CF,CADD;AAqDA;;eAEcd,a","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tDropdown,\n\tButton,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport DeleteTemplate from './delete-template';\nimport EditTemplateTitle from './edit-template-title';\nimport TemplateDescription from './template-description';\n\nfunction TemplateTitle() {\n\tconst { template, isEditing, title } = useSelect( ( select ) => {\n\t\tconst { isEditingTemplate, getEditedPostTemplate } =\n\t\t\tselect( editPostStore );\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\n\t\tconst _isEditing = isEditingTemplate();\n\n\t\treturn {\n\t\t\ttemplate: _isEditing ? getEditedPostTemplate() : null,\n\t\t\tisEditing: _isEditing,\n\t\t\ttitle: getEditedPostAttribute( 'title' )\n\t\t\t\t? getEditedPostAttribute( 'title' )\n\t\t\t\t: __( 'Untitled' ),\n\t\t};\n\t}, [] );\n\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\n\tif ( ! isEditing || ! template ) {\n\t\treturn null;\n\t}\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\tconst hasOptions = !! (\n\t\ttemplate.custom ||\n\t\ttemplate.wp_id ||\n\t\ttemplate.description\n\t);\n\n\treturn (\n\t\t<div className=\"edit-post-template-top-area\">\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-template-post-title\"\n\t\t\t\tisLink\n\t\t\t\tshowTooltip\n\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t/* translators: %s: Title of the referring post, e.g: \"Hello World!\" */\n\t\t\t\t\t__( 'Edit %s' ),\n\t\t\t\t\ttitle\n\t\t\t\t) }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</Button>\n\t\t\t{ hasOptions ? (\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ { placement: 'bottom' } }\n\t\t\t\t\tcontentClassName=\"edit-post-template-top-area__popover\"\n\t\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-post-template-title\"\n\t\t\t\t\t\t\tisLink\n\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\tlabel={ __( 'Template Options' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ templateTitle }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<EditTemplateTitle />\n\t\t\t\t\t\t\t<TemplateDescription />\n\t\t\t\t\t\t\t<DeleteTemplate />\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Text\n\t\t\t\t\tclassName=\"edit-post-template-title\"\n\t\t\t\t\tsize=\"body\"\n\t\t\t\t\tstyle={ { lineHeight: '24px' } }\n\t\t\t\t>\n\t\t\t\t\t{ templateTitle }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default TemplateTitle;\n"]}
|
|
@@ -117,7 +117,7 @@ function Layout(_ref) {
|
|
|
117
117
|
isInserterOpened,
|
|
118
118
|
isListViewOpened,
|
|
119
119
|
showIconLabels,
|
|
120
|
-
|
|
120
|
+
isDistractionFreeMode,
|
|
121
121
|
showBlockBreadcrumbs,
|
|
122
122
|
isTemplateMode,
|
|
123
123
|
documentLabel
|
|
@@ -141,12 +141,13 @@ function Layout(_ref) {
|
|
|
141
141
|
previousShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-post/previous-region'),
|
|
142
142
|
nextShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-post/next-region'),
|
|
143
143
|
showIconLabels: select(_store.store).isFeatureActive('showIconLabels'),
|
|
144
|
-
|
|
144
|
+
isDistractionFreeMode: select(_store.store).isFeatureActive('distractionFree'),
|
|
145
145
|
showBlockBreadcrumbs: select(_store.store).isFeatureActive('showBlockBreadcrumbs'),
|
|
146
146
|
// translators: Default label for the Document in the Block Breadcrumb.
|
|
147
147
|
documentLabel: postTypeLabel || (0, _i18n._x)('Document', 'noun')
|
|
148
148
|
};
|
|
149
149
|
}, []);
|
|
150
|
+
const isDistractionFree = isDistractionFreeMode && isLargeViewport;
|
|
150
151
|
const className = (0, _classnames.default)('edit-post-layout', 'is-mode-' + mode, {
|
|
151
152
|
'is-sidebar-opened': sidebarIsOpened,
|
|
152
153
|
'has-fixed-toolbar': hasFixedToolbar,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/layout/index.js"],"names":["interfaceLabels","header","body","sidebar","actions","footer","Layout","styles","isMobileViewport","isHugeViewport","isLargeViewport","openGeneralSidebar","closeGeneralSidebar","setIsInserterOpened","editPostStore","createErrorNotice","noticesStore","mode","isFullscreenActive","isRichEditingEnabled","sidebarIsOpened","hasActiveMetaboxes","hasFixedToolbar","previousShortcut","nextShortcut","hasBlockSelected","isInserterOpened","isListViewOpened","showIconLabels","isDistractionFree","showBlockBreadcrumbs","isTemplateMode","documentLabel","select","getEditorSettings","getPostTypeLabel","editorStore","editorSettings","postTypeLabel","isEditingTemplate","isFeatureActive","interfaceStore","getActiveComplementaryArea","name","isPublishSidebarOpened","getEditorMode","richEditingEnabled","hasMetaBoxes","keyboardShortcutsStore","getAllShortcutKeyCombinations","className","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","secondarySidebarLabel","secondarySidebar","onPluginAreaError","previous","next"],"mappings":";;;;;;;;;AA6BA;;AA1BA;;AAKA;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAlDA;AACA;AACA;;AAGA;AACA;AACA;;AA0BA;AACA;AACA;AAiBA,MAAMA,eAAe,GAAG;AACvB;AACAC,EAAAA,MAAM,EAAE,cAAI,gBAAJ,CAFe;;AAGvB;AACAC,EAAAA,IAAI,EAAE,cAAI,gBAAJ,CAJiB;;AAKvB;AACAC,EAAAA,OAAO,EAAE,cAAI,iBAAJ,CANc;;AAOvB;AACAC,EAAAA,OAAO,EAAE,cAAI,gBAAJ,CARc;;AASvB;AACAC,EAAAA,MAAM,EAAE,cAAI,eAAJ;AAVe,CAAxB;;AAaA,SAASC,MAAT,OAA8B;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AAC7B,QAAMC,gBAAgB,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAzB;AACA,QAAMC,cAAc,GAAG,+BAAkB,MAAlB,EAA0B,IAA1B,CAAvB;AACA,QAAMC,eAAe,GAAG,+BAAkB,OAAlB,CAAxB;AACA,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA,mBAAtB;AAA2CC,IAAAA;AAA3C,MACL,uBAAaC,YAAb,CADD;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAwB,uBAAaC,cAAb,CAA9B;AACA,QAAM;AACLC,IA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AC,sBAAD,OAfF,CAvCF;AA0DC,IAAA,MAAM,EACL,CAAES,iBAAF,IACAC,oBADA,IAEA,CAAEtB,gBAFF,IAGAW,oBAHA,IAIAF,IAAI,KAAK,QAJT,IAKC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,4BAAD;AAAiB,MAAA,aAAa,EAAGe;AAAjC,MADD,CAhEH;AAqEC,IAAA,OAAO,EACN,4BAAC,qBAAD;AACC,MAAA,wBAAwB,EAAGsB,wBAD5B;AAEC,MAAA,yBAAyB,EACxBF,2BAHF;AAKC,MAAA,8BAA8B,EAC7BC;AANF,MAtEF;AAgFC,IAAA,SAAS,EAAG;AACXM,MAAAA,QAAQ,EAAEpC,gBADC;AAEXqC,MAAAA,IAAI,EAAEpC;AAFK;AAhFb,IATD,EA8FC,4BAAC,yBAAD,OA9FD,EA+FC,4BAAC,kCAAD,OA/FD,EAgGC,4BAAC,qBAAD,OAhGD,EAiGC,4BAAC,yBAAD,OAjGD,EAkGC,4BAAC,mBAAD,CAAS,IAAT,OAlGD,EAmGC,4BAAC,mBAAD;AAAY,IAAA,OAAO,EAAGkC;AAAtB,IAnGD,CADD;AAuGA;;eAEcpD,M","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAutosaveMonitor,\n\tLocalAutosaveMonitor,\n\tUnsavedChangesWarning,\n\tEditorNotices,\n\tEditorKeyboardShortcutsRegister,\n\tEditorSnackbars,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { Button, ScrollLock, Popover } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { PluginArea } from '@wordpress/plugins';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tFullscreenMode,\n\tInterfaceSkeleton,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport EditPostKeyboardShortcuts from '../keyboard-shortcuts';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport EditPostPreferencesModal from '../preferences-modal';\nimport BrowserURL from '../browser-url';\nimport Header from '../header';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport SettingsSidebar from '../sidebar/settings-sidebar';\nimport MetaBoxes from '../meta-boxes';\nimport WelcomeGuide from '../welcome-guide';\nimport ActionsPanel from './actions-panel';\nimport StartPageOptions from '../start-page-options';\nimport { store as editPostStore } from '../../store';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nfunction Layout( { styles } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\tconst { openGeneralSidebar, closeGeneralSidebar, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tmode,\n\t\tisFullscreenActive,\n\t\tisRichEditingEnabled,\n\t\tsidebarIsOpened,\n\t\thasActiveMetaboxes,\n\t\thasFixedToolbar,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t\thasBlockSelected,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tshowIconLabels,\n\t\tisDistractionFree,\n\t\tshowBlockBreadcrumbs,\n\t\tisTemplateMode,\n\t\tdocumentLabel,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getPostTypeLabel } = select( editorStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst postTypeLabel = getPostTypeLabel();\n\n\t\treturn {\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t\thasFixedToolbar:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'fixedToolbar' ),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\teditPostStore.name\n\t\t\t\t) || select( editPostStore ).isPublishSidebarOpened()\n\t\t\t),\n\t\t\tisFullscreenActive:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'fullscreenMode' ),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editPostStore ).isListViewOpened(),\n\t\t\tmode: select( editPostStore ).getEditorMode(),\n\t\t\tisRichEditingEnabled: editorSettings.richEditingEnabled,\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/previous-region' ),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/next-region' ),\n\t\t\tshowIconLabels:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t\tisDistractionFree:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'distractionFree' ) &&\n\t\t\t\tisLargeViewport,\n\t\t\tshowBlockBreadcrumbs: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\t// translators: Default label for the Document in the Block Breadcrumb.\n\t\t\tdocumentLabel: postTypeLabel || _x( 'Document', 'noun' ),\n\t\t};\n\t}, [] );\n\n\tconst className = classnames( 'edit-post-layout', 'is-mode-' + mode, {\n\t\t'is-sidebar-opened': sidebarIsOpened,\n\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t'has-metaboxes': hasActiveMetaboxes,\n\t\t'show-icon-labels': showIconLabels,\n\t\t'is-distraction-free': isDistractionFree,\n\t} );\n\tconst openSidebarPanel = () =>\n\t\topenGeneralSidebar(\n\t\t\thasBlockSelected ? 'edit-post/block' : 'edit-post/document'\n\t\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( sidebarIsOpened && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t}\n\t}, [ sidebarIsOpened, isHugeViewport ] );\n\tuseEffect( () => {\n\t\tif ( isInserterOpened && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isHugeViewport ] );\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =\n\t\tuseState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'Document Overview' )\n\t\t: __( 'Block Library' );\n\n\tconst secondarySidebar = () => {\n\t\tif ( mode === 'visual' && isInserterOpened ) {\n\t\t\treturn <InserterSidebar />;\n\t\t}\n\t\tif ( mode === 'visual' && isListViewOpened ) {\n\t\t\treturn <ListViewSidebar />;\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<FullscreenMode isActive={ isFullscreenActive } />\n\t\t\t<BrowserURL />\n\t\t\t<UnsavedChangesWarning />\n\t\t\t<AutosaveMonitor />\n\t\t\t<LocalAutosaveMonitor />\n\t\t\t<EditPostKeyboardShortcuts />\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t<SettingsSidebar />\n\t\t\t<InterfaceSkeleton\n\t\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\t\tclassName={ className }\n\t\t\t\tlabels={ {\n\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t} }\n\t\t\t\theader={\n\t\t\t\t\t<Header\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\teditorNotices={ <EditorNotices /> }\n\t\t\t\tsecondarySidebar={ secondarySidebar() }\n\t\t\t\tsidebar={\n\t\t\t\t\t( ! isMobileViewport || sidebarIsOpened ) && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isMobileViewport && ! sidebarIsOpened && (\n\t\t\t\t\t\t\t\t<div className=\"edit-post-layout__toggle-sidebar-panel\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-post-layout__toggle-sidebar-panel-button\"\n\t\t\t\t\t\t\t\t\t\tonClick={ openSidebarPanel }\n\t\t\t\t\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ hasBlockSelected\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Open block settings' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Open document settings' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-post\" />\n\t\t\t\t\t\t</>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isDistractionFree && <EditorNotices /> }\n\t\t\t\t\t\t{ ( mode === 'text' || ! isRichEditingEnabled ) && (\n\t\t\t\t\t\t\t<TextEditor />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isRichEditingEnabled && mode === 'visual' && (\n\t\t\t\t\t\t\t<VisualEditor styles={ styles } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div className=\"edit-post-layout__metaboxes\">\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"normal\" />\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"advanced\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isMobileViewport && sidebarIsOpened && (\n\t\t\t\t\t\t\t<ScrollLock />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t! isDistractionFree &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\n\t\t\t\t\t! isMobileViewport &&\n\t\t\t\t\tisRichEditingEnabled &&\n\t\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t\t<div className=\"edit-post-layout__footer\">\n\t\t\t\t\t\t\t<BlockBreadcrumb rootLabelText={ documentLabel } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<ActionsPanel\n\t\t\t\t\t\tcloseEntitiesSavedStates={ closeEntitiesSavedStates }\n\t\t\t\t\t\tisEntitiesSavedStatesOpen={\n\t\t\t\t\t\t\tentitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tshortcuts={ {\n\t\t\t\t\tprevious: previousShortcut,\n\t\t\t\t\tnext: nextShortcut,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<EditPostPreferencesModal />\n\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t<WelcomeGuide />\n\t\t\t<StartPageOptions />\n\t\t\t<Popover.Slot />\n\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t</>\n\t);\n}\n\nexport default Layout;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/layout/index.js"],"names":["interfaceLabels","header","body","sidebar","actions","footer","Layout","styles","isMobileViewport","isHugeViewport","isLargeViewport","openGeneralSidebar","closeGeneralSidebar","setIsInserterOpened","editPostStore","createErrorNotice","noticesStore","mode","isFullscreenActive","isRichEditingEnabled","sidebarIsOpened","hasActiveMetaboxes","hasFixedToolbar","previousShortcut","nextShortcut","hasBlockSelected","isInserterOpened","isListViewOpened","showIconLabels","isDistractionFreeMode","showBlockBreadcrumbs","isTemplateMode","documentLabel","select","getEditorSettings","getPostTypeLabel","editorStore","editorSettings","postTypeLabel","isEditingTemplate","isFeatureActive","interfaceStore","getActiveComplementaryArea","name","isPublishSidebarOpened","getEditorMode","richEditingEnabled","hasMetaBoxes","keyboardShortcutsStore","getAllShortcutKeyCombinations","isDistractionFree","className","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","secondarySidebarLabel","secondarySidebar","onPlu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Ge;AAAjC,MADD,CAhEH;AAqEC,IAAA,OAAO,EACN,4BAAC,qBAAD;AACC,MAAA,wBAAwB,EAAGuB,wBAD5B;AAEC,MAAA,yBAAyB,EACxBF,2BAHF;AAKC,MAAA,8BAA8B,EAC7BC;AANF,MAtEF;AAgFC,IAAA,SAAS,EAAG;AACXM,MAAAA,QAAQ,EAAErC,gBADC;AAEXsC,MAAAA,IAAI,EAAErC;AAFK;AAhFb,IATD,EA8FC,4BAAC,yBAAD,OA9FD,EA+FC,4BAAC,kCAAD,OA/FD,EAgGC,4BAAC,qBAAD,OAhGD,EAiGC,4BAAC,yBAAD,OAjGD,EAkGC,4BAAC,mBAAD,CAAS,IAAT,OAlGD,EAmGC,4BAAC,mBAAD;AAAY,IAAA,OAAO,EAAGmC;AAAtB,IAnGD,CADD;AAuGA;;eAEcrD,M","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAutosaveMonitor,\n\tLocalAutosaveMonitor,\n\tUnsavedChangesWarning,\n\tEditorNotices,\n\tEditorKeyboardShortcutsRegister,\n\tEditorSnackbars,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { Button, ScrollLock, Popover } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { PluginArea } from '@wordpress/plugins';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tFullscreenMode,\n\tInterfaceSkeleton,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport EditPostKeyboardShortcuts from '../keyboard-shortcuts';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport EditPostPreferencesModal from '../preferences-modal';\nimport BrowserURL from '../browser-url';\nimport Header from '../header';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport SettingsSidebar from '../sidebar/settings-sidebar';\nimport MetaBoxes from '../meta-boxes';\nimport WelcomeGuide from '../welcome-guide';\nimport ActionsPanel from './actions-panel';\nimport StartPageOptions from '../start-page-options';\nimport { store as editPostStore } from '../../store';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nfunction Layout( { styles } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\tconst { openGeneralSidebar, closeGeneralSidebar, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tmode,\n\t\tisFullscreenActive,\n\t\tisRichEditingEnabled,\n\t\tsidebarIsOpened,\n\t\thasActiveMetaboxes,\n\t\thasFixedToolbar,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t\thasBlockSelected,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tshowIconLabels,\n\t\tisDistractionFreeMode,\n\t\tshowBlockBreadcrumbs,\n\t\tisTemplateMode,\n\t\tdocumentLabel,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getPostTypeLabel } = select( editorStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst postTypeLabel = getPostTypeLabel();\n\n\t\treturn {\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t\thasFixedToolbar:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'fixedToolbar' ),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\teditPostStore.name\n\t\t\t\t) || select( editPostStore ).isPublishSidebarOpened()\n\t\t\t),\n\t\t\tisFullscreenActive:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'fullscreenMode' ),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editPostStore ).isListViewOpened(),\n\t\t\tmode: select( editPostStore ).getEditorMode(),\n\t\t\tisRichEditingEnabled: editorSettings.richEditingEnabled,\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/previous-region' ),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/next-region' ),\n\t\t\tshowIconLabels:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t\tisDistractionFreeMode:\n\t\t\t\tselect( editPostStore ).isFeatureActive( 'distractionFree' ),\n\t\t\tshowBlockBreadcrumbs: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\t// translators: Default label for the Document in the Block Breadcrumb.\n\t\t\tdocumentLabel: postTypeLabel || _x( 'Document', 'noun' ),\n\t\t};\n\t}, [] );\n\n\tconst isDistractionFree = isDistractionFreeMode && isLargeViewport;\n\n\tconst className = classnames( 'edit-post-layout', 'is-mode-' + mode, {\n\t\t'is-sidebar-opened': sidebarIsOpened,\n\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t'has-metaboxes': hasActiveMetaboxes,\n\t\t'show-icon-labels': showIconLabels,\n\t\t'is-distraction-free': isDistractionFree,\n\t} );\n\tconst openSidebarPanel = () =>\n\t\topenGeneralSidebar(\n\t\t\thasBlockSelected ? 'edit-post/block' : 'edit-post/document'\n\t\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( sidebarIsOpened && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t}\n\t}, [ sidebarIsOpened, isHugeViewport ] );\n\tuseEffect( () => {\n\t\tif ( isInserterOpened && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isHugeViewport ] );\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =\n\t\tuseState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'Document Overview' )\n\t\t: __( 'Block Library' );\n\n\tconst secondarySidebar = () => {\n\t\tif ( mode === 'visual' && isInserterOpened ) {\n\t\t\treturn <InserterSidebar />;\n\t\t}\n\t\tif ( mode === 'visual' && isListViewOpened ) {\n\t\t\treturn <ListViewSidebar />;\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<FullscreenMode isActive={ isFullscreenActive } />\n\t\t\t<BrowserURL />\n\t\t\t<UnsavedChangesWarning />\n\t\t\t<AutosaveMonitor />\n\t\t\t<LocalAutosaveMonitor />\n\t\t\t<EditPostKeyboardShortcuts />\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t<SettingsSidebar />\n\t\t\t<InterfaceSkeleton\n\t\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\t\tclassName={ className }\n\t\t\t\tlabels={ {\n\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t} }\n\t\t\t\theader={\n\t\t\t\t\t<Header\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\teditorNotices={ <EditorNotices /> }\n\t\t\t\tsecondarySidebar={ secondarySidebar() }\n\t\t\t\tsidebar={\n\t\t\t\t\t( ! isMobileViewport || sidebarIsOpened ) && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isMobileViewport && ! sidebarIsOpened && (\n\t\t\t\t\t\t\t\t<div className=\"edit-post-layout__toggle-sidebar-panel\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-post-layout__toggle-sidebar-panel-button\"\n\t\t\t\t\t\t\t\t\t\tonClick={ openSidebarPanel }\n\t\t\t\t\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ hasBlockSelected\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Open block settings' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Open document settings' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-post\" />\n\t\t\t\t\t\t</>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isDistractionFree && <EditorNotices /> }\n\t\t\t\t\t\t{ ( mode === 'text' || ! isRichEditingEnabled ) && (\n\t\t\t\t\t\t\t<TextEditor />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isRichEditingEnabled && mode === 'visual' && (\n\t\t\t\t\t\t\t<VisualEditor styles={ styles } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div className=\"edit-post-layout__metaboxes\">\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"normal\" />\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"advanced\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isMobileViewport && sidebarIsOpened && (\n\t\t\t\t\t\t\t<ScrollLock />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t! isDistractionFree &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\n\t\t\t\t\t! isMobileViewport &&\n\t\t\t\t\tisRichEditingEnabled &&\n\t\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t\t<div className=\"edit-post-layout__footer\">\n\t\t\t\t\t\t\t<BlockBreadcrumb rootLabelText={ documentLabel } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<ActionsPanel\n\t\t\t\t\t\tcloseEntitiesSavedStates={ closeEntitiesSavedStates }\n\t\t\t\t\t\tisEntitiesSavedStatesOpen={\n\t\t\t\t\t\t\tentitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tshortcuts={ {\n\t\t\t\t\tprevious: previousShortcut,\n\t\t\t\t\tnext: nextShortcut,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<EditPostPreferencesModal />\n\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t<WelcomeGuide />\n\t\t\t<StartPageOptions />\n\t\t\t<Popover.Slot />\n\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t</>\n\t);\n}\n\nexport default Layout;\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = MetaBoxes;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
12
|
var _data = require("@wordpress/data");
|
|
15
13
|
|
|
16
14
|
var _editor = require("@wordpress/editor");
|
|
@@ -21,10 +19,6 @@ var _metaBoxVisibility = _interopRequireDefault(require("./meta-box-visibility")
|
|
|
21
19
|
|
|
22
20
|
var _store = require("../../store");
|
|
23
21
|
|
|
24
|
-
/**
|
|
25
|
-
* External dependencies
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
22
|
/**
|
|
29
23
|
* WordPress dependencies
|
|
30
24
|
*/
|
|
@@ -68,7 +62,7 @@ function MetaBoxes(_ref) {
|
|
|
68
62
|
return null;
|
|
69
63
|
}
|
|
70
64
|
|
|
71
|
-
return (0, _element.createElement)(_element.Fragment, null, (0
|
|
65
|
+
return (0, _element.createElement)(_element.Fragment, null, (metaBoxes !== null && metaBoxes !== void 0 ? metaBoxes : []).map(_ref2 => {
|
|
72
66
|
let {
|
|
73
67
|
id
|
|
74
68
|
} = _ref2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/meta-boxes/index.js"],"names":["MetaBoxes","location","registry","metaBoxes","areMetaBoxesInitialized","isEditorReady","select","__unstableIsEditorReady","editorStore","getMetaBoxesPerLocation","_areMetaBoxesInitialized","editPostStore","dispatch","initializeMetaBoxes","id"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/meta-boxes/index.js"],"names":["MetaBoxes","location","registry","metaBoxes","areMetaBoxesInitialized","isEditorReady","select","__unstableIsEditorReady","editorStore","getMetaBoxesPerLocation","_areMetaBoxesInitialized","editPostStore","dispatch","initializeMetaBoxes","map","id"],"mappings":";;;;;;;;;AAIA;;AADA;;AAEA;;AAKA;;AACA;;AACA;;AAZA;AACA;AACA;;AAKA;AACA;AACA;AAKe,SAASA,SAAT,OAAmC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACjD,QAAMC,QAAQ,GAAG,wBAAjB;AACA,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,uBAAb;AAAsCC,IAAAA;AAAtC,MAAwD,qBAC3DC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAA8BD,MAAM,CAAEE,aAAF,CAA1C;AACA,UAAM;AACLC,MAAAA,uBADK;AAELL,MAAAA,uBAAuB,EAAEM;AAFpB,QAGFJ,MAAM,CAAEK,YAAF,CAHV;AAIA,WAAO;AACNR,MAAAA,SAAS,EAAEM,uBAAuB,CAAER,QAAF,CAD5B;AAENG,MAAAA,uBAAuB,EAAEM,wBAAwB,EAF3C;AAGNL,MAAAA,aAAa,EAAEE,uBAAuB;AAHhC,KAAP;AAKA,GAZ4D,EAa7D,CAAEN,QAAF,CAb6D,CAA9D,CAFiD,CAkBjD;AACA;AACA;;AACA,0BAAW,MAAM;AAChB,QAAKI,aAAa,IAAI,CAAED,uBAAxB,EAAkD;AACjDF,MAAAA,QAAQ,CAACU,QAAT,CAAmBD,YAAnB,EAAmCE,mBAAnC;AACA;AACD,GAJD,EAIG,CAAER,aAAF,EAAiBD,uBAAjB,CAJH;;AAMA,MAAK,CAAEA,uBAAP,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,SACC,qDACG,CAAED,SAAF,aAAEA,SAAF,cAAEA,SAAF,GAAe,EAAf,EAAoBW,GAApB,CAAyB;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAC1B,4BAAC,0BAAD;AAAmB,MAAA,GAAG,EAAGA,EAAzB;AAA8B,MAAA,EAAE,EAAGA;AAAnC,MAD0B;AAAA,GAAzB,CADH,EAIC,4BAAC,sBAAD;AAAe,IAAA,QAAQ,EAAGd;AAA1B,IAJD,CADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useRegistry } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport MetaBoxesArea from './meta-boxes-area';\nimport MetaBoxVisibility from './meta-box-visibility';\nimport { store as editPostStore } from '../../store';\n\nexport default function MetaBoxes( { location } ) {\n\tconst registry = useRegistry();\n\tconst { metaBoxes, areMetaBoxesInitialized, isEditorReady } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __unstableIsEditorReady } = select( editorStore );\n\t\t\tconst {\n\t\t\t\tgetMetaBoxesPerLocation,\n\t\t\t\tareMetaBoxesInitialized: _areMetaBoxesInitialized,\n\t\t\t} = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tmetaBoxes: getMetaBoxesPerLocation( location ),\n\t\t\t\tareMetaBoxesInitialized: _areMetaBoxesInitialized(),\n\t\t\t\tisEditorReady: __unstableIsEditorReady(),\n\t\t\t};\n\t\t},\n\t\t[ location ]\n\t);\n\n\t// When editor is ready, initialize postboxes (wp core script) and metabox\n\t// saving. This initializes all meta box locations, not just this specific\n\t// one.\n\tuseEffect( () => {\n\t\tif ( isEditorReady && ! areMetaBoxesInitialized ) {\n\t\t\tregistry.dispatch( editPostStore ).initializeMetaBoxes();\n\t\t}\n\t}, [ isEditorReady, areMetaBoxesInitialized ] );\n\n\tif ( ! areMetaBoxesInitialized ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ ( metaBoxes ?? [] ).map( ( { id } ) => (\n\t\t\t\t<MetaBoxVisibility key={ id } id={ id } />\n\t\t\t) ) }\n\t\t\t<MetaBoxesArea location={ location } />\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -8,8 +8,6 @@ exports.default = void 0;
|
|
|
8
8
|
|
|
9
9
|
var _element = require("@wordpress/element");
|
|
10
10
|
|
|
11
|
-
var _lodash = require("lodash");
|
|
12
|
-
|
|
13
11
|
var _i18n = require("@wordpress/i18n");
|
|
14
12
|
|
|
15
13
|
var _data = require("@wordpress/data");
|
|
@@ -22,10 +20,6 @@ var _options = require("./options");
|
|
|
22
20
|
|
|
23
21
|
var _store = require("../../store");
|
|
24
22
|
|
|
25
|
-
/**
|
|
26
|
-
* External dependencies
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
23
|
/**
|
|
30
24
|
* WordPress dependencies
|
|
31
25
|
*/
|
|
@@ -53,7 +47,7 @@ function MetaBoxesSection(_ref) {
|
|
|
53
47
|
|
|
54
48
|
return (0, _element.createElement)(_interface.PreferencesModalSection, sectionProps, areCustomFieldsRegistered && (0, _element.createElement)(_options.EnableCustomFieldsOption, {
|
|
55
49
|
label: (0, _i18n.__)('Custom fields')
|
|
56
|
-
}),
|
|
50
|
+
}), thirdPartyMetaBoxes.map(_ref3 => {
|
|
57
51
|
let {
|
|
58
52
|
id,
|
|
59
53
|
title
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/preferences-modal/meta-boxes-section.js"],"names":["MetaBoxesSection","areCustomFieldsRegistered","metaBoxes","sectionProps","thirdPartyMetaBoxes","filter","id","length","title","select","getEditorSettings","editorStore","getAllMetaBoxes","editPostStore","enableCustomFields","undefined"],"mappings":";;;;;;;;;;AAGA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/preferences-modal/meta-boxes-section.js"],"names":["MetaBoxesSection","areCustomFieldsRegistered","metaBoxes","sectionProps","thirdPartyMetaBoxes","filter","id","length","map","title","select","getEditorSettings","editorStore","getAllMetaBoxes","editPostStore","enableCustomFields","undefined"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;AAIO,SAASA,gBAAT,OAIH;AAAA,MAJ8B;AACjCC,IAAAA,yBADiC;AAEjCC,IAAAA,SAFiC;AAGjC,OAAGC;AAH8B,GAI9B;AACH;AACA,QAAMC,mBAAmB,GAAGF,SAAS,CAACG,MAAV,CAC3B;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAcA,EAAE,KAAK,YAArB;AAAA,GAD2B,CAA5B;;AAIA,MAAK,CAAEL,yBAAF,IAA+BG,mBAAmB,CAACG,MAApB,KAA+B,CAAnE,EAAuE;AACtE,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,kCAAD,EAA8BJ,YAA9B,EACGF,yBAAyB,IAC1B,4BAAC,iCAAD;AAA0B,IAAA,KAAK,EAAG,cAAI,eAAJ;AAAlC,IAFF,EAIGG,mBAAmB,CAACI,GAApB,CAAyB;AAAA,QAAE;AAAEF,MAAAA,EAAF;AAAMG,MAAAA;AAAN,KAAF;AAAA,WAC1B,4BAAC,0BAAD;AACC,MAAA,GAAG,EAAGH,EADP;AAEC,MAAA,KAAK,EAAGG,KAFT;AAGC,MAAA,SAAS,EAAI,YAAYH,EAAI;AAH9B,MAD0B;AAAA,GAAzB,CAJH,CADD;AAcA;;eAEc,sBAAcI,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAwBD,MAAM,CAAEE,aAAF,CAApC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAsBH,MAAM,CAAEI,YAAF,CAAlC;AAEA,SAAO;AACN;AACAb,IAAAA,yBAAyB,EACxBU,iBAAiB,GAAGI,kBAApB,KAA2CC,SAHtC;AAINd,IAAAA,SAAS,EAAEW,eAAe;AAJpB,GAAP;AAMA,CAVc,EAUVb,gBAVU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { withSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { PreferencesModalSection } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { EnableCustomFieldsOption, EnablePanelOption } from './options';\nimport { store as editPostStore } from '../../store';\n\nexport function MetaBoxesSection( {\n\tareCustomFieldsRegistered,\n\tmetaBoxes,\n\t...sectionProps\n} ) {\n\t// The 'Custom Fields' meta box is a special case that we handle separately.\n\tconst thirdPartyMetaBoxes = metaBoxes.filter(\n\t\t( { id } ) => id !== 'postcustom'\n\t);\n\n\tif ( ! areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModalSection { ...sectionProps }>\n\t\t\t{ areCustomFieldsRegistered && (\n\t\t\t\t<EnableCustomFieldsOption label={ __( 'Custom fields' ) } />\n\t\t\t) }\n\t\t\t{ thirdPartyMetaBoxes.map( ( { id, title } ) => (\n\t\t\t\t<EnablePanelOption\n\t\t\t\t\tkey={ id }\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tpanelName={ `meta-box-${ id }` }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</PreferencesModalSection>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getEditorSettings } = select( editorStore );\n\tconst { getAllMetaBoxes } = select( editPostStore );\n\n\treturn {\n\t\t// This setting should not live in the block editor's store.\n\t\tareCustomFieldsRegistered:\n\t\t\tgetEditorSettings().enableCustomFields !== undefined,\n\t\tmetaBoxes: getAllMetaBoxes(),\n\t};\n} )( MetaBoxesSection );\n"]}
|
|
@@ -22,14 +22,14 @@ function PostSchedule() {
|
|
|
22
22
|
const [popoverAnchor, setPopoverAnchor] = (0, _element.useState)(null); // Memoize popoverProps to avoid returning a new object every time.
|
|
23
23
|
|
|
24
24
|
const popoverProps = (0, _element.useMemo)(() => ({
|
|
25
|
-
anchor: popoverAnchor
|
|
25
|
+
anchor: popoverAnchor,
|
|
26
|
+
placement: 'bottom-end'
|
|
26
27
|
}), [popoverAnchor]);
|
|
27
28
|
return (0, _element.createElement)(_editor.PostScheduleCheck, null, (0, _element.createElement)(_components.PanelRow, {
|
|
28
29
|
className: "edit-post-post-schedule",
|
|
29
30
|
ref: setPopoverAnchor
|
|
30
31
|
}, (0, _element.createElement)("span", null, (0, _i18n.__)('Publish')), (0, _element.createElement)(_components.Dropdown, {
|
|
31
32
|
popoverProps: popoverProps,
|
|
32
|
-
position: "bottom left",
|
|
33
33
|
contentClassName: "edit-post-post-schedule__dialog",
|
|
34
34
|
focusOnMount: true,
|
|
35
35
|
renderToggle: _ref => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-schedule/index.js"],"names":["PostSchedule","popoverAnchor","setPopoverAnchor","popoverProps","anchor","isOpen","onToggle","onClose","PostScheduleToggle","onClick","label","fullLabel","full"],"mappings":";;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AANA;AACA;AACA;AAUe,SAASA,YAAT,GAAwB;AACtC;AACA;AACA,QAAM,CAAEC,aAAF,EAAiBC,gBAAjB,IAAsC,uBAAU,IAAV,CAA5C,CAHsC,CAItC;;AACA,QAAMC,YAAY,GAAG,sBACpB,OAAQ;AAAEC,IAAAA,MAAM,EAAEH;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-schedule/index.js"],"names":["PostSchedule","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","isOpen","onToggle","onClose","PostScheduleToggle","onClick","label","fullLabel","full"],"mappings":";;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AANA;AACA;AACA;AAUe,SAASA,YAAT,GAAwB;AACtC;AACA;AACA,QAAM,CAAEC,aAAF,EAAiBC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C,CAPd;AAQC,IAAA,OAAO,EAAGD;AARX,KAUGC,KAVH,CADD;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport {\n\tPostSchedule as PostScheduleForm,\n\tPostScheduleCheck,\n\tusePostScheduleLabel,\n} from '@wordpress/editor';\n\nexport default function PostSchedule() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostScheduleCheck>\n\t\t\t<PanelRow\n\t\t\t\tclassName=\"edit-post-post-schedule\"\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t>\n\t\t\t\t<span>{ __( 'Publish' ) }</span>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tcontentClassName=\"edit-post-post-schedule__dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostScheduleToggle\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostScheduleForm onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</PostScheduleCheck>\n\t);\n}\n\nfunction PostScheduleToggle( { isOpen, onClick } ) {\n\tconst label = usePostScheduleLabel();\n\tconst fullLabel = usePostScheduleLabel( { full: true } );\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-schedule__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\tlabel={ fullLabel }\n\t\t\tshowTooltip\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post date.\n\t\t\taria-label={ sprintf( __( 'Change date: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"]}
|
|
@@ -84,29 +84,27 @@ function PostTemplateCreateModal(_ref) {
|
|
|
84
84
|
|
|
85
85
|
return (0, _element.createElement)(_components.Modal, {
|
|
86
86
|
title: (0, _i18n.__)('Create custom template'),
|
|
87
|
-
closeLabel: (0, _i18n.__)('Close'),
|
|
88
87
|
onRequestClose: cancel,
|
|
89
88
|
className: "edit-post-post-template__create-modal"
|
|
90
89
|
}, (0, _element.createElement)("form", {
|
|
91
90
|
className: "edit-post-post-template__create-form",
|
|
92
91
|
onSubmit: submit
|
|
93
|
-
}, (0, _element.createElement)(_components.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
}, (0, _element.createElement)(_components.__experimentalVStack, {
|
|
93
|
+
spacing: "3"
|
|
94
|
+
}, (0, _element.createElement)(_components.TextControl, {
|
|
95
|
+
__nextHasNoMarginBottom: true,
|
|
97
96
|
label: (0, _i18n.__)('Name'),
|
|
98
97
|
value: title,
|
|
99
98
|
onChange: setTitle,
|
|
100
99
|
placeholder: DEFAULT_TITLE,
|
|
101
100
|
disabled: isBusy,
|
|
102
101
|
help: (0, _i18n.__)('Describe the template, e.g. "Post with sidebar". Custom templates can be applied to any post or page.')
|
|
103
|
-
})
|
|
104
|
-
justify: "
|
|
105
|
-
|
|
106
|
-
}, (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(_components.Button, {
|
|
102
|
+
}), (0, _element.createElement)(_components.__experimentalHStack, {
|
|
103
|
+
justify: "right"
|
|
104
|
+
}, (0, _element.createElement)(_components.Button, {
|
|
107
105
|
variant: "tertiary",
|
|
108
106
|
onClick: cancel
|
|
109
|
-
}, (0, _i18n.__)('Cancel'))
|
|
107
|
+
}, (0, _i18n.__)('Cancel')), (0, _element.createElement)(_components.Button, {
|
|
110
108
|
variant: "primary",
|
|
111
109
|
type: "submit",
|
|
112
110
|
isBusy: isBusy,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-template/create-modal.js"],"names":["DEFAULT_TITLE","PostTemplateCreateModal","onClose","defaultBlockTemplate","select","editorStore","getEditorSettings","__unstableCreateTemplate","__unstableSwitchToTemplateMode","editPostStore","title","setTitle","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","tagName","layout","inherit","slug","content"],"mappings":";;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AACA;;AAOA;;AACA;;AAKA;;AApBA;AACA;AACA;;AAeA;AACA;AACA;AAGA,MAAMA,aAAa,GAAG,cAAI,iBAAJ,CAAtB;;AAEe,SAASC,uBAAT,OAAgD;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AAC9D,QAAMC,oBAAoB,GAAG,qBAC1BC,MAAF,IACCA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,iBAAtB,GAA0CH,oBAFf,EAG5B,EAH4B,CAA7B;AAMA,QAAM;AAAEI,IAAAA,wBAAF;AAA4BC,IAAAA;AAA5B,MACL,uBAAaC,YAAb,CADD;AAGA,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,uBAAU,EAAV,CAA5B;AAEA,QAAM,CAAEC,MAAF,EAAUC,SAAV,IAAwB,uBAAU,KAAV,CAA9B;;AAEA,QAAMC,MAAM,GAAG,MAAM;AACpBH,IAAAA,QAAQ,CAAE,EAAF,CAAR;AACAT,IAAAA,OAAO;AACP,GAHD;;AAKA,QAAMa,MAAM,GAAG,MAAQC,KAAR,IAAmB;AACjCA,IAAAA,KAAK,CAACC,cAAN;;AAEA,QAAKL,MAAL,EAAc;AACb;AACA;;AAEDC,IAAAA,SAAS,CAAE,IAAF,CAAT;AAEA,UAAMK,kBAAkB,GACvBf,oBADuB,aACvBA,oBADuB,cACvBA,oBADuB,GAEvB,uBAAW,CACV,yBACC,YADD,EAEC;AACCgB,MAAAA,OAAO,EAAE,QADV;AAECC,MAAAA,MAAM,EAAE;AAAEC,QAAAA,OAAO,EAAE;AAAX;AAFT,KAFD,EAMC,CACC,yBAAa,iBAAb,CADD,EAEC,yBAAa,mBAAb,CAFD,CAND,CADU,EAYV,yBAAa,gBAAb,CAZU,EAaV,yBACC,YADD,EAEC;AACCF,MAAAA,OAAO,EAAE;AADV,KAFD,EAKC,CACC,yBACC,YADD,EAEC;AACCC,MAAAA,MAAM,EAAE;AAAEC,QAAAA,OAAO,EAAE;AAAX;AADT,KAFD,EAKC,CAAE,yBAAa,iBAAb,CAAF,CALD,CADD,EAQC,yBAAa,mBAAb,EAAkC;AACjCD,MAAAA,MAAM,EAAE;AAAEC,QAAAA,OAAO,EAAE;AAAX;AADyB,KAAlC,CARD,CALD,CAbU,CAAX,CAFD;AAmCA,UAAMd,wBAAwB,CAAE;AAC/Be,MAAAA,IAAI,EAAE,uBAAcZ,KAAK,IAAIV,aAAvB,CADyB;AAE/BuB,MAAAA,OAAO,EAAEL,kBAFsB;AAG/BR,MAAAA,KAAK,EAAEA,KAAK,IAAIV;AAHe,KAAF,CAA9B;AAMAa,IAAAA,SAAS,CAAE,KAAF,CAAT;AACAC,IAAAA,MAAM;;AAENN,IAAAA,8BAA8B,CAAE,IAAF,CAA9B;AACA,GAtDD;;AAwDA,SACC,4BAAC,iBAAD;AACC,IAAA,KAAK,EAAG,cAAI,wBAAJ,CADT;AAEC,IAAA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-template/create-modal.js"],"names":["DEFAULT_TITLE","PostTemplateCreateModal","onClose","defaultBlockTemplate","select","editorStore","getEditorSettings","__unstableCreateTemplate","__unstableSwitchToTemplateMode","editPostStore","title","setTitle","isBusy","setIsBusy","cancel","submit","event","preventDefault","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AD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,MAAM,EAAGF,MAHV;AAIC,qBAAgBA;AAJjB,KAMG,cAAI,QAAJ,CANH,CALD,CAZD,CAJD,CALD,CADD;AAwCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useState } from '@wordpress/element';\nimport { serialize, createBlock } from '@wordpress/blocks';\nimport {\n\tModal,\n\tTextControl,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cleanForSlug } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nconst DEFAULT_TITLE = __( 'Custom Template' );\n\nexport default function PostTemplateCreateModal( { onClose } ) {\n\tconst defaultBlockTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().defaultBlockTemplate,\n\t\t[]\n\t);\n\n\tconst { __unstableCreateTemplate, __unstableSwitchToTemplateMode } =\n\t\tuseDispatch( editPostStore );\n\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst cancel = () => {\n\t\tsetTitle( '' );\n\t\tonClose();\n\t};\n\n\tconst submit = async ( event ) => {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst newTemplateContent =\n\t\t\tdefaultBlockTemplate ??\n\t\t\tserialize( [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'header',\n\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/site-title' ),\n\t\t\t\t\t\tcreateBlock( 'core/site-tagline' ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\tcreateBlock( 'core/separator' ),\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'main',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[ createBlock( 'core/post-title' ) ]\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreateBlock( 'core/post-content', {\n\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t] );\n\n\t\tawait __unstableCreateTemplate( {\n\t\t\tslug: cleanForSlug( title || DEFAULT_TITLE ),\n\t\t\tcontent: newTemplateContent,\n\t\t\ttitle: title || DEFAULT_TITLE,\n\t\t} );\n\n\t\tsetIsBusy( false );\n\t\tcancel();\n\n\t\t__unstableSwitchToTemplateMode( true );\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ cancel }\n\t\t\tclassName=\"edit-post-post-template__create-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"edit-post-post-template__create-form\"\n\t\t\t\tonSubmit={ submit }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ DEFAULT_TITLE }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\". Custom templates can be applied to any post or page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ cancel }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"]}
|
|
@@ -36,7 +36,8 @@ function PostTemplate() {
|
|
|
36
36
|
const [popoverAnchor, setPopoverAnchor] = (0, _element.useState)(null); // Memoize popoverProps to avoid returning a new object every time.
|
|
37
37
|
|
|
38
38
|
const popoverProps = (0, _element.useMemo)(() => ({
|
|
39
|
-
anchor: popoverAnchor
|
|
39
|
+
anchor: popoverAnchor,
|
|
40
|
+
placement: 'bottom-end'
|
|
40
41
|
}), [popoverAnchor]);
|
|
41
42
|
const isVisible = (0, _data.useSelect)(select => {
|
|
42
43
|
var _select$canUser;
|
|
@@ -72,7 +73,6 @@ function PostTemplate() {
|
|
|
72
73
|
ref: setPopoverAnchor
|
|
73
74
|
}, (0, _element.createElement)("span", null, (0, _i18n.__)('Template')), (0, _element.createElement)(_components.Dropdown, {
|
|
74
75
|
popoverProps: popoverProps,
|
|
75
|
-
position: "bottom left",
|
|
76
76
|
className: "edit-post-post-template__dropdown",
|
|
77
77
|
contentClassName: "edit-post-post-template__dialog",
|
|
78
78
|
focusOnMount: true,
|