@wordpress/edit-post 6.15.0 → 6.16.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/header/main-dashboard-button/index.js +2 -2
- package/build/components/header/main-dashboard-button/index.js.map +1 -1
- package/build/components/visual-editor/index.js +83 -20
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/index.js +15 -10
- package/build/index.js.map +1 -1
- package/build-module/components/header/main-dashboard-button/index.js +3 -3
- package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +83 -21
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/index.js +15 -10
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +9 -0
- package/build-style/style.css +9 -0
- package/package.json +27 -27
- package/src/components/header/main-dashboard-button/index.js +3 -3
- package/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap +37 -1
- package/src/components/sidebar/plugin-post-publish-panel/test/index.js +8 -6
- package/src/components/visual-editor/index.js +117 -21
- package/src/index.js +20 -16
- package/src/style.scss +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -23,8 +23,8 @@ const Slot = _ref => {
|
|
|
23
23
|
let {
|
|
24
24
|
children
|
|
25
25
|
} = _ref;
|
|
26
|
-
const
|
|
27
|
-
const hasFills = Boolean(
|
|
26
|
+
const fills = (0, _components.__experimentalUseSlotFills)(slotName);
|
|
27
|
+
const hasFills = Boolean(fills && fills.length);
|
|
28
28
|
|
|
29
29
|
if (!hasFills) {
|
|
30
30
|
return children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/main-dashboard-button/index.js"],"names":["slotName","Fill","Slot","MainDashboardButtonSlot","MainDashboardButton","children","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/main-dashboard-button/index.js"],"names":["slotName","Fill","Slot","MainDashboardButtonSlot","MainDashboardButton","children","fills","hasFills","Boolean","length"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAMA,MAAMA,QAAQ,GAAG,mCAAjB;AAEA,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,IAAI,EAAEC;AAAd,IAA0C,gCAAgBH,QAAhB,CAAhD;AAEA,MAAMI,mBAAmB,GAAGH,IAA5B;;AAEA,MAAMC,IAAI,GAAG,QAAoB;AAAA,MAAlB;AAAEG,IAAAA;AAAF,GAAkB;AAChC,QAAMC,KAAK,GAAG,4CAAcN,QAAd,CAAd;AACA,QAAMO,QAAQ,GAAGC,OAAO,CAAEF,KAAK,IAAIA,KAAK,CAACG,MAAjB,CAAxB;;AAEA,MAAK,CAAEF,QAAP,EAAkB;AACjB,WAAOF,QAAP;AACA;;AAED,SAAO,4BAAC,uBAAD;AAAyB,IAAA,gBAAgB;AAAzC,IAAP;AACA,CATD;;AAWAD,mBAAmB,CAACF,IAApB,GAA2BA,IAA3B;eAEeE,mB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseSlotFills as useSlotFills,\n\tcreateSlotFill,\n} from '@wordpress/components';\n\nconst slotName = '__experimentalMainDashboardButton';\n\nconst { Fill, Slot: MainDashboardButtonSlot } = createSlotFill( slotName );\n\nconst MainDashboardButton = Fill;\n\nconst Slot = ( { children } ) => {\n\tconst fills = useSlotFills( slotName );\n\tconst hasFills = Boolean( fills && fills.length );\n\n\tif ( ! hasFills ) {\n\t\treturn children;\n\t}\n\n\treturn <MainDashboardButtonSlot bubblesVirtually />;\n};\n\nMainDashboardButton.Slot = Slot;\n\nexport default MainDashboardButton;\n"]}
|
|
@@ -25,6 +25,8 @@ var _icons = require("@wordpress/icons");
|
|
|
25
25
|
|
|
26
26
|
var _i18n = require("@wordpress/i18n");
|
|
27
27
|
|
|
28
|
+
var _blocks = require("@wordpress/blocks");
|
|
29
|
+
|
|
28
30
|
var _blockInspectorButton = _interopRequireDefault(require("./block-inspector-button"));
|
|
29
31
|
|
|
30
32
|
var _store = require("../../store");
|
|
@@ -80,8 +82,35 @@ function MaybeIframe(_ref) {
|
|
|
80
82
|
name: "editor-canvas"
|
|
81
83
|
}, children);
|
|
82
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Given an array of nested blocks, find the first Post Content
|
|
87
|
+
* block inside it, recursing through any nesting levels.
|
|
88
|
+
*
|
|
89
|
+
* @param {Array} blocks A list of blocks.
|
|
90
|
+
*
|
|
91
|
+
* @return {Object} The Post Content block.
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
function findPostContent(blocks) {
|
|
96
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
97
|
+
if (blocks[i].name === 'core/post-content') {
|
|
98
|
+
return blocks[i];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (blocks[i].innerBlocks.length) {
|
|
102
|
+
const nestedPostContent = findPostContent(blocks[i].innerBlocks);
|
|
103
|
+
|
|
104
|
+
if (nestedPostContent) {
|
|
105
|
+
return nestedPostContent;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
83
110
|
|
|
84
111
|
function VisualEditor(_ref2) {
|
|
112
|
+
var _postContentBlock$att;
|
|
113
|
+
|
|
85
114
|
let {
|
|
86
115
|
styles
|
|
87
116
|
} = _ref2;
|
|
@@ -89,17 +118,20 @@ function VisualEditor(_ref2) {
|
|
|
89
118
|
deviceType,
|
|
90
119
|
isWelcomeGuideVisible,
|
|
91
120
|
isTemplateMode,
|
|
121
|
+
editedPostTemplate = {},
|
|
92
122
|
wrapperBlockName,
|
|
93
123
|
wrapperUniqueId
|
|
94
124
|
} = (0, _data.useSelect)(select => {
|
|
95
125
|
const {
|
|
96
126
|
isFeatureActive,
|
|
97
127
|
isEditingTemplate,
|
|
98
|
-
__experimentalGetPreviewDeviceType
|
|
128
|
+
__experimentalGetPreviewDeviceType,
|
|
129
|
+
getEditedPostTemplate
|
|
99
130
|
} = select(_store.store);
|
|
100
131
|
const {
|
|
101
132
|
getCurrentPostId,
|
|
102
|
-
getCurrentPostType
|
|
133
|
+
getCurrentPostType,
|
|
134
|
+
getEditorSettings
|
|
103
135
|
} = select(_editor.store);
|
|
104
136
|
|
|
105
137
|
const _isTemplateMode = isEditingTemplate();
|
|
@@ -112,10 +144,14 @@ function VisualEditor(_ref2) {
|
|
|
112
144
|
_wrapperBlockName = 'core/post-content';
|
|
113
145
|
}
|
|
114
146
|
|
|
147
|
+
const supportsTemplateMode = getEditorSettings().supportsTemplateMode;
|
|
115
148
|
return {
|
|
116
149
|
deviceType: __experimentalGetPreviewDeviceType(),
|
|
117
150
|
isWelcomeGuideVisible: isFeatureActive('welcomeGuide'),
|
|
118
151
|
isTemplateMode: _isTemplateMode,
|
|
152
|
+
// Post template fetch returns a 404 on classic themes, which
|
|
153
|
+
// messes with e2e tests, so we check it's a block theme first.
|
|
154
|
+
editedPostTemplate: supportsTemplateMode ? getEditedPostTemplate() : {},
|
|
119
155
|
wrapperBlockName: _wrapperBlockName,
|
|
120
156
|
wrapperUniqueId: getCurrentPostId()
|
|
121
157
|
};
|
|
@@ -128,18 +164,14 @@ function VisualEditor(_ref2) {
|
|
|
128
164
|
themeHasDisabledLayoutStyles,
|
|
129
165
|
themeSupportsLayout,
|
|
130
166
|
assets,
|
|
131
|
-
useRootPaddingAwareAlignments,
|
|
132
167
|
isFocusMode
|
|
133
168
|
} = (0, _data.useSelect)(select => {
|
|
134
|
-
var _settings$__experimen;
|
|
135
|
-
|
|
136
169
|
const _settings = select(_blockEditor.store).getSettings();
|
|
137
170
|
|
|
138
171
|
return {
|
|
139
172
|
themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
|
|
140
173
|
themeSupportsLayout: _settings.supportsLayout,
|
|
141
174
|
assets: _settings.__unstableResolvedAssets,
|
|
142
|
-
useRootPaddingAwareAlignments: (_settings$__experimen = _settings.__experimentalFeatures) === null || _settings$__experimen === void 0 ? void 0 : _settings$__experimen.useRootPaddingAwareAlignments,
|
|
143
175
|
isFocusMode: _settings.focusMode
|
|
144
176
|
};
|
|
145
177
|
}, []);
|
|
@@ -165,7 +197,7 @@ function VisualEditor(_ref2) {
|
|
|
165
197
|
borderBottom: 0
|
|
166
198
|
};
|
|
167
199
|
const resizedCanvasStyles = (0, _blockEditor.__experimentalUseResizeCanvas)(deviceType, isTemplateMode);
|
|
168
|
-
const
|
|
200
|
+
const globalLayoutSettings = (0, _blockEditor.useSetting)('layout');
|
|
169
201
|
const previewMode = 'is-' + deviceType.toLowerCase() + '-preview';
|
|
170
202
|
let animatedStyles = isTemplateMode ? templateModeStyles : desktopCanvasStyles;
|
|
171
203
|
|
|
@@ -182,8 +214,10 @@ function VisualEditor(_ref2) {
|
|
|
182
214
|
|
|
183
215
|
const ref = (0, _element.useRef)();
|
|
184
216
|
const contentRef = (0, _compose.useMergeRefs)([ref, (0, _blockEditor.__unstableUseClipboardHandler)(), (0, _blockEditor.__unstableUseTypewriter)(), (0, _blockEditor.__unstableUseTypingObserver)(), (0, _blockEditor.__unstableUseBlockSelectionClearer)()]);
|
|
185
|
-
const blockSelectionClearerRef = (0, _blockEditor.__unstableUseBlockSelectionClearer)();
|
|
186
|
-
|
|
217
|
+
const blockSelectionClearerRef = (0, _blockEditor.__unstableUseBlockSelectionClearer)(); // fallbackLayout is used if there is no Post Content,
|
|
218
|
+
// and for Post Title.
|
|
219
|
+
|
|
220
|
+
const fallbackLayout = (0, _element.useMemo)(() => {
|
|
187
221
|
if (isTemplateMode) {
|
|
188
222
|
return {
|
|
189
223
|
type: 'default'
|
|
@@ -193,7 +227,7 @@ function VisualEditor(_ref2) {
|
|
|
193
227
|
if (themeSupportsLayout) {
|
|
194
228
|
// We need to ensure support for wide and full alignments,
|
|
195
229
|
// so we add the constrained type.
|
|
196
|
-
return { ...
|
|
230
|
+
return { ...globalLayoutSettings,
|
|
197
231
|
type: 'constrained'
|
|
198
232
|
};
|
|
199
233
|
} // Set default layout for classic themes so all alignments are supported.
|
|
@@ -202,12 +236,37 @@ function VisualEditor(_ref2) {
|
|
|
202
236
|
return {
|
|
203
237
|
type: 'default'
|
|
204
238
|
};
|
|
205
|
-
}, [isTemplateMode, themeSupportsLayout,
|
|
239
|
+
}, [isTemplateMode, themeSupportsLayout, globalLayoutSettings]);
|
|
240
|
+
const postContentBlock = (0, _element.useMemo)(() => {
|
|
241
|
+
// When in template editing mode, we can access the blocks directly.
|
|
242
|
+
if (editedPostTemplate !== null && editedPostTemplate !== void 0 && editedPostTemplate.blocks) {
|
|
243
|
+
return findPostContent(editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.blocks);
|
|
244
|
+
} // If there are no blocks, we have to parse the content string.
|
|
245
|
+
// Best double-check it's a string otherwise the parse function gets unhappy.
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
const parseableContent = typeof (editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.content) === 'string' ? editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.content : '';
|
|
249
|
+
return findPostContent((0, _blocks.parse)(parseableContent)) || {};
|
|
250
|
+
}, [editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.content, editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.blocks]);
|
|
251
|
+
const postContentLayoutClasses = (0, _blockEditor.__experimentaluseLayoutClasses)(postContentBlock);
|
|
206
252
|
const blockListLayoutClass = (0, _classnames.default)({
|
|
207
|
-
'is-layout-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
253
|
+
'is-layout-flow': !themeSupportsLayout
|
|
254
|
+
}, themeSupportsLayout && postContentLayoutClasses);
|
|
255
|
+
const postContentLayoutStyles = (0, _blockEditor.__experimentaluseLayoutStyles)(postContentBlock, '.block-editor-block-list__layout.is-root-container');
|
|
256
|
+
const layout = (postContentBlock === null || postContentBlock === void 0 ? void 0 : (_postContentBlock$att = postContentBlock.attributes) === null || _postContentBlock$att === void 0 ? void 0 : _postContentBlock$att.layout) || {}; // Update type for blocks using legacy layouts.
|
|
257
|
+
|
|
258
|
+
const postContentLayout = (0, _element.useMemo)(() => {
|
|
259
|
+
return layout && ((layout === null || layout === void 0 ? void 0 : layout.type) === 'constrained' || layout !== null && layout !== void 0 && layout.inherit || layout !== null && layout !== void 0 && layout.contentSize || layout !== null && layout !== void 0 && layout.wideSize) ? { ...globalLayoutSettings,
|
|
260
|
+
...layout,
|
|
261
|
+
type: 'constrained'
|
|
262
|
+
} : { ...globalLayoutSettings,
|
|
263
|
+
...layout,
|
|
264
|
+
type: 'default'
|
|
265
|
+
};
|
|
266
|
+
}, [layout === null || layout === void 0 ? void 0 : layout.type, layout === null || layout === void 0 ? void 0 : layout.inherit, layout === null || layout === void 0 ? void 0 : layout.contentSize, layout === null || layout === void 0 ? void 0 : layout.wideSize, globalLayoutSettings]); // If there is a Post Content block we use its layout for the block list;
|
|
267
|
+
// if not, this must be a classic theme, in which case we use the fallback layout.
|
|
268
|
+
|
|
269
|
+
const blockListLayout = postContentBlock ? postContentLayout : fallbackLayout;
|
|
211
270
|
const titleRef = (0, _element.useRef)();
|
|
212
271
|
(0, _element.useEffect)(() => {
|
|
213
272
|
var _titleRef$current;
|
|
@@ -248,11 +307,15 @@ function VisualEditor(_ref2) {
|
|
|
248
307
|
style: {
|
|
249
308
|
paddingBottom
|
|
250
309
|
}
|
|
251
|
-
}, themeSupportsLayout && !themeHasDisabledLayoutStyles && !isTemplateMode && (0, _element.createElement)(_blockEditor.__experimentalLayoutStyle, {
|
|
310
|
+
}, themeSupportsLayout && !themeHasDisabledLayoutStyles && !isTemplateMode && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.__experimentalLayoutStyle, {
|
|
252
311
|
selector: ".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container",
|
|
253
|
-
layout:
|
|
254
|
-
layoutDefinitions:
|
|
255
|
-
}),
|
|
312
|
+
layout: fallbackLayout,
|
|
313
|
+
layoutDefinitions: globalLayoutSettings === null || globalLayoutSettings === void 0 ? void 0 : globalLayoutSettings.definitions
|
|
314
|
+
}), postContentLayoutStyles && (0, _element.createElement)(_blockEditor.__experimentalLayoutStyle, {
|
|
315
|
+
layout: postContentLayout,
|
|
316
|
+
css: postContentLayoutStyles,
|
|
317
|
+
layoutDefinitions: globalLayoutSettings === null || globalLayoutSettings === void 0 ? void 0 : globalLayoutSettings.definitions
|
|
318
|
+
})), !isTemplateMode && (0, _element.createElement)("div", {
|
|
256
319
|
className: (0, _classnames.default)('edit-post-visual-editor__post-title-wrapper', {
|
|
257
320
|
'is-focus-mode': isFocusMode
|
|
258
321
|
}),
|
|
@@ -265,7 +328,7 @@ function VisualEditor(_ref2) {
|
|
|
265
328
|
}, (0, _element.createElement)(_blockEditor.BlockList, {
|
|
266
329
|
className: isTemplateMode ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.
|
|
267
330
|
,
|
|
268
|
-
__experimentalLayout:
|
|
331
|
+
__experimentalLayout: blockListLayout
|
|
269
332
|
}))))), (0, _element.createElement)(_blockEditor.__unstableBlockSettingsMenuFirstItem, null, _ref3 => {
|
|
270
333
|
let {
|
|
271
334
|
onClose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["MaybeIframe","children","contentRef","shouldIframe","styles","assets","style","ref","flex","width","height","display","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","wrapperBlockName","wrapperUniqueId","select","isFeatureActive","isEditingTemplate","__experimentalGetPreviewDeviceType","editPostStore","getCurrentPostId","getCurrentPostType","editorStore","_isTemplateMode","_wrapperBlockName","isCleanNewPost","hasMetaBoxes","themeHasDisabledLayoutStyles","themeSupportsLayout","useRootPaddingAwareAlignments","isFocusMode","_settings","blockEditorStore","getSettings","disableLayoutStyles","supportsLayout","__unstableResolvedAssets","__experimentalFeatures","focusMode","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","defaultLayout","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","layout","type","blockListLayoutClass","titleRef","current","focus","padding","arrowLeft","definitions","onClose"],"mappings":";;;;;;;;;AA+BA;;AA5BA;;AAKA;;AAKA;;AAmBA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AA1CA;AACA;AACA;;AAGA;AACA;AACA;;AA+BA;AACA;AACA;AAIA,SAASA,WAAT,OAOI;AAAA,MAPkB;AACrBC,IAAAA,QADqB;AAErBC,IAAAA,UAFqB;AAGrBC,IAAAA,YAHqB;AAIrBC,IAAAA,MAJqB;AAKrBC,IAAAA,MALqB;AAMrBC,IAAAA;AANqB,GAOlB;AACH,QAAMC,GAAG,GAAG,qDAAZ;;AAEA,MAAK,CAAEJ,YAAP,EAAsB;AACrB,WACC,qDACC,4BAAC,mCAAD;AAAc,MAAA,MAAM,EAAGC;AAAvB,MADD,EAEC,4BAAC,wBAAD;AACC,MAAA,GAAG,EAAGF,UADP;AAEC,MAAA,SAAS,EAAC,uBAFX;AAGC,MAAA,KAAK,EAAG;AAAEM,QAAAA,IAAI,EAAE,GAAR;AAAa,WAAGF;AAAhB,OAHT;AAIC,MAAA,QAAQ,EAAG,CAAC;AAJb,OAMGL,QANH,CAFD,CADD;AAaA;;AAED,SACC,4BAAC,6BAAD;AACC,IAAA,IAAI,EAAG,4BAAC,mCAAD;AAAc,MAAA,MAAM,EAAGG;AAAvB,MADR;AAEC,IAAA,MAAM,EAAGC,MAFV;AAGC,IAAA,GAAG,EAAGE,GAHP;AAIC,IAAA,UAAU,EAAGL,UAJd;AAKC,IAAA,KAAK,EAAG;AAAEO,MAAAA,KAAK,EAAE,MAAT;AAAiBC,MAAAA,MAAM,EAAE,MAAzB;AAAiCC,MAAAA,OAAO,EAAE;AAA1C,KALT;AA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CADb;AAOC,IAAA,eAAe,EAAG;AAPnB,KASC,4BAAC,iBAAD;AAAW,IAAA,GAAG,EAAG6B;AAAjB,IATD,CAvBF,EAmCC,4BAAC,4CAAD;AACC,IAAA,SAAS,EAAG9C,gBADb;AAEC,IAAA,QAAQ,EAAGC;AAFZ,KAIC,4BAAC,sBAAD;AACC,IAAA,SAAS,EACRF,cAAc,GACX,gBADW,GAEV,GAAG8C,oBAAsB,wBAHrB,CAG6C;AAJvD;AAMC,IAAA,oBAAoB,EAAGF;AANxB,IAJD,CAnCD,CALD,CAnBD,CAPD,EAkFC,4BAAC,iDAAD,QACG;AAAA,QAAE;AAAES,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,6BAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CAlFD,CADD;AA0FA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalRecursionProvider as RecursionProvider,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from './block-inspector-button';\nimport { store as editPostStore } from '../../store';\n\nfunction MaybeIframe( {\n\tchildren,\n\tcontentRef,\n\tshouldIframe,\n\tstyles,\n\tassets,\n\tstyle,\n} ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\thead={ <EditorStyles styles={ styles } /> }\n\t\t\tassets={ assets }\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t\tname=\"editor-canvas\"\n\t\t>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst {\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t\tassets,\n\t\tuseRootPaddingAwareAlignments,\n\t\tisFocusMode,\n\t} = useSelect( ( select ) => {\n\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\tassets: _settings.__unstableResolvedAssets,\n\t\t\tuseRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\n\t\t\tisFocusMode: _settings.focusMode,\n\t\t};\n\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst defaultLayout = useSetting( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\tconst layout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...defaultLayout, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [ isTemplateMode, themeSupportsLayout, defaultLayout ] );\n\n\tconst blockListLayoutClass = classnames( {\n\t\t'is-layout-constrained': themeSupportsLayout,\n\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t'has-global-padding': useRootPaddingAwareAlignments,\n\t} );\n\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible, isCleanNewPost ] );\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : '0',\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\tassets={ assets }\n\t\t\t\t\t\tstyle={ { paddingBottom } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\t\t! isTemplateMode && (\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\tdefaultLayout?.definitions\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__experimentalLayout={ layout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</MaybeIframe>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</BlockTools>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["MaybeIframe","children","contentRef","shouldIframe","styles","assets","style","ref","flex","width","height","display","findPostContent","blocks","i","length","name","innerBlocks","nestedPostContent","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","editedPostTemplate","wrapperBlockName","wrapperUniqueId","select","isFeatureActive","isEditingTemplate","__experimentalGetPreviewDeviceType","getEditedPostTemplate","editPostStore","getCurrentPostId","getCurrentPostType","getEditorSettings","editorStore","_isTemplateMode","_wrapperBlockName","supportsTemplateMode","isCleanNewPost","hasMetaBoxes","themeHasDisabledLayoutStyles","themeSupportsLayout","isFocusMode","_settings","blockEditorStore","getSettings","disableLayoutStyles","supportsLayout","__unstableResolvedAssets","focusMode","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","globalLayoutSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","fallbackLayout","type","postContentBlock","parseableContent","content","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","layout","attributes","postContentLayout","inherit","contentSize","wideSize","blockListLayout","titleRef","current","focus","padding","arrowLeft","definitions","onClose"],"mappings":";;;;;;;;;AAiCA;;AA9BA;;AAKA;;AAKA;;AAqBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AA7CA;AACA;AACA;;AAGA;AACA;AACA;;AAkCA;AACA;AACA;AAIA,SAASA,WAAT,OAOI;AAAA,MAPkB;AACrBC,IAAAA,QADqB;AAErBC,IAAAA,UAFqB;AAGrBC,IAAAA,YAHqB;AAIrBC,IAAAA,MAJqB;AAKrBC,IAAAA,MALqB;AAMrBC,IAAAA;AANqB,GAOlB;AACH,QAAMC,GAAG,GAAG,qDAAZ;;AAEA,MAAK,CAAEJ,YAAP,EAAsB;AACrB,WACC,qDACC,4BAAC,mCAAD;AAAc,MAAA,MAAM,EAAGC;AAAvB,MADD,EAEC,4BAAC,wBAAD;AACC,MAAA,GAAG,EAAGF,UADP;AAEC,MAAA,SAAS,EAA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d;AAOC,IAAA,MAAM,EAAGE,MAPV;AAQC,IAAA,MAAM,EAAGC,MARV;AASC,IAAA,KAAK,EAAG;AAAE6D,MAAAA;AAAF;AATT,KAWGxB,mBAAmB,IACpB,CAAED,4BADD,IAED,CAAEnB,cAFD,IAGA,qDACC,4BAAC,sCAAD;AACC,IAAA,QAAQ,EAAC,kGADV;AAEC,IAAA,MAAM,EAAG8C,cAFV;AAGC,IAAA,iBAAiB,EAChBN,oBADgB,aAChBA,oBADgB,uBAChBA,oBAAoB,CAAE0B;AAJxB,IADD,EAQGb,uBAAuB,IACxB,4BAAC,sCAAD;AACC,IAAA,MAAM,EAAGG,iBADV;AAEC,IAAA,GAAG,EAAGH,uBAFP;AAGC,IAAA,iBAAiB,EAChBb,oBADgB,aAChBA,oBADgB,uBAChBA,oBAAoB,CAAE0B;AAJxB,IATF,CAdH,EAiCG,CAAElE,cAAF,IACD;AACC,IAAA,SAAS,EAAG,yBACX,6CADW,EAEX;AACC,uBAAiBqB;AADlB,KAFW,CADb;AAOC,IAAA,eAAe,EAAG;AAPnB,KASC,4BAAC,iBAAD;AAAW,IAAA,GAAG,EAAGwC;AAAjB,IATD,CAlCF,EA8CC,4BAAC,4CAAD;AACC,IAAA,SAAS,EAAG3D,gBADb;AAEC,IAAA,QAAQ,EAAGC;AAFZ,KAIC,4BAAC,sBAAD;AACC,IAAA,SAAS,EACRH,cAAc,GACX,gBADW,GAEV,GAAGoD,oBAAsB,wBAHrB,CAG6C;AAJvD;AAMC,IAAA,oBAAoB,EAAGQ;AANxB,IAJD,CA9CD,CALD,CAnBD,CAPD,EA6FC,4BAAC,iDAAD,QACG;AAAA,QAAE;AAAEO,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,6BAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CA7FD,CADD;AAqGA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentaluseLayoutClasses as useLayoutClasses,\n\t__experimentaluseLayoutStyles as useLayoutStyles,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from './block-inspector-button';\nimport { store as editPostStore } from '../../store';\n\nfunction MaybeIframe( {\n\tchildren,\n\tcontentRef,\n\tshouldIframe,\n\tstyles,\n\tassets,\n\tstyle,\n} ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\thead={ <EditorStyles styles={ styles } /> }\n\t\t\tassets={ assets }\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t\tname=\"editor-canvas\"\n\t\t>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object} The Post Content block.\n */\nfunction findPostContent( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ];\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = findPostContent(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetEditedPostTemplate,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst supportsTemplateMode = getEditorSettings().supportsTemplateMode;\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so we check it's a block theme first.\n\t\t\teditedPostTemplate: supportsTemplateMode\n\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t: {},\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst {\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t\tassets,\n\t\tisFocusMode,\n\t} = useSelect( ( select ) => {\n\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\tassets: _settings.__unstableResolvedAssets,\n\t\t\tisFocusMode: _settings.focusMode,\n\t\t};\n\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst globalLayoutSettings = useSetting( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [ isTemplateMode, themeSupportsLayout, globalLayoutSettings ] );\n\n\tconst postContentBlock = useMemo( () => {\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn findPostContent( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn findPostContent( parse( parseableContent ) ) || {};\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst postContentLayoutClasses = useLayoutClasses( postContentBlock );\n\n\tconst blockListLayoutClass = classnames(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tpostContentBlock,\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\tconst layout = postContentBlock?.attributes?.layout || {};\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentBlock\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible, isCleanNewPost ] );\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : '0',\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\tassets={ assets }\n\t\t\t\t\t\tstyle={ { paddingBottom } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\t\t! isTemplateMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__experimentalLayout={ blockListLayout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</MaybeIframe>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</BlockTools>\n\t);\n}\n"]}
|
package/build/index.js
CHANGED
|
@@ -161,15 +161,6 @@ function reinitializeEditor(postType, postId, target, settings, initialEdits) {
|
|
|
161
161
|
|
|
162
162
|
|
|
163
163
|
function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|
164
|
-
// Prevent adding template part in the post editor.
|
|
165
|
-
// Only add the filter when the post editor is initialized, not imported.
|
|
166
|
-
(0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (can, blockType) => {
|
|
167
|
-
if (!(0, _data.select)(_store.store).isEditingTemplate() && blockType.name === 'core/template-part') {
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return can;
|
|
172
|
-
});
|
|
173
164
|
const target = document.getElementById(id);
|
|
174
165
|
const reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
|
|
175
166
|
(0, _data.dispatch)(_preferences.store).setDefaults('core/edit-post', {
|
|
@@ -202,8 +193,22 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|
|
202
193
|
(0, _blockLibrary.__experimentalRegisterExperimentalCoreBlocks)({
|
|
203
194
|
enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks
|
|
204
195
|
});
|
|
205
|
-
}
|
|
196
|
+
}
|
|
197
|
+
/*
|
|
198
|
+
* Prevent adding template part in the post editor.
|
|
199
|
+
* Only add the filter when the post editor is initialized, not imported.
|
|
200
|
+
* Also only add the filter(s) after registerCoreBlocks()
|
|
201
|
+
* so that common filters in the block library are not overwritten.
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
(0, _hooks.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => {
|
|
206
|
+
if (!(0, _data.select)(_store.store).isEditingTemplate() && blockType.name === 'core/template-part') {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
206
209
|
|
|
210
|
+
return canInsert;
|
|
211
|
+
}); // Show a console log warning if the browser is not in Standards rendering mode.
|
|
207
212
|
|
|
208
213
|
const documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';
|
|
209
214
|
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/index.js"],"names":["reinitializeEditor","postType","postId","target","settings","initialEdits","reboot","bind","initializeEditor","id","can","blockType","editPostStore","isEditingTemplate","name","document","getElementById","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","themeStyles","welcomeGuide","welcomeGuideTemplate","blocksStore","__experimentalReapplyBlockTypeFilters","isFeatureActive","setIsListViewOpened","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;AALA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAgLA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA5MA;AACA;AACA;;AAWA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAT,CACNC,QADM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jD,MAAN,KAAiBY,QAAtB,EAAiC;AAChC;AACA;AACA,YAAKgC,MAAM,CAACQ,OAAP,GAAiB,GAAtB,EAA4B;AAC3BF,UAAAA,qBAAqB,CAACG,SAAtB,GACCH,qBAAqB,CAACG,SAAtB,GAAkCT,MAAM,CAACQ,OAD1C;AAEA,SAN+B,CAOhC;;;AACA,YACCxC,QAAQ,CAACuC,sBAAT,CAAiC,gBAAjC,EAAqD,CAArD,CADD,EAEE;AACDP,UAAAA,MAAM,CAACU,QAAP,CAAiB,CAAjB,EAAoB,CAApB;AACA;AACD;AACD,KAlBD;AAmBA,GAhGA,CAkGD;;;AACAV,EAAAA,MAAM,CAACI,gBAAP,CAAyB,UAAzB,EAAuCO,CAAF,IAASA,CAAC,CAACC,cAAF,EAA9C,EAAkE,KAAlE;AACAZ,EAAAA,MAAM,CAACI,gBAAP,CAAyB,MAAzB,EAAmCO,CAAF,IAASA,CAAC,CAACC,cAAF,EAA1C,EAA8D,KAA9D;AAEA,uBACC,4BAAC,eAAD;AACC,IAAA,QAAQ,EAAGvD,QADZ;AAEC,IAAA,OAAO,EAAGE,MAFX;AAGC,IAAA,MAAM,EAAGJ,MAHV;AAIC,IAAA,QAAQ,EAAGD,QAJZ;AAKC,IAAA,YAAY,EAAGI;AALhB,IADD,EAQCF,MARD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function reinitializeEditor(\n\tpostType,\n\tpostId,\n\ttarget,\n\tsettings,\n\tinitialEdits\n) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind(\n\t\tnull,\n\t\tpostType,\n\t\tpostId,\n\t\ttarget,\n\t\tsettings,\n\t\tinitialEdits\n\t);\n\n\trender(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tonError={ reboot }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t\trecovery\n\t\t/>,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\t// Prevent adding template part in the post editor.\n\t// Only add the filter when the post editor is initialized, not imported.\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( can, blockType ) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn can;\n\t\t}\n\t);\n\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind(\n\t\tnull,\n\t\tpostType,\n\t\tpostId,\n\t\ttarget,\n\t\tsettings,\n\t\tinitialEdits\n\t);\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\tif ( select( editPostStore ).isFeatureActive( 'showListViewByDefault' ) ) {\n\t\tdispatch( editPostStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\trender(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tonError={ reboot }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>,\n\t\ttarget\n\t);\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { store } from './store';\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/index.js"],"names":["reinitializeEditor","postType","postId","target","settings","initialEdits","reboot","bind","initializeEditor","id","document","getElementById","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","themeStyles","welcomeGuide","welcomeGuideTemplate","blocksStore","__experimentalReapplyBlockTypeFilters","editPostStore","isFeatureActive","setIsListViewOpened","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","__unstableEnableFullSiteEditingBlocks","canInsert","blockType","isEditingTemplate","name","documentMode","compatMode","console","warn","isIphone","window","navigator","userAgent","indexOf","addEventListener","event","editorScrollContainer","getElementsByClassName","scrollY","scrollTop","scrollTo","e","preventDefault"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;AALA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAoLA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAhNA;AACA;AACA;;AAWA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAT,CACNC,QADM,EAENC,MAFM,EAGNC,MAHM,EAINC,QAJM,EAKNC,YALM,EAML;AACD,uCAAwBF,MAAxB;AACA,QAAMG,MAAM,GAAGN,kBAAkB,CAACO,IAAnB,CACd,IADc,EAEdN,QAFc,EAGdC,MAHc,EAIdC,MAJc,EAKdC,QALc,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MAAM,CAACQ,OAD1C;AAEA,SAN+B,CAOhC;;;AACA,YACC7C,QAAQ,CAAC4C,sBAAT,CAAiC,gBAAjC,EAAqD,CAArD,CADD,EAEE;AACDP,UAAAA,MAAM,CAACU,QAAP,CAAiB,CAAjB,EAAoB,CAApB;AACA;AACD;AACD,KAlBD;AAmBA,GApGA,CAsGD;;;AACAV,EAAAA,MAAM,CAACI,gBAAP,CAAyB,UAAzB,EAAuCO,CAAF,IAASA,CAAC,CAACC,cAAF,EAA9C,EAAkE,KAAlE;AACAZ,EAAAA,MAAM,CAACI,gBAAP,CAAyB,MAAzB,EAAmCO,CAAF,IAASA,CAAC,CAACC,cAAF,EAA1C,EAA8D,KAA9D;AAEA,uBACC,4BAAC,eAAD;AACC,IAAA,QAAQ,EAAGvD,QADZ;AAEC,IAAA,OAAO,EAAGE,MAFX;AAGC,IAAA,MAAM,EAAGJ,MAHV;AAIC,IAAA,QAAQ,EAAGD,QAJZ;AAKC,IAAA,YAAY,EAAGI;AALhB,IADD,EAQCF,MARD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Object} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function reinitializeEditor(\n\tpostType,\n\tpostId,\n\ttarget,\n\tsettings,\n\tinitialEdits\n) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind(\n\t\tnull,\n\t\tpostType,\n\t\tpostId,\n\t\ttarget,\n\t\tsettings,\n\t\tinitialEdits\n\t);\n\n\trender(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tonError={ reboot }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t\trecovery\n\t\t/>,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes and returns an instance of Editor.\n *\n * @param {string} id Unique identifier for editor instance.\n * @param {string} postType Post type of the post to edit.\n * @param {Object} postId ID of the post to edit.\n * @param {?Object} settings Editor settings object.\n * @param {Object} initialEdits Programmatic edits to apply initially, to be\n * considered as non-user-initiated (bypass for\n * unsaved changes prompt).\n */\nexport function initializeEditor(\n\tid,\n\tpostType,\n\tpostId,\n\tsettings,\n\tinitialEdits\n) {\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind(\n\t\tnull,\n\t\tpostType,\n\t\tpostId,\n\t\ttarget,\n\t\tsettings,\n\t\tinitialEdits\n\t);\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-post', {\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfullscreenMode: true,\n\t\thiddenBlockTypes: [],\n\t\tinactivePanels: [],\n\t\tisPublishSidebarEnabled: true,\n\t\topenPanels: [ 'post-status' ],\n\t\tpreferredStyleVariations: {},\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowIconLabels: false,\n\t\tshowListViewByDefault: false,\n\t\tthemeStyles: true,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\n\t// Check if the block list view should be open by default.\n\tif ( select( editPostStore ).isFeatureActive( 'showListViewByDefault' ) ) {\n\t\tdispatch( editPostStore ).setIsListViewOpened( true );\n\t}\n\n\tregisterCoreBlocks();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,\n\t\t} );\n\t}\n\n\t/*\n\t * Prevent adding template part in the post editor.\n\t * Only add the filter when the post editor is initialized, not imported.\n\t * Also only add the filter(s) after registerCoreBlocks()\n\t * so that common filters in the block library are not overwritten.\n\t */\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'removeTemplatePartsFromInserter',\n\t\t( canInsert, blockType ) => {\n\t\t\tif (\n\t\t\t\t! select( editPostStore ).isEditingTemplate() &&\n\t\t\t\tblockType.name === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn canInsert;\n\t\t}\n\t);\n\n\t// Show a console log warning if the browser is not in Standards rendering mode.\n\tconst documentMode =\n\t\tdocument.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';\n\tif ( documentMode !== 'Standards' ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t\"Your browser is using Quirks Mode. \\nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.\"\n\t\t);\n\t}\n\n\t// This is a temporary fix for a couple of issues specific to Webkit on iOS.\n\t// Without this hack the browser scrolls the mobile toolbar off-screen.\n\t// Once supported in Safari we can replace this in favor of preventScroll.\n\t// For details see issue #18632 and PR #18686\n\t// Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.\n\t// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.\n\n\tconst isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;\n\tif ( isIphone ) {\n\t\twindow.addEventListener( 'scroll', ( event ) => {\n\t\t\tconst editorScrollContainer = document.getElementsByClassName(\n\t\t\t\t'interface-interface-skeleton__body'\n\t\t\t)[ 0 ];\n\t\t\tif ( event.target === document ) {\n\t\t\t\t// Scroll element into view by scrolling the editor container by the same amount\n\t\t\t\t// that Mobile Safari tried to scroll the html element upwards.\n\t\t\t\tif ( window.scrollY > 100 ) {\n\t\t\t\t\teditorScrollContainer.scrollTop =\n\t\t\t\t\t\teditorScrollContainer.scrollTop + window.scrollY;\n\t\t\t\t}\n\t\t\t\t// Undo unwanted scroll on html element, but only in the visual editor.\n\t\t\t\tif (\n\t\t\t\t\tdocument.getElementsByClassName( 'is-mode-visual' )[ 0 ]\n\t\t\t\t) {\n\t\t\t\t\twindow.scrollTo( 0, 0 );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\trender(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tonError={ reboot }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>,\n\t\ttarget\n\t);\n}\n\nexport { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';\nexport { default as PluginDocumentSettingPanel } from './components/sidebar/plugin-document-setting-panel';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\nexport { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';\nexport { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';\nexport { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';\nexport { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';\nexport { store } from './store';\n"]}
|
|
@@ -3,7 +3,7 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { __experimentalUseSlotFills as useSlotFills, createSlotFill } from '@wordpress/components';
|
|
7
7
|
const slotName = '__experimentalMainDashboardButton';
|
|
8
8
|
const {
|
|
9
9
|
Fill,
|
|
@@ -15,8 +15,8 @@ const Slot = _ref => {
|
|
|
15
15
|
let {
|
|
16
16
|
children
|
|
17
17
|
} = _ref;
|
|
18
|
-
const
|
|
19
|
-
const hasFills = Boolean(
|
|
18
|
+
const fills = useSlotFills(slotName);
|
|
19
|
+
const hasFills = Boolean(fills && fills.length);
|
|
20
20
|
|
|
21
21
|
if (!hasFills) {
|
|
22
22
|
return children;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/main-dashboard-button/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/main-dashboard-button/index.js"],"names":["__experimentalUseSlotFills","useSlotFills","createSlotFill","slotName","Fill","Slot","MainDashboardButtonSlot","MainDashboardButton","children","fills","hasFills","Boolean","length"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,0BAA0B,IAAIC,YAD/B,EAECC,cAFD,QAGO,uBAHP;AAKA,MAAMC,QAAQ,GAAG,mCAAjB;AAEA,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,IAAI,EAAEC;AAAd,IAA0CJ,cAAc,CAAEC,QAAF,CAA9D;AAEA,MAAMI,mBAAmB,GAAGH,IAA5B;;AAEA,MAAMC,IAAI,GAAG,QAAoB;AAAA,MAAlB;AAAEG,IAAAA;AAAF,GAAkB;AAChC,QAAMC,KAAK,GAAGR,YAAY,CAAEE,QAAF,CAA1B;AACA,QAAMO,QAAQ,GAAGC,OAAO,CAAEF,KAAK,IAAIA,KAAK,CAACG,MAAjB,CAAxB;;AAEA,MAAK,CAAEF,QAAP,EAAkB;AACjB,WAAOF,QAAP;AACA;;AAED,SAAO,cAAC,uBAAD;AAAyB,IAAA,gBAAgB;AAAzC,IAAP;AACA,CATD;;AAWAD,mBAAmB,CAACF,IAApB,GAA2BA,IAA3B;AAEA,eAAeE,mBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseSlotFills as useSlotFills,\n\tcreateSlotFill,\n} from '@wordpress/components';\n\nconst slotName = '__experimentalMainDashboardButton';\n\nconst { Fill, Slot: MainDashboardButtonSlot } = createSlotFill( slotName );\n\nconst MainDashboardButton = Fill;\n\nconst Slot = ( { children } ) => {\n\tconst fills = useSlotFills( slotName );\n\tconst hasFills = Boolean( fills && fills.length );\n\n\tif ( ! hasFills ) {\n\t\treturn children;\n\t}\n\n\treturn <MainDashboardButtonSlot bubblesVirtually />;\n};\n\nMainDashboardButton.Slot = Slot;\n\nexport default MainDashboardButton;\n"]}
|