@wordpress/edit-post 7.4.0 → 7.6.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 +4 -0
- package/build/components/device-preview/index.js +3 -7
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/header/fullscreen-mode-close/index.js +3 -3
- package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js +5 -0
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/post-publish-button-or-toggle.js +13 -15
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/header/template-title/edit-template-title.js +6 -8
- package/build/components/header/template-title/edit-template-title.js.map +1 -1
- package/build/components/header/tools-more-menu-group/index.js +1 -7
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +11 -11
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +13 -13
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -7
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/sidebar/featured-image/index.js +3 -7
- package/build/components/sidebar/featured-image/index.js.map +1 -1
- package/build/components/sidebar/page-attributes/index.js +3 -7
- package/build/components/sidebar/page-attributes/index.js.map +1 -1
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +6 -8
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
- package/build/components/sidebar/post-template/create-modal.js +1 -1
- package/build/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build/components/visual-editor/index.js +29 -24
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/welcome-guide/default.js +1 -1
- package/build/components/welcome-guide/default.js.map +1 -1
- package/build/index.js +3 -0
- package/build/index.js.map +1 -1
- package/build-module/components/device-preview/index.js +3 -6
- package/build-module/components/device-preview/index.js.map +1 -1
- package/build-module/components/header/fullscreen-mode-close/index.js +3 -2
- package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js +6 -0
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +13 -14
- package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build-module/components/header/template-title/edit-template-title.js +6 -7
- package/build-module/components/header/template-title/edit-template-title.js.map +1 -1
- package/build-module/components/header/tools-more-menu-group/index.js +1 -6
- package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +11 -11
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +13 -13
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -6
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/sidebar/featured-image/index.js +3 -6
- package/build-module/components/sidebar/featured-image/index.js.map +1 -1
- package/build-module/components/sidebar/page-attributes/index.js +3 -6
- package/build-module/components/sidebar/page-attributes/index.js.map +1 -1
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +6 -7
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
- package/build-module/components/sidebar/post-template/create-modal.js +1 -1
- package/build-module/components/sidebar/post-template/create-modal.js.map +1 -1
- package/build-module/components/visual-editor/index.js +28 -24
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/welcome-guide/default.js +1 -1
- package/build-module/components/welcome-guide/default.js.map +1 -1
- package/build-module/index.js +4 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +10 -3
- package/build-style/style.css +10 -3
- package/package.json +30 -31
- package/src/components/device-preview/index.js +1 -6
- package/src/components/header/fullscreen-mode-close/index.js +1 -6
- package/src/components/header/header-toolbar/index.native.js +5 -0
- package/src/components/header/post-publish-button-or-toggle.js +4 -10
- package/src/components/header/template-title/edit-template-title.js +8 -12
- package/src/components/header/tools-more-menu-group/index.js +1 -6
- package/src/components/keyboard-shortcuts/index.js +13 -11
- package/src/components/layout/index.js +14 -14
- package/src/components/preferences-modal/index.js +1 -9
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +1 -1
- package/src/components/sidebar/featured-image/index.js +3 -10
- package/src/components/sidebar/page-attributes/index.js +3 -10
- package/src/components/sidebar/post-taxonomies/taxonomy-panel.js +2 -7
- package/src/components/sidebar/post-template/create-modal.js +1 -1
- package/src/components/visual-editor/index.js +36 -22
- package/src/components/welcome-guide/default.js +1 -1
- package/src/index.js +5 -1
- package/src/test/editor.native.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["MaybeIframe","children","contentRef","shouldIframe","styles","style","ref","flex","width","height","display","findPostContent","blocks","i","length","name","innerBlocks","nestedPostContent","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","select","isFeatureActive","isEditingTemplate","__experimentalGetPreviewDeviceType","getEditedPostTemplate","editPostStore","getCurrentPostId","getCurrentPostType","getEditorSettings","editorStore","_isTemplateMode","_wrapperBlockName","editorSettings","supportsTemplateMode","canEditTemplate","coreStore","canUser","undefined","__unstableIsBlockBasedTheme","isCleanNewPost","hasMetaBoxes","themeHasDisabledLayoutStyles","themeSupportsLayout","isFocusMode","_settings","blockEditorStore","getSettings","disableLayoutStyles","supportsLayout","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","css","padding","arrowLeft","definitions"],"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G,EAAGH,uBAFP;AAGC,IAAA,iBAAiB,EAChBb,oBADgB,aAChBA,oBADgB,uBAChBA,oBAAoB,CAAE2B;AAJxB,IATF,CAbH,EAgCG,CAAEzE,cAAF,IACD;AACC,IAAA,SAAS,EAAG,0BACX;AACA;AACA,uBAHW,EAIX,iCAJW,EAKX,6CALW,EAMX;AACC,uBAAiB4B;AADlB,KANW,EASX8B,oBATW,CADb;AAYC,IAAA,eAAe,EAAG;AAZnB,KAcC,4BAAC,iBAAD;AAAW,IAAA,GAAG,EAAGS;AAAjB,IAdD,CAjCF,EAkDC,4BAAC,4CAAD;AACC,IAAA,SAAS,EAAGjE,gBADb;AAEC,IAAA,QAAQ,EAAGC;AAFZ,KAIC,4BAAC,sBAAD;AACC,IAAA,SAAS,EACRH,cAAc,GACX,gBADW,GAEV,GAAG0D,oBAAsB,wBAHrB,CAG6C;AAJvD;AAMC,IAAA,oBAAoB,EAAGQ;AANxB,IAJD,CAlDD,CALD,CAnBD,CAPD,CADD;AAoGA","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\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\thead={ <EditorStyles styles={ styles } /> }\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 | undefined} 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\tisBlockBasedTheme,\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 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\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:\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 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\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( isBlockBasedTheme && ! 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// This wrapper div should have the same\n\t\t\t\t\t\t\t\t\t// classes as the block list beneath.\n\t\t\t\t\t\t\t\t\t'is-root-container',\n\t\t\t\t\t\t\t\t\t'block-editor-block-list__layout',\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\tblockListLayoutClass\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":["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","editPostStore","getCurrentPostId","getCurrentPostType","getEditorSettings","editorStore","_isTemplateMode","_wrapperBlockName","editorSettings","supportsTemplateMode","canEditTemplate","coreStore","canUser","undefined","__unstableIsBlockBasedTheme","isCleanNewPost","hasMetaBoxes","themeHasDisabledLayoutStyles","themeSupportsLayout","isFocusMode","_settings","blockEditorStore","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","arrowLeft","definitions"],"mappings":";;;;;;;;;AAgCA;;AA7BA;;AAKA;;AAKA;;AAoBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AA5CA;AACA;AACA;;AAGA;AACA;AACA;;AAkCA;AACA;AACA;AAGA,MAAMA,iBAAiB,GAAGC,OAAO,CAACC,GAAR,CAAYC,mBAAZ,GAAkC,IAAlC,GAAyC,KAAnE;;AAEA,SAASC,WAAT,OAA8E;AAAA,MAAxD;AA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BN,oBADgB,aAChBA,oBADgB,uBAChBA,oBAAoB,CAAE0B;AAJxB,IADD,EAQGZ,uBAAuB,IACxB,4BAAC,sCAAD;AACC,IAAA,MAAM,EAAGC,iBADV;AAEC,IAAA,GAAG,EAAGD,uBAFP;AAGC,IAAA,iBAAiB,EAChBd,oBADgB,aAChBA,oBADgB,uBAChBA,oBAAoB,CAAE0B;AAJxB,IATF,CAfH,EAkCG,CAAEzE,cAAF,IACD;AACC,IAAA,SAAS,EAAG,yBACX,6CADW,EAEX;AACC,uBAAiB6B;AADlB,KAFW,EAKX,gBALW,CADb;AAQC,IAAA,eAAe,EAAG;AARnB,KAUC,4BAAC,iBAAD;AAAW,IAAA,GAAG,EAAGsC;AAAjB,IAVD,CAnCF,EAgDC,4BAAC,4CAAD;AACC,IAAA,SAAS,EAAGhE,gBADb;AAEC,IAAA,QAAQ,EAAGC;AAFZ,KAIC,4BAAC,sBAAD;AACC,IAAA,SAAS,EACRJ,cAAc,GACX,gBADW,GAEV,GAAG4D,oBAAsB,wBAHrB,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\thead={ <EditorStyles styles={ styles } /> }\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 * 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"]}
|
|
@@ -80,7 +80,7 @@ function WelcomeGuideDefault() {
|
|
|
80
80
|
}, (0, _i18n.__)('Learn how to use the block editor')), (0, _element.createElement)("p", {
|
|
81
81
|
className: "edit-post-welcome-guide__text"
|
|
82
82
|
}, (0, _i18n.__)('New to the block editor? Want to learn more about using it? '), (0, _element.createElement)(_components.ExternalLink, {
|
|
83
|
-
href: (0, _i18n.__)('https://wordpress.org/
|
|
83
|
+
href: (0, _i18n.__)('https://wordpress.org/documentation/article/wordpress-block-editor/')
|
|
84
84
|
}, (0, _i18n.__)("Here's a detailed guide."))))
|
|
85
85
|
}]
|
|
86
86
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/welcome-guide/default.js"],"names":["WelcomeGuideDefault","toggleFeature","editPostStore","image","content","InserterIconImage"],"mappings":";;;;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAMA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;AAIe,SAASA,mBAAT,GAA+B;AAC7C,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,YAAb,CAA1B;AAEA,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,yBADX;AAEC,IAAA,YAAY,EAAG,cAAI,6BAAJ,CAFhB;AAGC,IAAA,gBAAgB,EAAG,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cAAI,mCAAJ,CADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,cACD,8DADC,CADH,EAIC,4BAAC,wBAAD;AACC,QAAA,IAAI,EAAG,cACN,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/welcome-guide/default.js"],"names":["WelcomeGuideDefault","toggleFeature","editPostStore","image","content","InserterIconImage"],"mappings":";;;;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAMA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;AAIe,SAASA,mBAAT,GAA+B;AAC7C,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,YAAb,CAA1B;AAEA,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,yBADX;AAEC,IAAA,YAAY,EAAG,cAAI,6BAAJ,CAFhB;AAGC,IAAA,gBAAgB,EAAG,cAAI,aAAJ,CAHpB;AAIC,IAAA,QAAQ,EAAG,MAAMD,aAAa,CAAE,cAAF,CAJ/B;AAKC,IAAA,KAAK,EAAG,CACP;AACCE,MAAAA,KAAK,EACJ,4BAAC,cAAD;AACC,QAAA,cAAc,EAAC,wDADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,qDACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACG,cAAI,6BAAJ,CADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,cACD,yGADC,CADH,CAJD;AARF,KADO,EAqBP;AACCD,MAAAA,KAAK,EACJ,4BAAC,cAAD;AACC,QAAA,cAAc,EAAC,wDADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,qDACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACG,cAAI,0BAAJ,CADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,cACD,4KADC,CADH,CAJD;AARF,KArBO,EAyCP;AACCD,MAAAA,KAAK,EACJ,4BAAC,cAAD;AACC,QAAA,cAAc,EAAC,yDADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,qDACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACG,cAAI,+BAAJ,CADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,uCACD,cACC,+HADD,CADC,EAID;AACCC,QAAAA,iBAAiB,EAChB;AACC,UAAA,GAAG,EAAG,cAAI,UAAJ,CADP;AAEC,UAAA,GAAG,EAAC;AAFL;AAFF,OAJC,CADH,CAJD;AARF,KAzCO,EAuEP;AACCF,MAAAA,KAAK,EACJ,4BAAC,cAAD;AACC,QAAA,cAAc,EAAC,+DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,qDACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACG,cAAI,mCAAJ,CADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,cACD,8DADC,CADH,EAIC,4BAAC,wBAAD;AACC,QAAA,IAAI,EAAG,cACN,qEADM;AADR,SAKG,cAAI,0BAAJ,CALH,CAJD,CAJD;AARF,KAvEO;AALT,IADD;AA2GA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { ExternalLink, Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editPostStore } from '../../store';\n\nexport default function WelcomeGuideDefault() {\n\tconst { toggleFeature } = useDispatch( editPostStore );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-post-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to the block editor' ) }\n\t\t\tfinishButtonText={ __( 'Get started' ) }\n\t\t\tonFinish={ () => toggleFeature( 'welcomeGuide' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-canvas.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-canvas.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-post-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Welcome to the block editor' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-post-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-post-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Make each block your own' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-post-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-library.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-library.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-post-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Get to know the block library' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-post-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'\n\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\tInserterIconImage: (\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\talt={ __( 'inserter' ) }\n\t\t\t\t\t\t\t\t\t\t\t\tsrc=\"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A\"\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</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-post-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Learn how to use the block editor' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-post-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'New to the block editor? Want to learn more about using it? '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\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\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n"]}
|
package/build/index.js
CHANGED
|
@@ -168,6 +168,9 @@ function initializeEditor(id, postType, postId, settings, initialEdits) {
|
|
|
168
168
|
(0, _widgets.registerLegacyWidgetBlock)({
|
|
169
169
|
inserter: false
|
|
170
170
|
});
|
|
171
|
+
(0, _widgets.registerWidgetGroupBlock)({
|
|
172
|
+
inserter: false
|
|
173
|
+
});
|
|
171
174
|
|
|
172
175
|
if (process.env.IS_GUTENBERG_PLUGIN) {
|
|
173
176
|
(0, _blockLibrary.__experimentalRegisterExperimentalCoreBlocks)({
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/index.js"],"names":["initializeEditor","id","postType","postId","settings","initialEdits","target","document","getElementById","root","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","themeStyles","welcomeGuide","welcomeGuideTemplate","blocksStore","__experimentalReapplyBlockTypeFilters","editPostStore","isFeatureActive","setIsListViewOpened","inserter","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","render","reinitializeEditor","since","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;AANA;;AACA;;AAIA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA6IA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA3KA;AACA;AACA;;AAaA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CACNC,EADM,EAENC,QAFM,EAGNC,MAHM,EAINC,QAJM,EAKNC,YALM,EAML;AACD,QAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAT,CAAyBP,EAAzB,CAAf;AACA,QAAMQ,IAAI,GAAG,yBAAYH,MAAZ,CAAb;AAEA,sBAAUI,kBAAV,EAA6BC,WAA7B,CAA0C,gBAA1C,EAA4D;AAC3DC,IAAAA,UAAU,EAAE,QAD+C;AAE3DC,IAAAA,YAAY,EAAE,KAF6C;AAG3DC,IAAAA,cAAc,EAAE,IAH2C;AAI3DC,IAAAA,gBAAgB,EAAE,EAJyC;AAK3DC,IAAAA,cAAc,EAAE,EAL2C;AAM3DC,IAAAA,uBAAuB,EAAE,IANkC;AA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AIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { registerLegacyWidgetBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\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 root = createRoot( target );\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\tregisterLegacyWidgetBlock( { inserter: false } );\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\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\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":["initializeEditor","id","postType","postId","settings","initialEdits","target","document","getElementById","root","preferencesStore","setDefaults","editorMode","fixedToolbar","fullscreenMode","hiddenBlockTypes","inactivePanels","isPublishSidebarEnabled","openPanels","preferredStyleVariations","showBlockBreadcrumbs","showIconLabels","showListViewByDefault","themeStyles","welcomeGuide","welcomeGuideTemplate","blocksStore","__experimentalReapplyBlockTypeFilters","editPostStore","isFeatureActive","setIsListViewOpened","inserter","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","render","reinitializeEditor","since","version"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;AANA;;AACA;;AAIA;;AAEA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AA8IA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA/KA;AACA;AACA;;AAgBA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CACNC,EADM,EAENC,QAFM,EAGNC,MAHM,EAINC,QAJM,EAKNC,YALM,EAML;AACD,QAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAT,CAAyBP,EAAzB,CAAf;AACA,QAAMQ,IAAI,GAAG,yBAAYH,MAAZ,CAAb;AAEA,sBAAUI,kBA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eAAD;AACC,IAAA,QAAQ,EAAGvD,QADZ;AAEC,IAAA,MAAM,EAAGD,MAFV;AAGC,IAAA,QAAQ,EAAGD,QAHZ;AAIC,IAAA,YAAY,EAAGG;AAJhB,IADD;AASA,SAAOI,IAAP;AACA;AAED;AACA;AACA;;;AACO,SAASmD,kBAAT,GAA8B;AACpC,2BAAY,gCAAZ,EAA8C;AAC7CC,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,OAAO,EAAE;AAFoC,GAA9C;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { dispatch, select } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport './plugins';\nimport Editor from './editor';\nimport { store as editPostStore } from './store';\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 root = createRoot( target );\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\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\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\troot.render(\n\t\t<Editor\n\t\t\tsettings={ settings }\n\t\t\tpostId={ postId }\n\t\t\tpostType={ postType }\n\t\t\tinitialEdits={ initialEdits }\n\t\t/>\n\t);\n\n\treturn root;\n}\n\n/**\n * Used to reinitialize the editor after an error. Now it's a deprecated noop function.\n */\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editPost.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\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,13 +1,8 @@
|
|
|
1
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { get } from 'lodash';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
6
|
import { Icon, MenuGroup } from '@wordpress/components';
|
|
12
7
|
import { PostPreviewButton, store as editorStore } from '@wordpress/editor';
|
|
13
8
|
import { external } from '@wordpress/icons';
|
|
@@ -28,6 +23,8 @@ export default function DevicePreview() {
|
|
|
28
23
|
isViewable,
|
|
29
24
|
deviceType
|
|
30
25
|
} = useSelect(select => {
|
|
26
|
+
var _postType$viewable;
|
|
27
|
+
|
|
31
28
|
const {
|
|
32
29
|
getEditedPostAttribute
|
|
33
30
|
} = select(editorStore);
|
|
@@ -39,7 +36,7 @@ export default function DevicePreview() {
|
|
|
39
36
|
hasActiveMetaboxes: select(editPostStore).hasMetaBoxes(),
|
|
40
37
|
isSaving: select(editPostStore).isSavingMetaBoxes(),
|
|
41
38
|
isPostSaveable: select(editorStore).isEditedPostSaveable(),
|
|
42
|
-
isViewable:
|
|
39
|
+
isViewable: (_postType$viewable = postType === null || postType === void 0 ? void 0 : postType.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false,
|
|
43
40
|
deviceType: select(editPostStore).__experimentalGetPreviewDeviceType()
|
|
44
41
|
};
|
|
45
42
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/device-preview/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/device-preview/index.js"],"names":["Icon","MenuGroup","PostPreviewButton","store","editorStore","external","__","__experimentalPreviewOptions","PreviewOptions","useDispatch","useSelect","coreStore","editPostStore","DevicePreview","hasActiveMetaboxes","isPostSaveable","isSaving","isViewable","deviceType","select","getEditedPostAttribute","getPostType","postType","hasMetaBoxes","isSavingMetaBoxes","isEditedPostSaveable","viewable","__experimentalGetPreviewDeviceType","__experimentalSetPreviewDeviceType","setPreviewDeviceType","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,SAAf,QAAgC,uBAAhC;AACA,SAASC,iBAAT,EAA4BC,KAAK,IAAIC,WAArC,QAAwD,mBAAxD;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,4BAA4B,IAAIC,cAAzC,QAA+D,yBAA/D;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASP,KAAK,IAAIQ,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASR,KAAK,IAAIS,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,aAAT,GAAyB;AACvC,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,cAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,UAJK;AAKLC,IAAAA;AALK,MAMFR,SAAS,CAAIS,MAAF,IAAc;AAAA;;AAC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C,IAAD;AAAM,MAAA,IAAI,EAAGD;AAAb,MAFD;AARF,IADD,CADD,CATF,CADD;AA+BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Icon, MenuGroup } from '@wordpress/components';\nimport { PostPreviewButton, store as editorStore } from '@wordpress/editor';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalPreviewOptions as PreviewOptions } from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function DevicePreview() {\n\tconst {\n\t\thasActiveMetaboxes,\n\t\tisPostSaveable,\n\t\tisSaving,\n\t\tisViewable,\n\t\tdeviceType,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tisSaving: select( editPostStore ).isSavingMetaBoxes(),\n\t\t\tisPostSaveable: select( editorStore ).isEditedPostSaveable(),\n\t\t\tisViewable: postType?.viewable ?? false,\n\t\t\tdeviceType:\n\t\t\t\tselect( editPostStore ).__experimentalGetPreviewDeviceType(),\n\t\t};\n\t}, [] );\n\tconst { __experimentalSetPreviewDeviceType: setPreviewDeviceType } =\n\t\tuseDispatch( editPostStore );\n\n\treturn (\n\t\t<PreviewOptions\n\t\t\tisEnabled={ isPostSaveable }\n\t\t\tclassName=\"edit-post-post-preview-dropdown\"\n\t\t\tdeviceType={ deviceType }\n\t\t\tsetDeviceType={ setPreviewDeviceType }\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\tviewLabel={ __( 'Preview' ) }\n\t\t>\n\t\t\t{ isViewable && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<div className=\"edit-post-header-preview__grouping-external\">\n\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t'edit-post-header-preview__button-external'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\tforceIsAutosaveable={ hasActiveMetaboxes }\n\t\t\t\t\t\t\tforcePreviewLink={ isSaving ? null : undefined }\n\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</PreviewOptions>\n\t);\n}\n"]}
|
|
@@ -3,7 +3,6 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { get } from 'lodash';
|
|
7
6
|
import classnames from 'classnames';
|
|
8
7
|
/**
|
|
9
8
|
* WordPress dependencies
|
|
@@ -24,6 +23,8 @@ import { useReducedMotion } from '@wordpress/compose';
|
|
|
24
23
|
import { store as editPostStore } from '../../../store';
|
|
25
24
|
|
|
26
25
|
function FullscreenModeClose(_ref) {
|
|
26
|
+
var _postType$labels$view, _postType$labels;
|
|
27
|
+
|
|
27
28
|
let {
|
|
28
29
|
showTooltip,
|
|
29
30
|
icon,
|
|
@@ -106,7 +107,7 @@ function FullscreenModeClose(_ref) {
|
|
|
106
107
|
href: href !== null && href !== void 0 ? href : addQueryArgs('edit.php', {
|
|
107
108
|
post_type: postType.slug
|
|
108
109
|
}),
|
|
109
|
-
label:
|
|
110
|
+
label: (_postType$labels$view = postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.view_items) !== null && _postType$labels$view !== void 0 ? _postType$labels$view : __('Back'),
|
|
110
111
|
showTooltip: showTooltip
|
|
111
112
|
}, buttonIcon));
|
|
112
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/fullscreen-mode-close/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/fullscreen-mode-close/index.js"],"names":["classnames","useSelect","Button","Icon","__unstableMotion","motion","__","addQueryArgs","wordpress","store","editorStore","coreStore","useReducedMotion","editPostStore","FullscreenModeClose","showTooltip","icon","href","isActive","isRequestingSiteIcon","postType","siteIconUrl","select","getCurrentPostType","isFeatureActive","getEntityRecord","getPostType","isResolving","siteData","undefined","site_icon_url","disableMotion","buttonIcon","effect","expand","scale","transition","type","duration","classes","post_type","slug","labels","view_items"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,MADD,EAECC,IAFD,EAGCC,gBAAgB,IAAIC,MAHrB,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,gBAAvC;;AAEA,SAASC,mBAAT,OAA4D;AAAA;;AAAA,MAA9B;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,IAAf;AAAqBC,IAAAA;AAArB,GAA8B;AAC3D,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,oBAAZ;AAAkCC,IAAAA,QAAlC;AAA4CC,IAAAA;AAA5C,MAA4DpB,SAAS,CACxEqB,MAAF,IAAc;AACb,UAAM;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EAAE,CAAE,WAAF,CAFT;AAGC,MAAA,SAAS,EAAC,2CAHX;AAIC,MAAA,GAAG,EAAGe;AAJP,MADD;AAQA;;AAED,MAAKF,oBAAL,EAA4B;AAC3Ba,IAAAA,UAAU,GAAG,IAAb;AACA,GApD0D,CAsD3D;;;AACA,MAAKhB,IAAL,EAAY;AACXgB,IAAAA,UAAU,GAAG,cAAC,IAAD;AAAM,MAAA,IAAI,EAAC,MAAX;AAAkB,MAAA,IAAI,EAAGhB;AAAzB,MAAb;AACA;;AAED,QAAMuB,OAAO,GAAGvC,UAAU,CAAE;AAC3B,uCAAmC,IADR;AAE3B,gBAAYqB;AAFe,GAAF,CAA1B;AAKA,SACC,cAAC,MAAD,CAAQ,GAAR;AAAY,IAAA,UAAU,EAAC;AAAvB,KACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAGkB,OADb;AAEC,IAAA,IAAI,EACHtB,IADG,aACHA,IADG,cACHA,IADG,GAEHV,YAAY,CAAE,UAAF,EAAc;AACzBiC,MAAAA,SAAS,EAAEpB,QAAQ,CAACqB;AADK,KAAd,CAJd;AAQC,IAAA,KAAK,2BAAGrB,QAAH,aAAGA,QAAH,2CAAGA,QAAQ,CAAEsB,MAAb,qDAAG,iBAAkBC,UAArB,yEAAmCrC,EAAE,CAAE,MAAF,CAR3C;AASC,IAAA,WAAW,EAAGS;AATf,KAWGiB,UAXH,CADD,CADD;AAiBA;;AAED,eAAelB,mBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tIcon,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { wordpress } from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction FullscreenModeClose( { showTooltip, icon, href } ) {\n\tconst { isActive, isRequestingSiteIcon, postType, siteIconUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\tconst { isFeatureActive } = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, isResolving } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteData =\n\t\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\t\treturn {\n\t\t\t\tisActive: isFeatureActive( 'fullscreenMode' ),\n\t\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase',\n\t\t\t\t\tundefined,\n\t\t\t\t] ),\n\t\t\t\tpostType: getPostType( getCurrentPostType() ),\n\t\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst disableMotion = useReducedMotion();\n\n\tif ( ! isActive || ! postType ) {\n\t\treturn null;\n\t}\n\n\tlet buttonIcon = <Icon size=\"36px\" icon={ wordpress } />;\n\n\tconst effect = {\n\t\texpand: {\n\t\t\tscale: 1.25,\n\t\t\ttransition: { type: 'tween', duration: '0.3' },\n\t\t},\n\t};\n\n\tif ( siteIconUrl ) {\n\t\tbuttonIcon = (\n\t\t\t<motion.img\n\t\t\t\tvariants={ ! disableMotion && effect }\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"edit-post-fullscreen-mode-close_site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tbuttonIcon = null;\n\t}\n\n\t// Override default icon if custom icon is provided via props.\n\tif ( icon ) {\n\t\tbuttonIcon = <Icon size=\"36px\" icon={ icon } />;\n\t}\n\n\tconst classes = classnames( {\n\t\t'edit-post-fullscreen-mode-close': true,\n\t\t'has-icon': siteIconUrl,\n\t} );\n\n\treturn (\n\t\t<motion.div whileHover=\"expand\">\n\t\t\t<Button\n\t\t\t\tclassName={ classes }\n\t\t\t\thref={\n\t\t\t\t\thref ??\n\t\t\t\t\taddQueryArgs( 'edit.php', {\n\t\t\t\t\t\tpost_type: postType.slug,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t\tlabel={ postType?.labels?.view_items ?? __( 'Back' ) }\n\t\t\t\tshowTooltip={ showTooltip }\n\t\t\t>\n\t\t\t\t{ buttonIcon }\n\t\t\t</Button>\n\t\t</motion.div>\n\t);\n}\n\nexport default FullscreenModeClose;\n"]}
|
|
@@ -89,7 +89,13 @@ function HeaderToolbar(_ref) {
|
|
|
89
89
|
// This way we prevent style updates during the opening transition.
|
|
90
90
|
|
|
91
91
|
const useExpandedMode = isInserterOpen ? wasNoContentSelected.current : noContentSelected;
|
|
92
|
+
/* translators: accessibility text for the editor toolbar */
|
|
93
|
+
|
|
94
|
+
const toolbarAriaLabel = __('Document tools');
|
|
95
|
+
|
|
92
96
|
return createElement(View, {
|
|
97
|
+
testID: toolbarAriaLabel,
|
|
98
|
+
accessibilityLabel: toolbarAriaLabel,
|
|
93
99
|
style: [getStylesFromColorScheme(styles['header-toolbar__container'], styles['header-toolbar__container--dark']), useExpandedMode && styles['header-toolbar__container--expanded']]
|
|
94
100
|
}, createElement(ScrollView, {
|
|
95
101
|
ref: scrollViewRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.native.js"],"names":["Platform","ScrollView","View","useCallback","useRef","useState","compose","withPreferredColorScheme","withSelect","withDispatch","withViewportMatch","__","Inserter","BlockToolbar","store","blockEditorStore","ToolbarGroup","ToolbarButton","keyboardClose","undo","undoIcon","redo","redoIcon","editorStore","styles","editPostStore","HeaderToolbar","hasRedo","hasUndo","showInserter","showKeyboardHideButton","getStylesFromColorScheme","onHideKeyboard","isRTL","noContentSelected","wasNoContentSelected","isInserterOpen","setIsInserterOpen","scrollViewRef","scrollToStart","isAndroid","OS","current","scrollToEnd","scrollTo","x","renderHistoryButtons","buttons","hint","reverse","onToggleInserter","isOpen","useExpandedMode","select","getBlockRootClientId","getBlockSelectionEnd","hasInserterItems","hasSelectedBlock","getEditorSettings","isAnyBlockSelected","hasEditorRedo","hasEditorUndo","getEditorMode","richEditingEnabled","isTextModeEnabled","getSettings","dispatch","clearSelectedBlock","togglePostTitleSelection","isLargeViewport"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,UAAnB,EAA+BC,IAA/B,QAA2C,cAA3C;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,MAAtB,EAA8BC,QAA9B,QAA8C,oBAA9C;AACA,SAASC,OAAT,EAAkBC,wBAAlB,QAAkD,oBAAlD;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,QADD,EAECC,YAFD,EAGCC,KAAK,IAAIC,gBAHV,QAIO,yBAJP;AAKA,SAASC,YAAT,EAAuBC,aAAvB,QAA4C,uBAA5C;AACA,SACCC,aADD,EAECC,IAAI,IAAIC,QAFT,EAGCC,IAAI,IAAIC,QAHT,QAIO,kBAJP;AAKA,SAASR,KAAK,IAAIS,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,SAASV,KAAK,IAAIW,aAAlB,QAAuC,gBAAvC;;AAEA,SAASC,aAAT,OAWI;AAAA,MAXoB;AACvBC,IAAAA,OADuB;AAEvBC,IAAAA,OAFuB;AAGvBP,IAAAA,IAHuB;AAIvBF,IAAAA,IAJuB;AAKvBU,IAAAA,YALuB;AAMvBC,IAAAA,sBANuB;AAOvBC,IAAAA,wBAPuB;AAQvBC,IAAAA,cARuB;AASvBC,IAAAA,KATuB;AAUvBC,IAAAA;AAVuB,GA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AAQ,CAAE3C,WAAF,CAAR,CAAwBF,IADxB;AAENF,IAAAA,IAAI,EAAE+C,QAAQ,CAAE3C,WAAF,CAAR,CAAwBJ,IAFxB;;AAGNa,IAAAA,cAAc,GAAG;AAChBmC,MAAAA,kBAAkB;AAClBC,MAAAA,wBAAwB,CAAE,KAAF,CAAxB;AACA;;AANK,GAAP;AAQA,CAZW,CA1BW,EAuCvB1D,iBAAiB,CAAE;AAAE2D,EAAAA,eAAe,EAAE;AAAnB,CAAF,CAvCM,EAwCvB9D,wBAxCuB,CAAF,CAAP,CAyCVmB,aAzCU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { Platform, ScrollView, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef, useState } from '@wordpress/element';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { withViewportMatch } from '@wordpress/viewport';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInserter,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport {\n\tkeyboardClose,\n\tundo as undoIcon,\n\tredo as redoIcon,\n} from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport { store as editPostStore } from '../../../store';\n\nfunction HeaderToolbar( {\n\thasRedo,\n\thasUndo,\n\tredo,\n\tundo,\n\tshowInserter,\n\tshowKeyboardHideButton,\n\tgetStylesFromColorScheme,\n\tonHideKeyboard,\n\tisRTL,\n\tnoContentSelected,\n} ) {\n\tconst wasNoContentSelected = useRef( noContentSelected );\n\tconst [ isInserterOpen, setIsInserterOpen ] = useState( false );\n\n\tconst scrollViewRef = useRef( null );\n\tconst scrollToStart = () => {\n\t\t// scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android\n\t\tconst isAndroid = Platform.OS === 'android';\n\t\tif ( isAndroid && isRTL ) {\n\t\t\tscrollViewRef.current.scrollToEnd();\n\t\t} else {\n\t\t\tscrollViewRef.current.scrollTo( { x: 0 } );\n\t\t}\n\t};\n\tconst renderHistoryButtons = () => {\n\t\tconst buttons = [\n\t\t\t/* TODO: replace with EditorHistoryRedo and EditorHistoryUndo. */\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"undoButton\"\n\t\t\t\ttitle={ __( 'Undo' ) }\n\t\t\t\ticon={ ! isRTL ? undoIcon : redoIcon }\n\t\t\t\tisDisabled={ ! hasUndo }\n\t\t\t\tonClick={ undo }\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Double tap to undo last change' ),\n\t\t\t\t} }\n\t\t\t/>,\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"redoButton\"\n\t\t\t\ttitle={ __( 'Redo' ) }\n\t\t\t\ticon={ ! isRTL ? redoIcon : undoIcon }\n\t\t\t\tisDisabled={ ! hasRedo }\n\t\t\t\tonClick={ redo }\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Double tap to redo last change' ),\n\t\t\t\t} }\n\t\t\t/>,\n\t\t];\n\n\t\treturn isRTL ? buttons.reverse() : buttons;\n\t};\n\n\tconst onToggleInserter = useCallback(\n\t\t( isOpen ) => {\n\t\t\tif ( isOpen ) {\n\t\t\t\twasNoContentSelected.current = noContentSelected;\n\t\t\t}\n\t\t\tsetIsInserterOpen( isOpen );\n\t\t},\n\t\t[ noContentSelected ]\n\t);\n\n\t// Expanded mode should be preserved while the inserter is open.\n\t// This way we prevent style updates during the opening transition.\n\tconst useExpandedMode = isInserterOpen\n\t\t? wasNoContentSelected.current\n\t\t: noContentSelected;\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ [\n\t\t\t\tgetStylesFromColorScheme(\n\t\t\t\t\tstyles[ 'header-toolbar__container' ],\n\t\t\t\t\tstyles[ 'header-toolbar__container--dark' ]\n\t\t\t\t),\n\t\t\t\tuseExpandedMode &&\n\t\t\t\t\tstyles[ 'header-toolbar__container--expanded' ],\n\t\t\t] }\n\t\t>\n\t\t\t<ScrollView\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\tonContentSizeChange={ scrollToStart }\n\t\t\t\thorizontal={ true }\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\talwaysBounceHorizontal={ false }\n\t\t\t\tcontentContainerStyle={\n\t\t\t\t\tstyles[ 'header-toolbar__scrollable-content' ]\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<Inserter\n\t\t\t\t\tdisabled={ ! showInserter }\n\t\t\t\t\tuseExpandedMode={ useExpandedMode }\n\t\t\t\t\tonToggle={ onToggleInserter }\n\t\t\t\t/>\n\t\t\t\t{ renderHistoryButtons() }\n\t\t\t\t<BlockToolbar />\n\t\t\t</ScrollView>\n\t\t\t{ showKeyboardHideButton && (\n\t\t\t\t<ToolbarGroup\n\t\t\t\t\tpassedStyle={\n\t\t\t\t\t\tstyles[ 'header-toolbar__keyboard-hide-container' ]\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Hide keyboard' ) }\n\t\t\t\t\t\ticon={ keyboardClose }\n\t\t\t\t\t\tonClick={ onHideKeyboard }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\thint: __( 'Tap to hide the keyboard' ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</View>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockSelectionEnd,\n\t\t\thasInserterItems,\n\t\t\thasSelectedBlock,\n\t\t} = select( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst isAnyBlockSelected = hasSelectedBlock();\n\t\treturn {\n\t\t\thasRedo: select( editorStore ).hasEditorRedo(),\n\t\t\thasUndo: select( editorStore ).hasEditorUndo(),\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tshowInserter:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisTextModeEnabled:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'text',\n\t\t\tisRTL: select( blockEditorStore ).getSettings().isRTL,\n\t\t\tnoContentSelected: ! isAnyBlockSelected,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { clearSelectedBlock } = dispatch( blockEditorStore );\n\t\tconst { togglePostTitleSelection } = dispatch( editorStore );\n\n\t\treturn {\n\t\t\tredo: dispatch( editorStore ).redo,\n\t\t\tundo: dispatch( editorStore ).undo,\n\t\t\tonHideKeyboard() {\n\t\t\t\tclearSelectedBlock();\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t};\n\t} ),\n\twithViewportMatch( { isLargeViewport: 'medium' } ),\n\twithPreferredColorScheme,\n] )( HeaderToolbar );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/header-toolbar/index.native.js"],"names":["Platform","ScrollView","View","useCallback","useRef","useState","compose","withPreferredColorScheme","withSelect","withDispatch","withViewportMatch","__","Inserter","BlockToolbar","store","blockEditorStore","ToolbarGroup","ToolbarButton","keyboardClose","undo","undoIcon","redo","redoIcon","editorStore","styles","editPostStore","HeaderToolbar","hasRedo","hasUndo","showInserter","showKeyboardHideButton","getStylesFromColorScheme","onHideKeyboard","isRTL","noContentSelected","wasNoContentSelected","isInserterOpen","setIsInserterOpen","scrollViewRef","scrollToStart","isAndroid","OS","current","scrollToEnd","scrollTo","x","renderHistoryButtons","buttons","hint","reverse","onToggleInserter","isOpen","useExpandedMode","toolbarAriaLabel","select","getBlockRootClientId","getBlockSelectionEnd","hasInserterItems","hasSelectedBlock","getEditorSettings","isAnyBlockSelected","hasEditorRedo","hasEditorUndo","getEditorMode","richEditingEnabled","isTextModeEnabled","getSettings","dispatch","clearSelectedBlock","togglePostTitleSelection","isLargeViewport"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,UAAnB,EAA+BC,IAA/B,QAA2C,cAA3C;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,MAAtB,EAA8BC,QAA9B,QAA8C,oBAA9C;AACA,SAASC,OAAT,EAAkBC,wBAAlB,QAAkD,oBAAlD;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,QADD,EAECC,YAFD,EAGCC,KAAK,IAAIC,gBAHV,QAIO,yBAJP;AAKA,SAASC,YAAT,EAAuBC,aAAvB,QAA4C,uBAA5C;AACA,SACCC,aADD,EAECC,IAAI,IAAIC,QAFT,EAGCC,IAAI,IAAIC,QAHT,QAIO,kBAJP;AAKA,SAASR,KAAK,IAAIS,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,SAASV,KAAK,IAAIW,aAAlB,QAAuC,gBAAvC;;AAEA,SAASC,aAAT,OAWI;AAAA,MAXoB;AACvBC,IAAAA,OADuB;AAEvBC,IAAAA,OAFuB;AAGvBP,IAAAA,IAHuB;AAIvBF,IAAAA,IAJuB;AAKvBU,IAAAA,YALuB;AAMvBC,IAAAA,sBANuB;AAOvBC,IAAAA,wBAPuB;AAQvBC,IAAAA,cARuB;AASvBC,IAAAA,KATuB;AAUvBC,IAAAA;AAVuB,GAWpB;AACH,QAAMC,oBAAoB,GAAG/B,MAAM,CAAE8B,iBAAF,CAAnC;AACA,QAAM,CAAEE,cAAF,EAAkBC,iBAAlB,IAAwChC,QAAQ,CAAE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AI,EAAE8C,QAAQ,CAAE5C,WAAF,CAAR,CAAwBF,IADxB;AAENF,IAAAA,IAAI,EAAEgD,QAAQ,CAAE5C,WAAF,CAAR,CAAwBJ,IAFxB;;AAGNa,IAAAA,cAAc,GAAG;AAChBoC,MAAAA,kBAAkB;AAClBC,MAAAA,wBAAwB,CAAE,KAAF,CAAxB;AACA;;AANK,GAAP;AAQA,CAZW,CA1BW,EAuCvB3D,iBAAiB,CAAE;AAAE4D,EAAAA,eAAe,EAAE;AAAnB,CAAF,CAvCM,EAwCvB/D,wBAxCuB,CAAF,CAAP,CAyCVmB,aAzCU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { Platform, ScrollView, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef, useState } from '@wordpress/element';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { withViewportMatch } from '@wordpress/viewport';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInserter,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarGroup, ToolbarButton } from '@wordpress/components';\nimport {\n\tkeyboardClose,\n\tundo as undoIcon,\n\tredo as redoIcon,\n} from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport { store as editPostStore } from '../../../store';\n\nfunction HeaderToolbar( {\n\thasRedo,\n\thasUndo,\n\tredo,\n\tundo,\n\tshowInserter,\n\tshowKeyboardHideButton,\n\tgetStylesFromColorScheme,\n\tonHideKeyboard,\n\tisRTL,\n\tnoContentSelected,\n} ) {\n\tconst wasNoContentSelected = useRef( noContentSelected );\n\tconst [ isInserterOpen, setIsInserterOpen ] = useState( false );\n\n\tconst scrollViewRef = useRef( null );\n\tconst scrollToStart = () => {\n\t\t// scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android\n\t\tconst isAndroid = Platform.OS === 'android';\n\t\tif ( isAndroid && isRTL ) {\n\t\t\tscrollViewRef.current.scrollToEnd();\n\t\t} else {\n\t\t\tscrollViewRef.current.scrollTo( { x: 0 } );\n\t\t}\n\t};\n\tconst renderHistoryButtons = () => {\n\t\tconst buttons = [\n\t\t\t/* TODO: replace with EditorHistoryRedo and EditorHistoryUndo. */\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"undoButton\"\n\t\t\t\ttitle={ __( 'Undo' ) }\n\t\t\t\ticon={ ! isRTL ? undoIcon : redoIcon }\n\t\t\t\tisDisabled={ ! hasUndo }\n\t\t\t\tonClick={ undo }\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Double tap to undo last change' ),\n\t\t\t\t} }\n\t\t\t/>,\n\t\t\t<ToolbarButton\n\t\t\t\tkey=\"redoButton\"\n\t\t\t\ttitle={ __( 'Redo' ) }\n\t\t\t\ticon={ ! isRTL ? redoIcon : undoIcon }\n\t\t\t\tisDisabled={ ! hasRedo }\n\t\t\t\tonClick={ redo }\n\t\t\t\textraProps={ {\n\t\t\t\t\thint: __( 'Double tap to redo last change' ),\n\t\t\t\t} }\n\t\t\t/>,\n\t\t];\n\n\t\treturn isRTL ? buttons.reverse() : buttons;\n\t};\n\n\tconst onToggleInserter = useCallback(\n\t\t( isOpen ) => {\n\t\t\tif ( isOpen ) {\n\t\t\t\twasNoContentSelected.current = noContentSelected;\n\t\t\t}\n\t\t\tsetIsInserterOpen( isOpen );\n\t\t},\n\t\t[ noContentSelected ]\n\t);\n\n\t// Expanded mode should be preserved while the inserter is open.\n\t// This way we prevent style updates during the opening transition.\n\tconst useExpandedMode = isInserterOpen\n\t\t? wasNoContentSelected.current\n\t\t: noContentSelected;\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\treturn (\n\t\t<View\n\t\t\ttestID={ toolbarAriaLabel }\n\t\t\taccessibilityLabel={ toolbarAriaLabel }\n\t\t\tstyle={ [\n\t\t\t\tgetStylesFromColorScheme(\n\t\t\t\t\tstyles[ 'header-toolbar__container' ],\n\t\t\t\t\tstyles[ 'header-toolbar__container--dark' ]\n\t\t\t\t),\n\t\t\t\tuseExpandedMode &&\n\t\t\t\t\tstyles[ 'header-toolbar__container--expanded' ],\n\t\t\t] }\n\t\t>\n\t\t\t<ScrollView\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\tonContentSizeChange={ scrollToStart }\n\t\t\t\thorizontal={ true }\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\talwaysBounceHorizontal={ false }\n\t\t\t\tcontentContainerStyle={\n\t\t\t\t\tstyles[ 'header-toolbar__scrollable-content' ]\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<Inserter\n\t\t\t\t\tdisabled={ ! showInserter }\n\t\t\t\t\tuseExpandedMode={ useExpandedMode }\n\t\t\t\t\tonToggle={ onToggleInserter }\n\t\t\t\t/>\n\t\t\t\t{ renderHistoryButtons() }\n\t\t\t\t<BlockToolbar />\n\t\t\t</ScrollView>\n\t\t\t{ showKeyboardHideButton && (\n\t\t\t\t<ToolbarGroup\n\t\t\t\t\tpassedStyle={\n\t\t\t\t\t\tstyles[ 'header-toolbar__keyboard-hide-container' ]\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Hide keyboard' ) }\n\t\t\t\t\t\ticon={ keyboardClose }\n\t\t\t\t\t\tonClick={ onHideKeyboard }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\thint: __( 'Tap to hide the keyboard' ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t) }\n\t\t</View>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockSelectionEnd,\n\t\t\thasInserterItems,\n\t\t\thasSelectedBlock,\n\t\t} = select( blockEditorStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\t\tconst isAnyBlockSelected = hasSelectedBlock();\n\t\treturn {\n\t\t\thasRedo: select( editorStore ).hasEditorRedo(),\n\t\t\thasUndo: select( editorStore ).hasEditorUndo(),\n\t\t\t// This setting (richEditingEnabled) should not live in the block editor's setting.\n\t\t\tshowInserter:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'visual' &&\n\t\t\t\tgetEditorSettings().richEditingEnabled &&\n\t\t\t\thasInserterItems(\n\t\t\t\t\tgetBlockRootClientId( getBlockSelectionEnd() )\n\t\t\t\t),\n\t\t\tisTextModeEnabled:\n\t\t\t\tselect( editPostStore ).getEditorMode() === 'text',\n\t\t\tisRTL: select( blockEditorStore ).getSettings().isRTL,\n\t\t\tnoContentSelected: ! isAnyBlockSelected,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { clearSelectedBlock } = dispatch( blockEditorStore );\n\t\tconst { togglePostTitleSelection } = dispatch( editorStore );\n\n\t\treturn {\n\t\t\tredo: dispatch( editorStore ).redo,\n\t\t\tundo: dispatch( editorStore ).undo,\n\t\t\tonHideKeyboard() {\n\t\t\t\tclearSelectedBlock();\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t};\n\t} ),\n\twithViewportMatch( { isLargeViewport: 'medium' } ),\n\twithPreferredColorScheme,\n] )( HeaderToolbar );\n"]}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { get } from 'lodash';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
6
|
import { useViewportMatch, compose } from '@wordpress/compose';
|
|
12
7
|
import { withDispatch, withSelect } from '@wordpress/data';
|
|
13
8
|
import { PostPublishButton, store as editorStore } from '@wordpress/editor';
|
|
@@ -76,15 +71,19 @@ export function PostPublishButtonOrToggle(_ref) {
|
|
|
76
71
|
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
|
|
77
72
|
});
|
|
78
73
|
}
|
|
79
|
-
export default compose(withSelect(select =>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
74
|
+
export default compose(withSelect(select => {
|
|
75
|
+
var _select$getCurrentPos, _select$getCurrentPos2, _select$getCurrentPos3;
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
hasPublishAction: (_select$getCurrentPos = (_select$getCurrentPos2 = select(editorStore).getCurrentPost()) === null || _select$getCurrentPos2 === void 0 ? void 0 : (_select$getCurrentPos3 = _select$getCurrentPos2._links) === null || _select$getCurrentPos3 === void 0 ? void 0 : _select$getCurrentPos3['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false,
|
|
79
|
+
isBeingScheduled: select(editorStore).isEditedPostBeingScheduled(),
|
|
80
|
+
isPending: select(editorStore).isCurrentPostPending(),
|
|
81
|
+
isPublished: select(editorStore).isCurrentPostPublished(),
|
|
82
|
+
isPublishSidebarEnabled: select(editorStore).isPublishSidebarEnabled(),
|
|
83
|
+
isPublishSidebarOpened: select(editPostStore).isPublishSidebarOpened(),
|
|
84
|
+
isScheduled: select(editorStore).isCurrentPostScheduled()
|
|
85
|
+
};
|
|
86
|
+
}), withDispatch(dispatch => {
|
|
88
87
|
const {
|
|
89
88
|
togglePublishSidebar
|
|
90
89
|
} = dispatch(editPostStore);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/post-publish-button-or-toggle.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/post-publish-button-or-toggle.js"],"names":["useViewportMatch","compose","withDispatch","withSelect","PostPublishButton","store","editorStore","editPostStore","PostPublishButtonOrToggle","forceIsDirty","forceIsSaving","hasPublishAction","isBeingScheduled","isPending","isPublished","isPublishSidebarEnabled","isPublishSidebarOpened","isScheduled","togglePublishSidebar","setEntitiesSavedStatesCallback","IS_TOGGLE","IS_BUTTON","isSmallerThanMediumViewport","component","select","getCurrentPost","_links","isEditedPostBeingScheduled","isCurrentPostPending","isCurrentPostPublished","isCurrentPostScheduled","dispatch"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,OAA3B,QAA0C,oBAA1C;AACA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,iBAAT,EAA4BC,KAAK,IAAIC,WAArC,QAAwD,mBAAxD;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,aAAlB,QAAuC,aAAvC;AAEA,OAAO,SAASC,yBAAT,OAYH;AAAA,MAZuC;AAC1CC,IAAAA,YAD0C;AAE1CC,IAAAA,aAF0C;AAG1CC,IAAAA,gBAH0C;AAI1CC,IAAAA,gBAJ0C;AAK1CC,IAAAA,SAL0C;AAM1CC,IAAAA,WAN0C;AAO1CC,IAAAA,uBAP0C;AAQ1CC,IAAAA,sBAR0C;AAS1CC,IAAAA,WAT0C;AAU1CC,IAAAA,oBAV0C;AAW1CC,IAAAA;AAX0C,GAYvC;AACH,QAAMC,SAAS,GAAG,QAAlB;AACA,QAAMC,SAAS,GAAG,QAAlB;AACA,QAAMC,2BAA2B,GAAGtB,gBAAgB,CAAE,QAAF,EAAY,GAAZ,CAApD;AACA,MAAIuB,SAAJ;AAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACC,MACCT,WAAW,IACTG,WAAW,IAAIL,gBADjB,IAEEC,SAAS,IAAI,CAAEF,gBAAf,IAAmC,CAAEW,2BAHxC,EAIE;AACDC,IAAAA,SAAS,GAAGF,SAAZ;AACA,GAND,M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AQ,CAAExB,aAAF,CAAzC;AACA,SAAO;AACNW,IAAAA;AADM,GAAP;AAGA,CALW,CAfS,CAAP,CAqBZV,yBArBY,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch, compose } from '@wordpress/compose';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { PostPublishButton, store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport function PostPublishButtonOrToggle( {\n\tforceIsDirty,\n\tforceIsSaving,\n\thasPublishAction,\n\tisBeingScheduled,\n\tisPending,\n\tisPublished,\n\tisPublishSidebarEnabled,\n\tisPublishSidebarOpened,\n\tisScheduled,\n\ttogglePublishSidebar,\n\tsetEntitiesSavedStatesCallback,\n} ) {\n\tconst IS_TOGGLE = 'toggle';\n\tconst IS_BUTTON = 'button';\n\tconst isSmallerThanMediumViewport = useViewportMatch( 'medium', '<' );\n\tlet component;\n\n\t/**\n\t * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):\n\t *\n\t * 1) We want to show a BUTTON when the post status is at the _final stage_\n\t * for a particular role (see https://wordpress.org/support/article/post-status/):\n\t *\n\t * - is published\n\t * - is scheduled to be published\n\t * - is pending and can't be published (but only for viewports >= medium).\n\t * \t Originally, we considered showing a button for pending posts that couldn't be published\n\t * \t (for example, for an author with the contributor role). Some languages can have\n\t * \t long translations for \"Submit for review\", so given the lack of UI real estate available\n\t * \t we decided to take into account the viewport in that case.\n\t * \t See: https://github.com/WordPress/gutenberg/issues/10475\n\t *\n\t * 2) Then, in small viewports, we'll show a TOGGLE.\n\t *\n\t * 3) Finally, we'll use the publish sidebar status to decide:\n\t *\n\t * - if it is enabled, we show a TOGGLE\n\t * - if it is disabled, we show a BUTTON\n\t */\n\tif (\n\t\tisPublished ||\n\t\t( isScheduled && isBeingScheduled ) ||\n\t\t( isPending && ! hasPublishAction && ! isSmallerThanMediumViewport )\n\t) {\n\t\tcomponent = IS_BUTTON;\n\t} else if ( isSmallerThanMediumViewport ) {\n\t\tcomponent = IS_TOGGLE;\n\t} else if ( isPublishSidebarEnabled ) {\n\t\tcomponent = IS_TOGGLE;\n\t} else {\n\t\tcomponent = IS_BUTTON;\n\t}\n\n\treturn (\n\t\t<PostPublishButton\n\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\tforceIsSaving={ forceIsSaving }\n\t\t\tisOpen={ isPublishSidebarOpened }\n\t\t\tisToggle={ component === IS_TOGGLE }\n\t\t\tonToggle={ togglePublishSidebar }\n\t\t\tsetEntitiesSavedStatesCallback={ setEntitiesSavedStatesCallback }\n\t\t/>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select ) => ( {\n\t\thasPublishAction:\n\t\t\tselect( editorStore ).getCurrentPost()?._links?.[\n\t\t\t\t'wp:action-publish'\n\t\t\t] ?? false,\n\t\tisBeingScheduled: select( editorStore ).isEditedPostBeingScheduled(),\n\t\tisPending: select( editorStore ).isCurrentPostPending(),\n\t\tisPublished: select( editorStore ).isCurrentPostPublished(),\n\t\tisPublishSidebarEnabled:\n\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\tisPublishSidebarOpened:\n\t\t\tselect( editPostStore ).isPublishSidebarOpened(),\n\t\tisScheduled: select( editorStore ).isCurrentPostScheduled(),\n\t} ) ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { togglePublishSidebar } = dispatch( editPostStore );\n\t\treturn {\n\t\t\ttogglePublishSidebar,\n\t\t};\n\t} )\n)( PostPublishButtonOrToggle );\n"]}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { mapValues } from 'lodash';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
6
|
import { __ } from '@wordpress/i18n';
|
|
12
7
|
import { TextControl } from '@wordpress/components';
|
|
13
8
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
@@ -61,6 +56,8 @@ export default function EditTemplateTitle() {
|
|
|
61
56
|
value: forceEmpty ? '' : templateTitle,
|
|
62
57
|
help: __('Give the template a title that indicates its purpose, e.g. "Full Width".'),
|
|
63
58
|
onChange: newTitle => {
|
|
59
|
+
var _settings$availableTe;
|
|
60
|
+
|
|
64
61
|
// Allow having the field temporarily empty while typing.
|
|
65
62
|
if (!newTitle && !forceEmpty) {
|
|
66
63
|
setForceEmpty(true);
|
|
@@ -69,13 +66,15 @@ export default function EditTemplateTitle() {
|
|
|
69
66
|
|
|
70
67
|
setForceEmpty(false);
|
|
71
68
|
const settings = getEditorSettings();
|
|
72
|
-
const newAvailableTemplates =
|
|
69
|
+
const newAvailableTemplates = Object.fromEntries(Object.entries((_settings$availableTe = settings.availableTemplates) !== null && _settings$availableTe !== void 0 ? _settings$availableTe : {}).map(_ref => {
|
|
70
|
+
let [id, existingTitle] = _ref;
|
|
71
|
+
|
|
73
72
|
if (id !== template.slug) {
|
|
74
73
|
return existingTitle;
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
return newTitle;
|
|
78
|
-
});
|
|
77
|
+
}));
|
|
79
78
|
updateEditorSettings({ ...settings,
|
|
80
79
|
availableTemplates: newAvailableTemplates
|
|
81
80
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/edit-template-title.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/edit-template-title.js"],"names":["__","TextControl","useDispatch","useSelect","useState","store","editorStore","coreStore","editPostStore","EditTemplateTitle","forceEmpty","setForceEmpty","template","select","getEditedPostTemplate","editEntityRecord","getEditorSettings","updateEditorSettings","is_custom","has_theme_file","templateTitle","title","slug","newTitle","settings","newAvailableTemplates","Object","fromEntries","entries","availableTemplates","map","id","existingTitle"],"mappings":";;AAAA;AACA;AACA;AACA,SAAS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SAAS,EAAC;AAAf,KACC,cAAC,WAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGtB,EAAE,CAAE,OAAF,CAFX;AAGC,IAAA,KAAK,EAAGU,UAAU,GAAG,EAAH,GAAQU,aAH3B;AAIC,IAAA,IAAI,EAAGpB,EAAE,CACR,0EADQ,CAJV;AAOC,IAAA,QAAQ,EAAKuB,QAAF,IAAgB;AAAA;;AAC1B;AACA,UAAK,CAAEA,QAAF,IAAc,CAAEb,UAArB,EAAkC;AACjCC,QAAAA,aAAa,CAAE,IAAF,CAAb;AACA;AACA;;AACDA,MAAAA,aAAa,CAAE,KAAF,CAAb;AAEA,YAAMa,QAAQ,GAAGR,iBAAiB,EAAlC;AACA,YAAMS,qBAAqB,GAAGC,MAAM,CAACC,WAAP,CAC7BD,MAAM,CAACE,OAAP,0BAAgBJ,QAAQ,CAACK,kBAAzB,yEAA+C,EAA/C,EAAoDC,GAApD,CACC,QAA6B;AAAA,YAA3B,CAAEC,EAAF,EAAMC,aAAN,CAA2B;;AAC5B,YAAKD,EAAE,KAAKnB,QAAQ,CAACU,IAArB,EAA4B;AAC3B,iBAAOU,aAAP;AACA;;AACD,eAAOT,QAAP;AACA,OANF,CAD6B,CAA9B;AAUAN,MAAAA,oBAAoB,CAAE,EACrB,GAAGO,QADkB;AAErBK,QAAAA,kBAAkB,EAAEJ;AAFC,OAAF,CAApB;AAIAV,MAAAA,gBAAgB,CAAE,UAAF,EAAc,aAAd,EAA6BH,QAAQ,CAACmB,EAAtC,EAA0C;AACzDV,QAAAA,KAAK,EAAEE;AADkD,OAA1C,CAAhB;AAGA,KAjCF;AAkCC,IAAA,MAAM,EAAG,MAAMZ,aAAa,CAAE,KAAF;AAlC7B,IADD,CADD;AAwCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nexport default function EditTemplateTitle() {\n\tconst [ forceEmpty, setForceEmpty ] = useState( false );\n\tconst { template } = useSelect( ( select ) => {\n\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\treturn {\n\t\t\ttemplate: getEditedPostTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { getEditorSettings } = useSelect( editorStore );\n\tconst { updateEditorSettings } = useDispatch( editorStore );\n\n\t// Only user-created and non-default templates can change the name.\n\tif ( ! template.is_custom || template.has_theme_file ) {\n\t\treturn null;\n\t}\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\tvalue={ forceEmpty ? '' : templateTitle }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Give the template a title that indicates its purpose, e.g. \"Full Width\".'\n\t\t\t\t) }\n\t\t\t\tonChange={ ( newTitle ) => {\n\t\t\t\t\t// Allow having the field temporarily empty while typing.\n\t\t\t\t\tif ( ! newTitle && ! forceEmpty ) {\n\t\t\t\t\t\tsetForceEmpty( true );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tsetForceEmpty( false );\n\n\t\t\t\t\tconst settings = getEditorSettings();\n\t\t\t\t\tconst newAvailableTemplates = Object.fromEntries(\n\t\t\t\t\t\tObject.entries( settings.availableTemplates ?? {} ).map(\n\t\t\t\t\t\t\t( [ id, existingTitle ] ) => {\n\t\t\t\t\t\t\t\tif ( id !== template.slug ) {\n\t\t\t\t\t\t\t\t\treturn existingTitle;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn newTitle;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tupdateEditorSettings( {\n\t\t\t\t\t\t...settings,\n\t\t\t\t\t\tavailableTemplates: newAvailableTemplates,\n\t\t\t\t\t} );\n\t\t\t\t\teditEntityRecord( 'postType', 'wp_template', template.id, {\n\t\t\t\t\t\ttitle: newTitle,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tonBlur={ () => setForceEmpty( false ) }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"]}
|