@wordpress/editor 13.24.1 → 13.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/document-bar/index.js +152 -0
- package/build/components/document-bar/index.js.map +1 -0
- package/build/components/editor-canvas/edit-template-blocks-notification.js +106 -0
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -0
- package/build/components/editor-canvas/index.js +292 -0
- package/build/components/editor-canvas/index.js.map +1 -0
- package/build/components/index.js +24 -8
- package/build/components/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +1 -0
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +2 -4
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-saved-state/index.js +1 -0
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/panel.js +1 -1
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-template/block-theme.js +99 -0
- package/build/components/post-template/block-theme.js.map +1 -0
- package/build/components/post-template/classic-theme.js +171 -0
- package/build/components/post-template/classic-theme.js.map +1 -0
- package/build/components/post-template/create-new-template-modal.js +98 -0
- package/build/components/post-template/create-new-template-modal.js.map +1 -0
- package/build/components/post-template/create-new-template.js +55 -0
- package/build/components/post-template/create-new-template.js.map +1 -0
- package/build/components/post-template/hooks.js +88 -0
- package/build/components/post-template/hooks.js.map +1 -0
- package/build/components/post-template/panel.js +71 -0
- package/build/components/post-template/panel.js.map +1 -0
- package/build/components/post-template/reset-default-template.js +48 -0
- package/build/components/post-template/reset-default-template.js.map +1 -0
- package/build/components/post-template/swap-template-button.js +84 -0
- package/build/components/post-template/swap-template-button.js.map +1 -0
- package/build/components/post-title/index.native.js +0 -1
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/preview-dropdown/index.js +113 -0
- package/build/components/preview-dropdown/index.js.map +1 -0
- package/build/components/provider/index.js +24 -82
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +17 -8
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/navigation-block-editing-mode.js +40 -0
- package/build/components/provider/navigation-block-editing-mode.js.map +1 -0
- package/build/components/provider/use-block-editor-settings.js +9 -10
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/hooks/index.js +1 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/pattern-partial-syncing.js +49 -0
- package/build/hooks/pattern-partial-syncing.js.map +1 -0
- package/build/private-apis.js +4 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +59 -11
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +2 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +3 -0
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +52 -0
- package/build/store/private-actions.js.map +1 -0
- package/build/store/reducer.js +32 -27
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js +0 -1
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +31 -10
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/document-bar/index.js +144 -0
- package/build-module/components/document-bar/index.js.map +1 -0
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js +100 -0
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -0
- package/build-module/components/editor-canvas/index.js +283 -0
- package/build-module/components/editor-canvas/index.js.map +1 -0
- package/build-module/components/index.js +3 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +1 -0
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -4
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +1 -0
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/panel.js +1 -1
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +91 -0
- package/build-module/components/post-template/block-theme.js.map +1 -0
- package/build-module/components/post-template/classic-theme.js +162 -0
- package/build-module/components/post-template/classic-theme.js.map +1 -0
- package/build-module/components/post-template/create-new-template-modal.js +91 -0
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -0
- package/build-module/components/post-template/create-new-template.js +47 -0
- package/build-module/components/post-template/create-new-template.js.map +1 -0
- package/build-module/components/post-template/hooks.js +78 -0
- package/build-module/components/post-template/hooks.js.map +1 -0
- package/build-module/components/post-template/panel.js +63 -0
- package/build-module/components/post-template/panel.js.map +1 -0
- package/build-module/components/post-template/reset-default-template.js +41 -0
- package/build-module/components/post-template/reset-default-template.js.map +1 -0
- package/build-module/components/post-template/swap-template-button.js +77 -0
- package/build-module/components/post-template/swap-template-button.js.map +1 -0
- package/build-module/components/post-title/index.native.js +0 -1
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +105 -0
- package/build-module/components/preview-dropdown/index.js.map +1 -0
- package/build-module/components/provider/index.js +25 -83
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +18 -9
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/navigation-block-editing-mode.js +34 -0
- package/build-module/components/provider/navigation-block-editing-mode.js.map +1 -0
- package/build-module/components/provider/use-block-editor-settings.js +9 -10
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/pattern-partial-syncing.js +46 -0
- package/build-module/hooks/pattern-partial-syncing.js.map +1 -0
- package/build-module/private-apis.js +4 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +53 -9
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +2 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js +3 -0
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +44 -0
- package/build-module/store/private-actions.js.map +1 -0
- package/build-module/store/reducer.js +30 -26
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js +1 -2
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +26 -6
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +182 -0
- package/build-style/style.css +182 -0
- package/package.json +32 -31
- package/src/components/document-bar/index.js +182 -0
- package/src/components/document-bar/style.scss +130 -0
- package/src/components/editor-canvas/edit-template-blocks-notification.js +108 -0
- package/src/components/editor-canvas/index.js +381 -0
- package/src/components/index.js +3 -1
- package/src/components/post-publish-button/index.js +1 -0
- package/src/components/post-publish-panel/maybe-upload-media.js +3 -8
- package/src/components/post-saved-state/index.js +1 -0
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +2 -2
- package/src/components/post-schedule/panel.js +1 -1
- package/src/components/post-template/block-theme.js +109 -0
- package/src/components/post-template/classic-theme.js +213 -0
- package/src/components/post-template/create-new-template-modal.js +139 -0
- package/src/components/post-template/create-new-template.js +50 -0
- package/src/components/post-template/hooks.js +95 -0
- package/src/components/post-template/panel.js +67 -0
- package/src/components/post-template/reset-default-template.js +43 -0
- package/src/components/post-template/style.scss +52 -0
- package/src/components/post-template/swap-template-button.js +83 -0
- package/src/components/post-title/index.native.js +0 -1
- package/src/components/preview-dropdown/index.js +136 -0
- package/src/components/preview-dropdown/style.scss +5 -0
- package/src/components/provider/index.js +28 -118
- package/src/components/provider/index.native.js +26 -12
- package/src/components/provider/navigation-block-editing-mode.js +37 -0
- package/src/components/provider/use-block-editor-settings.js +6 -9
- package/src/hooks/index.js +1 -0
- package/src/hooks/pattern-partial-syncing.js +73 -0
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +51 -9
- package/src/store/defaults.js +1 -0
- package/src/store/index.js +3 -0
- package/src/store/private-actions.js +61 -0
- package/src/store/reducer.js +32 -27
- package/src/store/reducer.native.js +0 -2
- package/src/store/selectors.js +64 -42
- package/src/store/test/selectors.js +88 -147
- package/src/style.scss +3 -0
- package/build/components/post-template/index.js +0 -66
- package/build/components/post-template/index.js.map +0 -1
- package/build-module/components/post-template/index.js +0 -57
- package/build-module/components/post-template/index.js.map +0 -1
- package/src/components/post-template/index.js +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = DocumentBar;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
var _data = require("@wordpress/data");
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
14
|
+
var _icons = require("@wordpress/icons");
|
|
15
|
+
var _keycodes = require("@wordpress/keycodes");
|
|
16
|
+
var _coreData = require("@wordpress/core-data");
|
|
17
|
+
var _commands = require("@wordpress/commands");
|
|
18
|
+
var _element = require("@wordpress/element");
|
|
19
|
+
var _store = require("../../store");
|
|
20
|
+
/**
|
|
21
|
+
* External dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* WordPress dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal dependencies
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
const typeLabels = {
|
|
33
|
+
// translators: 1: Pattern title.
|
|
34
|
+
wp_pattern: (0, _i18n.__)('Editing pattern: %s'),
|
|
35
|
+
// translators: 1: Navigation menu title.
|
|
36
|
+
wp_navigation: (0, _i18n.__)('Editing navigation menu: %s'),
|
|
37
|
+
// translators: 1: Template title.
|
|
38
|
+
wp_template: (0, _i18n.__)('Editing template: %s'),
|
|
39
|
+
// translators: 1: Template part title.
|
|
40
|
+
wp_template_part: (0, _i18n.__)('Editing template part: %s')
|
|
41
|
+
};
|
|
42
|
+
const icons = {
|
|
43
|
+
wp_block: _icons.symbol,
|
|
44
|
+
wp_navigation: _icons.navigation
|
|
45
|
+
};
|
|
46
|
+
function DocumentBar() {
|
|
47
|
+
const {
|
|
48
|
+
isEditingTemplate,
|
|
49
|
+
templateId,
|
|
50
|
+
postType,
|
|
51
|
+
postId
|
|
52
|
+
} = (0, _data.useSelect)(select => {
|
|
53
|
+
const {
|
|
54
|
+
getRenderingMode,
|
|
55
|
+
getCurrentTemplateId,
|
|
56
|
+
getCurrentPostId,
|
|
57
|
+
getCurrentPostType
|
|
58
|
+
} = select(_store.store);
|
|
59
|
+
const _templateId = getCurrentTemplateId();
|
|
60
|
+
return {
|
|
61
|
+
isEditingTemplate: !!_templateId && getRenderingMode() === 'template-only',
|
|
62
|
+
templateId: _templateId,
|
|
63
|
+
postType: getCurrentPostType(),
|
|
64
|
+
postId: getCurrentPostId()
|
|
65
|
+
};
|
|
66
|
+
}, []);
|
|
67
|
+
const {
|
|
68
|
+
getEditorSettings
|
|
69
|
+
} = (0, _data.useSelect)(_store.store);
|
|
70
|
+
const {
|
|
71
|
+
setRenderingMode
|
|
72
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
73
|
+
return (0, _react.createElement)(BaseDocumentActions, {
|
|
74
|
+
postType: isEditingTemplate ? 'wp_template' : postType,
|
|
75
|
+
postId: isEditingTemplate ? templateId : postId,
|
|
76
|
+
onBack: isEditingTemplate ? () => setRenderingMode(getEditorSettings().defaultRenderingMode) : undefined
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function BaseDocumentActions({
|
|
80
|
+
postType,
|
|
81
|
+
postId,
|
|
82
|
+
onBack
|
|
83
|
+
}) {
|
|
84
|
+
var _icons$postType;
|
|
85
|
+
const {
|
|
86
|
+
open: openCommandCenter
|
|
87
|
+
} = (0, _data.useDispatch)(_commands.store);
|
|
88
|
+
const {
|
|
89
|
+
editedRecord: doc,
|
|
90
|
+
isResolving
|
|
91
|
+
} = (0, _coreData.useEntityRecord)('postType', postType, postId);
|
|
92
|
+
const {
|
|
93
|
+
templateIcon,
|
|
94
|
+
templateTitle
|
|
95
|
+
} = (0, _data.useSelect)(select => {
|
|
96
|
+
const {
|
|
97
|
+
__experimentalGetTemplateInfo: getTemplateInfo
|
|
98
|
+
} = select(_store.store);
|
|
99
|
+
const templateInfo = getTemplateInfo(doc);
|
|
100
|
+
return {
|
|
101
|
+
templateIcon: templateInfo.icon,
|
|
102
|
+
templateTitle: templateInfo.title
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
const isNotFound = !doc && !isResolving;
|
|
106
|
+
const icon = (_icons$postType = icons[postType]) !== null && _icons$postType !== void 0 ? _icons$postType : _icons.page;
|
|
107
|
+
const [isAnimated, setIsAnimated] = (0, _element.useState)(false);
|
|
108
|
+
const isMounting = (0, _element.useRef)(true);
|
|
109
|
+
const isTemplate = ['wp_template', 'wp_template_part'].includes(postType);
|
|
110
|
+
const isGlobalEntity = ['wp_template', 'wp_navigation', 'wp_template_part', 'wp_block'].includes(postType);
|
|
111
|
+
(0, _element.useEffect)(() => {
|
|
112
|
+
if (!isMounting.current) {
|
|
113
|
+
setIsAnimated(true);
|
|
114
|
+
}
|
|
115
|
+
isMounting.current = false;
|
|
116
|
+
}, [postType, postId]);
|
|
117
|
+
const title = isTemplate ? templateTitle : doc.title;
|
|
118
|
+
return (0, _react.createElement)("div", {
|
|
119
|
+
className: (0, _classnames.default)('editor-document-bar', {
|
|
120
|
+
'has-back-button': !!onBack,
|
|
121
|
+
'is-animated': isAnimated,
|
|
122
|
+
'is-global': isGlobalEntity
|
|
123
|
+
})
|
|
124
|
+
}, onBack && (0, _react.createElement)(_components.Button, {
|
|
125
|
+
className: "editor-document-bar__back",
|
|
126
|
+
icon: (0, _i18n.isRTL)() ? _icons.chevronRightSmall : _icons.chevronLeftSmall,
|
|
127
|
+
onClick: event => {
|
|
128
|
+
event.stopPropagation();
|
|
129
|
+
onBack();
|
|
130
|
+
},
|
|
131
|
+
size: "compact"
|
|
132
|
+
}, (0, _i18n.__)('Back')), isNotFound && (0, _react.createElement)(_components.__experimentalText, null, (0, _i18n.__)('Document not found')), !isNotFound && (0, _react.createElement)(_components.Button, {
|
|
133
|
+
className: "editor-document-bar__command",
|
|
134
|
+
onClick: () => openCommandCenter(),
|
|
135
|
+
size: "compact"
|
|
136
|
+
}, (0, _react.createElement)(_components.__experimentalHStack, {
|
|
137
|
+
className: "editor-document-bar__title",
|
|
138
|
+
spacing: 1,
|
|
139
|
+
justify: "center"
|
|
140
|
+
}, (0, _react.createElement)(_blockEditor.BlockIcon, {
|
|
141
|
+
icon: isTemplate ? templateIcon : icon
|
|
142
|
+
}), (0, _react.createElement)(_components.__experimentalText, {
|
|
143
|
+
size: "body",
|
|
144
|
+
as: "h1",
|
|
145
|
+
"aria-label": typeLabels[postType] ?
|
|
146
|
+
// eslint-disable-next-line @wordpress/valid-sprintf
|
|
147
|
+
(0, _i18n.sprintf)(typeLabels[postType], title) : undefined
|
|
148
|
+
}, title)), (0, _react.createElement)("span", {
|
|
149
|
+
className: "editor-document-bar__shortcut"
|
|
150
|
+
}, _keycodes.displayShortcut.primary('k'))));
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_data","_components","_blockEditor","_icons","_keycodes","_coreData","_commands","_element","_store","typeLabels","wp_pattern","__","wp_navigation","wp_template","wp_template_part","icons","wp_block","symbol","navigationIcon","DocumentBar","isEditingTemplate","templateId","postType","postId","useSelect","select","getRenderingMode","getCurrentTemplateId","getCurrentPostId","getCurrentPostType","editorStore","_templateId","getEditorSettings","setRenderingMode","useDispatch","_react","createElement","BaseDocumentActions","onBack","defaultRenderingMode","undefined","_icons$postType","open","openCommandCenter","commandsStore","editedRecord","doc","isResolving","useEntityRecord","templateIcon","templateTitle","__experimentalGetTemplateInfo","getTemplateInfo","templateInfo","icon","title","isNotFound","pageIcon","isAnimated","setIsAnimated","useState","isMounting","useRef","isTemplate","includes","isGlobalEntity","useEffect","current","className","classnames","Button","isRTL","chevronRightSmall","chevronLeftSmall","onClick","event","stopPropagation","size","__experimentalText","__experimentalHStack","spacing","justify","BlockIcon","as","sprintf","displayShortcut","primary"],"sources":["@wordpress/editor/src/components/document-bar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport {\n\tchevronLeftSmall,\n\tchevronRightSmall,\n\tpage as pageIcon,\n\tnavigation as navigationIcon,\n\tsymbol,\n} from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useEntityRecord } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useState, useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nconst typeLabels = {\n\t// translators: 1: Pattern title.\n\twp_pattern: __( 'Editing pattern: %s' ),\n\t// translators: 1: Navigation menu title.\n\twp_navigation: __( 'Editing navigation menu: %s' ),\n\t// translators: 1: Template title.\n\twp_template: __( 'Editing template: %s' ),\n\t// translators: 1: Template part title.\n\twp_template_part: __( 'Editing template part: %s' ),\n};\n\nconst icons = {\n\twp_block: symbol,\n\twp_navigation: navigationIcon,\n};\n\nexport default function DocumentBar() {\n\tconst { isEditingTemplate, templateId, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetRenderingMode,\n\t\t\t\tgetCurrentTemplateId,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tgetCurrentPostType,\n\t\t\t} = select( editorStore );\n\t\t\tconst _templateId = getCurrentTemplateId();\n\t\t\treturn {\n\t\t\t\tisEditingTemplate:\n\t\t\t\t\t!! _templateId && getRenderingMode() === 'template-only',\n\t\t\t\ttemplateId: _templateId,\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { getEditorSettings } = useSelect( editorStore );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\treturn (\n\t\t<BaseDocumentActions\n\t\t\tpostType={ isEditingTemplate ? 'wp_template' : postType }\n\t\t\tpostId={ isEditingTemplate ? templateId : postId }\n\t\t\tonBack={\n\t\t\t\tisEditingTemplate\n\t\t\t\t\t? () =>\n\t\t\t\t\t\t\tsetRenderingMode(\n\t\t\t\t\t\t\t\tgetEditorSettings().defaultRenderingMode\n\t\t\t\t\t\t\t)\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\n\nfunction BaseDocumentActions( { postType, postId, onBack } ) {\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\tconst { editedRecord: doc, isResolving } = useEntityRecord(\n\t\t'postType',\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst { templateIcon, templateTitle } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\tselect( editorStore );\n\t\tconst templateInfo = getTemplateInfo( doc );\n\t\treturn {\n\t\t\ttemplateIcon: templateInfo.icon,\n\t\t\ttemplateTitle: templateInfo.title,\n\t\t};\n\t} );\n\tconst isNotFound = ! doc && ! isResolving;\n\tconst icon = icons[ postType ] ?? pageIcon;\n\tconst [ isAnimated, setIsAnimated ] = useState( false );\n\tconst isMounting = useRef( true );\n\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\tpostType\n\t);\n\tconst isGlobalEntity = [\n\t\t'wp_template',\n\t\t'wp_navigation',\n\t\t'wp_template_part',\n\t\t'wp_block',\n\t].includes( postType );\n\n\tuseEffect( () => {\n\t\tif ( ! isMounting.current ) {\n\t\t\tsetIsAnimated( true );\n\t\t}\n\t\tisMounting.current = false;\n\t}, [ postType, postId ] );\n\n\tconst title = isTemplate ? templateTitle : doc.title;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'editor-document-bar', {\n\t\t\t\t'has-back-button': !! onBack,\n\t\t\t\t'is-animated': isAnimated,\n\t\t\t\t'is-global': isGlobalEntity,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ onBack && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__back\"\n\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tonBack();\n\t\t\t\t\t} }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\t{ isNotFound && <Text>{ __( 'Document not found' ) }</Text> }\n\t\t\t{ ! isNotFound && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__command\"\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tclassName=\"editor-document-bar__title\"\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockIcon icon={ isTemplate ? templateIcon : icon } />\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\ttypeLabels[ postType ]\n\t\t\t\t\t\t\t\t\t? // eslint-disable-next-line @wordpress/valid-sprintf\n\t\t\t\t\t\t\t\t\t sprintf( typeLabels[ postType ], title )\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<span className=\"editor-document-bar__shortcut\">\n\t\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAOA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAV,OAAA;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAqBA;AACA;AACA;;AAGA,MAAMW,UAAU,GAAG;EAClB;EACAC,UAAU,EAAE,IAAAC,QAAE,EAAE,qBAAsB,CAAC;EACvC;EACAC,aAAa,EAAE,IAAAD,QAAE,EAAE,6BAA8B,CAAC;EAClD;EACAE,WAAW,EAAE,IAAAF,QAAE,EAAE,sBAAuB,CAAC;EACzC;EACAG,gBAAgB,EAAE,IAAAH,QAAE,EAAE,2BAA4B;AACnD,CAAC;AAED,MAAMI,KAAK,GAAG;EACbC,QAAQ,EAAEC,aAAM;EAChBL,aAAa,EAAEM;AAChB,CAAC;AAEc,SAASC,WAAWA,CAAA,EAAG;EACrC,MAAM;IAAEC,iBAAiB;IAAEC,UAAU;IAAEC,QAAQ;IAAEC;EAAO,CAAC,GAAG,IAAAC,eAAS,EAClEC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C,aAAA;IAAMgC,SAAS,EAAC;EAA+B,GAC5CiB,yBAAe,CAACC,OAAO,CAAE,GAAI,CAC1B,CACC,CAEL,CAAC;AAER"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = EditTemplateBlocksNotification;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _data = require("@wordpress/data");
|
|
9
|
+
var _element = require("@wordpress/element");
|
|
10
|
+
var _notices = require("@wordpress/notices");
|
|
11
|
+
var _i18n = require("@wordpress/i18n");
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
var _store = require("../../store");
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Component that:
|
|
24
|
+
*
|
|
25
|
+
* - Displays a 'Edit your template to edit this block' notification when the
|
|
26
|
+
* user is focusing on editing page content and clicks on a disabled template
|
|
27
|
+
* block.
|
|
28
|
+
* - Displays a 'Edit your template to edit this block' dialog when the user
|
|
29
|
+
* is focusing on editing page conetnt and double clicks on a disabled
|
|
30
|
+
* template block.
|
|
31
|
+
*
|
|
32
|
+
* @param {Object} props
|
|
33
|
+
* @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block
|
|
34
|
+
* editor iframe canvas.
|
|
35
|
+
*/
|
|
36
|
+
function EditTemplateBlocksNotification({
|
|
37
|
+
contentRef
|
|
38
|
+
}) {
|
|
39
|
+
const renderingMode = (0, _data.useSelect)(select => select(_store.store).getRenderingMode(), []);
|
|
40
|
+
const {
|
|
41
|
+
getNotices
|
|
42
|
+
} = (0, _data.useSelect)(_notices.store);
|
|
43
|
+
const {
|
|
44
|
+
createInfoNotice,
|
|
45
|
+
removeNotice
|
|
46
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
47
|
+
const {
|
|
48
|
+
setRenderingMode
|
|
49
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
50
|
+
const [isDialogOpen, setIsDialogOpen] = (0, _element.useState)(false);
|
|
51
|
+
const lastNoticeId = (0, _element.useRef)(0);
|
|
52
|
+
(0, _element.useEffect)(() => {
|
|
53
|
+
const handleClick = async event => {
|
|
54
|
+
if (renderingMode !== 'template-locked') {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!event.target.classList.contains('is-root-container')) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const isNoticeAlreadyShowing = getNotices().some(notice => notice.id === lastNoticeId.current);
|
|
61
|
+
if (isNoticeAlreadyShowing) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const {
|
|
65
|
+
notice
|
|
66
|
+
} = await createInfoNotice((0, _i18n.__)('Edit your template to edit this block.'), {
|
|
67
|
+
isDismissible: true,
|
|
68
|
+
type: 'snackbar',
|
|
69
|
+
actions: [{
|
|
70
|
+
label: (0, _i18n.__)('Edit template'),
|
|
71
|
+
onClick: () => setRenderingMode('template-only')
|
|
72
|
+
}]
|
|
73
|
+
});
|
|
74
|
+
lastNoticeId.current = notice.id;
|
|
75
|
+
};
|
|
76
|
+
const handleDblClick = event => {
|
|
77
|
+
if (renderingMode !== 'template-locked') {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (!event.target.classList.contains('is-root-container')) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (lastNoticeId.current) {
|
|
84
|
+
removeNotice(lastNoticeId.current);
|
|
85
|
+
}
|
|
86
|
+
setIsDialogOpen(true);
|
|
87
|
+
};
|
|
88
|
+
const canvas = contentRef.current;
|
|
89
|
+
canvas?.addEventListener('click', handleClick);
|
|
90
|
+
canvas?.addEventListener('dblclick', handleDblClick);
|
|
91
|
+
return () => {
|
|
92
|
+
canvas?.removeEventListener('click', handleClick);
|
|
93
|
+
canvas?.removeEventListener('dblclick', handleDblClick);
|
|
94
|
+
};
|
|
95
|
+
}, [lastNoticeId, renderingMode, contentRef.current]);
|
|
96
|
+
return (0, _react.createElement)(_components.__experimentalConfirmDialog, {
|
|
97
|
+
isOpen: isDialogOpen,
|
|
98
|
+
confirmButtonText: (0, _i18n.__)('Edit template'),
|
|
99
|
+
onConfirm: () => {
|
|
100
|
+
setIsDialogOpen(false);
|
|
101
|
+
setRenderingMode('template-only');
|
|
102
|
+
},
|
|
103
|
+
onCancel: () => setIsDialogOpen(false)
|
|
104
|
+
}, (0, _i18n.__)('Edit your template to edit this block.'));
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=edit-template-blocks-notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_element","_notices","_i18n","_components","_store","EditTemplateBlocksNotification","contentRef","renderingMode","useSelect","select","editorStore","getRenderingMode","getNotices","noticesStore","createInfoNotice","removeNotice","useDispatch","setRenderingMode","isDialogOpen","setIsDialogOpen","useState","lastNoticeId","useRef","useEffect","handleClick","event","target","classList","contains","isNoticeAlreadyShowing","some","notice","id","current","__","isDismissible","type","actions","label","onClick","handleDblClick","canvas","addEventListener","removeEventListener","_react","createElement","__experimentalConfirmDialog","isOpen","confirmButtonText","onConfirm","onCancel"],"sources":["@wordpress/editor/src/components/editor-canvas/edit-template-blocks-notification.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useState, useRef } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component that:\n *\n * - Displays a 'Edit your template to edit this block' notification when the\n * user is focusing on editing page content and clicks on a disabled template\n * block.\n * - Displays a 'Edit your template to edit this block' dialog when the user\n * is focusing on editing page conetnt and double clicks on a disabled\n * template block.\n *\n * @param {Object} props\n * @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block\n * editor iframe canvas.\n */\nexport default function EditTemplateBlocksNotification( { contentRef } ) {\n\tconst renderingMode = useSelect(\n\t\t( select ) => select( editorStore ).getRenderingMode(),\n\t\t[]\n\t);\n\tconst { getNotices } = useSelect( noticesStore );\n\n\tconst { createInfoNotice, removeNotice } = useDispatch( noticesStore );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tconst [ isDialogOpen, setIsDialogOpen ] = useState( false );\n\n\tconst lastNoticeId = useRef( 0 );\n\n\tuseEffect( () => {\n\t\tconst handleClick = async ( event ) => {\n\t\t\tif ( renderingMode !== 'template-locked' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( ! event.target.classList.contains( 'is-root-container' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst isNoticeAlreadyShowing = getNotices().some(\n\t\t\t\t( notice ) => notice.id === lastNoticeId.current\n\t\t\t);\n\t\t\tif ( isNoticeAlreadyShowing ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { notice } = await createInfoNotice(\n\t\t\t\t__( 'Edit your template to edit this block.' ),\n\t\t\t\t{\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Edit template' ),\n\t\t\t\t\t\t\tonClick: () => setRenderingMode( 'template-only' ),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t\tlastNoticeId.current = notice.id;\n\t\t};\n\n\t\tconst handleDblClick = ( event ) => {\n\t\t\tif ( renderingMode !== 'template-locked' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( ! event.target.classList.contains( 'is-root-container' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( lastNoticeId.current ) {\n\t\t\t\tremoveNotice( lastNoticeId.current );\n\t\t\t}\n\t\t\tsetIsDialogOpen( true );\n\t\t};\n\n\t\tconst canvas = contentRef.current;\n\t\tcanvas?.addEventListener( 'click', handleClick );\n\t\tcanvas?.addEventListener( 'dblclick', handleDblClick );\n\t\treturn () => {\n\t\t\tcanvas?.removeEventListener( 'click', handleClick );\n\t\t\tcanvas?.removeEventListener( 'dblclick', handleDblClick );\n\t\t};\n\t}, [ lastNoticeId, renderingMode, contentRef.current ] );\n\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen={ isDialogOpen }\n\t\t\tconfirmButtonText={ __( 'Edit template' ) }\n\t\t\tonConfirm={ () => {\n\t\t\t\tsetIsDialogOpen( false );\n\t\t\t\tsetRenderingMode( 'template-only' );\n\t\t\t} }\n\t\t\tonCancel={ () => setIsDialogOpen( false ) }\n\t\t>\n\t\t\t{ __( 'Edit your template to edit this block.' ) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASM,8BAA8BA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACxE,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAC5BC,MAAM,IAAMA,MAAM,CAAEC,YAAY,CAAC,CAACC,gBAAgB,CAAC,CAAC,EACtD,EACD,CAAC;EACD,MAAM;IAAEC;EAAW,CAAC,GAAG,IAAAJ,eAAS,EAAEK,cAAa,CAAC;EAEhD,MAAM;IAAEC,gBAAgB;IAAE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C/D;MACD;MACA,IAAKP,YAAY,CAACY,OAAO,EAAG;QAC3BlB,YAAY,CAAEM,YAAY,CAACY,OAAQ,CAAC;MACrC;MACAd,eAAe,CAAE,IAAK,CAAC;IACxB,CAAC;IAED,MAAMsB,MAAM,GAAGnC,UAAU,CAAC2B,OAAO;IACjCQ,MAAM,EAAEC,gBAAgB,CAAE,OAAO,EAAElB,WAAY,CAAC;IAChDiB,MAAM,EAAEC,gBAAgB,CAAE,UAAU,EAAEF,cAAe,CAAC;IACtD,OAAO,MAAM;MACZC,MAAM,EAAEE,mBAAmB,CAAE,OAAO,EAAEnB,WAAY,CAAC;MACnDiB,MAAM,EAAEE,mBAAmB,CAAE,UAAU,EAAEH,cAAe,CAAC;IAC1D,CAAC;EACF,CAAC,EAAE,CAAEnB,YAAY,EAAEd,aAAa,EAAED,UAAU,CAAC2B,OAAO,CAAG,CAAC;EAExD,OACC,IAAAW,MAAA,CAAAC,aAAA,EAAC1C,WAAA,CAAA2C,2BAAa;IACbC,MAAM,EAAG7B,YAAc;IACvB8B,iBAAiB,EAAG,IAAAd,QAAE,EAAE,eAAgB,CAAG;IAC3Ce,SAAS,EAAGA,CAAA,KAAM;MACjB9B,eAAe,CAAE,KAAM,CAAC;MACxBF,gBAAgB,CAAE,eAAgB,CAAC;IACpC,CAAG;IACHiC,QAAQ,EAAGA,CAAA,KAAM/B,eAAe,CAAE,KAAM;EAAG,GAEzC,IAAAe,QAAE,EAAE,wCAAyC,CACjC,CAAC;AAElB"}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
+
var _element = require("@wordpress/element");
|
|
12
|
+
var _data = require("@wordpress/data");
|
|
13
|
+
var _blocks = require("@wordpress/blocks");
|
|
14
|
+
var _coreData = require("@wordpress/core-data");
|
|
15
|
+
var _compose = require("@wordpress/compose");
|
|
16
|
+
var _postTitle = _interopRequireDefault(require("../post-title"));
|
|
17
|
+
var _store = require("../../store");
|
|
18
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
19
|
+
var _editTemplateBlocksNotification = _interopRequireDefault(require("./edit-template-blocks-notification"));
|
|
20
|
+
/**
|
|
21
|
+
* External dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* WordPress dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal dependencies
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
LayoutStyle,
|
|
34
|
+
useLayoutClasses,
|
|
35
|
+
useLayoutStyles,
|
|
36
|
+
ExperimentalBlockCanvas: BlockCanvas
|
|
37
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Given an array of nested blocks, find the first Post Content
|
|
41
|
+
* block inside it, recursing through any nesting levels,
|
|
42
|
+
* and return its attributes.
|
|
43
|
+
*
|
|
44
|
+
* @param {Array} blocks A list of blocks.
|
|
45
|
+
*
|
|
46
|
+
* @return {Object | undefined} The Post Content block.
|
|
47
|
+
*/
|
|
48
|
+
function getPostContentAttributes(blocks) {
|
|
49
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
50
|
+
if (blocks[i].name === 'core/post-content') {
|
|
51
|
+
return blocks[i].attributes;
|
|
52
|
+
}
|
|
53
|
+
if (blocks[i].innerBlocks.length) {
|
|
54
|
+
const nestedPostContent = getPostContentAttributes(blocks[i].innerBlocks);
|
|
55
|
+
if (nestedPostContent) {
|
|
56
|
+
return nestedPostContent;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function checkForPostContentAtRootLevel(blocks) {
|
|
62
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
63
|
+
if (blocks[i].name === 'core/post-content') {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
function EditorCanvas({
|
|
70
|
+
// Ideally as we unify post and site editors, we won't need these props.
|
|
71
|
+
autoFocus,
|
|
72
|
+
className,
|
|
73
|
+
renderAppender,
|
|
74
|
+
styles,
|
|
75
|
+
disableIframe = false,
|
|
76
|
+
iframeProps,
|
|
77
|
+
children
|
|
78
|
+
}) {
|
|
79
|
+
const {
|
|
80
|
+
renderingMode,
|
|
81
|
+
postContentAttributes,
|
|
82
|
+
editedPostTemplate = {},
|
|
83
|
+
wrapperBlockName,
|
|
84
|
+
wrapperUniqueId,
|
|
85
|
+
deviceType
|
|
86
|
+
} = (0, _data.useSelect)(select => {
|
|
87
|
+
const {
|
|
88
|
+
getCurrentPostId,
|
|
89
|
+
getCurrentPostType,
|
|
90
|
+
getCurrentTemplateId,
|
|
91
|
+
getEditorSettings,
|
|
92
|
+
getRenderingMode,
|
|
93
|
+
getDeviceType
|
|
94
|
+
} = select(_store.store);
|
|
95
|
+
const {
|
|
96
|
+
getPostType,
|
|
97
|
+
canUser,
|
|
98
|
+
getEditedEntityRecord
|
|
99
|
+
} = select(_coreData.store);
|
|
100
|
+
const postTypeSlug = getCurrentPostType();
|
|
101
|
+
const _renderingMode = getRenderingMode();
|
|
102
|
+
let _wrapperBlockName;
|
|
103
|
+
if (postTypeSlug === 'wp_block') {
|
|
104
|
+
_wrapperBlockName = 'core/block';
|
|
105
|
+
} else if (!_renderingMode === 'post-only') {
|
|
106
|
+
_wrapperBlockName = 'core/post-content';
|
|
107
|
+
}
|
|
108
|
+
const editorSettings = getEditorSettings();
|
|
109
|
+
const supportsTemplateMode = editorSettings.supportsTemplateMode;
|
|
110
|
+
const postType = getPostType(postTypeSlug);
|
|
111
|
+
const canEditTemplate = canUser('create', 'templates');
|
|
112
|
+
const currentTemplateId = getCurrentTemplateId();
|
|
113
|
+
const template = currentTemplateId ? getEditedEntityRecord('postType', 'wp_template', currentTemplateId) : undefined;
|
|
114
|
+
return {
|
|
115
|
+
renderingMode: _renderingMode,
|
|
116
|
+
postContentAttributes: getEditorSettings().postContentAttributes,
|
|
117
|
+
// Post template fetch returns a 404 on classic themes, which
|
|
118
|
+
// messes with e2e tests, so check it's a block theme first.
|
|
119
|
+
editedPostTemplate: postType?.viewable && supportsTemplateMode && canEditTemplate ? template : undefined,
|
|
120
|
+
wrapperBlockName: _wrapperBlockName,
|
|
121
|
+
wrapperUniqueId: getCurrentPostId(),
|
|
122
|
+
deviceType: getDeviceType()
|
|
123
|
+
};
|
|
124
|
+
}, []);
|
|
125
|
+
const {
|
|
126
|
+
isCleanNewPost
|
|
127
|
+
} = (0, _data.useSelect)(_store.store);
|
|
128
|
+
const {
|
|
129
|
+
hasRootPaddingAwareAlignments,
|
|
130
|
+
themeHasDisabledLayoutStyles,
|
|
131
|
+
themeSupportsLayout
|
|
132
|
+
} = (0, _data.useSelect)(select => {
|
|
133
|
+
const _settings = select(_blockEditor.store).getSettings();
|
|
134
|
+
return {
|
|
135
|
+
themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
|
|
136
|
+
themeSupportsLayout: _settings.supportsLayout,
|
|
137
|
+
hasRootPaddingAwareAlignments: _settings.__experimentalFeatures?.useRootPaddingAwareAlignments
|
|
138
|
+
};
|
|
139
|
+
}, []);
|
|
140
|
+
const deviceStyles = (0, _blockEditor.__experimentalUseResizeCanvas)(deviceType);
|
|
141
|
+
const [globalLayoutSettings] = (0, _blockEditor.useSettings)('layout');
|
|
142
|
+
|
|
143
|
+
// fallbackLayout is used if there is no Post Content,
|
|
144
|
+
// and for Post Title.
|
|
145
|
+
const fallbackLayout = (0, _element.useMemo)(() => {
|
|
146
|
+
if (renderingMode !== 'post-only') {
|
|
147
|
+
return {
|
|
148
|
+
type: 'default'
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
if (themeSupportsLayout) {
|
|
152
|
+
// We need to ensure support for wide and full alignments,
|
|
153
|
+
// so we add the constrained type.
|
|
154
|
+
return {
|
|
155
|
+
...globalLayoutSettings,
|
|
156
|
+
type: 'constrained'
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
// Set default layout for classic themes so all alignments are supported.
|
|
160
|
+
return {
|
|
161
|
+
type: 'default'
|
|
162
|
+
};
|
|
163
|
+
}, [renderingMode, themeSupportsLayout, globalLayoutSettings]);
|
|
164
|
+
const newestPostContentAttributes = (0, _element.useMemo)(() => {
|
|
165
|
+
if (!editedPostTemplate?.content && !editedPostTemplate?.blocks && postContentAttributes) {
|
|
166
|
+
return postContentAttributes;
|
|
167
|
+
}
|
|
168
|
+
// When in template editing mode, we can access the blocks directly.
|
|
169
|
+
if (editedPostTemplate?.blocks) {
|
|
170
|
+
return getPostContentAttributes(editedPostTemplate?.blocks);
|
|
171
|
+
}
|
|
172
|
+
// If there are no blocks, we have to parse the content string.
|
|
173
|
+
// Best double-check it's a string otherwise the parse function gets unhappy.
|
|
174
|
+
const parseableContent = typeof editedPostTemplate?.content === 'string' ? editedPostTemplate?.content : '';
|
|
175
|
+
return getPostContentAttributes((0, _blocks.parse)(parseableContent)) || {};
|
|
176
|
+
}, [editedPostTemplate?.content, editedPostTemplate?.blocks, postContentAttributes]);
|
|
177
|
+
const hasPostContentAtRootLevel = (0, _element.useMemo)(() => {
|
|
178
|
+
if (!editedPostTemplate?.content && !editedPostTemplate?.blocks) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
// When in template editing mode, we can access the blocks directly.
|
|
182
|
+
if (editedPostTemplate?.blocks) {
|
|
183
|
+
return checkForPostContentAtRootLevel(editedPostTemplate?.blocks);
|
|
184
|
+
}
|
|
185
|
+
// If there are no blocks, we have to parse the content string.
|
|
186
|
+
// Best double-check it's a string otherwise the parse function gets unhappy.
|
|
187
|
+
const parseableContent = typeof editedPostTemplate?.content === 'string' ? editedPostTemplate?.content : '';
|
|
188
|
+
return checkForPostContentAtRootLevel((0, _blocks.parse)(parseableContent)) || false;
|
|
189
|
+
}, [editedPostTemplate?.content, editedPostTemplate?.blocks]);
|
|
190
|
+
const {
|
|
191
|
+
layout = {},
|
|
192
|
+
align = ''
|
|
193
|
+
} = newestPostContentAttributes || {};
|
|
194
|
+
const postContentLayoutClasses = useLayoutClasses(newestPostContentAttributes, 'core/post-content');
|
|
195
|
+
const blockListLayoutClass = (0, _classnames.default)({
|
|
196
|
+
'is-layout-flow': !themeSupportsLayout
|
|
197
|
+
}, themeSupportsLayout && postContentLayoutClasses, align && `align${align}`);
|
|
198
|
+
const postContentLayoutStyles = useLayoutStyles(newestPostContentAttributes, 'core/post-content', '.block-editor-block-list__layout.is-root-container');
|
|
199
|
+
|
|
200
|
+
// Update type for blocks using legacy layouts.
|
|
201
|
+
const postContentLayout = (0, _element.useMemo)(() => {
|
|
202
|
+
return layout && (layout?.type === 'constrained' || layout?.inherit || layout?.contentSize || layout?.wideSize) ? {
|
|
203
|
+
...globalLayoutSettings,
|
|
204
|
+
...layout,
|
|
205
|
+
type: 'constrained'
|
|
206
|
+
} : {
|
|
207
|
+
...globalLayoutSettings,
|
|
208
|
+
...layout,
|
|
209
|
+
type: 'default'
|
|
210
|
+
};
|
|
211
|
+
}, [layout?.type, layout?.inherit, layout?.contentSize, layout?.wideSize, globalLayoutSettings]);
|
|
212
|
+
|
|
213
|
+
// If there is a Post Content block we use its layout for the block list;
|
|
214
|
+
// if not, this must be a classic theme, in which case we use the fallback layout.
|
|
215
|
+
const blockListLayout = postContentAttributes ? postContentLayout : fallbackLayout;
|
|
216
|
+
const postEditorLayout = blockListLayout?.type === 'default' && !hasPostContentAtRootLevel ? fallbackLayout : blockListLayout;
|
|
217
|
+
const observeTypingRef = (0, _blockEditor.__unstableUseTypingObserver)();
|
|
218
|
+
const titleRef = (0, _element.useRef)();
|
|
219
|
+
(0, _element.useEffect)(() => {
|
|
220
|
+
if (!autoFocus || !isCleanNewPost()) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
titleRef?.current?.focus();
|
|
224
|
+
}, [autoFocus, isCleanNewPost]);
|
|
225
|
+
|
|
226
|
+
// Add some styles for alignwide/alignfull Post Content and its children.
|
|
227
|
+
const alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}
|
|
228
|
+
.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}
|
|
229
|
+
.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}
|
|
230
|
+
.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;
|
|
231
|
+
const localRef = (0, _element.useRef)();
|
|
232
|
+
const typewriterRef = (0, _blockEditor.__unstableUseTypewriter)();
|
|
233
|
+
const contentRef = (0, _compose.useMergeRefs)([localRef, renderingMode === 'post-only' ? typewriterRef : undefined].filter(r => !!r));
|
|
234
|
+
return (0, _react.createElement)(BlockCanvas, {
|
|
235
|
+
shouldIframe: !disableIframe || ['Tablet', 'Mobile'].includes(deviceType),
|
|
236
|
+
contentRef: contentRef,
|
|
237
|
+
styles: styles,
|
|
238
|
+
height: "100%",
|
|
239
|
+
iframeProps: {
|
|
240
|
+
...iframeProps,
|
|
241
|
+
style: {
|
|
242
|
+
...iframeProps?.style,
|
|
243
|
+
...deviceStyles
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}, themeSupportsLayout && !themeHasDisabledLayoutStyles && renderingMode === 'post-only' && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(LayoutStyle, {
|
|
247
|
+
selector: ".editor-editor-canvas__post-title-wrapper",
|
|
248
|
+
layout: fallbackLayout
|
|
249
|
+
}), (0, _react.createElement)(LayoutStyle, {
|
|
250
|
+
selector: ".block-editor-block-list__layout.is-root-container",
|
|
251
|
+
layout: postEditorLayout
|
|
252
|
+
}), align && (0, _react.createElement)(LayoutStyle, {
|
|
253
|
+
css: alignCSS
|
|
254
|
+
}), postContentLayoutStyles && (0, _react.createElement)(LayoutStyle, {
|
|
255
|
+
layout: postContentLayout,
|
|
256
|
+
css: postContentLayoutStyles
|
|
257
|
+
})), renderingMode === 'post-only' && (0, _react.createElement)("div", {
|
|
258
|
+
className: (0, _classnames.default)('editor-editor-canvas__post-title-wrapper',
|
|
259
|
+
// The following class is only here for backward comapatibility
|
|
260
|
+
// some themes might be using it to style the post title.
|
|
261
|
+
'edit-post-visual-editor__post-title-wrapper', {
|
|
262
|
+
'has-global-padding': hasRootPaddingAwareAlignments
|
|
263
|
+
}),
|
|
264
|
+
contentEditable: false,
|
|
265
|
+
ref: observeTypingRef,
|
|
266
|
+
style: {
|
|
267
|
+
// This is using inline styles
|
|
268
|
+
// so it's applied for both iframed and non iframed editors.
|
|
269
|
+
marginTop: '4rem'
|
|
270
|
+
}
|
|
271
|
+
}, (0, _react.createElement)(_postTitle.default, {
|
|
272
|
+
ref: titleRef
|
|
273
|
+
})), (0, _react.createElement)(_blockEditor.__experimentalRecursionProvider, {
|
|
274
|
+
blockName: wrapperBlockName,
|
|
275
|
+
uniqueId: wrapperUniqueId
|
|
276
|
+
}, (0, _react.createElement)(_blockEditor.BlockList, {
|
|
277
|
+
className: (0, _classnames.default)(className, 'is-' + deviceType.toLowerCase() + '-preview', renderingMode !== 'post-only' ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.
|
|
278
|
+
),
|
|
279
|
+
|
|
280
|
+
layout: blockListLayout,
|
|
281
|
+
dropZoneElement:
|
|
282
|
+
// When iframed, pass in the html element of the iframe to
|
|
283
|
+
// ensure the drop zone extends to the edges of the iframe.
|
|
284
|
+
disableIframe ? localRef.current : localRef.current?.parentNode,
|
|
285
|
+
renderAppender: renderAppender
|
|
286
|
+
}), (0, _react.createElement)(_editTemplateBlocksNotification.default, {
|
|
287
|
+
contentRef: localRef
|
|
288
|
+
})), children);
|
|
289
|
+
}
|
|
290
|
+
var _default = EditorCanvas;
|
|
291
|
+
exports.default = _default;
|
|
292
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_blockEditor","_element","_data","_blocks","_coreData","_compose","_postTitle","_store","_lockUnlock","_editTemplateBlocksNotification","LayoutStyle","useLayoutClasses","useLayoutStyles","ExperimentalBlockCanvas","BlockCanvas","unlock","blockEditorPrivateApis","getPostContentAttributes","blocks","i","length","name","attributes","innerBlocks","nestedPostContent","checkForPostContentAtRootLevel","EditorCanvas","autoFocus","className","renderAppender","styles","disableIframe","iframeProps","children","renderingMode","postContentAttributes","editedPostTemplate","wrapperBlockName","wrapperUniqueId","deviceType","useSelect","select","getCurrentPostId","getCurrentPostType","getCurrentTemplateId","getEditorSettings","getRenderingMode","getDeviceType","editorStore","getPostType","canUser","getEditedEntityRecord","coreStore","postTypeSlug","_renderingMode","_wrapperBlockName","editorSettings","supportsTemplateMode","postType","canEditTemplate","currentTemplateId","template","undefined","viewable","isCleanNewPost","hasRootPaddingAwareAlignments","themeHasDisabledLayoutStyles","themeSupportsLayout","_settings","blockEditorStore","getSettings","disableLayoutStyles","supportsLayout","__experimentalFeatures","useRootPaddingAwareAlignments","deviceStyles","useResizeCanvas","globalLayoutSettings","useSettings","fallbackLayout","useMemo","type","newestPostContentAttributes","content","parseableContent","parse","hasPostContentAtRootLevel","layout","align","postContentLayoutClasses","blockListLayoutClass","classnames","postContentLayoutStyles","postContentLayout","inherit","contentSize","wideSize","blockListLayout","postEditorLayout","observeTypingRef","useTypingObserver","titleRef","useRef","useEffect","current","focus","alignCSS","localRef","typewriterRef","useTypewriter","contentRef","useMergeRefs","filter","r","_react","createElement","shouldIframe","includes","height","style","Fragment","selector","css","contentEditable","ref","marginTop","default","__experimentalRecursionProvider","blockName","uniqueId","BlockList","toLowerCase","dropZoneElement","parentNode","_default","exports"],"sources":["@wordpress/editor/src/components/editor-canvas/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tstore as blockEditorStore,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tuseSettings,\n\t__experimentalRecursionProvider as RecursionProvider,\n\tprivateApis as blockEditorPrivateApis,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostTitle from '../post-title';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport EditTemplateBlocksNotification from './edit-template-blocks-notification';\n\nconst {\n\tLayoutStyle,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tExperimentalBlockCanvas: BlockCanvas,\n} = unlock( blockEditorPrivateApis );\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels,\n * and return its attributes.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction getPostContentAttributes( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ].attributes;\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = getPostContentAttributes(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction checkForPostContentAtRootLevel( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction EditorCanvas( {\n\t// Ideally as we unify post and site editors, we won't need these props.\n\tautoFocus,\n\tclassName,\n\trenderAppender,\n\tstyles,\n\tdisableIframe = false,\n\tiframeProps,\n\tchildren,\n} ) {\n\tconst {\n\t\trenderingMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tdeviceType,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostId,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentTemplateId,\n\t\t\tgetEditorSettings,\n\t\t\tgetRenderingMode,\n\t\t\tgetDeviceType,\n\t\t} = select( editorStore );\n\t\tconst { getPostType, canUser, getEditedEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst postTypeSlug = getCurrentPostType();\n\t\tconst _renderingMode = getRenderingMode();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( postTypeSlug === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _renderingMode === 'post-only' ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst postType = getPostType( postTypeSlug );\n\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\tconst currentTemplateId = getCurrentTemplateId();\n\t\tconst template = currentTemplateId\n\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tcurrentTemplateId\n\t\t\t )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\trenderingMode: _renderingMode,\n\t\t\tpostContentAttributes: getEditorSettings().postContentAttributes,\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tpostType?.viewable && supportsTemplateMode && canEditTemplate\n\t\t\t\t\t? template\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tdeviceType: getDeviceType(),\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst {\n\t\thasRootPaddingAwareAlignments,\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t} = useSelect( ( select ) => {\n\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\thasRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\n\t\t};\n\t}, [] );\n\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ globalLayoutSettings ] = useSettings( 'layout' );\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( renderingMode !== 'post-only' ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [ renderingMode, themeSupportsLayout, globalLayoutSettings ] );\n\n\tconst newestPostContentAttributes = useMemo( () => {\n\t\tif (\n\t\t\t! editedPostTemplate?.content &&\n\t\t\t! editedPostTemplate?.blocks &&\n\t\t\tpostContentAttributes\n\t\t) {\n\t\t\treturn postContentAttributes;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn getPostContentAttributes( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn getPostContentAttributes( parse( parseableContent ) ) || {};\n\t}, [\n\t\teditedPostTemplate?.content,\n\t\teditedPostTemplate?.blocks,\n\t\tpostContentAttributes,\n\t] );\n\n\tconst hasPostContentAtRootLevel = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn false;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn checkForPostContentAtRootLevel( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn (\n\t\t\tcheckForPostContentAtRootLevel( parse( parseableContent ) ) || false\n\t\t);\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst { layout = {}, align = '' } = newestPostContentAttributes || {};\n\n\tconst postContentLayoutClasses = useLayoutClasses(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content'\n\t);\n\n\tconst blockListLayoutClass = classnames(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses,\n\t\talign && `align${ align }`\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content',\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentAttributes\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst postEditorLayout =\n\t\tblockListLayout?.type === 'default' && ! hasPostContentAtRootLevel\n\t\t\t? fallbackLayout\n\t\t\t: blockListLayout;\n\n\tconst observeTypingRef = useTypingObserver();\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( ! autoFocus || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ autoFocus, isCleanNewPost ] );\n\n\t// Add some styles for alignwide/alignfull Post Content and its children.\n\tconst alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;\n\n\tconst localRef = useRef();\n\tconst typewriterRef = useTypewriter();\n\tconst contentRef = useMergeRefs(\n\t\t[\n\t\t\tlocalRef,\n\t\t\trenderingMode === 'post-only' ? typewriterRef : undefined,\n\t\t].filter( ( r ) => !! r )\n\t);\n\n\treturn (\n\t\t<BlockCanvas\n\t\t\tshouldIframe={\n\t\t\t\t! disableIframe || [ 'Tablet', 'Mobile' ].includes( deviceType )\n\t\t\t}\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyles={ styles }\n\t\t\theight=\"100%\"\n\t\t\tiframeProps={ {\n\t\t\t\t...iframeProps,\n\t\t\t\tstyle: {\n\t\t\t\t\t...iframeProps?.style,\n\t\t\t\t\t...deviceStyles,\n\t\t\t\t},\n\t\t\t} }\n\t\t>\n\t\t\t{ themeSupportsLayout &&\n\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\trenderingMode === 'post-only' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tselector=\".editor-editor-canvas__post-title-wrapper\"\n\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tselector=\".block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\tlayout={ postEditorLayout }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ align && <LayoutStyle css={ alignCSS } /> }\n\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t{ renderingMode === 'post-only' && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'editor-editor-canvas__post-title-wrapper',\n\t\t\t\t\t\t// The following class is only here for backward comapatibility\n\t\t\t\t\t\t// some themes might be using it to style the post title.\n\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-global-padding': hasRootPaddingAwareAlignments,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\tref={ observeTypingRef }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t// This is using inline styles\n\t\t\t\t\t\t// so it's applied for both iframed and non iframed editors.\n\t\t\t\t\t\tmarginTop: '4rem',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<RecursionProvider\n\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t>\n\t\t\t\t<BlockList\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t'is-' + deviceType.toLowerCase() + '-preview',\n\t\t\t\t\t\trenderingMode !== 'post-only'\n\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t) }\n\t\t\t\t\tlayout={ blockListLayout }\n\t\t\t\t\tdropZoneElement={\n\t\t\t\t\t\t// When iframed, pass in the html element of the iframe to\n\t\t\t\t\t\t// ensure the drop zone extends to the edges of the iframe.\n\t\t\t\t\t\tdisableIframe\n\t\t\t\t\t\t\t? localRef.current\n\t\t\t\t\t\t\t: localRef.current?.parentNode\n\t\t\t\t\t}\n\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t/>\n\t\t\t\t<EditTemplateBlocksNotification contentRef={ localRef } />\n\t\t\t</RecursionProvider>\n\t\t\t{ children }\n\t\t</BlockCanvas>\n\t);\n}\n\nexport default EditorCanvas;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAUA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA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