@wordpress/edit-post 7.7.0 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +6 -15
- package/build/components/header/post-publish-button-or-toggle.js +1 -1
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +1 -2
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/visual-editor/index.js +23 -8
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/visual-editor/index.native.js +1 -38
- package/build/components/visual-editor/index.native.js.map +1 -1
- package/build/plugins/index.js +1 -1
- package/build/plugins/index.js.map +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -2
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/visual-editor/index.js +23 -8
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/index.native.js +1 -37
- package/build-module/components/visual-editor/index.native.js.map +1 -1
- package/build-module/plugins/index.js +1 -1
- package/build-module/plugins/index.js.map +1 -1
- package/build-style/style-rtl.css +1 -2
- package/build-style/style.css +1 -2
- package/package.json +30 -30
- package/src/components/header/post-publish-button-or-toggle.js +1 -1
- package/src/components/secondary-sidebar/list-view-sidebar.js +1 -2
- package/src/components/secondary-sidebar/style.scss +1 -2
- package/src/components/visual-editor/index.js +30 -13
- package/src/components/visual-editor/index.native.js +1 -36
- package/src/plugins/index.js +1 -1
|
@@ -146,16 +146,20 @@ export default function VisualEditor(_ref2) {
|
|
|
146
146
|
} = useSelect(editorStore);
|
|
147
147
|
const hasMetaBoxes = useSelect(select => select(editPostStore).hasMetaBoxes(), []);
|
|
148
148
|
const {
|
|
149
|
+
hasRootPaddingAwareAlignments,
|
|
150
|
+
isFocusMode,
|
|
149
151
|
themeHasDisabledLayoutStyles,
|
|
150
|
-
themeSupportsLayout
|
|
151
|
-
isFocusMode
|
|
152
|
+
themeSupportsLayout
|
|
152
153
|
} = useSelect(select => {
|
|
154
|
+
var _settings$__experimen;
|
|
155
|
+
|
|
153
156
|
const _settings = select(blockEditorStore).getSettings();
|
|
154
157
|
|
|
155
158
|
return {
|
|
156
159
|
themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
|
|
157
160
|
themeSupportsLayout: _settings.supportsLayout,
|
|
158
|
-
isFocusMode: _settings.focusMode
|
|
161
|
+
isFocusMode: _settings.focusMode,
|
|
162
|
+
hasRootPaddingAwareAlignments: (_settings$__experimen = _settings.__experimentalFeatures) === null || _settings$__experimen === void 0 ? void 0 : _settings$__experimen.useRootPaddingAwareAlignments
|
|
159
163
|
};
|
|
160
164
|
}, []);
|
|
161
165
|
const {
|
|
@@ -235,11 +239,14 @@ export default function VisualEditor(_ref2) {
|
|
|
235
239
|
const parseableContent = typeof (editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.content) === 'string' ? editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.content : '';
|
|
236
240
|
return getPostContentAttributes(parse(parseableContent)) || {};
|
|
237
241
|
}, [editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.content, editedPostTemplate === null || editedPostTemplate === void 0 ? void 0 : editedPostTemplate.blocks, postContentAttributes]);
|
|
238
|
-
const
|
|
242
|
+
const {
|
|
243
|
+
layout = {},
|
|
244
|
+
align = ''
|
|
245
|
+
} = newestPostContentAttributes || {};
|
|
239
246
|
const postContentLayoutClasses = useLayoutClasses(newestPostContentAttributes, 'core/post-content');
|
|
240
247
|
const blockListLayoutClass = classnames({
|
|
241
248
|
'is-layout-flow': !themeSupportsLayout
|
|
242
|
-
}, themeSupportsLayout && postContentLayoutClasses);
|
|
249
|
+
}, themeSupportsLayout && postContentLayoutClasses, align && `align${align}`);
|
|
243
250
|
const postContentLayoutStyles = useLayoutStyles(newestPostContentAttributes, 'core/post-content', '.block-editor-block-list__layout.is-root-container'); // Update type for blocks using legacy layouts.
|
|
244
251
|
|
|
245
252
|
const postContentLayout = useMemo(() => {
|
|
@@ -267,7 +274,12 @@ export default function VisualEditor(_ref2) {
|
|
|
267
274
|
styles = useMemo(() => [...styles, {
|
|
268
275
|
// We should move this in to future to the body.
|
|
269
276
|
css: `.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` + (paddingBottom ? `body{padding-bottom:${paddingBottom}}` : '')
|
|
270
|
-
}], [styles]);
|
|
277
|
+
}], [styles]); // Add some styles for alignwide/alignfull Post Content and its children.
|
|
278
|
+
|
|
279
|
+
const alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}
|
|
280
|
+
.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}
|
|
281
|
+
.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}
|
|
282
|
+
.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;
|
|
271
283
|
return createElement(BlockTools, {
|
|
272
284
|
__unstableContentRef: ref,
|
|
273
285
|
className: classnames('edit-post-visual-editor', {
|
|
@@ -298,14 +310,17 @@ export default function VisualEditor(_ref2) {
|
|
|
298
310
|
selector: ".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container",
|
|
299
311
|
layout: fallbackLayout,
|
|
300
312
|
layoutDefinitions: globalLayoutSettings === null || globalLayoutSettings === void 0 ? void 0 : globalLayoutSettings.definitions
|
|
313
|
+
}), align && createElement(LayoutStyle, {
|
|
314
|
+
css: alignCSS
|
|
301
315
|
}), postContentLayoutStyles && createElement(LayoutStyle, {
|
|
302
316
|
layout: postContentLayout,
|
|
303
317
|
css: postContentLayoutStyles,
|
|
304
318
|
layoutDefinitions: globalLayoutSettings === null || globalLayoutSettings === void 0 ? void 0 : globalLayoutSettings.definitions
|
|
305
319
|
})), !isTemplateMode && createElement("div", {
|
|
306
320
|
className: classnames('edit-post-visual-editor__post-title-wrapper', {
|
|
307
|
-
'is-focus-mode': isFocusMode
|
|
308
|
-
|
|
321
|
+
'is-focus-mode': isFocusMode,
|
|
322
|
+
'has-global-padding': hasRootPaddingAwareAlignments
|
|
323
|
+
}),
|
|
309
324
|
contentEditable: false
|
|
310
325
|
}, createElement(PostTitle, {
|
|
311
326
|
ref: titleRef
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["classnames","VisualEditorGlobalKeyboardShortcuts","PostTitle","store","editorStore","WritingFlow","BlockList","BlockTools","blockEditorStore","__unstableUseBlockSelectionClearer","useBlockSelectionClearer","__unstableUseTypewriter","useTypewriter","__unstableUseClipboardHandler","useClipboardHandler","__unstableUseTypingObserver","useTypingObserver","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","useSetting","__experimentalLayoutStyle","LayoutStyle","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","__unstableIframe","Iframe","__experimentalRecursionProvider","RecursionProvider","__experimentaluseLayoutClasses","useLayoutClasses","__experimentaluseLayoutStyles","useLayoutStyles","useEffect","useRef","useMemo","Button","__unstableMotion","motion","useSelect","useDispatch","useMergeRefs","arrowLeft","__","parse","coreStore","editPostStore","isGutenbergPlugin","process","env","IS_GUTENBERG_PLUGIN","MaybeIframe","children","contentRef","shouldIframe","styles","style","ref","flex","width","height","display","getPostContentAttributes","blocks","i","length","name","attributes","innerBlocks","nestedPostContent","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","postContentAttributes","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","select","isFeatureActive","isEditingTemplate","getEditedPostTemplate","__experimentalGetPreviewDeviceType","getCurrentPostId","getCurrentPostType","getEditorSettings","_isTemplateMode","_wrapperBlockName","editorSettings","supportsTemplateMode","canEditTemplate","canUser","undefined","__unstableIsBlockBasedTheme","isCleanNewPost","hasMetaBoxes","themeHasDisabledLayoutStyles","themeSupportsLayout","isFocusMode","_settings","getSettings","disableLayoutStyles","supportsLayout","focusMode","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","globalLayoutSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","fallbackLayout","type","newestPostContentAttributes","content","parseableContent","layout","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","postContentLayout","inherit","contentSize","wideSize","blockListLayout","titleRef","current","focus","css","padding","definitions"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,mCADD,EAECC,SAFD,EAGCC,KAAK,IAAIC,WAHV,QAIO,mBAJP;AAKA,SACCC,WADD,EAECC,SAFD,EAGCC,UAHD,EAICJ,KAAK,IAAIK,gBAJV,EAKCC,kCAAkC,IAAIC,wBALvC,EAMCC,uBAAuB,IAAIC,aAN5B,EAOCC,6BAA6B,IAAIC,mBAPlC,EAQCC,2BAA2B,IAAIC,iBARhC,EASCC,6BAA6B,IAAIC,eATlC,EAUCC,sBAAsB,IAAIC,YAV3B,EAWCC,UAXD,EAYCC,yBAAyB,IAAIC,WAZ9B,EAaCC,iCAAiC,IAAIC,uBAbtC,EAcCC,gBAAgB,IAAIC,MAdrB,EAeCC,+BAA+B,IAAIC,iBAfpC,EAgBCC,8BAA8B,IAAIC,gBAhBnC,EAiBCC,6BAA6B,IAAIC,eAjBlC,QAkBO,yBAlBP;AAmBA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,OAA5B,QAA2C,oBAA3C;AACA,SAASC,MAAT,EAAiBC,gBAAgB,IAAIC,MAArC,QAAmD,uBAAnD;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAv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,CAG6C;AAJvD;AAMC,IAAA,oBAAoB,EAAGM;AANxB,IAJD,CAhDD,CALD,CAnBD,CAPD,CADD;AAkGA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentaluseLayoutClasses as useLayoutClasses,\n\t__experimentaluseLayoutStyles as useLayoutStyles,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nconst isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;\n\nfunction MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\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<EditorStyles styles={ styles } />\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 * 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\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tisBlockBasedTheme,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\tgetEditedPostTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst canEditTemplate = select( coreStore ).canUser(\n\t\t\t'create',\n\t\t\t'templates'\n\t\t);\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\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\tsupportsTemplateMode && canEditTemplate\n\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst { themeHasDisabledLayoutStyles, themeSupportsLayout, isFocusMode } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\t\treturn {\n\t\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\t\tisFocusMode: _settings.focusMode,\n\t\t\t};\n\t\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst globalLayoutSettings = useSetting( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [ isTemplateMode, themeSupportsLayout, globalLayoutSettings ] );\n\n\tconst newestPostContentAttributes = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\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 layout = newestPostContentAttributes?.layout || {};\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);\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 titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible, isCleanNewPost ] );\n\n\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss:\n\t\t\t\t\t`.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` +\n\t\t\t\t\t( paddingBottom\n\t\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t\t: '' ),\n\t\t\t},\n\t\t],\n\t\t[ styles ]\n\t);\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : 0,\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\t( isGutenbergPlugin &&\n\t\t\t\t\t\t\t\tisBlockBasedTheme &&\n\t\t\t\t\t\t\t\t! hasMetaBoxes ) ||\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\t\t! isTemplateMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'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\t'is-layout-flow'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__experimentalLayout={ blockListLayout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</MaybeIframe>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t</BlockTools>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["classnames","VisualEditorGlobalKeyboardShortcuts","PostTitle","store","editorStore","WritingFlow","BlockList","BlockTools","blockEditorStore","__unstableUseBlockSelectionClearer","useBlockSelectionClearer","__unstableUseTypewriter","useTypewriter","__unstableUseClipboardHandler","useClipboardHandler","__unstableUseTypingObserver","useTypingObserver","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","useSetting","__experimentalLayoutStyle","LayoutStyle","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","__unstableIframe","Iframe","__experimentalRecursionProvider","RecursionProvider","__experimentaluseLayoutClasses","useLayoutClasses","__experimentaluseLayoutStyles","useLayoutStyles","useEffect","useRef","useMemo","Button","__unstableMotion","motion","useSelect","useDispatch","useMergeRefs","arrowLeft","__","parse","coreStore","editPostStore","isGutenbergPlugin","process","env","IS_GUTENBERG_PLUGIN","MaybeIframe","children","contentRef","shouldIframe","styles","style","ref","flex","width","height","display","getPostContentAttributes","blocks","i","length","name","attributes","innerBlocks","nestedPostContent","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","postContentAttributes","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","select","isFeatureActive","isEditingTemplate","getEditedPostTemplate","__experimentalGetPreviewDeviceType","getCurrentPostId","getCurrentPostType","getEditorSettings","_isTemplateMode","_wrapperBlockName","editorSettings","supportsTemplateMode","canEditTemplate","canUser","undefined","__unstableIsBlockBasedTheme","isCleanNewPost","hasMetaBoxes","hasRootPaddingAwareAlignments","isFocusMode","themeHasDisabledLayoutStyles","themeSupportsLayout","_settings","getSettings","disableLayoutStyles","supportsLayout","focusMode","__experimentalFeatures","useRootPaddingAwareAlignments","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","globalLayoutSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","fallbackLayout","type","newestPostContentAttributes","content","parseableContent","layout","align","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","postContentLayout","inherit","contentSize","wideSize","blockListLayout","titleRef","current","focus","css","alignCSS","padding","definitions"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAC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AKAA,UAAU,KAAK,QAPjB;AASC,IAAA,UAAU,EAAGlB,UATd;AAUC,IAAA,MAAM,EAAGE;AAVV,KAYG6C,mBAAmB,IACpB,CAAED,4BADD,IAED,CAAE1B,cAFD,IAGA,8BACC,cAAC,WAAD;AACC,IAAA,QAAQ,EAAC,kGADV;AAEC,IAAA,MAAM,EAAGoD,cAFV;AAGC,IAAA,iBAAiB,EAChBN,oBADgB,aAChBA,oBADgB,uBAChBA,oBAAoB,CAAE2B;AAJxB,IADD,EAQGf,KAAK,IACN,cAAC,WAAD;AAAa,IAAA,GAAG,EAAGa;AAAnB,IATF,EAWGV,uBAAuB,IACxB,cAAC,WAAD;AACC,IAAA,MAAM,EAAGC,iBADV;AAEC,IAAA,GAAG,EAAGD,uBAFP;AAGC,IAAA,iBAAiB,EAChBf,oBADgB,aAChBA,oBADgB,uBAChBA,oBAAoB,CAAE2B;AAJxB,IAZF,CAfH,EAqCG,CAAEzE,cAAF,IACD;AACC,IAAA,SAAS,EAAG1E,UAAU,CACrB,6CADqB,EAErB;AACC,uBAAiBmG,WADlB;AAEC,4BACCD;AAHF,KAFqB,CADvB;AASC,IAAA,eAAe,EAAG;AATnB,KAWC,cAAC,SAAD;AAAW,IAAA,GAAG,EAAG2C;AAAjB,IAXD,CAtCF,EAoDC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAGhE,gBADb;AAEC,IAAA,QAAQ,EAAGC;AAFZ,KAIC,cAAC,SAAD;AACC,IAAA,SAAS,EACRJ,cAAc,GACX,gBADW,GAEV,GAAG4D,oBAAsB,wBAHrB,CAG6C;AAJvD;AAMC,IAAA,oBAAoB,EAAGM;AANxB,IAJD,CApDD,CALD,CAnBD,CAPD,CADD;AAsGA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentaluseLayoutClasses as useLayoutClasses,\n\t__experimentaluseLayoutStyles as useLayoutStyles,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nconst isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;\n\nfunction MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\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<EditorStyles styles={ styles } />\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 * 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\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tisBlockBasedTheme,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\tgetEditedPostTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst canEditTemplate = select( coreStore ).canUser(\n\t\t\t'create',\n\t\t\t'templates'\n\t\t);\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\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\tsupportsTemplateMode && canEditTemplate\n\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst {\n\t\thasRootPaddingAwareAlignments,\n\t\tisFocusMode,\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\tisFocusMode: _settings.focusMode,\n\t\t\thasRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\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 newestPostContentAttributes = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\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 { 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 titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible, isCleanNewPost ] );\n\n\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss:\n\t\t\t\t\t`.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` +\n\t\t\t\t\t( paddingBottom\n\t\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t\t: '' ),\n\t\t\t},\n\t\t],\n\t\t[ styles ]\n\t);\n\n\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\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : 0,\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\t( isGutenbergPlugin &&\n\t\t\t\t\t\t\t\tisBlockBasedTheme &&\n\t\t\t\t\t\t\t\t! hasMetaBoxes ) ||\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\t\t! isTemplateMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ align && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle css={ alignCSS } />\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\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\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</BlockTools>\n\t);\n}\n"]}
|
|
@@ -5,11 +5,6 @@ import { createElement } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { Component } from '@wordpress/element';
|
|
7
7
|
import { BlockList } from '@wordpress/block-editor';
|
|
8
|
-
/**
|
|
9
|
-
* External dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { Keyboard } from 'react-native';
|
|
13
8
|
/**
|
|
14
9
|
* Internal dependencies
|
|
15
10
|
*/
|
|
@@ -19,33 +14,6 @@ export default class VisualEditor extends Component {
|
|
|
19
14
|
constructor(props) {
|
|
20
15
|
super(props);
|
|
21
16
|
this.renderHeader = this.renderHeader.bind(this);
|
|
22
|
-
this.keyboardDidShow = this.keyboardDidShow.bind(this);
|
|
23
|
-
this.keyboardDidHide = this.keyboardDidHide.bind(this);
|
|
24
|
-
this.state = {
|
|
25
|
-
isAutoScrollEnabled: true
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
componentDidMount() {
|
|
30
|
-
this.keyboardDidShow = Keyboard.addListener('keyboardDidShow', this.keyboardDidShow);
|
|
31
|
-
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this.keyboardDidHide);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
componentWillUnmount() {
|
|
35
|
-
this.keyboardDidShow.remove();
|
|
36
|
-
this.keyboardDidHideListener.remove();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
keyboardDidShow() {
|
|
40
|
-
this.setState({
|
|
41
|
-
isAutoScrollEnabled: false
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
keyboardDidHide() {
|
|
46
|
-
this.setState({
|
|
47
|
-
isAutoScrollEnabled: true
|
|
48
|
-
});
|
|
49
17
|
}
|
|
50
18
|
|
|
51
19
|
renderHeader() {
|
|
@@ -61,13 +29,9 @@ export default class VisualEditor extends Component {
|
|
|
61
29
|
const {
|
|
62
30
|
safeAreaBottomInset
|
|
63
31
|
} = this.props;
|
|
64
|
-
const {
|
|
65
|
-
isAutoScrollEnabled
|
|
66
|
-
} = this.state;
|
|
67
32
|
return createElement(BlockList, {
|
|
68
33
|
header: this.renderHeader,
|
|
69
|
-
safeAreaBottomInset: safeAreaBottomInset
|
|
70
|
-
autoScroll: isAutoScrollEnabled
|
|
34
|
+
safeAreaBottomInset: safeAreaBottomInset
|
|
71
35
|
});
|
|
72
36
|
}
|
|
73
37
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.native.js"],"names":["Component","BlockList","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.native.js"],"names":["Component","BlockList","Header","VisualEditor","constructor","props","renderHeader","bind","setTitleRef","render","safeAreaBottomInset"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,QAA0B,yBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,eAAe,MAAMC,YAAN,SAA2BH,SAA3B,CAAqC;AACnDI,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAOA,KAAP;AACA,SAAKC,YAAL,GAAoB,KAAKA,YAAL,CAAkBC,IAAlB,CAAwB,IAAxB,CAApB;AACA;;AAEDD,EAAAA,YAAY,GAAG;AACd,UAAM;AAAEE,MAAAA;AAAF,QAAkB,KAAKH,KAA7B;AACA,WAAO,cAAC,MAAD;AAAQ,MAAA,WAAW,EAAGG;AAAtB,MAAP;AACA;;AAEDC,EAAAA,MAAM,GAAG;AACR,UAAM;AAAEC,MAAAA;AAAF,QAA0B,KAAKL,KAArC;AAEA,WACC,cAAC,SAAD;AACC,MAAA,MAAM,EAAG,KAAKC,YADf;AAEC,MAAA,mBAAmB,EAAGI;AAFvB,MADD;AAMA;;AApBkD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { BlockList } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport Header from './header';\n\nexport default class VisualEditor extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.renderHeader = this.renderHeader.bind( this );\n\t}\n\n\trenderHeader() {\n\t\tconst { setTitleRef } = this.props;\n\t\treturn <Header setTitleRef={ setTitleRef } />;\n\t}\n\n\trender() {\n\t\tconst { safeAreaBottomInset } = this.props;\n\n\t\treturn (\n\t\t\t<BlockList\n\t\t\t\theader={ this.renderHeader }\n\t\t\t\tsafeAreaBottomInset={ safeAreaBottomInset }\n\t\t\t/>\n\t\t);\n\t}\n}\n"]}
|
|
@@ -32,7 +32,7 @@ registerPlugin('edit-post', {
|
|
|
32
32
|
}), createElement(WelcomeGuideMenuItem, null), createElement(CopyContentMenuItem, null), createElement(MenuItem, {
|
|
33
33
|
role: "menuitem",
|
|
34
34
|
icon: external,
|
|
35
|
-
href: __('https://wordpress.org/
|
|
35
|
+
href: __('https://wordpress.org/documentation/article/wordpress-block-editor/'),
|
|
36
36
|
target: "_blank",
|
|
37
37
|
rel: "noopener noreferrer"
|
|
38
38
|
}, __('Help'), createElement(VisuallyHidden, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["MenuItem","VisuallyHidden","external","__","registerPlugin","addQueryArgs","CopyContentMenuItem","KeyboardShortcutsHelpMenuItem","ToolsMoreMenuGroup","WelcomeGuideMenuItem","render","onClose","post_type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,cAAnB,QAAyC,uBAAzC;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,OAAOC,6BAAP,MAA0C,qCAA1C;AACA,OAAOC,kBAAP,MAA+B,4CAA/B;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AAEAL,cAAc,CAAE,WAAF,EAAe;AAC5BM,EAAAA,MAAM,GAAG;AACR,WACC,8BACC,cAAC,kBAAD,QACG;AAAA,UAAE;AAAEC,QAAAA;AAAF,OAAF;AAAA,aACD,8BACC,cAAC,QAAD;AACC,QAAA,IAAI,EAAC,UADN;AAEC,QAAA,IAAI,EAAGN,YAAY,CAAE,UAAF,EAAc;AAChCO,UAAAA,SAAS,EAAE;AADqB,SAAd;AAFpB,SAMGT,EAAE,CAAE,wBAAF,CANL,CADD,EASC,cAAC,6BAAD;AACC,QAAA,QAAQ,EAAGQ;AADZ,QATD,EAYC,cAAC,oBAAD,OAZD,EAaC,cAAC,mBAAD,OAbD,EAcC,cAAC,QAAD;AACC,QAAA,IAAI,EAAC,UADN;AAEC,QAAA,IAAI,EAAGT,QAFR;AAGC,QAAA,IAAI,EAAGC,EAAE,CACR,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["MenuItem","VisuallyHidden","external","__","registerPlugin","addQueryArgs","CopyContentMenuItem","KeyboardShortcutsHelpMenuItem","ToolsMoreMenuGroup","WelcomeGuideMenuItem","render","onClose","post_type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,cAAnB,QAAyC,uBAAzC;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,OAAOC,6BAAP,MAA0C,qCAA1C;AACA,OAAOC,kBAAP,MAA+B,4CAA/B;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AAEAL,cAAc,CAAE,WAAF,EAAe;AAC5BM,EAAAA,MAAM,GAAG;AACR,WACC,8BACC,cAAC,kBAAD,QACG;AAAA,UAAE;AAAEC,QAAAA;AAAF,OAAF;AAAA,aACD,8BACC,cAAC,QAAD;AACC,QAAA,IAAI,EAAC,UADN;AAEC,QAAA,IAAI,EAAGN,YAAY,CAAE,UAAF,EAAc;AAChCO,UAAAA,SAAS,EAAE;AADqB,SAAd;AAFpB,SAMGT,EAAE,CAAE,wBAAF,CANL,CADD,EASC,cAAC,6BAAD;AACC,QAAA,QAAQ,EAAGQ;AADZ,QATD,EAYC,cAAC,oBAAD,OAZD,EAaC,cAAC,mBAAD,OAbD,EAcC,cAAC,QAAD;AACC,QAAA,IAAI,EAAC,UADN;AAEC,QAAA,IAAI,EAAGT,QAFR;AAGC,QAAA,IAAI,EAAGC,EAAE,CACR,qEADQ,CAHV;AAMC,QAAA,MAAM,EAAC,QANR;AAOC,QAAA,GAAG,EAAC;AAPL,SASGA,EAAE,CAAE,MAAF,CATL,EAUC,cAAC,cAAD;AAAgB,QAAA,EAAE,EAAC;AAAnB;AAEE;AACAA,MAAAA,EAAE,CAAE,sBAAF,CAHJ,CAVD,CAdD,CADC;AAAA,KADH,CADD,CADD;AAwCA;;AA1C2B,CAAf,CAAd","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nregisterPlugin( 'edit-post', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\thref={ addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\t\t\tpost_type: 'wp_block',\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Manage Reusable blocks' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<KeyboardShortcutsHelpMenuItem\n\t\t\t\t\t\t\t\tonSelect={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsMoreMenuGroup>\n\t\t\t</>\n\t\t);\n\t},\n} );\n"]}
|
|
@@ -1458,8 +1458,7 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1458
1458
|
.edit-post-editor__list-view-panel-content,
|
|
1459
1459
|
.edit-post-editor__list-view-container > .document-outline,
|
|
1460
1460
|
.edit-post-editor__list-view-empty-headings {
|
|
1461
|
-
overflow
|
|
1462
|
-
overflow-y: auto;
|
|
1461
|
+
overflow: auto;
|
|
1463
1462
|
height: 100%;
|
|
1464
1463
|
padding: 8px 6px;
|
|
1465
1464
|
}
|
package/build-style/style.css
CHANGED
|
@@ -1458,8 +1458,7 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1458
1458
|
.edit-post-editor__list-view-panel-content,
|
|
1459
1459
|
.edit-post-editor__list-view-container > .document-outline,
|
|
1460
1460
|
.edit-post-editor__list-view-empty-headings {
|
|
1461
|
-
overflow
|
|
1462
|
-
overflow-y: auto;
|
|
1461
|
+
overflow: auto;
|
|
1463
1462
|
height: 100%;
|
|
1464
1463
|
padding: 8px 6px;
|
|
1465
1464
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.8.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,34 +27,34 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^3.
|
|
31
|
-
"@wordpress/api-fetch": "^6.
|
|
32
|
-
"@wordpress/block-editor": "^11.
|
|
33
|
-
"@wordpress/block-library": "^8.
|
|
34
|
-
"@wordpress/blocks": "^12.
|
|
35
|
-
"@wordpress/components": "^23.
|
|
36
|
-
"@wordpress/compose": "^6.
|
|
37
|
-
"@wordpress/core-data": "^6.
|
|
38
|
-
"@wordpress/data": "^9.
|
|
39
|
-
"@wordpress/deprecated": "^3.
|
|
40
|
-
"@wordpress/dom": "^3.
|
|
41
|
-
"@wordpress/editor": "^13.
|
|
42
|
-
"@wordpress/element": "^5.
|
|
43
|
-
"@wordpress/hooks": "^3.
|
|
44
|
-
"@wordpress/i18n": "^4.
|
|
45
|
-
"@wordpress/icons": "^9.
|
|
46
|
-
"@wordpress/interface": "^5.
|
|
47
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
48
|
-
"@wordpress/keycodes": "^3.
|
|
49
|
-
"@wordpress/media-utils": "^4.
|
|
50
|
-
"@wordpress/notices": "^3.
|
|
51
|
-
"@wordpress/plugins": "^5.
|
|
52
|
-
"@wordpress/preferences": "^3.
|
|
53
|
-
"@wordpress/private-apis": "^0.
|
|
54
|
-
"@wordpress/url": "^3.
|
|
55
|
-
"@wordpress/viewport": "^5.
|
|
56
|
-
"@wordpress/warning": "^2.
|
|
57
|
-
"@wordpress/widgets": "^3.
|
|
30
|
+
"@wordpress/a11y": "^3.31.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.28.0",
|
|
32
|
+
"@wordpress/block-editor": "^11.8.0",
|
|
33
|
+
"@wordpress/block-library": "^8.8.0",
|
|
34
|
+
"@wordpress/blocks": "^12.8.0",
|
|
35
|
+
"@wordpress/components": "^23.8.0",
|
|
36
|
+
"@wordpress/compose": "^6.8.0",
|
|
37
|
+
"@wordpress/core-data": "^6.8.0",
|
|
38
|
+
"@wordpress/data": "^9.1.0",
|
|
39
|
+
"@wordpress/deprecated": "^3.31.0",
|
|
40
|
+
"@wordpress/dom": "^3.31.0",
|
|
41
|
+
"@wordpress/editor": "^13.8.0",
|
|
42
|
+
"@wordpress/element": "^5.8.0",
|
|
43
|
+
"@wordpress/hooks": "^3.31.0",
|
|
44
|
+
"@wordpress/i18n": "^4.31.0",
|
|
45
|
+
"@wordpress/icons": "^9.22.0",
|
|
46
|
+
"@wordpress/interface": "^5.8.0",
|
|
47
|
+
"@wordpress/keyboard-shortcuts": "^4.8.0",
|
|
48
|
+
"@wordpress/keycodes": "^3.31.0",
|
|
49
|
+
"@wordpress/media-utils": "^4.22.0",
|
|
50
|
+
"@wordpress/notices": "^3.31.0",
|
|
51
|
+
"@wordpress/plugins": "^5.8.0",
|
|
52
|
+
"@wordpress/preferences": "^3.8.0",
|
|
53
|
+
"@wordpress/private-apis": "^0.13.0",
|
|
54
|
+
"@wordpress/url": "^3.32.0",
|
|
55
|
+
"@wordpress/viewport": "^5.8.0",
|
|
56
|
+
"@wordpress/warning": "^2.31.0",
|
|
57
|
+
"@wordpress/widgets": "^3.8.0",
|
|
58
58
|
"classnames": "^2.3.1",
|
|
59
59
|
"memize": "^1.1.0",
|
|
60
60
|
"rememo": "^4.0.0"
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "d61700b9f1c72ba0b030fc815ef1685b4f4031ec"
|
|
70
70
|
}
|
|
@@ -32,7 +32,7 @@ export function PostPublishButtonOrToggle( {
|
|
|
32
32
|
* Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):
|
|
33
33
|
*
|
|
34
34
|
* 1) We want to show a BUTTON when the post status is at the _final stage_
|
|
35
|
-
* for a particular role (see https://wordpress.org/
|
|
35
|
+
* for a particular role (see https://wordpress.org/documentation/article/post-status/):
|
|
36
36
|
*
|
|
37
37
|
* - is published
|
|
38
38
|
* - is scheduled to be published
|
|
@@ -96,7 +96,6 @@ export default function ListViewSidebar() {
|
|
|
96
96
|
return (
|
|
97
97
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
98
98
|
<div
|
|
99
|
-
aria-label={ __( 'Document Overview' ) }
|
|
100
99
|
className="edit-post-editor__document-overview-panel"
|
|
101
100
|
onKeyDown={ closeOnEscape }
|
|
102
101
|
ref={ sidebarRef }
|
|
@@ -107,7 +106,7 @@ export default function ListViewSidebar() {
|
|
|
107
106
|
>
|
|
108
107
|
<Button
|
|
109
108
|
icon={ closeSmall }
|
|
110
|
-
label={ __( 'Close
|
|
109
|
+
label={ __( 'Close' ) }
|
|
111
110
|
onClick={ () => setIsListViewOpened( false ) }
|
|
112
111
|
/>
|
|
113
112
|
<ul>
|
|
@@ -62,8 +62,7 @@
|
|
|
62
62
|
.edit-post-editor__list-view-panel-content,
|
|
63
63
|
.edit-post-editor__list-view-container > .document-outline,
|
|
64
64
|
.edit-post-editor__list-view-empty-headings {
|
|
65
|
-
overflow
|
|
66
|
-
overflow-y: auto;
|
|
65
|
+
overflow: auto;
|
|
67
66
|
height: 100%;
|
|
68
67
|
// The table cells use an extra pixels of space left and right. We compensate for that here.
|
|
69
68
|
padding: $grid-unit-10 ($grid-unit-10 - $border-width - $border-width);
|
|
@@ -160,15 +160,21 @@ export default function VisualEditor( { styles } ) {
|
|
|
160
160
|
( select ) => select( editPostStore ).hasMetaBoxes(),
|
|
161
161
|
[]
|
|
162
162
|
);
|
|
163
|
-
const {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
163
|
+
const {
|
|
164
|
+
hasRootPaddingAwareAlignments,
|
|
165
|
+
isFocusMode,
|
|
166
|
+
themeHasDisabledLayoutStyles,
|
|
167
|
+
themeSupportsLayout,
|
|
168
|
+
} = useSelect( ( select ) => {
|
|
169
|
+
const _settings = select( blockEditorStore ).getSettings();
|
|
170
|
+
return {
|
|
171
|
+
themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
|
|
172
|
+
themeSupportsLayout: _settings.supportsLayout,
|
|
173
|
+
isFocusMode: _settings.focusMode,
|
|
174
|
+
hasRootPaddingAwareAlignments:
|
|
175
|
+
_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,
|
|
176
|
+
};
|
|
177
|
+
}, [] );
|
|
172
178
|
const { clearSelectedBlock } = useDispatch( blockEditorStore );
|
|
173
179
|
const { setIsEditingTemplate } = useDispatch( editPostStore );
|
|
174
180
|
const desktopCanvasStyles = {
|
|
@@ -255,7 +261,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
255
261
|
postContentAttributes,
|
|
256
262
|
] );
|
|
257
263
|
|
|
258
|
-
const layout = newestPostContentAttributes
|
|
264
|
+
const { layout = {}, align = '' } = newestPostContentAttributes || {};
|
|
259
265
|
|
|
260
266
|
const postContentLayoutClasses = useLayoutClasses(
|
|
261
267
|
newestPostContentAttributes,
|
|
@@ -266,7 +272,8 @@ export default function VisualEditor( { styles } ) {
|
|
|
266
272
|
{
|
|
267
273
|
'is-layout-flow': ! themeSupportsLayout,
|
|
268
274
|
},
|
|
269
|
-
themeSupportsLayout && postContentLayoutClasses
|
|
275
|
+
themeSupportsLayout && postContentLayoutClasses,
|
|
276
|
+
align && `align${ align }`
|
|
270
277
|
);
|
|
271
278
|
|
|
272
279
|
const postContentLayoutStyles = useLayoutStyles(
|
|
@@ -321,6 +328,12 @@ export default function VisualEditor( { styles } ) {
|
|
|
321
328
|
[ styles ]
|
|
322
329
|
);
|
|
323
330
|
|
|
331
|
+
// Add some styles for alignwide/alignfull Post Content and its children.
|
|
332
|
+
const alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}
|
|
333
|
+
.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}
|
|
334
|
+
.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}
|
|
335
|
+
.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;
|
|
336
|
+
|
|
324
337
|
return (
|
|
325
338
|
<BlockTools
|
|
326
339
|
__unstableContentRef={ ref }
|
|
@@ -376,6 +389,9 @@ export default function VisualEditor( { styles } ) {
|
|
|
376
389
|
globalLayoutSettings?.definitions
|
|
377
390
|
}
|
|
378
391
|
/>
|
|
392
|
+
{ align && (
|
|
393
|
+
<LayoutStyle css={ alignCSS } />
|
|
394
|
+
) }
|
|
379
395
|
{ postContentLayoutStyles && (
|
|
380
396
|
<LayoutStyle
|
|
381
397
|
layout={ postContentLayout }
|
|
@@ -393,8 +409,9 @@ export default function VisualEditor( { styles } ) {
|
|
|
393
409
|
'edit-post-visual-editor__post-title-wrapper',
|
|
394
410
|
{
|
|
395
411
|
'is-focus-mode': isFocusMode,
|
|
396
|
-
|
|
397
|
-
|
|
412
|
+
'has-global-padding':
|
|
413
|
+
hasRootPaddingAwareAlignments,
|
|
414
|
+
}
|
|
398
415
|
) }
|
|
399
416
|
contentEditable={ false }
|
|
400
417
|
>
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Component } from '@wordpress/element';
|
|
5
5
|
import { BlockList } from '@wordpress/block-editor';
|
|
6
|
-
|
|
7
|
-
* External dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { Keyboard } from 'react-native';
|
|
6
|
+
|
|
10
7
|
/**
|
|
11
8
|
* Internal dependencies
|
|
12
9
|
*/
|
|
@@ -16,36 +13,6 @@ export default class VisualEditor extends Component {
|
|
|
16
13
|
constructor( props ) {
|
|
17
14
|
super( props );
|
|
18
15
|
this.renderHeader = this.renderHeader.bind( this );
|
|
19
|
-
this.keyboardDidShow = this.keyboardDidShow.bind( this );
|
|
20
|
-
this.keyboardDidHide = this.keyboardDidHide.bind( this );
|
|
21
|
-
|
|
22
|
-
this.state = {
|
|
23
|
-
isAutoScrollEnabled: true,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
componentDidMount() {
|
|
28
|
-
this.keyboardDidShow = Keyboard.addListener(
|
|
29
|
-
'keyboardDidShow',
|
|
30
|
-
this.keyboardDidShow
|
|
31
|
-
);
|
|
32
|
-
this.keyboardDidHideListener = Keyboard.addListener(
|
|
33
|
-
'keyboardDidHide',
|
|
34
|
-
this.keyboardDidHide
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
componentWillUnmount() {
|
|
39
|
-
this.keyboardDidShow.remove();
|
|
40
|
-
this.keyboardDidHideListener.remove();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
keyboardDidShow() {
|
|
44
|
-
this.setState( { isAutoScrollEnabled: false } );
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
keyboardDidHide() {
|
|
48
|
-
this.setState( { isAutoScrollEnabled: true } );
|
|
49
16
|
}
|
|
50
17
|
|
|
51
18
|
renderHeader() {
|
|
@@ -55,13 +22,11 @@ export default class VisualEditor extends Component {
|
|
|
55
22
|
|
|
56
23
|
render() {
|
|
57
24
|
const { safeAreaBottomInset } = this.props;
|
|
58
|
-
const { isAutoScrollEnabled } = this.state;
|
|
59
25
|
|
|
60
26
|
return (
|
|
61
27
|
<BlockList
|
|
62
28
|
header={ this.renderHeader }
|
|
63
29
|
safeAreaBottomInset={ safeAreaBottomInset }
|
|
64
|
-
autoScroll={ isAutoScrollEnabled }
|
|
65
30
|
/>
|
|
66
31
|
);
|
|
67
32
|
}
|
package/src/plugins/index.js
CHANGED
|
@@ -39,7 +39,7 @@ registerPlugin( 'edit-post', {
|
|
|
39
39
|
role="menuitem"
|
|
40
40
|
icon={ external }
|
|
41
41
|
href={ __(
|
|
42
|
-
'https://wordpress.org/
|
|
42
|
+
'https://wordpress.org/documentation/article/wordpress-block-editor/'
|
|
43
43
|
) }
|
|
44
44
|
target="_blank"
|
|
45
45
|
rel="noopener noreferrer"
|