@wordpress/edit-post 7.12.9 → 7.12.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/layout/index.js +38 -5
- package/build/components/layout/index.js.map +1 -1
- package/build/editor.js +2 -39
- package/build/editor.js.map +1 -1
- package/build/plugins/index.js +1 -1
- package/build/plugins/index.js.map +1 -1
- package/build-module/components/layout/index.js +38 -6
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/editor.js +2 -38
- package/build-module/editor.js.map +1 -1
- package/build-module/plugins/index.js +1 -1
- package/build-module/plugins/index.js.map +1 -1
- package/package.json +19 -19
- package/src/components/layout/index.js +47 -2
- package/src/editor.js +2 -47
- package/src/plugins/index.js +1 -1
|
@@ -61,6 +61,8 @@ var _startPageOptions = _interopRequireDefault(require("../start-page-options"))
|
|
|
61
61
|
|
|
62
62
|
var _store = require("../../store");
|
|
63
63
|
|
|
64
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
65
|
+
|
|
64
66
|
/**
|
|
65
67
|
* External dependencies
|
|
66
68
|
*/
|
|
@@ -72,6 +74,9 @@ var _store = require("../../store");
|
|
|
72
74
|
/**
|
|
73
75
|
* Internal dependencies
|
|
74
76
|
*/
|
|
77
|
+
const {
|
|
78
|
+
getLayoutStyles
|
|
79
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
75
80
|
const interfaceLabels = {
|
|
76
81
|
/* translators: accessibility text for the editor top bar landmark region. */
|
|
77
82
|
header: (0, _i18n.__)('Editor top bar'),
|
|
@@ -89,9 +94,7 @@ const interfaceLabels = {
|
|
|
89
94
|
footer: (0, _i18n.__)('Editor footer')
|
|
90
95
|
};
|
|
91
96
|
|
|
92
|
-
function Layout({
|
|
93
|
-
styles
|
|
94
|
-
}) {
|
|
97
|
+
function Layout() {
|
|
95
98
|
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
96
99
|
const isHugeViewport = (0, _compose.useViewportMatch)('huge', '>=');
|
|
97
100
|
const isLargeViewport = (0, _compose.useViewportMatch)('large');
|
|
@@ -119,14 +122,43 @@ function Layout({
|
|
|
119
122
|
isDistractionFree,
|
|
120
123
|
showBlockBreadcrumbs,
|
|
121
124
|
isTemplateMode,
|
|
122
|
-
documentLabel
|
|
125
|
+
documentLabel,
|
|
126
|
+
styles
|
|
123
127
|
} = (0, _data.useSelect)(select => {
|
|
124
128
|
const {
|
|
125
129
|
getEditorSettings,
|
|
126
130
|
getPostTypeLabel
|
|
127
131
|
} = select(_editor.store);
|
|
132
|
+
const {
|
|
133
|
+
isFeatureActive
|
|
134
|
+
} = select(_store.store);
|
|
128
135
|
const editorSettings = getEditorSettings();
|
|
129
136
|
const postTypeLabel = getPostTypeLabel();
|
|
137
|
+
const hasThemeStyles = isFeatureActive('themeStyles');
|
|
138
|
+
const themeStyles = [];
|
|
139
|
+
const presetStyles = [];
|
|
140
|
+
editorSettings.styles?.forEach(style => {
|
|
141
|
+
if (!style.__unstableType || style.__unstableType === 'theme') {
|
|
142
|
+
themeStyles.push(style);
|
|
143
|
+
} else {
|
|
144
|
+
presetStyles.push(style);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
const defaultEditorStyles = [...editorSettings.defaultEditorStyles, ...presetStyles]; // If theme styles are not present or displayed, ensure that
|
|
148
|
+
// base layout styles are still present in the editor.
|
|
149
|
+
|
|
150
|
+
if (!editorSettings.disableLayoutStyles && !(hasThemeStyles && themeStyles.length)) {
|
|
151
|
+
defaultEditorStyles.push({
|
|
152
|
+
css: getLayoutStyles({
|
|
153
|
+
style: {},
|
|
154
|
+
selector: 'body',
|
|
155
|
+
hasBlockGapSupport: false,
|
|
156
|
+
hasFallbackGapSupport: true,
|
|
157
|
+
fallbackGapValue: '0.5em'
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
130
162
|
return {
|
|
131
163
|
isTemplateMode: select(_store.store).isEditingTemplate(),
|
|
132
164
|
hasFixedToolbar: select(_store.store).isFeatureActive('fixedToolbar'),
|
|
@@ -143,7 +175,8 @@ function Layout({
|
|
|
143
175
|
isDistractionFree: select(_store.store).isFeatureActive('distractionFree'),
|
|
144
176
|
showBlockBreadcrumbs: select(_store.store).isFeatureActive('showBlockBreadcrumbs'),
|
|
145
177
|
// translators: Default label for the Document in the Block Breadcrumb.
|
|
146
|
-
documentLabel: postTypeLabel || (0, _i18n._x)('Document', 'noun')
|
|
178
|
+
documentLabel: postTypeLabel || (0, _i18n._x)('Document', 'noun'),
|
|
179
|
+
styles: hasThemeStyles && themeStyles.length ? editorSettings.styles : defaultEditorStyles
|
|
147
180
|
};
|
|
148
181
|
}, []);
|
|
149
182
|
|
|
@@ -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","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","className","secondarySidebarLabel","secondarySidebar","onPluginAreaError","previous","next"],"mappings":";;;;;;;;;AA8BA;;AA3BA;;AAKA;;AAUA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAC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BAHF;AAKC,MAAA,8BAA8B,EAC7BC;AANF,MAtEF;AAgFC,IAAA,SAAS,EAAG;AACXO,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,2BAAD,OAjGD,EAkGC,4BAAC,yBAAD,OAlGD,EAmGC,4BAAC,mBAAD,CAAS,IAAT,OAnGD,EAoGC,4BAAC,mBAAD;AAAY,IAAA,OAAO,EAAGkC;AAAtB,IApGD,CADD;AAwGA;;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\tPostSyncStatusModal,\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\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 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 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 && isLargeViewport,\n\t\t'is-entity-save-view-open': !! 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 && isLargeViewport }\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{ ! isDistractionFree && ! 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\t! isMobileViewport &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\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<PostSyncStatusModal />\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":["getLayoutStyles","blockEditorPrivateApis","interfaceLabels","header","body","sidebar","actions","footer","Layout","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","styles","select","getEditorSettings","getPostTypeLabel","editorStore","isFeatureActive","editorSettings","postTypeLabel","hasThemeStyles","themeStyles","presetStyles","forEach","style","__unstableType","push","defaultEditorStyles","disableLayoutStyles","length","css","selector","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","isEditingTemplate","interfaceStore","getActiveComplementaryArea","name","isPublishSidebarOpened","getEditorMode","richEditingEnabled","hasMetaBoxes","keyboardShortcutsStore","getAllShortcutKeyCombinations","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","className","secondarySidebarLabel","secondarySidebar","onPluginAreaError","previous","next"],"mappings":";;;;;;;;;AAiCA;;AA9BA;;AAKA;;AAUA;;AACA;;AAIA;;AACA;;AACA;;AACA;;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MAtEF;AAgFC,IAAA,SAAS,EAAG;AACXO,MAAAA,QAAQ,EAAEpD,gBADC;AAEXqD,MAAAA,IAAI,EAAEpD;AAFK;AAhFb,IATD,EA8FC,4BAAC,yBAAD,OA9FD,EA+FC,4BAAC,kCAAD,OA/FD,EAgGC,4BAAC,qBAAD,OAhGD,EAiGC,4BAAC,2BAAD,OAjGD,EAkGC,4BAAC,yBAAD,OAlGD,EAmGC,4BAAC,mBAAD,CAAS,IAAT,OAnGD,EAoGC,4BAAC,mBAAD;AAAY,IAAA,OAAO,EAAGkD;AAAtB,IApGD,CADD;AAwGA;;eAEcnE,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\tPostSyncStatusModal,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockBreadcrumb,\n\tprivateApis as blockEditorPrivateApis,\n} 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';\nimport { unlock } from '../../lock-unlock';\n\nconst { getLayoutStyles } = unlock( blockEditorPrivateApis );\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() {\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\tstyles,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getPostTypeLabel } = select( editorStore );\n\t\tconst { isFeatureActive } = select( editPostStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst postTypeLabel = getPostTypeLabel();\n\t\tconst hasThemeStyles = isFeatureActive( 'themeStyles' );\n\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\teditorSettings.styles?.forEach( ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\n\t\tconst defaultEditorStyles = [\n\t\t\t...editorSettings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\n\t\t// If theme styles are not present or displayed, ensure that\n\t\t// base layout styles are still present in the editor.\n\t\tif (\n\t\t\t! editorSettings.disableLayoutStyles &&\n\t\t\t! ( hasThemeStyles && themeStyles.length )\n\t\t) {\n\t\t\tdefaultEditorStyles.push( {\n\t\t\t\tcss: getLayoutStyles( {\n\t\t\t\t\tstyle: {},\n\t\t\t\t\tselector: 'body',\n\t\t\t\t\thasBlockGapSupport: false,\n\t\t\t\t\thasFallbackGapSupport: true,\n\t\t\t\t\tfallbackGapValue: '0.5em',\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\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\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\tstyles:\n\t\t\t\thasThemeStyles && themeStyles.length\n\t\t\t\t\t? editorSettings.styles\n\t\t\t\t\t: defaultEditorStyles,\n\t\t};\n\t}, [] );\n\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 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 && isLargeViewport,\n\t\t'is-entity-save-view-open': !! 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 && isLargeViewport }\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{ ! isDistractionFree && ! 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\t! isMobileViewport &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\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<PostSyncStatusModal />\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"]}
|
package/build/editor.js
CHANGED
|
@@ -15,8 +15,6 @@ var _data = require("@wordpress/data");
|
|
|
15
15
|
|
|
16
16
|
var _editor = require("@wordpress/editor");
|
|
17
17
|
|
|
18
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
19
|
-
|
|
20
18
|
var _components = require("@wordpress/components");
|
|
21
19
|
|
|
22
20
|
var _coreData = require("@wordpress/core-data");
|
|
@@ -49,9 +47,6 @@ var _useCommonCommands = _interopRequireDefault(require("./hooks/commands/use-co
|
|
|
49
47
|
const {
|
|
50
48
|
ExperimentalEditorProvider
|
|
51
49
|
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
52
|
-
const {
|
|
53
|
-
getLayoutStyles
|
|
54
|
-
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
55
50
|
const {
|
|
56
51
|
useCommands
|
|
57
52
|
} = (0, _lockUnlock.unlock)(_coreCommands.privateApis);
|
|
@@ -70,7 +65,6 @@ function Editor({
|
|
|
70
65
|
focusMode,
|
|
71
66
|
isDistractionFree,
|
|
72
67
|
hasInlineToolbar,
|
|
73
|
-
hasThemeStyles,
|
|
74
68
|
post,
|
|
75
69
|
preferredStyleVariations,
|
|
76
70
|
hiddenBlockTypes,
|
|
@@ -83,7 +77,6 @@ function Editor({
|
|
|
83
77
|
|
|
84
78
|
const {
|
|
85
79
|
isFeatureActive,
|
|
86
|
-
__experimentalGetPreviewDeviceType,
|
|
87
80
|
isEditingTemplate,
|
|
88
81
|
getEditedPostTemplate,
|
|
89
82
|
getHiddenBlockTypes
|
|
@@ -118,11 +111,10 @@ function Editor({
|
|
|
118
111
|
const isViewable = (_getPostType$viewable = getPostType(postType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
|
|
119
112
|
const canEditTemplate = canUser('create', 'templates');
|
|
120
113
|
return {
|
|
121
|
-
hasFixedToolbar: isFeatureActive('fixedToolbar')
|
|
114
|
+
hasFixedToolbar: isFeatureActive('fixedToolbar'),
|
|
122
115
|
focusMode: isFeatureActive('focusMode'),
|
|
123
116
|
isDistractionFree: isFeatureActive('distractionFree'),
|
|
124
117
|
hasInlineToolbar: isFeatureActive('inlineToolbar'),
|
|
125
|
-
hasThemeStyles: isFeatureActive('themeStyles'),
|
|
126
118
|
preferredStyleVariations: select(_preferences.store).get('core/edit-post', 'preferredStyleVariations'),
|
|
127
119
|
hiddenBlockTypes: getHiddenBlockTypes(),
|
|
128
120
|
blockTypes: getBlockTypes(),
|
|
@@ -166,33 +158,6 @@ function Editor({
|
|
|
166
158
|
|
|
167
159
|
return result;
|
|
168
160
|
}, [settings, hasFixedToolbar, hasInlineToolbar, focusMode, isDistractionFree, hiddenBlockTypes, blockTypes, preferredStyleVariations, setIsInserterOpened, updatePreferredStyleVariations, keepCaretInsideBlock]);
|
|
169
|
-
const styles = (0, _element.useMemo)(() => {
|
|
170
|
-
const themeStyles = [];
|
|
171
|
-
const presetStyles = [];
|
|
172
|
-
settings.styles?.forEach(style => {
|
|
173
|
-
if (!style.__unstableType || style.__unstableType === 'theme') {
|
|
174
|
-
themeStyles.push(style);
|
|
175
|
-
} else {
|
|
176
|
-
presetStyles.push(style);
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
const defaultEditorStyles = [...settings.defaultEditorStyles, ...presetStyles]; // If theme styles are not present or displayed, ensure that
|
|
180
|
-
// base layout styles are still present in the editor.
|
|
181
|
-
|
|
182
|
-
if (!settings.disableLayoutStyles && !(hasThemeStyles && themeStyles.length)) {
|
|
183
|
-
defaultEditorStyles.push({
|
|
184
|
-
css: getLayoutStyles({
|
|
185
|
-
style: {},
|
|
186
|
-
selector: 'body',
|
|
187
|
-
hasBlockGapSupport: false,
|
|
188
|
-
hasFallbackGapSupport: true,
|
|
189
|
-
fallbackGapValue: '0.5em'
|
|
190
|
-
})
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return hasThemeStyles && themeStyles.length ? settings.styles : defaultEditorStyles;
|
|
195
|
-
}, [settings, hasThemeStyles]);
|
|
196
161
|
|
|
197
162
|
if (!post) {
|
|
198
163
|
return null;
|
|
@@ -207,9 +172,7 @@ function Editor({
|
|
|
207
172
|
...props
|
|
208
173
|
}, (0, _element.createElement)(_editor.ErrorBoundary, null, (0, _element.createElement)(_commands.CommandMenu, null), (0, _element.createElement)(_editorInitialization.default, {
|
|
209
174
|
postId: postId
|
|
210
|
-
}), (0, _element.createElement)(_layout.default,
|
|
211
|
-
styles: styles
|
|
212
|
-
})), (0, _element.createElement)(_editor.PostLockedModal, null))));
|
|
175
|
+
}), (0, _element.createElement)(_layout.default, null)), (0, _element.createElement)(_editor.PostLockedModal, null))));
|
|
213
176
|
}
|
|
214
177
|
|
|
215
178
|
var _default = Editor;
|
package/build/editor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["ExperimentalEditorProvider","editorPrivateApis","getLayoutStyles","blockEditorPrivateApis","useCommands","coreCommandsPrivateApis","Editor","postId","postType","settings","initialEdits","props","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","hasThemeStyles","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","__experimentalGetPreviewDeviceType","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","editPostStore","getEntityRecord","getPostType","getEntityRecords","canUser","coreStore","getEditorSettings","editorStore","getBlockTypes","blocksStore","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","preferencesStore","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","styles","themeStyles","presetStyles","forEach","style","__unstableType","push","defaultEditorStyles","disableLayoutStyles","css","selector","hasBlockGapSupport","hasFallb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ACC,4BAAC,0BAAD;AACC,IAAA,QAAQ,EAAGoC,cADZ;AAEC,IAAA,IAAI,EAAGpC,IAFR;AAGC,IAAA,YAAY,EAAGP,YAHhB;AAIC,IAAA,cAAc,EAAG,KAJlB;AAKC,IAAA,kBAAkB,EAAGY,cAAc,GAAGC,QAAH,GAAcyD,SALlD;AAAA,OAMMrE;AANN,KAQC,4BAAC,qBAAD,QACC,4BAAC,qBAAD,OADD,EAEC,4BAAC,6BAAD;AAAsB,IAAA,MAAM,EAAGJ;AAA/B,IAFD,EAGC,4BAAC,eAAD;AAAQ,IAAA,MAAM,EAAG2D;AAAjB,IAHD,CARD,EAaC,4BAAC,uBAAD,OAbD,CADD,CADD,CADD;AAqBA;;eAEc5D,M","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport useCommonCommands from './hooks/commands/use-common-commands';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { getLayoutStyles } = unlock( blockEditorPrivateApis );\nconst { useCommands } = unlock( coreCommandsPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tuseCommands();\n\tuseCommonCommands();\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\thasThemeStyles,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\thasThemeStyles: isFeatureActive( 'themeStyles' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tconst styles = useMemo( () => {\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\tsettings.styles?.forEach( ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\n\t\tconst defaultEditorStyles = [\n\t\t\t...settings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\n\t\t// If theme styles are not present or displayed, ensure that\n\t\t// base layout styles are still present in the editor.\n\t\tif (\n\t\t\t! settings.disableLayoutStyles &&\n\t\t\t! ( hasThemeStyles && themeStyles.length )\n\t\t) {\n\t\t\tdefaultEditorStyles.push( {\n\t\t\t\tcss: getLayoutStyles( {\n\t\t\t\t\tstyle: {},\n\t\t\t\t\tselector: 'body',\n\t\t\t\t\thasBlockGapSupport: false,\n\t\t\t\t\thasFallbackGapSupport: true,\n\t\t\t\t\tfallbackGapValue: '0.5em',\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\n\n\t\treturn hasThemeStyles && themeStyles.length\n\t\t\t? settings.styles\n\t\t\t: defaultEditorStyles;\n\t}, [ settings, hasThemeStyles ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tpost={ post }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t__unstableTemplate={ isTemplateMode ? template : undefined }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t<Layout styles={ styles } />\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t<PostLockedModal />\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n\nexport default Editor;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["ExperimentalEditorProvider","editorPrivateApis","useCommands","coreCommandsPrivateApis","Editor","postId","postType","settings","initialEdits","props","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","editPostStore","getEntityRecord","getPostType","getEntityRecords","canUser","coreStore","getEditorSettings","editorStore","getBlockTypes","blocksStore","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","preferencesStore","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","undefined"],"mappings":";;;;;;;;;AAWA;;AARA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AA1BA;AACA;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AAc,EAAG,KAJlB;AAKC,IAAA,kBAAkB,EAAGW,cAAc,GAAGC,QAAH,GAAc0C,SALlD;AAAA,OAMMrD;AANN,KAQC,4BAAC,qBAAD,QACC,4BAAC,qBAAD,OADD,EAEC,4BAAC,6BAAD;AAAsB,IAAA,MAAM,EAAGJ;AAA/B,IAFD,EAGC,4BAAC,eAAD,OAHD,CARD,EAaC,4BAAC,uBAAD,OAbD,CADD,CADD,CADD;AAqBA;;eAEcD,M","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport useCommonCommands from './hooks/commands/use-common-commands';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { useCommands } = unlock( coreCommandsPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tuseCommands();\n\tuseCommonCommands();\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar: isFeatureActive( 'fixedToolbar' ),\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tpost={ post }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t__unstableTemplate={ isTemplateMode ? template : undefined }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t<Layout />\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t<PostLockedModal />\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n\nexport default Editor;\n"]}
|
package/build/plugins/index.js
CHANGED
|
@@ -60,7 +60,7 @@ function ManagePatternsMenuItem() {
|
|
|
60
60
|
return (0, _element.createElement)(_components.MenuItem, {
|
|
61
61
|
role: "menuitem",
|
|
62
62
|
href: url
|
|
63
|
-
}, (0, _i18n.__)('Manage
|
|
63
|
+
}, (0, _i18n.__)('Manage patterns'));
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
(0, _plugins.registerPlugin)('edit-post', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["ManagePatternsMenuItem","url","select","canUser","coreStore","getEditorSettings","editorStore","isBlockTheme","__unstableIsBlockBasedTheme","defaultUrl","post_type","patternsUrl","path","render","onClose","external"],"mappings":";;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAUA;AACA;AACA;AAMA,SAASA,sBA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I,sBAAJ,CAHF,CAVD,CAPD,CAFF,CADD,CADD;AAiCA;;AAnC2B,CAA7B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\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\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\tconst isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tpath: '/patterns',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'read', 'templates' ) && isBlockTheme\n\t\t\t? patternsUrl\n\t\t\t: defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["ManagePatternsMenuItem","url","select","canUser","coreStore","getEditorSettings","editorStore","isBlockTheme","__unstableIsBlockBasedTheme","defaultUrl","post_type","patternsUrl","path","render","onClose","external"],"mappings":";;;;;;AAGA;;AACA;;AAC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AAG,EAAC;AAPL,OASG,cAAI,MAAJ,CATH,EAUC,4BAAC,0BAAD;AAAgB,MAAA,EAAE,EAAC;AAAnB;AAEE;AACA,kBAAI,sBAAJ,CAHF,CAVD,CAPD,CAFF,CADD,CADD;AAiCA;;AAnC2B,CAA7B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\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\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\tconst isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tpath: '/patterns',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'read', 'templates' ) && isBlockTheme\n\t\t\t? patternsUrl\n\t\t\t: defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage patterns' ) }\n\t\t</MenuItem>\n\t);\n}\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<ManagePatternsMenuItem />\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/documentation/article/wordpress-block-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"]}
|
|
@@ -10,7 +10,7 @@ import classnames from 'classnames';
|
|
|
10
10
|
|
|
11
11
|
import { AutosaveMonitor, LocalAutosaveMonitor, UnsavedChangesWarning, EditorNotices, EditorKeyboardShortcutsRegister, EditorSnackbars, PostSyncStatusModal, store as editorStore } from '@wordpress/editor';
|
|
12
12
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
|
-
import { BlockBreadcrumb } from '@wordpress/block-editor';
|
|
13
|
+
import { BlockBreadcrumb, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
14
14
|
import { Button, ScrollLock, Popover } from '@wordpress/components';
|
|
15
15
|
import { useViewportMatch } from '@wordpress/compose';
|
|
16
16
|
import { PluginArea } from '@wordpress/plugins';
|
|
@@ -38,6 +38,10 @@ import WelcomeGuide from '../welcome-guide';
|
|
|
38
38
|
import ActionsPanel from './actions-panel';
|
|
39
39
|
import StartPageOptions from '../start-page-options';
|
|
40
40
|
import { store as editPostStore } from '../../store';
|
|
41
|
+
import { unlock } from '../../lock-unlock';
|
|
42
|
+
const {
|
|
43
|
+
getLayoutStyles
|
|
44
|
+
} = unlock(blockEditorPrivateApis);
|
|
41
45
|
const interfaceLabels = {
|
|
42
46
|
/* translators: accessibility text for the editor top bar landmark region. */
|
|
43
47
|
header: __('Editor top bar'),
|
|
@@ -55,9 +59,7 @@ const interfaceLabels = {
|
|
|
55
59
|
footer: __('Editor footer')
|
|
56
60
|
};
|
|
57
61
|
|
|
58
|
-
function Layout({
|
|
59
|
-
styles
|
|
60
|
-
}) {
|
|
62
|
+
function Layout() {
|
|
61
63
|
const isMobileViewport = useViewportMatch('medium', '<');
|
|
62
64
|
const isHugeViewport = useViewportMatch('huge', '>=');
|
|
63
65
|
const isLargeViewport = useViewportMatch('large');
|
|
@@ -85,14 +87,43 @@ function Layout({
|
|
|
85
87
|
isDistractionFree,
|
|
86
88
|
showBlockBreadcrumbs,
|
|
87
89
|
isTemplateMode,
|
|
88
|
-
documentLabel
|
|
90
|
+
documentLabel,
|
|
91
|
+
styles
|
|
89
92
|
} = useSelect(select => {
|
|
90
93
|
const {
|
|
91
94
|
getEditorSettings,
|
|
92
95
|
getPostTypeLabel
|
|
93
96
|
} = select(editorStore);
|
|
97
|
+
const {
|
|
98
|
+
isFeatureActive
|
|
99
|
+
} = select(editPostStore);
|
|
94
100
|
const editorSettings = getEditorSettings();
|
|
95
101
|
const postTypeLabel = getPostTypeLabel();
|
|
102
|
+
const hasThemeStyles = isFeatureActive('themeStyles');
|
|
103
|
+
const themeStyles = [];
|
|
104
|
+
const presetStyles = [];
|
|
105
|
+
editorSettings.styles?.forEach(style => {
|
|
106
|
+
if (!style.__unstableType || style.__unstableType === 'theme') {
|
|
107
|
+
themeStyles.push(style);
|
|
108
|
+
} else {
|
|
109
|
+
presetStyles.push(style);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const defaultEditorStyles = [...editorSettings.defaultEditorStyles, ...presetStyles]; // If theme styles are not present or displayed, ensure that
|
|
113
|
+
// base layout styles are still present in the editor.
|
|
114
|
+
|
|
115
|
+
if (!editorSettings.disableLayoutStyles && !(hasThemeStyles && themeStyles.length)) {
|
|
116
|
+
defaultEditorStyles.push({
|
|
117
|
+
css: getLayoutStyles({
|
|
118
|
+
style: {},
|
|
119
|
+
selector: 'body',
|
|
120
|
+
hasBlockGapSupport: false,
|
|
121
|
+
hasFallbackGapSupport: true,
|
|
122
|
+
fallbackGapValue: '0.5em'
|
|
123
|
+
})
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
96
127
|
return {
|
|
97
128
|
isTemplateMode: select(editPostStore).isEditingTemplate(),
|
|
98
129
|
hasFixedToolbar: select(editPostStore).isFeatureActive('fixedToolbar'),
|
|
@@ -109,7 +140,8 @@ function Layout({
|
|
|
109
140
|
isDistractionFree: select(editPostStore).isFeatureActive('distractionFree'),
|
|
110
141
|
showBlockBreadcrumbs: select(editPostStore).isFeatureActive('showBlockBreadcrumbs'),
|
|
111
142
|
// translators: Default label for the Document in the Block Breadcrumb.
|
|
112
|
-
documentLabel: postTypeLabel || _x('Document', 'noun')
|
|
143
|
+
documentLabel: postTypeLabel || _x('Document', 'noun'),
|
|
144
|
+
styles: hasThemeStyles && themeStyles.length ? editorSettings.styles : defaultEditorStyles
|
|
113
145
|
};
|
|
114
146
|
}, []);
|
|
115
147
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/layout/index.js"],"names":["classnames","AutosaveMonitor","LocalAutosaveMonitor","UnsavedChangesWarning","EditorNotices","EditorKeyboardShortcutsRegister","EditorSnackbars","PostSyncStatusModal","store","editorStore","useSelect","useDispatch","BlockBreadcrumb","Button","ScrollLock","Popover","useViewportMatch","PluginArea","__","_x","sprintf","ComplementaryArea","FullscreenMode","InterfaceSkeleton","interfaceStore","useState","useEffect","useCallback","keyboardShortcutsStore","noticesStore","TextEditor","VisualEditor","EditPostKeyboardShortcuts","KeyboardShortcutHelpModal","EditPostPreferencesModal","BrowserURL","Header","InserterSidebar","ListViewSidebar","SettingsSidebar","MetaBoxes","WelcomeGuide","ActionsPanel","StartPageOptions","editPostStore","interfaceLabels","header","body","sidebar","actions","footer","Layout","styles","isMobileViewport","isHugeViewport","isLargeViewport","openGeneralSidebar","closeGeneralSidebar","setIsInserterOpened","createErrorNotice","mode","isFullscreenActive","isRichEditingEnabled","sidebarIsOpened","hasActiveMetaboxes","hasFixedToolbar","previousShortcut","nextShortcut","hasBlockSelected","isInserterOpened","isListViewOpened","showIconLabels","isDistractionFree","showBlockBreadcrumbs","isTemplateMode","documentLabel","select","getEditorSettings","getPostTypeLabel","editorSettings","postTypeLabel","isEditingTemplate","isFeatureActive","getActiveComplementaryArea","name","isPublishSidebarOpened","getEditorMode","richEditingEnabled","hasMetaBoxes","getAllShortcutKeyCombinations","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","className","secondarySidebarLabel","secondarySidebar","onPluginAreaError","previous","next"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,oBAFD,EAGCC,qBAHD,EAICC,aAJD,EAKCC,+BALD,EAMCC,eAND,EAOCC,mBAPD,EAQCC,KAAK,IAAIC,WARV,QASO,mBATP;AAUA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,eAAT,QAA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BAAD,OA9FD,EA+FC,cAAC,yBAAD,OA/FD,EAgGC,cAAC,YAAD,OAhGD,EAiGC,cAAC,mBAAD,OAjGD,EAkGC,cAAC,gBAAD,OAlGD,EAmGC,cAAC,OAAD,CAAS,IAAT,OAnGD,EAoGC,cAAC,UAAD;AAAY,IAAA,OAAO,EAAG+B;AAAtB,IApGD,CADD;AAwGA;;AAED,eAAe/C,MAAf","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\tPostSyncStatusModal,\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\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 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 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 && isLargeViewport,\n\t\t'is-entity-save-view-open': !! 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 && isLargeViewport }\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{ ! isDistractionFree && ! 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\t! isMobileViewport &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\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<PostSyncStatusModal />\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":["classnames","AutosaveMonitor","LocalAutosaveMonitor","UnsavedChangesWarning","EditorNotices","EditorKeyboardShortcutsRegister","EditorSnackbars","PostSyncStatusModal","store","editorStore","useSelect","useDispatch","BlockBreadcrumb","privateApis","blockEditorPrivateApis","Button","ScrollLock","Popover","useViewportMatch","PluginArea","__","_x","sprintf","ComplementaryArea","FullscreenMode","InterfaceSkeleton","interfaceStore","useState","useEffect","useCallback","keyboardShortcutsStore","noticesStore","TextEditor","VisualEditor","EditPostKeyboardShortcuts","KeyboardShortcutHelpModal","EditPostPreferencesModal","BrowserURL","Header","InserterSidebar","ListViewSidebar","SettingsSidebar","MetaBoxes","WelcomeGuide","ActionsPanel","StartPageOptions","editPostStore","unlock","getLayoutStyles","interfaceLabels","header","body","sidebar","actions","footer","Layout","isMobileViewport","isHugeViewport","isLargeViewport","openGeneralSidebar","closeGeneralSidebar","setIsInserterOpened","createErrorNotice","mode","isFullscreenActive","isRichEditingEnabled","sidebarIsOpened","hasActiveMetaboxes","hasFixedToolbar","previousShortcut","nextShortcut","hasBlockSelected","isInserterOpened","isListViewOpened","showIconLabels","isDistractionFree","showBlockBreadcrumbs","isTemplateMode","documentLabel","styles","select","getEditorSettings","getPostTypeLabel","isFeatureActive","editorSettings","postTypeLabel","hasThemeStyles","themeStyles","presetStyles","forEach","style","__unstableType","push","defaultEditorStyles","disableLayoutStyles","length","css","selector","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","isEditingTemplate","getActiveComplementaryArea","name","isPublishSidebarOpened","getEditorMode","richEditingEnabled","hasMetaBoxes","getAllShortcutKeyCombinations","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","className","secondarySidebarLabel","secondarySidebar","onPluginAreaError","previous","next"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,oBAFD,EAGCC,qBAHD,EAICC,aAJD,EAKCC,+BALD,EAMCC,eAND,EAOCC,mBAPD,EAQCC,KAAK,IAAIC,WARV,QASO,mBATP;AAUA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,eADD,EAECC,WAAW,IAAIC,sBAFhB,QAGO,yBAHP;AAIA,SAASC,MAAT,EAAiBC,UAAjB,EAA6BC,OAA7B,QAA4C,uBAA5C;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SACCC,iBADD,EAECC,cAFD,EAGCC,iBAHD,EAICjB,KAAK,IAAIkB,cAJV,QAKO,sBALP;AAMA,SAASC,QAAT,EAAmBC,SAAnB,EAA8BC,WAA9B,QAAiD,oBAAjD;AACA,SAASrB,KAAK,IAAIsB,sBAAlB,QAAgD,+BAAhD;AACA,SAAStB,KAAK,IAAIuB,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,yBAAP,MAAsC,uBAAtC;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AACA,OAAOC,wBAAP,MAAqC,sBAArC;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,eAAP,MAA4B,wCAA5B;AACA,OAAOC,eAAP,MAA4B,6BAA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AAf,OACC,cAAC,eAAD;AAAiB,MAAA,aAAa,EAAGe;AAAjC,MADD,CAhEH;AAqEC,IAAA,OAAO,EACN,cAAC,YAAD;AACC,MAAA,wBAAwB,EAAGkC,wBAD5B;AAEC,MAAA,yBAAyB,EACxBF,2BAHF;AAKC,MAAA,8BAA8B,EAC7BC;AANF,MAtEF;AAgFC,IAAA,SAAS,EAAG;AACXO,MAAAA,QAAQ,EAAEjD,gBADC;AAEXkD,MAAAA,IAAI,EAAEjD;AAFK;AAhFb,IATD,EA8FC,cAAC,wBAAD,OA9FD,EA+FC,cAAC,yBAAD,OA/FD,EAgGC,cAAC,YAAD,OAhGD,EAiGC,cAAC,mBAAD,OAjGD,EAkGC,cAAC,gBAAD,OAlGD,EAmGC,cAAC,OAAD,CAAS,IAAT,OAnGD,EAoGC,cAAC,UAAD;AAAY,IAAA,OAAO,EAAG+C;AAAtB,IApGD,CADD;AAwGA;;AAED,eAAe9D,MAAf","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\tPostSyncStatusModal,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockBreadcrumb,\n\tprivateApis as blockEditorPrivateApis,\n} 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';\nimport { unlock } from '../../lock-unlock';\n\nconst { getLayoutStyles } = unlock( blockEditorPrivateApis );\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() {\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\tstyles,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getPostTypeLabel } = select( editorStore );\n\t\tconst { isFeatureActive } = select( editPostStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst postTypeLabel = getPostTypeLabel();\n\t\tconst hasThemeStyles = isFeatureActive( 'themeStyles' );\n\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\teditorSettings.styles?.forEach( ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\n\t\tconst defaultEditorStyles = [\n\t\t\t...editorSettings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\n\t\t// If theme styles are not present or displayed, ensure that\n\t\t// base layout styles are still present in the editor.\n\t\tif (\n\t\t\t! editorSettings.disableLayoutStyles &&\n\t\t\t! ( hasThemeStyles && themeStyles.length )\n\t\t) {\n\t\t\tdefaultEditorStyles.push( {\n\t\t\t\tcss: getLayoutStyles( {\n\t\t\t\t\tstyle: {},\n\t\t\t\t\tselector: 'body',\n\t\t\t\t\thasBlockGapSupport: false,\n\t\t\t\t\thasFallbackGapSupport: true,\n\t\t\t\t\tfallbackGapValue: '0.5em',\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\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\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\tstyles:\n\t\t\t\thasThemeStyles && themeStyles.length\n\t\t\t\t\t? editorSettings.styles\n\t\t\t\t\t: defaultEditorStyles,\n\t\t};\n\t}, [] );\n\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 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 && isLargeViewport,\n\t\t'is-entity-save-view-open': !! 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 && isLargeViewport }\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{ ! isDistractionFree && ! 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\t! isMobileViewport &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\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<PostSyncStatusModal />\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"]}
|
package/build-module/editor.js
CHANGED
|
@@ -6,7 +6,6 @@ import { createElement } from "@wordpress/element";
|
|
|
6
6
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
7
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
8
|
import { ErrorBoundary, PostLockedModal, store as editorStore, privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
9
|
-
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
10
9
|
import { useMemo } from '@wordpress/element';
|
|
11
10
|
import { SlotFillProvider } from '@wordpress/components';
|
|
12
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -26,9 +25,6 @@ import useCommonCommands from './hooks/commands/use-common-commands';
|
|
|
26
25
|
const {
|
|
27
26
|
ExperimentalEditorProvider
|
|
28
27
|
} = unlock(editorPrivateApis);
|
|
29
|
-
const {
|
|
30
|
-
getLayoutStyles
|
|
31
|
-
} = unlock(blockEditorPrivateApis);
|
|
32
28
|
const {
|
|
33
29
|
useCommands
|
|
34
30
|
} = unlock(coreCommandsPrivateApis);
|
|
@@ -47,7 +43,6 @@ function Editor({
|
|
|
47
43
|
focusMode,
|
|
48
44
|
isDistractionFree,
|
|
49
45
|
hasInlineToolbar,
|
|
50
|
-
hasThemeStyles,
|
|
51
46
|
post,
|
|
52
47
|
preferredStyleVariations,
|
|
53
48
|
hiddenBlockTypes,
|
|
@@ -60,7 +55,6 @@ function Editor({
|
|
|
60
55
|
|
|
61
56
|
const {
|
|
62
57
|
isFeatureActive,
|
|
63
|
-
__experimentalGetPreviewDeviceType,
|
|
64
58
|
isEditingTemplate,
|
|
65
59
|
getEditedPostTemplate,
|
|
66
60
|
getHiddenBlockTypes
|
|
@@ -95,11 +89,10 @@ function Editor({
|
|
|
95
89
|
const isViewable = (_getPostType$viewable = getPostType(postType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
|
|
96
90
|
const canEditTemplate = canUser('create', 'templates');
|
|
97
91
|
return {
|
|
98
|
-
hasFixedToolbar: isFeatureActive('fixedToolbar')
|
|
92
|
+
hasFixedToolbar: isFeatureActive('fixedToolbar'),
|
|
99
93
|
focusMode: isFeatureActive('focusMode'),
|
|
100
94
|
isDistractionFree: isFeatureActive('distractionFree'),
|
|
101
95
|
hasInlineToolbar: isFeatureActive('inlineToolbar'),
|
|
102
|
-
hasThemeStyles: isFeatureActive('themeStyles'),
|
|
103
96
|
preferredStyleVariations: select(preferencesStore).get('core/edit-post', 'preferredStyleVariations'),
|
|
104
97
|
hiddenBlockTypes: getHiddenBlockTypes(),
|
|
105
98
|
blockTypes: getBlockTypes(),
|
|
@@ -143,33 +136,6 @@ function Editor({
|
|
|
143
136
|
|
|
144
137
|
return result;
|
|
145
138
|
}, [settings, hasFixedToolbar, hasInlineToolbar, focusMode, isDistractionFree, hiddenBlockTypes, blockTypes, preferredStyleVariations, setIsInserterOpened, updatePreferredStyleVariations, keepCaretInsideBlock]);
|
|
146
|
-
const styles = useMemo(() => {
|
|
147
|
-
const themeStyles = [];
|
|
148
|
-
const presetStyles = [];
|
|
149
|
-
settings.styles?.forEach(style => {
|
|
150
|
-
if (!style.__unstableType || style.__unstableType === 'theme') {
|
|
151
|
-
themeStyles.push(style);
|
|
152
|
-
} else {
|
|
153
|
-
presetStyles.push(style);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
const defaultEditorStyles = [...settings.defaultEditorStyles, ...presetStyles]; // If theme styles are not present or displayed, ensure that
|
|
157
|
-
// base layout styles are still present in the editor.
|
|
158
|
-
|
|
159
|
-
if (!settings.disableLayoutStyles && !(hasThemeStyles && themeStyles.length)) {
|
|
160
|
-
defaultEditorStyles.push({
|
|
161
|
-
css: getLayoutStyles({
|
|
162
|
-
style: {},
|
|
163
|
-
selector: 'body',
|
|
164
|
-
hasBlockGapSupport: false,
|
|
165
|
-
hasFallbackGapSupport: true,
|
|
166
|
-
fallbackGapValue: '0.5em'
|
|
167
|
-
})
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return hasThemeStyles && themeStyles.length ? settings.styles : defaultEditorStyles;
|
|
172
|
-
}, [settings, hasThemeStyles]);
|
|
173
139
|
|
|
174
140
|
if (!post) {
|
|
175
141
|
return null;
|
|
@@ -184,9 +150,7 @@ function Editor({
|
|
|
184
150
|
...props
|
|
185
151
|
}, createElement(ErrorBoundary, null, createElement(CommandMenu, null), createElement(EditorInitialization, {
|
|
186
152
|
postId: postId
|
|
187
|
-
}), createElement(Layout,
|
|
188
|
-
styles: styles
|
|
189
|
-
})), createElement(PostLockedModal, null))));
|
|
153
|
+
}), createElement(Layout, null)), createElement(PostLockedModal, null))));
|
|
190
154
|
}
|
|
191
155
|
|
|
192
156
|
export default Editor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["store","blocksStore","useSelect","useDispatch","ErrorBoundary","PostLockedModal","editorStore","privateApis","editorPrivateApis","blockEditorPrivateApis","useMemo","SlotFillProvider","coreStore","ShortcutProvider","preferencesStore","CommandMenu","coreCommandsPrivateApis","Layout","EditorInitialization","editPostStore","unlock","useCommonCommands","ExperimentalEditorProvider","getLayoutStyles","useCommands","Editor","postId","postType","settings","initialEdits","props","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","hasThemeStyles","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","__experimentalGetPreviewDeviceType","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","getEntityRecord","getPostType","getEntityRecords","canUser","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","styles","themeStyles","presetStyles","forEach","style","__unstableType","push","defaultEditorStyles","disableLayoutStyles","css","selector","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,aADD,EAECC,eAFD,EAGCL,KAAK,IAAIM,WAHV,EAICC,WAAW,IAAIC,iBAJhB,QAKO,mBALP;AAMA,SAASD,WAAW,IAAIE,sBAAxB,QAAsD,yBAAtD;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,gBAAT,QAAiC,uBAAjC;AACA,SAASX,KAAK,IAAIY,SAAlB,QAAmC,sBAAnC;AACA,SAASC,gBAAT,QAAiC,+BAAjC;AACA,SAASb,KAAK,IAAIc,gBAAlB,QAA0C,wBAA1C;AACA,SAASC,WAAT,QAA4B,qBAA5B;AACA,SAASR,WAAW,IAAIS,uBAAxB,QAAuD,0BAAvD;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASlB,KAAK,IAAImB,aAAlB,QAAuC,SAAvC;AACA,SAASC,MAAT,QAAuB,eAAvB;AACA,OAAOC,iBAAP,MAA8B,sCAA9B;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAiCF,MAAM,CAAEZ,iBAAF,CAA7C;AACA,MAAM;AAAEe,EAAAA;AAAF,IAAsBH,MAAM,CAAEX,sBAAF,CAAlC;AACA,MAAM;AAAEe,EAAAA;AAAF,IAAkBJ,MAAM,CAAEJ,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AAD;AAAsB,IAAA,MAAM,EAAGJ;AAA/B,IAFD,EAGC,cAAC,MAAD;AAAQ,IAAA,MAAM,EAAGsD;AAAjB,IAHD,CARD,EAaC,cAAC,eAAD,OAbD,CADD,CADD,CADD;AAqBA;;AAED,eAAevD,MAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport useCommonCommands from './hooks/commands/use-common-commands';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { getLayoutStyles } = unlock( blockEditorPrivateApis );\nconst { useCommands } = unlock( coreCommandsPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tuseCommands();\n\tuseCommonCommands();\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\thasThemeStyles,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\thasThemeStyles: isFeatureActive( 'themeStyles' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tconst styles = useMemo( () => {\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\tsettings.styles?.forEach( ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\n\t\tconst defaultEditorStyles = [\n\t\t\t...settings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\n\t\t// If theme styles are not present or displayed, ensure that\n\t\t// base layout styles are still present in the editor.\n\t\tif (\n\t\t\t! settings.disableLayoutStyles &&\n\t\t\t! ( hasThemeStyles && themeStyles.length )\n\t\t) {\n\t\t\tdefaultEditorStyles.push( {\n\t\t\t\tcss: getLayoutStyles( {\n\t\t\t\t\tstyle: {},\n\t\t\t\t\tselector: 'body',\n\t\t\t\t\thasBlockGapSupport: false,\n\t\t\t\t\thasFallbackGapSupport: true,\n\t\t\t\t\tfallbackGapValue: '0.5em',\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\n\n\t\treturn hasThemeStyles && themeStyles.length\n\t\t\t? settings.styles\n\t\t\t: defaultEditorStyles;\n\t}, [ settings, hasThemeStyles ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tpost={ post }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t__unstableTemplate={ isTemplateMode ? template : undefined }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t<Layout styles={ styles } />\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t<PostLockedModal />\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n\nexport default Editor;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["store","blocksStore","useSelect","useDispatch","ErrorBoundary","PostLockedModal","editorStore","privateApis","editorPrivateApis","useMemo","SlotFillProvider","coreStore","ShortcutProvider","preferencesStore","CommandMenu","coreCommandsPrivateApis","Layout","EditorInitialization","editPostStore","unlock","useCommonCommands","ExperimentalEditorProvider","useCommands","Editor","postId","postType","settings","initialEdits","props","hasFixedToolbar","focusMode","isDistractionFree","hasInlineToolbar","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","getEntityRecord","getPostType","getEntityRecords","canUser","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,aADD,EAECC,eAFD,EAGCL,KAAK,IAAIM,WAHV,EAICC,WAAW,IAAIC,iBAJhB,QAKO,mBALP;AAMA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,gBAAT,QAAiC,uBAAjC;AACA,SAASV,KAAK,IAAI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ED,WAAOX,MAAP;AACA,GApC6B,EAoC3B,CACFtC,QADE,EAEFG,eAFE,EAGFG,gBAHE,EAIFF,SAJE,EAKFC,iBALE,EAMFI,gBANE,EAOFC,UAPE,EAQFF,wBARE,EASF4B,mBATE,EAUFD,8BAVE,EAWFxB,oBAXE,CApC2B,CAA9B;;AAkDA,MAAK,CAAEJ,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,cAAC,gBAAD,QACC,cAAC,gBAAD,QACC,cAAC,0BAAD;AACC,IAAA,QAAQ,EAAG8B,cADZ;AAEC,IAAA,IAAI,EAAG9B,IAFR;AAGC,IAAA,YAAY,EAAGN,YAHhB;AAIC,IAAA,cAAc,EAAG,KAJlB;AAKC,IAAA,kBAAkB,EAAGW,cAAc,GAAGC,QAAH,GAAcqC,SALlD;AAAA,OAMMhD;AANN,KAQC,cAAC,aAAD,QACC,cAAC,WAAD,OADD,EAEC,cAAC,oBAAD;AAAsB,IAAA,MAAM,EAAGJ;AAA/B,IAFD,EAGC,cAAC,MAAD,OAHD,CARD,EAaC,cAAC,eAAD,OAbD,CADD,CADD,CADD;AAqBA;;AAED,eAAeD,MAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport useCommonCommands from './hooks/commands/use-common-commands';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { useCommands } = unlock( coreCommandsPrivateApis );\n\nfunction Editor( { postId, postType, settings, initialEdits, ...props } ) {\n\tuseCommands();\n\tuseCommonCommands();\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thasInlineToolbar,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar: isFeatureActive( 'fixedToolbar' ),\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\tisDistractionFree: isFeatureActive( 'distractionFree' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tisDistractionFree,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\thasInlineToolbar,\n\t\tfocusMode,\n\t\tisDistractionFree,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<ExperimentalEditorProvider\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tpost={ post }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t__unstableTemplate={ isTemplateMode ? template : undefined }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t<Layout />\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t<PostLockedModal />\n\t\t\t\t</ExperimentalEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n\nexport default Editor;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["MenuItem","VisuallyHidden","store","coreStore","editorStore","useSelect","external","__","registerPlugin","addQueryArgs","CopyContentMenuItem","KeyboardShortcutsHelpMenuItem","ToolsMoreMenuGroup","WelcomeGuideMenuItem","ManagePatternsMenuItem","url","select","canUser","getEditorSettings","isBlockTheme","__unstableIsBlockBasedTheme","defaultUrl","post_type","patternsUrl","path","render","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,cAAnB,QAAyC,uBAAzC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,QAA0B,iBAA1B;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;;AAEA,SAASC,sBAAT,GAAkC;AACjC,QAAMC,GAAG,GAAGV,SAAS,CAAIW,MAAF,IAAc;AACpC,UAAM;AAAEC,MAAAA;AAAF,QAAcD,MAAM,CAAEb,SAAF,CAA1B;AACA,UAAM;AAAEe,MAAAA;AAAF,QAAwBF,MAAM,CAAEZ,WAAF,CAApC;;AAEA,UAAMe,YAAY,GAAGD,iBAAiB,GAAGE,2BAAzC;;AACA,UAAMC,UAAU,GAAGZ,YAAY,CAAE,UAAF,EAAc;AAC5Ca,MAAAA,SAAS,EAAE;AADiC,KAAd,CAA/B;AAGA,UAAMC,WAAW,GAAGd,YAAY,CAAE,iBAAF,EAAqB;AACpDe,MAAAA,IAAI,EAAE;AAD8C,KAArB,CAAhC,CARoC,CAYpC;AACA;AACA;;AACA,WAAOP,OAAO,CAAE,MAAF,EAAU,WAAV,CAAP,IAAkCE,YAAlC,GACJI,WADI,GAEJF,UAFH;AAGA,GAlBoB,EAkBlB,EAlBkB,CAArB;AAoBA,SACC,cAAC,QAAD;AAAU,IAAA,IAAI,EAAC,UAAf;AAA0B,IAAA,IAAI,EAAGN;AAAjC,KACGR,EAAE,CAAE,iBAAF,CADL,CADD;AAKA;;AAEDC,cAAc,CAAE,WAAF,EAAe;AAC5BiB,EAAAA,MAAM,GAAG;AACR,WACC,8BACC,cAAC,kBAAD,QACG,CAAE;AAAEC,MAAAA;AAAF,KAAF,KACD,8BACC,cAAC,sBAAD,OADD,EAEC,cAAC,6BAAD;AACC,MAAA,QAAQ,EAAGA;AADZ,MAFD,EAKC,cAAC,oBAAD,OALD,EAMC,cAAC,mBAAD,OAND,EAOC,cAAC,QAAD;AACC,MAAA,IAAI,EAAC,UADN;AAEC,MAAA,IAAI,EAAGpB,QAFR;AAGC,MAAA,IAAI,EAAGC,EAAE,CACR,qEADQ,CAHV;AAMC,MAAA,MAAM,EAAC,QANR;AAOC,MAAA,GAAG,EAAC;AAPL,OASGA,EAAE,CAAE,MAAF,CATL,EAUC,cAAC,cAAD;AAAgB,MAAA,EAAE,EAAC;AAAnB;AAEE;AACAA,IAAAA,EAAE,CAAE,sBAAF,CAHJ,CAVD,CAPD,CAFF,CADD,CADD;AAiCA;;AAnC2B,CAAf,CAAd","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\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\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\tconst isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tpath: '/patterns',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'read', 'templates' ) && isBlockTheme\n\t\t\t? patternsUrl\n\t\t\t: defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["MenuItem","VisuallyHidden","store","coreStore","editorStore","useSelect","external","__","registerPlugin","addQueryArgs","CopyContentMenuItem","KeyboardShortcutsHelpMenuItem","ToolsMoreMenuGroup","WelcomeGuideMenuItem","ManagePatternsMenuItem","url","select","canUser","getEditorSettings","isBlockTheme","__unstableIsBlockBasedTheme","defaultUrl","post_type","patternsUrl","path","render","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,cAAnB,QAAyC,uBAAzC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,QAA0B,iBAA1B;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,M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EAUC,cAAC,cAAD;AAAgB,MAAA,EAAE,EAAC;AAAnB;AAEE;AACAA,IAAAA,EAAE,CAAE,sBAAF,CAHJ,CAVD,CAPD,CAFF,CADD,CADD;AAiCA;;AAnC2B,CAAf,CAAd","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\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\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\tconst isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tpath: '/patterns',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'read', 'templates' ) && isBlockTheme\n\t\t\t? patternsUrl\n\t\t\t: defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage patterns' ) }\n\t\t</MenuItem>\n\t);\n}\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<ManagePatternsMenuItem />\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/documentation/article/wordpress-block-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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "7.12.
|
|
3
|
+
"version": "7.12.11",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -29,34 +29,34 @@
|
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
30
|
"@wordpress/a11y": "^3.35.1",
|
|
31
31
|
"@wordpress/api-fetch": "^6.32.1",
|
|
32
|
-
"@wordpress/block-editor": "^12.3.
|
|
33
|
-
"@wordpress/block-library": "^8.12.
|
|
34
|
-
"@wordpress/blocks": "^12.12.
|
|
35
|
-
"@wordpress/commands": "^0.6.
|
|
36
|
-
"@wordpress/components": "^25.1.
|
|
32
|
+
"@wordpress/block-editor": "^12.3.9",
|
|
33
|
+
"@wordpress/block-library": "^8.12.11",
|
|
34
|
+
"@wordpress/blocks": "^12.12.5",
|
|
35
|
+
"@wordpress/commands": "^0.6.8",
|
|
36
|
+
"@wordpress/components": "^25.1.8",
|
|
37
37
|
"@wordpress/compose": "^6.12.1",
|
|
38
|
-
"@wordpress/core-commands": "^0.4.
|
|
39
|
-
"@wordpress/core-data": "^6.12.
|
|
40
|
-
"@wordpress/data": "^9.5.
|
|
38
|
+
"@wordpress/core-commands": "^0.4.9",
|
|
39
|
+
"@wordpress/core-data": "^6.12.9",
|
|
40
|
+
"@wordpress/data": "^9.5.4",
|
|
41
41
|
"@wordpress/deprecated": "^3.35.1",
|
|
42
42
|
"@wordpress/dom": "^3.35.1",
|
|
43
|
-
"@wordpress/editor": "^13.12.
|
|
43
|
+
"@wordpress/editor": "^13.12.9",
|
|
44
44
|
"@wordpress/element": "^5.12.1",
|
|
45
45
|
"@wordpress/hooks": "^3.35.1",
|
|
46
46
|
"@wordpress/i18n": "^4.35.1",
|
|
47
47
|
"@wordpress/icons": "^9.26.2",
|
|
48
|
-
"@wordpress/interface": "^5.12.
|
|
49
|
-
"@wordpress/keyboard-shortcuts": "^4.12.
|
|
48
|
+
"@wordpress/interface": "^5.12.8",
|
|
49
|
+
"@wordpress/keyboard-shortcuts": "^4.12.4",
|
|
50
50
|
"@wordpress/keycodes": "^3.35.1",
|
|
51
51
|
"@wordpress/media-utils": "^4.26.1",
|
|
52
|
-
"@wordpress/notices": "^4.3.
|
|
53
|
-
"@wordpress/plugins": "^6.3.
|
|
54
|
-
"@wordpress/preferences": "^3.12.
|
|
55
|
-
"@wordpress/private-apis": "^0.17.
|
|
52
|
+
"@wordpress/notices": "^4.3.4",
|
|
53
|
+
"@wordpress/plugins": "^6.3.8",
|
|
54
|
+
"@wordpress/preferences": "^3.12.8",
|
|
55
|
+
"@wordpress/private-apis": "^0.17.2",
|
|
56
56
|
"@wordpress/url": "^3.36.1",
|
|
57
|
-
"@wordpress/viewport": "^5.12.
|
|
57
|
+
"@wordpress/viewport": "^5.12.4",
|
|
58
58
|
"@wordpress/warning": "^2.35.1",
|
|
59
|
-
"@wordpress/widgets": "^3.12.
|
|
59
|
+
"@wordpress/widgets": "^3.12.9",
|
|
60
60
|
"classnames": "^2.3.1",
|
|
61
61
|
"memize": "^2.1.0",
|
|
62
62
|
"rememo": "^4.0.2"
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "ec0ed708e46a598ab2cf8e18bf2591b0102b5bb3"
|
|
72
72
|
}
|
|
@@ -17,7 +17,10 @@ import {
|
|
|
17
17
|
store as editorStore,
|
|
18
18
|
} from '@wordpress/editor';
|
|
19
19
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
BlockBreadcrumb,
|
|
22
|
+
privateApis as blockEditorPrivateApis,
|
|
23
|
+
} from '@wordpress/block-editor';
|
|
21
24
|
import { Button, ScrollLock, Popover } from '@wordpress/components';
|
|
22
25
|
import { useViewportMatch } from '@wordpress/compose';
|
|
23
26
|
import { PluginArea } from '@wordpress/plugins';
|
|
@@ -50,6 +53,9 @@ import WelcomeGuide from '../welcome-guide';
|
|
|
50
53
|
import ActionsPanel from './actions-panel';
|
|
51
54
|
import StartPageOptions from '../start-page-options';
|
|
52
55
|
import { store as editPostStore } from '../../store';
|
|
56
|
+
import { unlock } from '../../lock-unlock';
|
|
57
|
+
|
|
58
|
+
const { getLayoutStyles } = unlock( blockEditorPrivateApis );
|
|
53
59
|
|
|
54
60
|
const interfaceLabels = {
|
|
55
61
|
/* translators: accessibility text for the editor top bar landmark region. */
|
|
@@ -64,7 +70,7 @@ const interfaceLabels = {
|
|
|
64
70
|
footer: __( 'Editor footer' ),
|
|
65
71
|
};
|
|
66
72
|
|
|
67
|
-
function Layout(
|
|
73
|
+
function Layout() {
|
|
68
74
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
69
75
|
const isHugeViewport = useViewportMatch( 'huge', '>=' );
|
|
70
76
|
const isLargeViewport = useViewportMatch( 'large' );
|
|
@@ -88,10 +94,45 @@ function Layout( { styles } ) {
|
|
|
88
94
|
showBlockBreadcrumbs,
|
|
89
95
|
isTemplateMode,
|
|
90
96
|
documentLabel,
|
|
97
|
+
styles,
|
|
91
98
|
} = useSelect( ( select ) => {
|
|
92
99
|
const { getEditorSettings, getPostTypeLabel } = select( editorStore );
|
|
100
|
+
const { isFeatureActive } = select( editPostStore );
|
|
93
101
|
const editorSettings = getEditorSettings();
|
|
94
102
|
const postTypeLabel = getPostTypeLabel();
|
|
103
|
+
const hasThemeStyles = isFeatureActive( 'themeStyles' );
|
|
104
|
+
|
|
105
|
+
const themeStyles = [];
|
|
106
|
+
const presetStyles = [];
|
|
107
|
+
editorSettings.styles?.forEach( ( style ) => {
|
|
108
|
+
if ( ! style.__unstableType || style.__unstableType === 'theme' ) {
|
|
109
|
+
themeStyles.push( style );
|
|
110
|
+
} else {
|
|
111
|
+
presetStyles.push( style );
|
|
112
|
+
}
|
|
113
|
+
} );
|
|
114
|
+
|
|
115
|
+
const defaultEditorStyles = [
|
|
116
|
+
...editorSettings.defaultEditorStyles,
|
|
117
|
+
...presetStyles,
|
|
118
|
+
];
|
|
119
|
+
|
|
120
|
+
// If theme styles are not present or displayed, ensure that
|
|
121
|
+
// base layout styles are still present in the editor.
|
|
122
|
+
if (
|
|
123
|
+
! editorSettings.disableLayoutStyles &&
|
|
124
|
+
! ( hasThemeStyles && themeStyles.length )
|
|
125
|
+
) {
|
|
126
|
+
defaultEditorStyles.push( {
|
|
127
|
+
css: getLayoutStyles( {
|
|
128
|
+
style: {},
|
|
129
|
+
selector: 'body',
|
|
130
|
+
hasBlockGapSupport: false,
|
|
131
|
+
hasFallbackGapSupport: true,
|
|
132
|
+
fallbackGapValue: '0.5em',
|
|
133
|
+
} ),
|
|
134
|
+
} );
|
|
135
|
+
}
|
|
95
136
|
|
|
96
137
|
return {
|
|
97
138
|
isTemplateMode: select( editPostStore ).isEditingTemplate(),
|
|
@@ -124,6 +165,10 @@ function Layout( { styles } ) {
|
|
|
124
165
|
),
|
|
125
166
|
// translators: Default label for the Document in the Block Breadcrumb.
|
|
126
167
|
documentLabel: postTypeLabel || _x( 'Document', 'noun' ),
|
|
168
|
+
styles:
|
|
169
|
+
hasThemeStyles && themeStyles.length
|
|
170
|
+
? editorSettings.styles
|
|
171
|
+
: defaultEditorStyles,
|
|
127
172
|
};
|
|
128
173
|
}, [] );
|
|
129
174
|
|
package/src/editor.js
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
store as editorStore,
|
|
10
10
|
privateApis as editorPrivateApis,
|
|
11
11
|
} from '@wordpress/editor';
|
|
12
|
-
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
13
12
|
import { useMemo } from '@wordpress/element';
|
|
14
13
|
import { SlotFillProvider } from '@wordpress/components';
|
|
15
14
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -28,7 +27,6 @@ import { unlock } from './lock-unlock';
|
|
|
28
27
|
import useCommonCommands from './hooks/commands/use-common-commands';
|
|
29
28
|
|
|
30
29
|
const { ExperimentalEditorProvider } = unlock( editorPrivateApis );
|
|
31
|
-
const { getLayoutStyles } = unlock( blockEditorPrivateApis );
|
|
32
30
|
const { useCommands } = unlock( coreCommandsPrivateApis );
|
|
33
31
|
|
|
34
32
|
function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
@@ -39,7 +37,6 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
|
39
37
|
focusMode,
|
|
40
38
|
isDistractionFree,
|
|
41
39
|
hasInlineToolbar,
|
|
42
|
-
hasThemeStyles,
|
|
43
40
|
post,
|
|
44
41
|
preferredStyleVariations,
|
|
45
42
|
hiddenBlockTypes,
|
|
@@ -51,7 +48,6 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
|
51
48
|
( select ) => {
|
|
52
49
|
const {
|
|
53
50
|
isFeatureActive,
|
|
54
|
-
__experimentalGetPreviewDeviceType,
|
|
55
51
|
isEditingTemplate,
|
|
56
52
|
getEditedPostTemplate,
|
|
57
53
|
getHiddenBlockTypes,
|
|
@@ -80,13 +76,10 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
|
80
76
|
const canEditTemplate = canUser( 'create', 'templates' );
|
|
81
77
|
|
|
82
78
|
return {
|
|
83
|
-
hasFixedToolbar:
|
|
84
|
-
isFeatureActive( 'fixedToolbar' ) ||
|
|
85
|
-
__experimentalGetPreviewDeviceType() !== 'Desktop',
|
|
79
|
+
hasFixedToolbar: isFeatureActive( 'fixedToolbar' ),
|
|
86
80
|
focusMode: isFeatureActive( 'focusMode' ),
|
|
87
81
|
isDistractionFree: isFeatureActive( 'distractionFree' ),
|
|
88
82
|
hasInlineToolbar: isFeatureActive( 'inlineToolbar' ),
|
|
89
|
-
hasThemeStyles: isFeatureActive( 'themeStyles' ),
|
|
90
83
|
preferredStyleVariations: select( preferencesStore ).get(
|
|
91
84
|
'core/edit-post',
|
|
92
85
|
'preferredStyleVariations'
|
|
@@ -158,44 +151,6 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
|
158
151
|
keepCaretInsideBlock,
|
|
159
152
|
] );
|
|
160
153
|
|
|
161
|
-
const styles = useMemo( () => {
|
|
162
|
-
const themeStyles = [];
|
|
163
|
-
const presetStyles = [];
|
|
164
|
-
settings.styles?.forEach( ( style ) => {
|
|
165
|
-
if ( ! style.__unstableType || style.__unstableType === 'theme' ) {
|
|
166
|
-
themeStyles.push( style );
|
|
167
|
-
} else {
|
|
168
|
-
presetStyles.push( style );
|
|
169
|
-
}
|
|
170
|
-
} );
|
|
171
|
-
|
|
172
|
-
const defaultEditorStyles = [
|
|
173
|
-
...settings.defaultEditorStyles,
|
|
174
|
-
...presetStyles,
|
|
175
|
-
];
|
|
176
|
-
|
|
177
|
-
// If theme styles are not present or displayed, ensure that
|
|
178
|
-
// base layout styles are still present in the editor.
|
|
179
|
-
if (
|
|
180
|
-
! settings.disableLayoutStyles &&
|
|
181
|
-
! ( hasThemeStyles && themeStyles.length )
|
|
182
|
-
) {
|
|
183
|
-
defaultEditorStyles.push( {
|
|
184
|
-
css: getLayoutStyles( {
|
|
185
|
-
style: {},
|
|
186
|
-
selector: 'body',
|
|
187
|
-
hasBlockGapSupport: false,
|
|
188
|
-
hasFallbackGapSupport: true,
|
|
189
|
-
fallbackGapValue: '0.5em',
|
|
190
|
-
} ),
|
|
191
|
-
} );
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return hasThemeStyles && themeStyles.length
|
|
195
|
-
? settings.styles
|
|
196
|
-
: defaultEditorStyles;
|
|
197
|
-
}, [ settings, hasThemeStyles ] );
|
|
198
|
-
|
|
199
154
|
if ( ! post ) {
|
|
200
155
|
return null;
|
|
201
156
|
}
|
|
@@ -214,7 +169,7 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
|
214
169
|
<ErrorBoundary>
|
|
215
170
|
<CommandMenu />
|
|
216
171
|
<EditorInitialization postId={ postId } />
|
|
217
|
-
<Layout
|
|
172
|
+
<Layout />
|
|
218
173
|
</ErrorBoundary>
|
|
219
174
|
<PostLockedModal />
|
|
220
175
|
</ExperimentalEditorProvider>
|