@wordpress/editor 13.22.0 → 13.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/index.js +8 -0
- package/build/components/index.js.map +1 -1
- package/build/components/page-attributes/order.js +1 -0
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/post-featured-image/index.js +3 -1
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-sync-status/index.js +1 -1
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build/components/post-title/index.js +1 -2
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js +1 -1
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-url/panel.js +69 -0
- package/build/components/post-url/panel.js.map +1 -0
- package/build/components/provider/index.js +125 -14
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +22 -17
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.native.js +2 -2
- package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build/private-apis.js +5 -1
- package/build/private-apis.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/page-attributes/order.js +1 -0
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +3 -1
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js +2 -2
- package/build-module/components/post-sync-status/index.js.map +1 -1
- package/build-module/components/post-title/index.js +1 -2
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +3 -3
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-url/panel.js +61 -0
- package/build-module/components/post-url/panel.js.map +1 -0
- package/build-module/components/provider/index.js +124 -14
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +22 -17
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.native.js +2 -2
- package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-module/private-apis.js +4 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-style/style-rtl.css +30 -3
- package/build-style/style.css +30 -3
- package/package.json +31 -31
- package/src/components/index.js +1 -0
- package/src/components/page-attributes/order.js +1 -0
- package/src/components/post-featured-image/index.js +3 -1
- package/src/components/post-sync-status/index.js +5 -2
- package/src/components/post-sync-status/style.scss +2 -3
- package/src/components/post-title/index.js +0 -1
- package/src/components/post-title/index.native.js +4 -8
- package/src/components/post-url/panel.js +64 -0
- package/src/components/post-url/style.scss +30 -0
- package/src/components/provider/README.md +50 -0
- package/src/components/provider/index.js +190 -14
- package/src/components/provider/use-block-editor-settings.js +54 -35
- package/src/components/provider/use-block-editor-settings.native.js +2 -2
- package/src/private-apis.js +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","sprintf","applyFilters","DropZone","Button","Spinner","ResponsiveWrapper","withNotices","withFilters","__experimentalHStack","HStack","isBlobURL","useState","useRef","compose","useSelect","withDispatch","withSelect","MediaUpload","MediaUploadCheck","store","blockEditorStore","coreStore","PostFeaturedImageCheck","editorStore","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","createElement","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","toggleRef","isLoading","setIsLoading","mediaUpload","select","getSettings","onDropFiles","filesList","allowedTypes","onFileChange","image","url","onError","message","removeAllNotices","createErrorNotice","className","alt_text","full","file","slug","fallback","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","ref","onClick","naturalWidth","naturalHeight","isInline","src","alt","set_featured_image","current","focus","onFilesDrop","value","applyWithSelect","getMedia","getPostType","getCurrentPostId","getEditedPostAttribute","context","applyWithDispatch","dispatch","editPost","featured_media","onDropImage"],"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\tResponsiveWrapper,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Set featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n} ) {\n\tconst toggleRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst mediaUpload = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).getSettings().mediaUpload;\n\t}, [] );\n\tconst { mediaWidth, mediaHeight, mediaSourceUrl } = getMediaDetails(\n\t\tmedia,\n\t\tcurrentPostId\n\t);\n\n\tfunction onDropFiles( filesList ) {\n\t\tmediaUpload( {\n\t\t\tallowedTypes: [ 'image' ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonUpdateImage( image );\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tmedia.media_details.sizes?.full?.file ||\n\t\t\t\t\t\t\t\t\tmedia.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostType?.labels?.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Edit or replace the image' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\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{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t<ResponsiveWrapper\n\t\t\t\t\t\t\t\t\t\t\tnaturalWidth={ mediaWidth }\n\t\t\t\t\t\t\t\t\t\t\tnaturalHeight={ mediaHeight }\n\t\t\t\t\t\t\t\t\t\t\tisInline\n\t\t\t\t\t\t\t\t\t\t>\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\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</ResponsiveWrapper>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isLoading && <Spinner /> }\n\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t! isLoading &&\n\t\t\t\t\t\t\t\t\t\t( postType?.labels\n\t\t\t\t\t\t\t\t\t\t\t?.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t\t\t\t\t<HStack className=\"editor-post-featured-image__actions\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\t// Prefer that screen readers use the .editor-post-featured-image__preview button.\n\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t\t\t\t\t\t\ttoggleRef.current.focus();\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\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropFiles } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType } = select( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SACCC,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD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AAOA,CAAEC,OAAO,EAAG;UAClBd,gBAAgB,CAACe,gBAAgB,CAAC,CAAC;UACnCf,gBAAgB,CAACgB,iBAAiB,CAAEF,OAAQ,CAAC;QAC9C;MACD,CAAE,CAAC;IACL,CAAC;IACDjB,aAAaA,CAAA,EAAG;MACfsD,QAAQ,CAAE;QAAEC,cAAc,EAAE;MAAE,CAAE,CAAC;IAClC;EACD,CAAC;AACF,CACD,CAAC;AAED,eAAe3F,OAAO,CACrBP,WAAW,EACXyF,eAAe,EACfM,iBAAiB,EACjB9F,WAAW,CAAE,0BAA2B,CACzC,CAAC,CAAEsC,iBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"names":["__","sprintf","applyFilters","DropZone","Button","Spinner","ResponsiveWrapper","withNotices","withFilters","__experimentalHStack","HStack","isBlobURL","useState","useRef","compose","useSelect","withDispatch","withSelect","MediaUpload","MediaUploadCheck","store","blockEditorStore","coreStore","PostFeaturedImageCheck","editorStore","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","createElement","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","toggleRef","isLoading","setIsLoading","mediaUpload","select","getSettings","onDropFiles","filesList","allowedTypes","onFileChange","image","url","onError","message","removeAllNotices","createErrorNotice","className","alt_text","full","file","slug","fallback","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","ref","onClick","naturalWidth","naturalHeight","isInline","src","alt","set_featured_image","current","focus","onFilesDrop","value","applyWithSelect","getMedia","getPostType","getCurrentPostId","getEditedPostAttribute","context","applyWithDispatch","dispatch","editPost","featured_media","onDropImage"],"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\tResponsiveWrapper,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Set featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n} ) {\n\tconst toggleRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst mediaUpload = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).getSettings().mediaUpload;\n\t}, [] );\n\tconst { mediaWidth, mediaHeight, mediaSourceUrl } = getMediaDetails(\n\t\tmedia,\n\t\tcurrentPostId\n\t);\n\n\tfunction onDropFiles( filesList ) {\n\t\tmediaUpload( {\n\t\t\tallowedTypes: [ 'image' ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( image ) {\n\t\t\t\t\tonUpdateImage( image );\n\t\t\t\t}\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tmedia.media_details.sizes?.full?.file ||\n\t\t\t\t\t\t\t\t\tmedia.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostType?.labels?.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Edit or replace the image' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\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{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t<ResponsiveWrapper\n\t\t\t\t\t\t\t\t\t\t\tnaturalWidth={ mediaWidth }\n\t\t\t\t\t\t\t\t\t\t\tnaturalHeight={ mediaHeight }\n\t\t\t\t\t\t\t\t\t\t\tisInline\n\t\t\t\t\t\t\t\t\t\t>\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\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</ResponsiveWrapper>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isLoading && <Spinner /> }\n\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t! isLoading &&\n\t\t\t\t\t\t\t\t\t\t( postType?.labels\n\t\t\t\t\t\t\t\t\t\t\t?.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t\t\t\t\t<HStack className=\"editor-post-featured-image__actions\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\t// Prefer that screen readers use the .editor-post-featured-image__preview button.\n\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t\t\t\t\t\t\ttoggleRef.current.focus();\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\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropFiles } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType } = select( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SACCC,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,EAAEC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AACrE,SACCC,WAAW,EACXC,gBAAgB,EAChBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB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E,CAAC;IACL,CAAC;IACDjB,aAAaA,CAAA,EAAG;MACfsD,QAAQ,CAAE;QAAEC,cAAc,EAAE;MAAE,CAAE,CAAC;IAClC;EACD,CAAC;AACF,CACD,CAAC;AAED,eAAe3F,OAAO,CACrBP,WAAW,EACXyF,eAAe,EACfM,iBAAiB,EACjB9F,WAAW,CAAE,0BAA2B,CACzC,CAAC,CAAEsC,iBAAkB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { createElement, Fragment } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { __, _x } from '@wordpress/i18n';
|
|
7
7
|
import { PanelRow, Modal, Button, __experimentalHStack as HStack, __experimentalVStack as VStack, ToggleControl } from '@wordpress/components';
|
|
8
8
|
import { useEffect, useState } from '@wordpress/element';
|
|
9
9
|
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
@@ -91,7 +91,7 @@ export function PostSyncStatusModal() {
|
|
|
91
91
|
}, createElement(VStack, {
|
|
92
92
|
spacing: "5"
|
|
93
93
|
}, createElement(ReusableBlocksRenameHint, null), createElement(ToggleControl, {
|
|
94
|
-
label:
|
|
94
|
+
label: _x('Synced', 'Option that makes an individual pattern synchronized'),
|
|
95
95
|
help: __('Editing the pattern will update it anywhere it is used.'),
|
|
96
96
|
checked: !syncType,
|
|
97
97
|
onChange: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","__","PanelRow","Modal","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","ToggleControl","useEffect","useState","privateApis","blockEditorPrivateApis","store","editorStore","unlock","ReusableBlocksRenameHint","PostSyncStatus","syncStatus","postType","select","getEditedPostAttribute","meta","currentSyncStatus","wp_pattern_sync_status","createElement","className","PostSyncStatusModal","editPost","isModalOpen","setIsModalOpen","syncType","setSyncType","undefined","isNewPost","isCleanNewPost","setSyncStatus","Fragment","title","onRequestClose","overlayClassName","onSubmit","event","preventDefault","spacing","label","help","checked","onChange","justify","variant","type"],"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPanelRow,\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst meta = getEditedPostAttribute( 'meta' );\n\n\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\tconst currentSyncStatus =\n\t\t\tmeta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t? 'unsynced'\n\t\t\t\t: getEditedPostAttribute( 'wp_pattern_sync_status' );\n\n\t\treturn {\n\t\t\tsyncStatus: currentSyncStatus,\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelRow className=\"edit-post-sync-status\">\n\t\t\t<span>{ __( 'Sync status' ) }</span>\n\t\t\t<div>\n\t\t\t\t{ syncStatus === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ) }\n\t\t\t</div>\n\t\t</PanelRow>\n\t);\n}\n\nexport function PostSyncStatusModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst setSyncStatus = () => {\n\t\teditPost( {\n\t\t\tmeta: {\n\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t},\n\t\t} );\n\t};\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Set pattern sync status' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetSyncStatus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","__","_x","PanelRow","Modal","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","ToggleControl","useEffect","useState","privateApis","blockEditorPrivateApis","store","editorStore","unlock","ReusableBlocksRenameHint","PostSyncStatus","syncStatus","postType","select","getEditedPostAttribute","meta","currentSyncStatus","wp_pattern_sync_status","createElement","className","PostSyncStatusModal","editPost","isModalOpen","setIsModalOpen","syncType","setSyncType","undefined","isNewPost","isCleanNewPost","setSyncStatus","Fragment","title","onRequestClose","overlayClassName","onSubmit","event","preventDefault","spacing","label","help","checked","onChange","justify","variant","type"],"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tPanelRow,\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst meta = getEditedPostAttribute( 'meta' );\n\n\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\tconst currentSyncStatus =\n\t\t\tmeta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t? 'unsynced'\n\t\t\t\t: getEditedPostAttribute( 'wp_pattern_sync_status' );\n\n\t\treturn {\n\t\t\tsyncStatus: currentSyncStatus,\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelRow className=\"edit-post-sync-status\">\n\t\t\t<span>{ __( 'Sync status' ) }</span>\n\t\t\t<div>\n\t\t\t\t{ syncStatus === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ) }\n\t\t\t</div>\n\t\t</PanelRow>\n\t);\n}\n\nexport function PostSyncStatusModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst setSyncStatus = () => {\n\t\teditPost( {\n\t\t\tmeta: {\n\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t},\n\t\t} );\n\t};\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Set pattern sync status' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetSyncStatus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t\t\t'Option that makes an individual pattern synchronized'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Editing the pattern will update it anywhere it is used.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\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\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,QAAQ,EACRC,KAAK,EACLC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,aAAa,QACP,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAE/E;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAyB,CAAC,GAAGD,MAAM,CAAEH,sBAAuB,CAAC;AAErE,eAAe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ACpB,MAAM;IAAC4C,OAAO,EAAC;EAAO,GACtBxB,aAAA,CAACtB,MAAM;IAAC+C,OAAO,EAAC,SAAS;IAACC,IAAI,EAAC;EAAQ,GACpCpD,EAAE,CAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAEP,CAAC;AAEL"}
|
|
@@ -213,8 +213,7 @@ function PostTitle(_, forwardedRef) {
|
|
|
213
213
|
};
|
|
214
214
|
});
|
|
215
215
|
},
|
|
216
|
-
__unstableDisableFormats: true
|
|
217
|
-
preserveWhiteSpace: true
|
|
216
|
+
__unstableDisableFormats: true
|
|
218
217
|
});
|
|
219
218
|
|
|
220
219
|
/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","__","forwardRef","useEffect","useImperativeHandle","useRef","useState","decodeEntities","ENTER","useSelect","useDispatch","pasteHandler","store","blockEditorStore","__unstableUseRichText","useRichText","create","toHTMLString","insert","useMergeRefs","__unstableStripHTML","stripHTML","PostTypeSupportCheck","editorStore","REGEXP_NEWLINES","PostTitle","_","forwardedRef","ref","isSelected","setIsSelected","editPost","insertDefaultBlock","clearSelectedBlock","insertBlocks","isCleanNewPost","title","placeholder","hasFixedToolbar","select","getEditedPostAttribute","_isCleanNewPost","getSettings","titlePlaceholder","_hasFixedToolbar","focus","current","defaultView","ownerDocument","name","parent","document","activeElement","body","onEnterPress","undefined","onInsertBlockAfter","blocks","onUpdate","newTitle","selection","setSelection","onSelect","onUnselect","onChange","value","replace","onKeyDown","event","keyCode","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","HTML","length","firstBlock","attributes","slice","newValue","start","end","className","decodedPlaceholder","richTextRef","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","preserveWhiteSpace","createElement","supportKeys","contentEditable","role","onFocus","onBlur","onKeyPress"],"sources":["@wordpress/editor/src/components/post-title/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tforwardRef,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { ENTER } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\t__unstableUseRichText as useRichText,\n\tcreate,\n\ttoHTMLString,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\n/**\n * Constants\n */\nconst REGEXP_NEWLINES = /[\\r\\n]+/g;\n\nfunction PostTitle( _, forwardedRef ) {\n\tconst ref = useRef();\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { insertDefaultBlock, clearSelectedBlock, insertBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { isCleanNewPost, title, placeholder, hasFixedToolbar } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, isCleanNewPost: _isCleanNewPost } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\tconst { titlePlaceholder, hasFixedToolbar: _hasFixedToolbar } =\n\t\t\t\tgetSettings();\n\n\t\t\treturn {\n\t\t\t\tisCleanNewPost: _isCleanNewPost(),\n\t\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\t\tplaceholder: titlePlaceholder,\n\t\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tuseImperativeHandle( forwardedRef, () => ( {\n\t\tfocus: () => {\n\t\t\tref?.current?.focus();\n\t\t},\n\t} ) );\n\n\tuseEffect( () => {\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { defaultView } = ref.current.ownerDocument;\n\t\tconst { name, parent } = defaultView;\n\t\tconst ownerDocument =\n\t\t\tname === 'editor-canvas' ? parent.document : defaultView.document;\n\t\tconst { activeElement, body } = ownerDocument;\n\n\t\t// Only autofocus the title when the post is entirely empty. This should\n\t\t// only happen for a new post, which means we focus the title on new\n\t\t// post so the author can start typing right away, without needing to\n\t\t// click anything.\n\t\tif ( isCleanNewPost && ( ! activeElement || body === activeElement ) ) {\n\t\t\tref.current.focus();\n\t\t}\n\t}, [ isCleanNewPost ] );\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onUpdate( newTitle ) {\n\t\teditPost( { title: newTitle } );\n\t}\n\n\tconst [ selection, setSelection ] = useState( {} );\n\n\tfunction onSelect() {\n\t\tsetIsSelected( true );\n\t\tclearSelectedBlock();\n\t}\n\n\tfunction onUnselect() {\n\t\tsetIsSelected( false );\n\t\tsetSelection( {} );\n\t}\n\n\tfunction onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t// arguments first, then fallback to `Text` if they fail.\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error1 ) {\n\t\t\ttry {\n\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t} catch ( error2 ) {\n\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t// behaviour.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tevent.preventDefault();\n\n\t\tif ( ! content.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof content !== 'string' ) {\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\tonUpdate( stripHTML( firstBlock.attributes.content ) );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t} else {\n\t\t\tconst value = {\n\t\t\t\t...create( { html: title } ),\n\t\t\t\t...selection,\n\t\t\t};\n\t\t\tconst newValue = insert(\n\t\t\t\tvalue,\n\t\t\t\tcreate( { html: stripHTML( content ) } )\n\t\t\t);\n\t\t\tonUpdate( toHTMLString( { value: newValue } ) );\n\t\t\tsetSelection( {\n\t\t\t\tstart: newValue.start,\n\t\t\t\tend: newValue.end,\n\t\t\t} );\n\t\t}\n\t}\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = classnames(\n\t\t'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text',\n\t\t{\n\t\t\t'is-selected': isSelected,\n\t\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t}\n\t);\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\tconst { ref: richTextRef } = useRichText( {\n\t\tvalue: title,\n\t\tonChange,\n\t\tplaceholder: decodedPlaceholder,\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange( newStart, newEnd ) {\n\t\t\tsetSelection( ( sel ) => {\n\t\t\t\tconst { start, end } = sel;\n\t\t\t\tif ( start === newStart && end === newEnd ) {\n\t\t\t\t\treturn sel;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tend: newEnd,\n\t\t\t\t};\n\t\t\t} );\n\t\t},\n\t\t__unstableDisableFormats: true,\n\t\tpreserveWhiteSpace: true,\n\t} );\n\n\t/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<h1\n\t\t\t\tref={ useMergeRefs( [ richTextRef, ref ] ) }\n\t\t\t\tcontentEditable\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ decodedPlaceholder }\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline=\"true\"\n\t\t\t\tonFocus={ onSelect }\n\t\t\t\tonBlur={ onUnselect }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\tonPaste={ onPaste }\n\t\t\t/>\n\t\t</PostTypeSupportCheck>\n\t);\n\t/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n\nexport default forwardRef( PostTitle );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QACF,oBAAoB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EACnD,MAAM;IAAE2B,GAAG,EAAEgE;EAAY,CAAC,GAAG7E,WAAW,CAAE;IACzCkD,KAAK,EAAE7B,KAAK;IACZ4B,QAAQ;IACR3B,WAAW,EAAEsD,kBAAkB;IAC/BE,cAAc,EAAEjC,SAAS,CAAC4B,KAAK;IAC/BM,YAAY,EAAElC,SAAS,CAAC6B,GAAG;IAC3BM,iBAAiBA,CAAEC,QAAQ,EAAEC,MAAM,EAAG;MACrCpC,YAAY,CAAIqC,GAAG,IAAM;QACxB,MAAM;UAAEV,KAAK;UAAEC;QAAI,CAAC,GAAGS,GAAG;QAC1B,IAAKV,KAAK,KAAKQ,QAAQ,IAAIP,GAAG,KAAKQ,MAAM,EAAG;UAC3C,OAAOC,GAAG;QACX;QACA,OAAO;UACNV,KAAK,EAAEQ,QAAQ;UACfP,GAAG,EAAEQ;QACN,CAAC;MACF,CAAE,CAAC;IACJ,CAAC;IACDE,wBAAwB,EAAE,IAAI;IAC9BC,kBAAkB,EAAE;EACrB,CAAE,CAAC;;EAEH;EACA,OACCC,aAAA,CAAC/E,oBAAoB;IAACgF,WAAW,EAAC;EAAO,GACxCD,aAAA;IACCzE,GAAG,EAAGT,YAAY,CAAE,CAAEyE,WAAW,EAAEhE,GAAG,CAAG,CAAG;IAC5C2E,eAAe;IACfb,SAAS,EAAGA,SAAW;IACvB,cAAaC,kBAAoB;IACjCa,IAAI,EAAC,SAAS;IACd,kBAAe,MAAM;IACrBC,OAAO,EAAG3C,QAAU;IACpB4C,MAAM,EAAG3C,UAAY;IACrBI,SAAS,EAAGA,SAAW;IACvBwC,UAAU,EAAG5C,UAAY;IACzBQ,OAAO,EAAGA;EAAS,CACnB,CACoB,CAAC;EAExB;AACD;;AAEA,eAAerE,UAAU,CAAEuB,SAAU,CAAC"}
|
|
1
|
+
{"version":3,"names":["classnames","__","forwardRef","useEffect","useImperativeHandle","useRef","useState","decodeEntities","ENTER","useSelect","useDispatch","pasteHandler","store","blockEditorStore","__unstableUseRichText","useRichText","create","toHTMLString","insert","useMergeRefs","__unstableStripHTML","stripHTML","PostTypeSupportCheck","editorStore","REGEXP_NEWLINES","PostTitle","_","forwardedRef","ref","isSelected","setIsSelected","editPost","insertDefaultBlock","clearSelectedBlock","insertBlocks","isCleanNewPost","title","placeholder","hasFixedToolbar","select","getEditedPostAttribute","_isCleanNewPost","getSettings","titlePlaceholder","_hasFixedToolbar","focus","current","defaultView","ownerDocument","name","parent","document","activeElement","body","onEnterPress","undefined","onInsertBlockAfter","blocks","onUpdate","newTitle","selection","setSelection","onSelect","onUnselect","onChange","value","replace","onKeyDown","event","keyCode","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","HTML","length","firstBlock","attributes","slice","newValue","start","end","className","decodedPlaceholder","richTextRef","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","createElement","supportKeys","contentEditable","role","onFocus","onBlur","onKeyPress"],"sources":["@wordpress/editor/src/components/post-title/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tforwardRef,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { ENTER } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\t__unstableUseRichText as useRichText,\n\tcreate,\n\ttoHTMLString,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\n/**\n * Constants\n */\nconst REGEXP_NEWLINES = /[\\r\\n]+/g;\n\nfunction PostTitle( _, forwardedRef ) {\n\tconst ref = useRef();\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { insertDefaultBlock, clearSelectedBlock, insertBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { isCleanNewPost, title, placeholder, hasFixedToolbar } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, isCleanNewPost: _isCleanNewPost } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\tconst { titlePlaceholder, hasFixedToolbar: _hasFixedToolbar } =\n\t\t\t\tgetSettings();\n\n\t\t\treturn {\n\t\t\t\tisCleanNewPost: _isCleanNewPost(),\n\t\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\t\tplaceholder: titlePlaceholder,\n\t\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tuseImperativeHandle( forwardedRef, () => ( {\n\t\tfocus: () => {\n\t\t\tref?.current?.focus();\n\t\t},\n\t} ) );\n\n\tuseEffect( () => {\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { defaultView } = ref.current.ownerDocument;\n\t\tconst { name, parent } = defaultView;\n\t\tconst ownerDocument =\n\t\t\tname === 'editor-canvas' ? parent.document : defaultView.document;\n\t\tconst { activeElement, body } = ownerDocument;\n\n\t\t// Only autofocus the title when the post is entirely empty. This should\n\t\t// only happen for a new post, which means we focus the title on new\n\t\t// post so the author can start typing right away, without needing to\n\t\t// click anything.\n\t\tif ( isCleanNewPost && ( ! activeElement || body === activeElement ) ) {\n\t\t\tref.current.focus();\n\t\t}\n\t}, [ isCleanNewPost ] );\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onUpdate( newTitle ) {\n\t\teditPost( { title: newTitle } );\n\t}\n\n\tconst [ selection, setSelection ] = useState( {} );\n\n\tfunction onSelect() {\n\t\tsetIsSelected( true );\n\t\tclearSelectedBlock();\n\t}\n\n\tfunction onUnselect() {\n\t\tsetIsSelected( false );\n\t\tsetSelection( {} );\n\t}\n\n\tfunction onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t// arguments first, then fallback to `Text` if they fail.\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error1 ) {\n\t\t\ttry {\n\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t} catch ( error2 ) {\n\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t// behaviour.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tevent.preventDefault();\n\n\t\tif ( ! content.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof content !== 'string' ) {\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\tonUpdate( stripHTML( firstBlock.attributes.content ) );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t} else {\n\t\t\tconst value = {\n\t\t\t\t...create( { html: title } ),\n\t\t\t\t...selection,\n\t\t\t};\n\t\t\tconst newValue = insert(\n\t\t\t\tvalue,\n\t\t\t\tcreate( { html: stripHTML( content ) } )\n\t\t\t);\n\t\t\tonUpdate( toHTMLString( { value: newValue } ) );\n\t\t\tsetSelection( {\n\t\t\t\tstart: newValue.start,\n\t\t\t\tend: newValue.end,\n\t\t\t} );\n\t\t}\n\t}\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = classnames(\n\t\t'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text',\n\t\t{\n\t\t\t'is-selected': isSelected,\n\t\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t}\n\t);\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\tconst { ref: richTextRef } = useRichText( {\n\t\tvalue: title,\n\t\tonChange,\n\t\tplaceholder: decodedPlaceholder,\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange( newStart, newEnd ) {\n\t\t\tsetSelection( ( sel ) => {\n\t\t\t\tconst { start, end } = sel;\n\t\t\t\tif ( start === newStart && end === newEnd ) {\n\t\t\t\t\treturn sel;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tend: newEnd,\n\t\t\t\t};\n\t\t\t} );\n\t\t},\n\t\t__unstableDisableFormats: true,\n\t} );\n\n\t/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<h1\n\t\t\t\tref={ useMergeRefs( [ richTextRef, ref ] ) }\n\t\t\t\tcontentEditable\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ decodedPlaceholder }\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline=\"true\"\n\t\t\t\tonFocus={ onSelect }\n\t\t\t\tonBlur={ onUnselect }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\tonPaste={ onPaste }\n\t\t\t/>\n\t\t</PostTypeSupportCheck>\n\t);\n\t/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n\nexport default forwardRef( PostTitle );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QACF,oBAAoB;AAC3B,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,QAAQ,qBAAqB;AAC3C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SACCC,qBAAqB,IAAIC,WAAW,EACpCC,MAAM,EACNC,YAAY,EACZC,MAAM,QACA,sBAAsB;AAC7B,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,IAAIC,SAAS,QAAQ,gBAAgB;;AAEjE;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,4BAA4B;AAC7D,SAASV,KAAK,IAAIW,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA,MAAMC,eAAe,GAAG,UAAU;AAElC,SAASC,SAASA,CAAEC,CAAC,EAAEC,YAAY,EAAG;EACrC,MAAMC,GAAG,GAAGvB,MAAM,CAAC,CAAC;EACpB,MAAM,CAAEwB,UAAU,EAAEC,aAA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AC+E,WAAW,EAAC;EAAO,GACxCD,aAAA;IACCxE,GAAG,EAAGT,YAAY,CAAE,CAAEyE,WAAW,EAAEhE,GAAG,CAAG,CAAG;IAC5C0E,eAAe;IACfZ,SAAS,EAAGA,SAAW;IACvB,cAAaC,kBAAoB;IACjCY,IAAI,EAAC,SAAS;IACd,kBAAe,MAAM;IACrBC,OAAO,EAAG1C,QAAU;IACpB2C,MAAM,EAAG1C,UAAY;IACrBI,SAAS,EAAGA,SAAW;IACvBuC,UAAU,EAAG3C,UAAY;IACzBQ,OAAO,EAAGA;EAAS,CACnB,CACoB,CAAC;EAExB;AACD;;AAEA,eAAerE,UAAU,CAAEuB,SAAU,CAAC"}
|
|
@@ -8,14 +8,14 @@ import { View } from 'react-native';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
import { Component } from '@wordpress/element';
|
|
11
|
-
import {
|
|
11
|
+
import { create, insert } from '@wordpress/rich-text';
|
|
12
12
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
13
13
|
import { withDispatch, withSelect } from '@wordpress/data';
|
|
14
14
|
import { withFocusOutside } from '@wordpress/components';
|
|
15
15
|
import { withInstanceId, compose } from '@wordpress/compose';
|
|
16
16
|
import { __, sprintf } from '@wordpress/i18n';
|
|
17
17
|
import { pasteHandler } from '@wordpress/blocks';
|
|
18
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
18
|
+
import { store as blockEditorStore, RichText } from '@wordpress/block-editor';
|
|
19
19
|
import { store as editorStore } from '@wordpress/editor';
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -121,7 +121,7 @@ class PostTitle extends Component {
|
|
|
121
121
|
accessible: !this.props.isSelected,
|
|
122
122
|
accessibilityLabel: this.getTitle(title, postType),
|
|
123
123
|
accessibilityHint: __('Updates the title.')
|
|
124
|
-
}, createElement(RichText, {
|
|
124
|
+
}, createElement(RichText.Raw, {
|
|
125
125
|
setRef: this.setRef,
|
|
126
126
|
accessibilityLabel: this.getTitle(title, postType),
|
|
127
127
|
tagName: 'p',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","Component","__experimentalRichText","RichText","create","insert","decodeEntities","withDispatch","withSelect","withFocusOutside","withInstanceId","compose","__","sprintf","pasteHandler","store","blockEditorStore","editorStore","styles","PostTitle","constructor","props","setRef","bind","onPaste","componentDidUpdate","prevProps","isSelected","isAnyBlockSelected","richTextRef","blur","onUnselect","componentDidMount","innerRef","handleFocusOutside","focus","onSelect","value","onChange","plainText","html","title","onInsertBlockAfter","onUpdate","content","HTML","length","valueToInsert","firstBlock","name","attributes","slice","richText","getTitle","postType","render","placeholder","style","focusedBorderColor","borderStyle","isDimmed","globalStyles","decodedPlaceholder","borderColor","titleStyles","text","color","placeholderColor","createElement","testID","titleContainer","dimmed","accessible","accessibilityLabel","accessibilityHint","tagName","tagsToEliminate","unstableOnFocus","onBlur","multiline","fontSize","lineHeight","fontWeight","deleteEnter","onSelectionChange","onEnter","onEnterPress","disableEditingMenu","__unstableIsSelected","__unstableOnCreateUndoLevel","select","isPostTitleSelected","getEditedPostAttribute","getSelectedBlockClientId","getBlockRootClientId","getSettings","selectedId","selectionIsNested","__experimentalGlobalStylesBaseStyles","dispatch","undo","redo","togglePostTitleSelection","editPost","clearSelectedBlock","insertDefaultBlock","insertBlocks","undefined","onUndo","onRedo","blocks"],"sources":["@wordpress/editor/src/components/post-title/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport {\n\t__experimentalRichText as RichText,\n\tcreate,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { withFocusOutside } from '@wordpress/components';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nclass PostTitle extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.setRef = this.setRef.bind( this );\n\t\tthis.onPaste = this.onPaste.bind( this );\n\t}\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Unselect if any other block is selected and blur the RichText.\n\t\tif (\n\t\t\tthis.props.isSelected &&\n\t\t\t! prevProps.isAnyBlockSelected &&\n\t\t\tthis.props.isAnyBlockSelected\n\t\t) {\n\t\t\tif ( this.richTextRef ) {\n\t\t\t\tthis.richTextRef.blur();\n\t\t\t}\n\t\t\tthis.props.onUnselect();\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.innerRef ) {\n\t\t\tthis.props.innerRef( this );\n\t\t}\n\t}\n\n\thandleFocusOutside() {\n\t\tthis.props.onUnselect();\n\t}\n\n\tfocus() {\n\t\tthis.props.onSelect();\n\t}\n\n\tonPaste( { value, onChange, plainText, html } ) {\n\t\tconst { title, onInsertBlockAfter, onUpdate } = this.props;\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tif ( content.length ) {\n\t\t\tif ( typeof content === 'string' ) {\n\t\t\t\tconst valueToInsert = create( { html: content } );\n\t\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t\t} else {\n\t\t\t\tconst [ firstBlock ] = content;\n\t\t\t\tif (\n\t\t\t\t\t! title &&\n\t\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t\t) {\n\t\t\t\t\tonUpdate( firstBlock.attributes.content );\n\t\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t\t} else {\n\t\t\t\t\tonInsertBlockAfter( content );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tsetRef( richText ) {\n\t\tthis.richTextRef = richText;\n\t}\n\n\tgetTitle( title, postType ) {\n\t\tif ( 'page' === postType ) {\n\t\t\treturn ! title\n\t\t\t\t? /* translators: accessibility text. empty page title. */\n\t\t\t\t __( 'Page title. Empty' )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. %s: text content of the page title. */\n\t\t\t\t\t\t__( 'Page title. %s' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t );\n\t\t}\n\n\t\treturn ! title\n\t\t\t? /* translators: accessibility text. empty post title. */\n\t\t\t __( 'Post title. Empty' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: accessibility text. %s: text content of the post title. */\n\t\t\t\t\t__( 'Post title. %s' ),\n\t\t\t\t\ttitle\n\t\t\t );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tplaceholder,\n\t\t\tstyle,\n\t\t\ttitle,\n\t\t\tfocusedBorderColor,\n\t\t\tborderStyle,\n\t\t\tisDimmed,\n\t\t\tpostType,\n\t\t\tglobalStyles,\n\t\t} = this.props;\n\n\t\tconst decodedPlaceholder = decodeEntities( placeholder );\n\t\tconst borderColor = this.props.isSelected\n\t\t\t? focusedBorderColor\n\t\t\t: 'transparent';\n\t\tconst titleStyles = {\n\t\t\t...style,\n\t\t\t...( globalStyles?.text && {\n\t\t\t\tcolor: globalStyles.text,\n\t\t\t\tplaceholderColor: globalStyles.text,\n\t\t\t} ),\n\t\t};\n\n\t\treturn (\n\t\t\t<View\n\t\t\t\ttestID=\"post-title\"\n\t\t\t\tstyle={ [\n\t\t\t\t\tstyles.titleContainer,\n\t\t\t\t\tborderStyle,\n\t\t\t\t\t{ borderColor },\n\t\t\t\t\tisDimmed && styles.dimmed,\n\t\t\t\t] }\n\t\t\t\taccessible={ ! this.props.isSelected }\n\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\taccessibilityHint={ __( 'Updates the title.' ) }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\tsetRef={ this.setRef }\n\t\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\t\ttagName={ 'p' }\n\t\t\t\t\ttagsToEliminate={ [ 'strong' ] }\n\t\t\t\t\tunstableOnFocus={ this.props.onSelect }\n\t\t\t\t\tonBlur={ this.props.onBlur } // Always assign onBlur as a props.\n\t\t\t\t\tmultiline={ false }\n\t\t\t\t\tstyle={ titleStyles }\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tfontSize={ 24 }\n\t\t\t\t\tlineHeight={ 1 }\n\t\t\t\t\tfontWeight={ 'bold' }\n\t\t\t\t\tdeleteEnter={ true }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tthis.props.onUpdate( value );\n\t\t\t\t\t} }\n\t\t\t\t\tonPaste={ this.onPaste }\n\t\t\t\t\tplaceholder={ decodedPlaceholder }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonSelectionChange={ () => {} }\n\t\t\t\t\tonEnter={ this.props.onEnterPress }\n\t\t\t\t\tdisableEditingMenu={ true }\n\t\t\t\t\t__unstableIsSelected={ this.props.isSelected }\n\t\t\t\t\t__unstableOnCreateUndoLevel={ () => {} }\n\t\t\t\t></RichText>\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst { isPostTitleSelected, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\t\tconst { getSelectedBlockClientId, getBlockRootClientId, getSettings } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst selectedId = getSelectedBlockClientId();\n\t\tconst selectionIsNested = !! getBlockRootClientId( selectedId );\n\t\tconst globalStyles =\n\t\t\tgetSettings()?.__experimentalGlobalStylesBaseStyles?.color;\n\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tisAnyBlockSelected: !! selectedId,\n\t\t\tisSelected: isPostTitleSelected(),\n\t\t\tisDimmed: selectionIsNested,\n\t\t\tglobalStyles,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { undo, redo, togglePostTitleSelection, editPost } =\n\t\t\tdispatch( editorStore );\n\n\t\tconst { clearSelectedBlock, insertDefaultBlock, insertBlocks } =\n\t\t\tdispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tonEnterPress() {\n\t\t\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t\t\t},\n\t\t\tonUndo: undo,\n\t\t\tonRedo: redo,\n\t\t\tonSelect() {\n\t\t\t\ttogglePostTitleSelection( true );\n\t\t\t\tclearSelectedBlock();\n\t\t\t},\n\t\t\tonUnselect() {\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t\tonUpdate( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\tonInsertBlockAfter( blocks ) {\n\t\t\t\tinsertBlocks( blocks, 0 );\n\t\t\t},\n\t\t};\n\t} ),\n\twithInstanceId,\n\twithFocusOutside\n)( PostTitle );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,cAAc;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SACCC,sBAAsB,IAAIC,QAAQ,EAClCC,MAAM,EACNC,MAAM,QACA,sBAAsB;AAC7B,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AAC1D,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASC,cAAc,EAAEC,OAAO,QAAQ,oBAAoB;AAC5D,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AAEjC,MAAMC,SAAS,S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;EAAa,CAAC,GAC7DP,QAAQ,CAAEnF,gBAAiB,CAAC;EAE7B,OAAO;IACNsE,YAAYA,CAAA,EAAG;MACdmB,kBAAkB,CAAEE,SAAS,EAAEA,SAAS,EAAE,CAAE,CAAC;IAC9C,CAAC;IACDC,MAAM,EAAER,IAAI;IACZS,MAAM,EAAER,IAAI;IACZjE,QAAQA,CAAA,EAAG;MACVkE,wBAAwB,CAAE,IAAK,CAAC;MAChCE,kBAAkB,CAAC,CAAC;IACrB,CAAC;IACDzE,UAAUA,CAAA,EAAG;MACZuE,wBAAwB,CAAE,KAAM,CAAC;IAClC,CAAC;IACD3D,QAAQA,CAAEF,KAAK,EAAG;MACjB8D,QAAQ,CAAE;QAAE9D;MAAM,CAAE,CAAC;IACtB,CAAC;IACDC,kBAAkBA,CAAEoE,MAAM,EAAG;MAC5BJ,YAAY,CAAEI,MAAM,EAAE,CAAE,CAAC;IAC1B;EACD,CAAC;AACF,CAAE,CAAC,EACHpG,cAAc,EACdD,gBACD,CAAC,CAAEU,SAAU,CAAC"}
|
|
1
|
+
{"version":3,"names":["View","Component","create","insert","decodeEntities","withDispatch","withSelect","withFocusOutside","withInstanceId","compose","__","sprintf","pasteHandler","store","blockEditorStore","RichText","editorStore","styles","PostTitle","constructor","props","setRef","bind","onPaste","componentDidUpdate","prevProps","isSelected","isAnyBlockSelected","richTextRef","blur","onUnselect","componentDidMount","innerRef","handleFocusOutside","focus","onSelect","value","onChange","plainText","html","title","onInsertBlockAfter","onUpdate","content","HTML","length","valueToInsert","firstBlock","name","attributes","slice","richText","getTitle","postType","render","placeholder","style","focusedBorderColor","borderStyle","isDimmed","globalStyles","decodedPlaceholder","borderColor","titleStyles","text","color","placeholderColor","createElement","testID","titleContainer","dimmed","accessible","accessibilityLabel","accessibilityHint","Raw","tagName","tagsToEliminate","unstableOnFocus","onBlur","multiline","fontSize","lineHeight","fontWeight","deleteEnter","onSelectionChange","onEnter","onEnterPress","disableEditingMenu","__unstableIsSelected","__unstableOnCreateUndoLevel","select","isPostTitleSelected","getEditedPostAttribute","getSelectedBlockClientId","getBlockRootClientId","getSettings","selectedId","selectionIsNested","__experimentalGlobalStylesBaseStyles","dispatch","undo","redo","togglePostTitleSelection","editPost","clearSelectedBlock","insertDefaultBlock","insertBlocks","undefined","onUndo","onRedo","blocks"],"sources":["@wordpress/editor/src/components/post-title/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { create, insert } from '@wordpress/rich-text';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { withFocusOutside } from '@wordpress/components';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore, RichText } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nclass PostTitle extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.setRef = this.setRef.bind( this );\n\t\tthis.onPaste = this.onPaste.bind( this );\n\t}\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Unselect if any other block is selected and blur the RichText.\n\t\tif (\n\t\t\tthis.props.isSelected &&\n\t\t\t! prevProps.isAnyBlockSelected &&\n\t\t\tthis.props.isAnyBlockSelected\n\t\t) {\n\t\t\tif ( this.richTextRef ) {\n\t\t\t\tthis.richTextRef.blur();\n\t\t\t}\n\t\t\tthis.props.onUnselect();\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.innerRef ) {\n\t\t\tthis.props.innerRef( this );\n\t\t}\n\t}\n\n\thandleFocusOutside() {\n\t\tthis.props.onUnselect();\n\t}\n\n\tfocus() {\n\t\tthis.props.onSelect();\n\t}\n\n\tonPaste( { value, onChange, plainText, html } ) {\n\t\tconst { title, onInsertBlockAfter, onUpdate } = this.props;\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tif ( content.length ) {\n\t\t\tif ( typeof content === 'string' ) {\n\t\t\t\tconst valueToInsert = create( { html: content } );\n\t\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t\t} else {\n\t\t\t\tconst [ firstBlock ] = content;\n\t\t\t\tif (\n\t\t\t\t\t! title &&\n\t\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t\t) {\n\t\t\t\t\tonUpdate( firstBlock.attributes.content );\n\t\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t\t} else {\n\t\t\t\t\tonInsertBlockAfter( content );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tsetRef( richText ) {\n\t\tthis.richTextRef = richText;\n\t}\n\n\tgetTitle( title, postType ) {\n\t\tif ( 'page' === postType ) {\n\t\t\treturn ! title\n\t\t\t\t? /* translators: accessibility text. empty page title. */\n\t\t\t\t __( 'Page title. Empty' )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. %s: text content of the page title. */\n\t\t\t\t\t\t__( 'Page title. %s' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t );\n\t\t}\n\n\t\treturn ! title\n\t\t\t? /* translators: accessibility text. empty post title. */\n\t\t\t __( 'Post title. Empty' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: accessibility text. %s: text content of the post title. */\n\t\t\t\t\t__( 'Post title. %s' ),\n\t\t\t\t\ttitle\n\t\t\t );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tplaceholder,\n\t\t\tstyle,\n\t\t\ttitle,\n\t\t\tfocusedBorderColor,\n\t\t\tborderStyle,\n\t\t\tisDimmed,\n\t\t\tpostType,\n\t\t\tglobalStyles,\n\t\t} = this.props;\n\n\t\tconst decodedPlaceholder = decodeEntities( placeholder );\n\t\tconst borderColor = this.props.isSelected\n\t\t\t? focusedBorderColor\n\t\t\t: 'transparent';\n\t\tconst titleStyles = {\n\t\t\t...style,\n\t\t\t...( globalStyles?.text && {\n\t\t\t\tcolor: globalStyles.text,\n\t\t\t\tplaceholderColor: globalStyles.text,\n\t\t\t} ),\n\t\t};\n\n\t\treturn (\n\t\t\t<View\n\t\t\t\ttestID=\"post-title\"\n\t\t\t\tstyle={ [\n\t\t\t\t\tstyles.titleContainer,\n\t\t\t\t\tborderStyle,\n\t\t\t\t\t{ borderColor },\n\t\t\t\t\tisDimmed && styles.dimmed,\n\t\t\t\t] }\n\t\t\t\taccessible={ ! this.props.isSelected }\n\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\taccessibilityHint={ __( 'Updates the title.' ) }\n\t\t\t>\n\t\t\t\t<RichText.Raw\n\t\t\t\t\tsetRef={ this.setRef }\n\t\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\t\ttagName={ 'p' }\n\t\t\t\t\ttagsToEliminate={ [ 'strong' ] }\n\t\t\t\t\tunstableOnFocus={ this.props.onSelect }\n\t\t\t\t\tonBlur={ this.props.onBlur } // Always assign onBlur as a props.\n\t\t\t\t\tmultiline={ false }\n\t\t\t\t\tstyle={ titleStyles }\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tfontSize={ 24 }\n\t\t\t\t\tlineHeight={ 1 }\n\t\t\t\t\tfontWeight={ 'bold' }\n\t\t\t\t\tdeleteEnter={ true }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tthis.props.onUpdate( value );\n\t\t\t\t\t} }\n\t\t\t\t\tonPaste={ this.onPaste }\n\t\t\t\t\tplaceholder={ decodedPlaceholder }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonSelectionChange={ () => {} }\n\t\t\t\t\tonEnter={ this.props.onEnterPress }\n\t\t\t\t\tdisableEditingMenu={ true }\n\t\t\t\t\t__unstableIsSelected={ this.props.isSelected }\n\t\t\t\t\t__unstableOnCreateUndoLevel={ () => {} }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst { isPostTitleSelected, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\t\tconst { getSelectedBlockClientId, getBlockRootClientId, getSettings } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst selectedId = getSelectedBlockClientId();\n\t\tconst selectionIsNested = !! getBlockRootClientId( selectedId );\n\t\tconst globalStyles =\n\t\t\tgetSettings()?.__experimentalGlobalStylesBaseStyles?.color;\n\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tisAnyBlockSelected: !! selectedId,\n\t\t\tisSelected: isPostTitleSelected(),\n\t\t\tisDimmed: selectionIsNested,\n\t\t\tglobalStyles,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { undo, redo, togglePostTitleSelection, editPost } =\n\t\t\tdispatch( editorStore );\n\n\t\tconst { clearSelectedBlock, insertDefaultBlock, insertBlocks } =\n\t\t\tdispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tonEnterPress() {\n\t\t\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t\t\t},\n\t\t\tonUndo: undo,\n\t\t\tonRedo: redo,\n\t\t\tonSelect() {\n\t\t\t\ttogglePostTitleSelection( true );\n\t\t\t\tclearSelectedBlock();\n\t\t\t},\n\t\t\tonUnselect() {\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t\tonUpdate( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\tonInsertBlockAfter( blocks ) {\n\t\t\t\tinsertBlocks( blocks, 0 );\n\t\t\t},\n\t\t};\n\t} ),\n\twithInstanceId,\n\twithFocusOutside\n)( PostTitle );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,QAA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
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { useMemo, useState } from '@wordpress/element';
|
|
6
|
+
import { __experimentalHStack as HStack, Dropdown, Button } from '@wordpress/components';
|
|
7
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import PostURLCheck from './check';
|
|
13
|
+
import PostURL from './index';
|
|
14
|
+
import { usePostURLLabel } from './label';
|
|
15
|
+
export default function PostURLPanel() {
|
|
16
|
+
// Use internal state instead of a ref to make sure that the component
|
|
17
|
+
// re-renders when the popover's anchor updates.
|
|
18
|
+
const [popoverAnchor, setPopoverAnchor] = useState(null);
|
|
19
|
+
// Memoize popoverProps to avoid returning a new object every time.
|
|
20
|
+
const popoverProps = useMemo(() => ({
|
|
21
|
+
anchor: popoverAnchor,
|
|
22
|
+
placement: 'bottom-end'
|
|
23
|
+
}), [popoverAnchor]);
|
|
24
|
+
return createElement(PostURLCheck, null, createElement(HStack, {
|
|
25
|
+
className: "editor-post-url__panel",
|
|
26
|
+
ref: setPopoverAnchor
|
|
27
|
+
}, createElement("span", null, __('URL')), createElement(Dropdown, {
|
|
28
|
+
popoverProps: popoverProps,
|
|
29
|
+
className: "editor-post-url__panel-dropdown",
|
|
30
|
+
contentClassName: "editor-post-url__panel-dialog",
|
|
31
|
+
focusOnMount: true,
|
|
32
|
+
renderToggle: ({
|
|
33
|
+
isOpen,
|
|
34
|
+
onToggle
|
|
35
|
+
}) => createElement(PostURLToggle, {
|
|
36
|
+
isOpen: isOpen,
|
|
37
|
+
onClick: onToggle
|
|
38
|
+
}),
|
|
39
|
+
renderContent: ({
|
|
40
|
+
onClose
|
|
41
|
+
}) => createElement(PostURL, {
|
|
42
|
+
onClose: onClose
|
|
43
|
+
})
|
|
44
|
+
})));
|
|
45
|
+
}
|
|
46
|
+
function PostURLToggle({
|
|
47
|
+
isOpen,
|
|
48
|
+
onClick
|
|
49
|
+
}) {
|
|
50
|
+
const label = usePostURLLabel();
|
|
51
|
+
return createElement(Button, {
|
|
52
|
+
className: "editor-post-url__panel-toggle",
|
|
53
|
+
variant: "tertiary",
|
|
54
|
+
"aria-expanded": isOpen
|
|
55
|
+
// translators: %s: Current post URL.
|
|
56
|
+
,
|
|
57
|
+
"aria-label": sprintf(__('Change URL: %s'), label),
|
|
58
|
+
onClick: onClick
|
|
59
|
+
}, label);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","useState","__experimentalHStack","HStack","Dropdown","Button","__","sprintf","PostURLCheck","PostURL","usePostURLLabel","PostURLPanel","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","createElement","className","ref","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","label","variant"],"sources":["@wordpress/editor/src/components/post-url/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport {\n\t__experimentalHStack as HStack,\n\tDropdown,\n\tButton,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PostURLCheck from './check';\nimport PostURL from './index';\nimport { usePostURLLabel } from './label';\n\nexport default function PostURLPanel() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<HStack className=\"editor-post-url__panel\" ref={ setPopoverAnchor }>\n\t\t\t\t<span>{ __( 'URL' ) }</span>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-url__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-url__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostURLToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostURL onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst label = usePostURLLabel();\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"editor-post-url__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post URL.\n\t\t\taria-label={ sprintf( __( 'Change URL: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SACCC,oBAAoB,IAAIC,MAAM,EAC9BC,QAAQ,EACRC,MAAM,QACA,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,YAAY,MAAM,SAAS;AAClC,OAAOC,OAAO,MAAM,SAAS;AAC7B,SAASC,eAAe,QAAQ,SAAS;AAEzC,eAAe,SAASC,YAAYA,CAAA,EAAG;EACtC;EACA;EACA,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAGZ,QAAQ,CAAE,IAAK,CAAC;EAC5D;EACA,MAAMa,YAAY,GAAGd,OAAO,CAC3B,OAAQ;IAAEe,MAAM,EAAEH,aAAa;IAAEI,SAAS,EAAE;EAAa,CAAC,CAAE,EAC5D,CAAEJ,aAAa,CAChB,CAAC;EAED,OACCK,aAAA,CAACT,YAAY,QACZS,aAAA,CAACd,MAAM;IAACe,SAAS,EAAC,wBAAwB;IAACC,GAAG,EAAGN;EAAkB,GAClEI,aAAA,eAAQX,EAAE,CAAE,KAAM,CAAS,CAAC,EAC5BW,aAAA,CAACb,QAAQ;IACRU,YAAY,EAAGA,YAAc;IAC7BI,SAAS,EAAC,iCAAiC;IAC3CE,gBAAgB,EAAC,+BAA+B;IAChDC,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,KACpCP,aAAA,CAACQ,aAAa;MAACF,MAAM,EAAGA,MAAQ;MAACG,OAAO,EAAGF;IAAU,CAAE,CACrD;IACHG,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,KAC5BX,aAAA,CAACR,OAAO;MAACmB,OAAO,EAAGA;IAAS,CAAE;EAC5B,CACH,CACM,CACK,CAAC;AAEjB;AAEA,SAASH,aAAaA,CAAE;EAAEF,MAAM;EAAEG;AAAQ,CAAC,EAAG;EAC7C,MAAMG,KAAK,GAAGnB,eAAe,CAAC,CAAC;EAC/B,OACCO,aAAA,CAACZ,MAAM;IACNa,SAAS,EAAC,+BAA+B;IACzCY,OAAO,EAAC,UAAU;IAClB,iBAAgBP;IAChB;IAAA;IACA,cAAahB,OAAO,CAAED,EAAE,CAAE,gBAAiB,CAAC,EAAEuB,KAAM,CAAG;IACvDH,OAAO,EAAGA;EAAS,GAEjBG,KACK,CAAC;AAEX"}
|
|
@@ -6,9 +6,10 @@ import { useEffect, useLayoutEffect, useMemo } from '@wordpress/element';
|
|
|
6
6
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
import { EntityProvider, useEntityBlockEditor } from '@wordpress/core-data';
|
|
9
|
-
import { BlockEditorProvider, BlockContextProvider, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
9
|
+
import { BlockEditorProvider, BlockContextProvider, privateApis as blockEditorPrivateApis, store as blockEditorStore } from '@wordpress/block-editor';
|
|
10
10
|
import { store as noticesStore } from '@wordpress/notices';
|
|
11
11
|
import { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';
|
|
12
|
+
import { createBlock } from '@wordpress/blocks';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
@@ -23,24 +24,135 @@ const {
|
|
|
23
24
|
const {
|
|
24
25
|
PatternsMenuItems
|
|
25
26
|
} = unlock(editPatternsPrivateApis);
|
|
27
|
+
const noop = () => {};
|
|
28
|
+
export const PAGE_CONTENT_BLOCK_TYPES = ['core/post-title', 'core/post-featured-image', 'core/post-content'];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* For the Navigation block editor, we need to force the block editor to contentOnly for that block.
|
|
32
|
+
*
|
|
33
|
+
* Set block editing mode to contentOnly when entering Navigation focus mode.
|
|
34
|
+
* this ensures that non-content controls on the block will be hidden and thus
|
|
35
|
+
* the user can focus on editing the Navigation Menu content only.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} navigationBlockClientId ClientId.
|
|
38
|
+
*/
|
|
39
|
+
function useForceFocusModeForNavigation(navigationBlockClientId) {
|
|
40
|
+
const {
|
|
41
|
+
setBlockEditingMode,
|
|
42
|
+
unsetBlockEditingMode
|
|
43
|
+
} = useDispatch(blockEditorStore);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (!navigationBlockClientId) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
setBlockEditingMode(navigationBlockClientId, 'contentOnly');
|
|
49
|
+
return () => {
|
|
50
|
+
unsetBlockEditingMode(navigationBlockClientId);
|
|
51
|
+
};
|
|
52
|
+
}, [navigationBlockClientId, unsetBlockEditingMode, setBlockEditingMode]);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Helper method to extract the post content block types from a template.
|
|
57
|
+
*
|
|
58
|
+
* @param {Array} blocks Template blocks.
|
|
59
|
+
*
|
|
60
|
+
* @return {Array} Flattened object.
|
|
61
|
+
*/
|
|
62
|
+
function extractPageContentBlockTypesFromTemplateBlocks(blocks) {
|
|
63
|
+
const result = [];
|
|
64
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
65
|
+
// Since the Query Block could contain PAGE_CONTENT_BLOCK_TYPES block types,
|
|
66
|
+
// we skip it because we only want to render stand-alone page content blocks in the block list.
|
|
67
|
+
if (blocks[i].name === 'core/query') {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (PAGE_CONTENT_BLOCK_TYPES.includes(blocks[i].name)) {
|
|
71
|
+
result.push(createBlock(blocks[i].name));
|
|
72
|
+
}
|
|
73
|
+
if (blocks[i].innerBlocks.length) {
|
|
74
|
+
result.push(...extractPageContentBlockTypesFromTemplateBlocks(blocks[i].innerBlocks));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Depending on the post, template and template mode,
|
|
82
|
+
* returns the appropriate blocks and change handlers for the block editor provider.
|
|
83
|
+
*
|
|
84
|
+
* @param {Array} post Block list.
|
|
85
|
+
* @param {boolean} template Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`.
|
|
86
|
+
* @param {string} mode Rendering mode.
|
|
87
|
+
* @return {Array} Block editor props.
|
|
88
|
+
*/
|
|
89
|
+
function useBlockEditorProps(post, template, mode) {
|
|
90
|
+
const rootLevelPost = mode === 'post-only' || !template ? 'post' : 'template';
|
|
91
|
+
const [postBlocks, onInput, onChange] = useEntityBlockEditor('postType', post.type, {
|
|
92
|
+
id: post.id
|
|
93
|
+
});
|
|
94
|
+
const [templateBlocks, onInputTemplate, onChangeTemplate] = useEntityBlockEditor('postType', template?.type, {
|
|
95
|
+
id: template?.id
|
|
96
|
+
});
|
|
97
|
+
const blocks = useMemo(() => {
|
|
98
|
+
if (post.type === 'wp_navigation') {
|
|
99
|
+
return [createBlock('core/navigation', {
|
|
100
|
+
ref: post.id,
|
|
101
|
+
// As the parent editor is locked with `templateLock`, the template locking
|
|
102
|
+
// must be explicitly "unset" on the block itself to allow the user to modify
|
|
103
|
+
// the block's content.
|
|
104
|
+
templateLock: false
|
|
105
|
+
})];
|
|
106
|
+
}
|
|
107
|
+
if (mode === 'post-only') {
|
|
108
|
+
return [createBlock('core/group', {
|
|
109
|
+
layout: {
|
|
110
|
+
type: 'constrained'
|
|
111
|
+
},
|
|
112
|
+
style: {
|
|
113
|
+
spacing: {
|
|
114
|
+
margin: {
|
|
115
|
+
top: '4em' // Mimics the post editor.
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}, extractPageContentBlockTypesFromTemplateBlocks(templateBlocks))];
|
|
120
|
+
}
|
|
121
|
+
if (rootLevelPost === 'template') {
|
|
122
|
+
return templateBlocks;
|
|
123
|
+
}
|
|
124
|
+
return postBlocks;
|
|
125
|
+
}, [templateBlocks, postBlocks, rootLevelPost, post.type, post.id, mode]);
|
|
126
|
+
const disableRootLevelChanges = !!template && mode === 'template-locked' || post.type === 'wp_navigation' || mode === 'post-only';
|
|
127
|
+
const navigationBlockClientId = post.type === 'wp_navigation' && blocks && blocks[0]?.clientId;
|
|
128
|
+
useForceFocusModeForNavigation(navigationBlockClientId);
|
|
129
|
+
if (disableRootLevelChanges) {
|
|
130
|
+
return [blocks, noop, noop];
|
|
131
|
+
}
|
|
132
|
+
return [blocks, rootLevelPost === 'post' ? onInput : onInputTemplate, rootLevelPost === 'post' ? onChange : onChangeTemplate];
|
|
133
|
+
}
|
|
26
134
|
export const ExperimentalEditorProvider = withRegistryProvider(({
|
|
27
|
-
|
|
135
|
+
mode = 'all',
|
|
28
136
|
post,
|
|
29
137
|
settings,
|
|
30
138
|
recovery,
|
|
31
139
|
initialEdits,
|
|
32
140
|
children,
|
|
33
|
-
BlockEditorProviderComponent = ExperimentalBlockEditorProvider
|
|
141
|
+
BlockEditorProviderComponent = ExperimentalBlockEditorProvider,
|
|
142
|
+
__unstableTemplate: template
|
|
34
143
|
}) => {
|
|
144
|
+
const shouldRenderTemplate = !!template && mode !== 'post-only';
|
|
145
|
+
const rootLevelPost = shouldRenderTemplate ? template : post;
|
|
35
146
|
const defaultBlockContext = useMemo(() => {
|
|
36
|
-
|
|
37
|
-
return {};
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
147
|
+
const postContext = rootLevelPost.type !== 'wp_template' || shouldRenderTemplate && mode !== 'template-only' ? {
|
|
40
148
|
postId: post.id,
|
|
41
149
|
postType: post.type
|
|
150
|
+
} : {};
|
|
151
|
+
return {
|
|
152
|
+
...postContext,
|
|
153
|
+
templateSlug: rootLevelPost.type === 'wp_template' ? rootLevelPost.slug : undefined
|
|
42
154
|
};
|
|
43
|
-
}, [post.id, post.type]);
|
|
155
|
+
}, [mode, post.id, post.type, rootLevelPost.type, rootLevelPost?.slug, shouldRenderTemplate]);
|
|
44
156
|
const {
|
|
45
157
|
editorSettings,
|
|
46
158
|
selection,
|
|
@@ -60,11 +172,9 @@ export const ExperimentalEditorProvider = withRegistryProvider(({
|
|
|
60
172
|
const {
|
|
61
173
|
id,
|
|
62
174
|
type
|
|
63
|
-
} =
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
});
|
|
67
|
-
const blockEditorSettings = useBlockEditorSettings(editorSettings, !!__unstableTemplate);
|
|
175
|
+
} = rootLevelPost;
|
|
176
|
+
const blockEditorSettings = useBlockEditorSettings(editorSettings, type, id);
|
|
177
|
+
const [blocks, onInput, onChange] = useBlockEditorProps(post, template, mode);
|
|
68
178
|
const {
|
|
69
179
|
updatePostLock,
|
|
70
180
|
setupEditor,
|
|
@@ -101,7 +211,7 @@ export const ExperimentalEditorProvider = withRegistryProvider(({
|
|
|
101
211
|
// Synchronize the editor settings as they change.
|
|
102
212
|
useEffect(() => {
|
|
103
213
|
updateEditorSettings(settings);
|
|
104
|
-
}, [settings]);
|
|
214
|
+
}, [settings, updateEditorSettings]);
|
|
105
215
|
if (!isReady) {
|
|
106
216
|
return null;
|
|
107
217
|
}
|