@wordpress/block-library 8.24.0 → 8.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/audio/edit.js +7 -52
- package/build/audio/edit.js.map +1 -1
- package/build/audio/edit.native.js +1 -1
- package/build/audio/edit.native.js.map +1 -1
- package/build/audio/index.js +2 -2
- package/build/block/edit.js +102 -11
- package/build/block/edit.js.map +1 -1
- package/build/block/index.js +3 -2
- package/build/block/index.js.map +1 -1
- package/build/block/v1/edit.js +116 -0
- package/build/block/v1/edit.js.map +1 -0
- package/build/block/{edit.native.js → v1/edit.native.js} +2 -2
- package/build/block/v1/edit.native.js.map +1 -0
- package/build/button/index.js +2 -2
- package/build/button/save.js +1 -1
- package/build/button/save.js.map +1 -1
- package/build/code/edit.native.js +13 -14
- package/build/code/edit.native.js.map +1 -1
- package/build/code/index.js +2 -2
- package/build/code/save.js +6 -2
- package/build/code/save.js.map +1 -1
- package/build/details/index.js +2 -2
- package/build/embed/deprecated.js +2 -2
- package/build/embed/embed-preview.native.js +1 -1
- package/build/embed/embed-preview.native.js.map +1 -1
- package/build/embed/icons.js +1 -1
- package/build/embed/icons.js.map +1 -1
- package/build/embed/index.js +2 -2
- package/build/embed/transforms.js +2 -2
- package/build/embed/util.js +2 -2
- package/build/file/edit.js +1 -1
- package/build/file/edit.js.map +1 -1
- package/build/file/edit.native.js +1 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/index.js +4 -4
- package/build/file/save.js +4 -1
- package/build/file/save.js.map +1 -1
- package/build/form-input/deprecated.js +147 -0
- package/build/form-input/deprecated.js.map +1 -0
- package/build/form-input/edit.js +1 -1
- package/build/form-input/edit.js.map +1 -1
- package/build/form-input/index.js +4 -2
- package/build/form-input/index.js.map +1 -1
- package/build/form-input/save.js +7 -9
- package/build/form-input/save.js.map +1 -1
- package/build/gallery/edit.js +2 -41
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +18 -24
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gallery.native.js +1 -1
- package/build/gallery/gallery.native.js.map +1 -1
- package/build/gallery/index.js +4 -4
- package/build/gallery/v1/gallery.native.js +1 -1
- package/build/gallery/v1/gallery.native.js.map +1 -1
- package/build/group/edit.js +6 -1
- package/build/group/edit.js.map +1 -1
- package/build/heading/index.js +3 -6
- package/build/heading/index.js.map +1 -1
- package/build/image/edit.native.js +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +14 -51
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +2 -2
- package/build/image/save.js +3 -1
- package/build/image/save.js.map +1 -1
- package/build/list-item/index.js +10 -3
- package/build/list-item/index.js.map +1 -1
- package/build/navigation/edit/index.js +1 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +2 -2
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/paragraph/edit.js +54 -32
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/index.js +2 -3
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +2 -3
- package/build/paragraph/transforms.js.map +1 -1
- package/build/post-title/index.js +1 -3
- package/build/post-title/index.js.map +1 -1
- package/build/preformatted/index.js +2 -3
- package/build/preformatted/index.js.map +1 -1
- package/build/pullquote/index.js +5 -7
- package/build/pullquote/index.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -0
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query-title/index.js +1 -3
- package/build/query-title/index.js.map +1 -1
- package/build/quote/index.js +3 -5
- package/build/quote/index.js.map +1 -1
- package/build/quote/transforms.js +7 -6
- package/build/quote/transforms.js.map +1 -1
- package/build/site-title/index.js +1 -5
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/icons/gravatar.js +22 -0
- package/build/social-link/icons/gravatar.js.map +1 -0
- package/build/social-link/icons/index.js +11 -0
- package/build/social-link/icons/index.js.map +1 -1
- package/build/social-link/variations.js +7 -0
- package/build/social-link/variations.js.map +1 -1
- package/build/table/edit.js +3 -1
- package/build/table/edit.js.map +1 -1
- package/build/table/index.js +9 -10
- package/build/table/index.js.map +1 -1
- package/build/table-of-contents/edit.js +2 -2
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/index.js +5 -2
- package/build/table-of-contents/index.js.map +1 -1
- package/build/utils/caption.js +90 -0
- package/build/utils/caption.js.map +1 -0
- package/build/utils/remove-anchor-tag.js +2 -1
- package/build/utils/remove-anchor-tag.js.map +1 -1
- package/build/verse/index.js +3 -5
- package/build/verse/index.js.map +1 -1
- package/build/video/deprecated.js +2 -2
- package/build/video/edit.js +8 -52
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +1 -1
- package/build/video/edit.native.js.map +1 -1
- package/build/video/index.js +2 -2
- package/build-module/audio/edit.js +11 -56
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js +2 -2
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/audio/index.js +2 -2
- package/build-module/block/edit.js +104 -13
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/index.js +3 -2
- package/build-module/block/index.js.map +1 -1
- package/build-module/block/v1/edit.js +108 -0
- package/build-module/block/v1/edit.js.map +1 -0
- package/build-module/block/{edit.native.js → v1/edit.native.js} +2 -2
- package/build-module/block/v1/edit.native.js.map +1 -0
- package/build-module/button/index.js +2 -2
- package/build-module/button/save.js +1 -1
- package/build-module/button/save.js.map +1 -1
- package/build-module/code/edit.native.js +14 -16
- package/build-module/code/edit.native.js.map +1 -1
- package/build-module/code/index.js +2 -2
- package/build-module/code/save.js +6 -2
- package/build-module/code/save.js.map +1 -1
- package/build-module/details/index.js +2 -2
- package/build-module/embed/deprecated.js +2 -2
- package/build-module/embed/embed-preview.native.js +2 -2
- package/build-module/embed/embed-preview.native.js.map +1 -1
- package/build-module/embed/icons.js +1 -1
- package/build-module/embed/icons.js.map +1 -1
- package/build-module/embed/index.js +2 -2
- package/build-module/embed/transforms.js +2 -2
- package/build-module/embed/util.js +2 -2
- package/build-module/file/edit.js +1 -1
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js +1 -1
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/index.js +4 -4
- package/build-module/file/save.js +4 -1
- package/build-module/file/save.js.map +1 -1
- package/build-module/form-input/deprecated.js +138 -0
- package/build-module/form-input/deprecated.js.map +1 -0
- package/build-module/form-input/edit.js +1 -1
- package/build-module/form-input/edit.js.map +1 -1
- package/build-module/form-input/index.js +4 -2
- package/build-module/form-input/index.js.map +1 -1
- package/build-module/form-input/save.js +8 -10
- package/build-module/form-input/save.js.map +1 -1
- package/build-module/gallery/edit.js +5 -44
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +17 -21
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gallery.native.js +2 -2
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/index.js +4 -4
- package/build-module/gallery/v1/gallery.native.js +2 -2
- package/build-module/gallery/v1/gallery.native.js.map +1 -1
- package/build-module/group/edit.js +6 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/heading/index.js +3 -6
- package/build-module/heading/index.js.map +1 -1
- package/build-module/image/edit.native.js +2 -2
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +19 -56
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +2 -2
- package/build-module/image/save.js +3 -1
- package/build-module/image/save.js.map +1 -1
- package/build-module/list-item/index.js +10 -3
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/navigation/edit/index.js +2 -2
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +2 -2
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/paragraph/edit.js +54 -32
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/index.js +2 -3
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +2 -3
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/post-title/index.js +1 -3
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/preformatted/index.js +2 -3
- package/build-module/preformatted/index.js.map +1 -1
- package/build-module/pullquote/index.js +5 -7
- package/build-module/pullquote/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -0
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query-title/index.js +1 -3
- package/build-module/query-title/index.js.map +1 -1
- package/build-module/quote/index.js +3 -5
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/transforms.js +7 -6
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/site-title/index.js +1 -5
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/icons/gravatar.js +14 -0
- package/build-module/social-link/icons/gravatar.js.map +1 -0
- package/build-module/social-link/icons/index.js +1 -0
- package/build-module/social-link/icons/index.js.map +1 -1
- package/build-module/social-link/variations.js +8 -1
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/table/edit.js +3 -1
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/index.js +9 -10
- package/build-module/table/index.js.map +1 -1
- package/build-module/table-of-contents/edit.js +1 -1
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/index.js +5 -1
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/utils/caption.js +82 -0
- package/build-module/utils/caption.js.map +1 -0
- package/build-module/utils/remove-anchor-tag.js +2 -1
- package/build-module/utils/remove-anchor-tag.js.map +1 -1
- package/build-module/verse/index.js +3 -5
- package/build-module/verse/index.js.map +1 -1
- package/build-module/video/deprecated.js +2 -2
- package/build-module/video/edit.js +13 -57
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +2 -2
- package/build-module/video/edit.native.js.map +1 -1
- package/build-module/video/index.js +2 -2
- package/build-style/editor-rtl.css +1 -11
- package/build-style/editor.css +1 -11
- package/build-style/social-links/style-rtl.css +14 -2
- package/build-style/social-links/style.css +14 -2
- package/build-style/style-rtl.css +14 -2
- package/build-style/style.css +14 -2
- package/build-style/table/editor-rtl.css +1 -11
- package/build-style/table/editor.css +1 -11
- package/package.json +32 -32
- package/src/audio/block.json +2 -2
- package/src/audio/edit.js +11 -74
- package/src/audio/edit.native.js +2 -1
- package/src/block/edit.js +143 -16
- package/src/block/index.js +3 -2
- package/src/block/index.php +48 -0
- package/src/block/v1/edit.js +163 -0
- package/src/block/{edit.native.js → v1/edit.native.js} +2 -2
- package/src/button/block.json +2 -2
- package/src/button/save.js +1 -1
- package/src/code/block.json +2 -2
- package/src/code/edit.native.js +11 -13
- package/src/code/save.js +4 -1
- package/src/code/test/edit.native.js +2 -2
- package/src/cover/test/edit.native.js +7 -1
- package/src/details/block.json +2 -2
- package/src/embed/block.json +2 -2
- package/src/embed/embed-preview.native.js +2 -1
- package/src/embed/icons.js +1 -1
- package/src/file/block.json +4 -4
- package/src/file/edit.js +1 -1
- package/src/file/edit.native.js +1 -1
- package/src/file/save.js +5 -1
- package/src/form-input/block.json +2 -2
- package/src/form-input/deprecated.js +142 -0
- package/src/form-input/edit.js +1 -1
- package/src/form-input/index.js +2 -0
- package/src/form-input/save.js +27 -24
- package/src/gallery/block.json +4 -4
- package/src/gallery/edit.js +4 -59
- package/src/gallery/gallery.js +19 -36
- package/src/gallery/gallery.native.js +6 -2
- package/src/gallery/v1/gallery.native.js +2 -1
- package/src/group/edit.js +4 -1
- package/src/heading/block.json +3 -6
- package/src/image/block.json +2 -2
- package/src/image/edit.native.js +2 -3
- package/src/image/image.js +24 -93
- package/src/image/save.js +3 -1
- package/src/list-item/block.json +10 -3
- package/src/navigation/edit/index.js +7 -2
- package/src/navigation/index.php +1 -1
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +6 -3
- package/src/page-list/convert-to-links-modal.js +2 -2
- package/src/paragraph/block.json +2 -3
- package/src/paragraph/edit.js +53 -40
- package/src/post-title/block.json +1 -3
- package/src/preformatted/block.json +2 -3
- package/src/pullquote/block.json +5 -7
- package/src/query/edit/inspector-controls/taxonomy-controls.js +2 -0
- package/src/query-title/block.json +1 -3
- package/src/quote/block.json +3 -5
- package/src/quote/transforms.js +12 -11
- package/src/site-title/block.json +1 -5
- package/src/social-link/icons/gravatar.js +10 -0
- package/src/social-link/icons/index.js +1 -0
- package/src/social-link/index.php +4 -0
- package/src/social-link/socials-with-bg.scss +5 -0
- package/src/social-link/socials-without-bg.scss +4 -0
- package/src/social-link/variations.js +7 -0
- package/src/social-links/style.scss +14 -8
- package/src/table/block.json +9 -10
- package/src/table/edit.js +3 -1
- package/src/table/editor.scss +1 -14
- package/src/table-of-contents/edit.js +1 -1
- package/src/table-of-contents/index.js +5 -1
- package/src/utils/caption.js +108 -0
- package/src/utils/remove-anchor-tag.js +2 -1
- package/src/verse/block.json +3 -5
- package/src/video/block.json +2 -2
- package/src/video/edit.js +12 -74
- package/src/video/edit.native.js +2 -1
- package/build/block/edit.native.js.map +0 -1
- package/build/table-of-contents/icon.js +0 -22
- package/build/table-of-contents/icon.js.map +0 -1
- package/build-module/block/edit.native.js.map +0 -1
- package/build-module/table-of-contents/icon.js +0 -15
- package/build-module/table-of-contents/icon.js.map +0 -1
- package/src/table-of-contents/icon.js +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TouchableWithoutFeedback","View","PanelBody","SelectControl","ToggleControl","ToolbarButton","ToolbarGroup","AudioPlayer","BlockCaption","BlockControls","BlockIcon","InspectorControls","MediaPlaceholder","MediaUpload","MediaUploadProgress","store","blockEditorStore","__","_x","sprintf","audio","icon","replace","useState","useDispatch","useSelect","noticesStore","isURL","getProtocol","styles","ALLOWED_MEDIA_TYPES","AudioEdit","attributes","setAttributes","isSelected","insertBlocksAfter","onFocus","onBlur","clientId","id","autoplay","loop","preload","src","isCaptionSelected","setIsCaptionSelected","onFileChange","mediaId","mediaUrl","wasBlockJustInserted","select","createErrorNotice","toggleAttribute","attribute","newValue","onSelectURL","newSrc","test","undefined","onSelectAudio","media","url","onAudioPress","onFocusCaption","createElement","onSelect","accept","allowedTypes","value","autoOpenMediaUpload","getBlockControls","open","title","onClick","getBlockUI","getMediaOptions","onFinishMediaUploadWithSuccess","onMediaUploadStateReset","containerStyle","progressContainer","progressBarStyle","progressBar","spinnerStyle","spinner","renderContent","isUploadInProgress","isUploadFailed","retryMessage","Fragment","accessible","onPress","disabled","label","onChange","checked","help","options","hideCancelButton","isReplacingMedia","render","accessibilityLabelCreator","caption"],"sources":["@wordpress/block-library/src/audio/edit.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { TouchableWithoutFeedback } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { View } from '@wordpress/primitives';\nimport {\n\tPanelBody,\n\tSelectControl,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n\tAudioPlayer,\n} from '@wordpress/components';\nimport {\n\tBlockCaption,\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tMediaPlaceholder,\n\tMediaUpload,\n\tMediaUploadProgress,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { audio as icon, replace } from '@wordpress/icons';\nimport { useState } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { isURL, getProtocol } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst ALLOWED_MEDIA_TYPES = [ 'audio' ];\n\nfunction AudioEdit( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n\tonFocus,\n\tonBlur,\n\tclientId,\n} ) {\n\tconst { id, autoplay, loop, preload, src } = attributes;\n\n\tconst [ isCaptionSelected, setIsCaptionSelected ] = useState( false );\n\n\tconst onFileChange = ( { mediaId, mediaUrl } ) => {\n\t\tsetAttributes( { id: mediaId, src: mediaUrl } );\n\t};\n\n\tconst { wasBlockJustInserted } = useSelect( ( select ) => ( {\n\t\twasBlockJustInserted: select( blockEditorStore ).wasBlockJustInserted(\n\t\t\tclientId,\n\t\t\t'inserter_menu'\n\t\t),\n\t} ) );\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction toggleAttribute( attribute ) {\n\t\treturn ( newValue ) => {\n\t\t\tsetAttributes( { [ attribute ]: newValue } );\n\t\t};\n\t}\n\n\tfunction onSelectURL( newSrc ) {\n\t\tif ( newSrc !== src ) {\n\t\t\tif ( isURL( newSrc ) && /^https?:/.test( getProtocol( newSrc ) ) ) {\n\t\t\t\tsetAttributes( { src: newSrc, id: undefined } );\n\t\t\t} else {\n\t\t\t\tcreateErrorNotice( __( 'Invalid URL. Audio file not found.' ) );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction onSelectAudio( media ) {\n\t\tif ( ! media || ! media.url ) {\n\t\t\t// In this case there was an error and we should continue in the editing state\n\t\t\t// previous attributes should be removed because they may be temporary blob urls.\n\t\t\tsetAttributes( { src: undefined, id: undefined } );\n\t\t\treturn;\n\t\t}\n\t\t// Sets the block's attribute and updates the edit component from the\n\t\t// selected media, then switches off the editing UI.\n\t\tsetAttributes( { src: media.url, id: media.id } );\n\t}\n\n\tfunction onAudioPress() {\n\t\tsetIsCaptionSelected( false );\n\t}\n\n\tfunction onFocusCaption() {\n\t\tif ( ! isCaptionSelected ) {\n\t\t\tsetIsCaptionSelected( true );\n\t\t}\n\t}\n\n\tif ( ! src ) {\n\t\treturn (\n\t\t\t<View>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tonSelect={ onSelectAudio }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\taccept=\"audio/*\"\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tvalue={ attributes }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\tautoOpenMediaUpload={ isSelected && wasBlockJustInserted }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction getBlockControls( open ) {\n\t\treturn (\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Replace audio' ) }\n\t\t\t\t\t\ticon={ replace }\n\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t);\n\t}\n\n\tfunction getBlockUI( open, getMediaOptions ) {\n\t\treturn (\n\t\t\t<MediaUploadProgress\n\t\t\t\tmediaId={ id }\n\t\t\t\tonFinishMediaUploadWithSuccess={ onFileChange }\n\t\t\t\tonMediaUploadStateReset={ onFileChange }\n\t\t\t\tcontainerStyle={ styles.progressContainer }\n\t\t\t\tprogressBarStyle={ styles.progressBar }\n\t\t\t\tspinnerStyle={ styles.spinner }\n\t\t\t\trenderContent={ ( {\n\t\t\t\t\tisUploadInProgress,\n\t\t\t\t\tisUploadFailed,\n\t\t\t\t\tretryMessage,\n\t\t\t\t} ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isCaptionSelected &&\n\t\t\t\t\t\t\t\t! isUploadInProgress &&\n\t\t\t\t\t\t\t\tgetBlockControls( open ) }\n\t\t\t\t\t\t\t{ getMediaOptions() }\n\t\t\t\t\t\t\t<AudioPlayer\n\t\t\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\t\t\tisUploadFailed={ isUploadFailed }\n\t\t\t\t\t\t\t\tretryMessage={ retryMessage }\n\t\t\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessible={ ! isSelected }\n\t\t\tonPress={ onAudioPress }\n\t\t\tdisabled={ ! isSelected }\n\t\t>\n\t\t\t<View>\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Autoplay' ) }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'autoplay' ) }\n\t\t\t\t\t\t\tchecked={ autoplay }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Autoplay may cause usability issues for some users.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Loop' ) }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'loop' ) }\n\t\t\t\t\t\t\tchecked={ loop }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Preload',\n\t\t\t\t\t\t\t\t'noun; Audio block parameter'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ preload || '' }\n\t\t\t\t\t\t\t// `undefined` is required for the preload attribute to be unset.\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tpreload: value || undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ value: '', label: __( 'Browser default' ) },\n\t\t\t\t\t\t\t\t{ value: 'auto', label: __( 'Auto' ) },\n\t\t\t\t\t\t\t\t{ value: 'metadata', label: __( 'Metadata' ) },\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: 'none',\n\t\t\t\t\t\t\t\t\tlabel: _x( 'None', '\"Preload\" value' ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\thideCancelButton={ true }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</InspectorControls>\n\t\t\t\t<MediaUpload\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tisReplacingMedia={ true }\n\t\t\t\t\tonSelect={ onSelectAudio }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\trender={ ( { open, getMediaOptions } ) => {\n\t\t\t\t\t\treturn getBlockUI( open, getMediaOptions );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<BlockCaption\n\t\t\t\t\taccessible={ true }\n\t\t\t\t\taccessibilityLabelCreator={ ( caption ) =>\n\t\t\t\t\t\t! caption\n\t\t\t\t\t\t\t? /* translators: accessibility text. Empty Audio caption. */\n\t\t\t\t\t\t\t __( 'Audio caption. Empty' )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: accessibility text. %s: Audio caption. */\n\t\t\t\t\t\t\t\t\t__( 'Audio caption. %s' ),\n\t\t\t\t\t\t\t\t\tcaption\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSelected={ isCaptionSelected }\n\t\t\t\t\tonFocus={ onFocusCaption }\n\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n}\nexport default AudioEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,wBAAwB,QAAQ,cAAc;;AAEvD;AACA;AACA;AACA,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SACCC,SAAS,EACTC,aAAa,EACbC,aAAa,EACbC,aAAa,EACbC,YAAY,EACZC,WA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AAK,EAAE1E,EAAE,CAAE,MAAM,EAAE,iBAAkB;IACtC,CAAC,CACC;IACH+E,gBAAgB,EAAG;EAAM,CACzB,CACS,CACO,CAAC,EACpBjC,aAAA,CAACnD,WAAW;IACXsD,YAAY,EAAGrC,mBAAqB;IACpCoE,gBAAgB,EAAG,IAAM;IACzBjC,QAAQ,EAAGN,aAAe;IAC1BJ,WAAW,EAAGA,WAAa;IAC3B4C,MAAM,EAAGA,CAAE;MAAE5B,IAAI;MAAEI;IAAgB,CAAC,KAAM;MACzC,OAAOD,UAAU,CAAEH,IAAI,EAAEI,eAAgB,CAAC;IAC3C;EAAG,CACH,CAAC,EACFX,aAAA,CAACxD,YAAY;IACZiF,UAAU,EAAG,IAAM;IACnBW,yBAAyB,EAAKC,OAAO,IACpC,CAAEA,OAAO,GACN;IACApF,EAAE,CAAE,sBAAuB,CAAC,GAC5BE,OAAO,EACP;IACAF,EAAE,CAAE,mBAAoB,CAAC,EACzBoF,OACA,CACH;IACD/D,QAAQ,EAAGA,QAAU;IACrBJ,UAAU,EAAGU,iBAAmB;IAChCR,OAAO,EAAG2B,cAAgB;IAC1B1B,MAAM,EAAGA,MAAQ;IACjBF,iBAAiB,EAAGA;EAAmB,CACvC,CACI,CACmB,CAAC;AAE7B;AACA,eAAeJ,SAAS"}
|
|
1
|
+
{"version":3,"names":["TouchableWithoutFeedback","View","PanelBody","SelectControl","ToggleControl","ToolbarButton","ToolbarGroup","AudioPlayer","BlockCaption","BlockControls","BlockIcon","InspectorControls","MediaPlaceholder","MediaUpload","MediaUploadProgress","RichText","store","blockEditorStore","__","_x","sprintf","audio","icon","replace","useState","useDispatch","useSelect","noticesStore","isURL","getProtocol","styles","ALLOWED_MEDIA_TYPES","AudioEdit","attributes","setAttributes","isSelected","insertBlocksAfter","onFocus","onBlur","clientId","id","autoplay","loop","preload","src","isCaptionSelected","setIsCaptionSelected","onFileChange","mediaId","mediaUrl","wasBlockJustInserted","select","createErrorNotice","toggleAttribute","attribute","newValue","onSelectURL","newSrc","test","undefined","onSelectAudio","media","url","onAudioPress","onFocusCaption","createElement","onSelect","accept","allowedTypes","value","autoOpenMediaUpload","getBlockControls","open","title","onClick","getBlockUI","getMediaOptions","onFinishMediaUploadWithSuccess","onMediaUploadStateReset","containerStyle","progressContainer","progressBarStyle","progressBar","spinnerStyle","spinner","renderContent","isUploadInProgress","isUploadFailed","retryMessage","Fragment","accessible","onPress","disabled","label","onChange","checked","help","options","hideCancelButton","isReplacingMedia","render","accessibilityLabelCreator","caption","isEmpty"],"sources":["@wordpress/block-library/src/audio/edit.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { TouchableWithoutFeedback } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { View } from '@wordpress/primitives';\nimport {\n\tPanelBody,\n\tSelectControl,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n\tAudioPlayer,\n} from '@wordpress/components';\nimport {\n\tBlockCaption,\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tMediaPlaceholder,\n\tMediaUpload,\n\tMediaUploadProgress,\n\tRichText,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { audio as icon, replace } from '@wordpress/icons';\nimport { useState } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { isURL, getProtocol } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst ALLOWED_MEDIA_TYPES = [ 'audio' ];\n\nfunction AudioEdit( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n\tonFocus,\n\tonBlur,\n\tclientId,\n} ) {\n\tconst { id, autoplay, loop, preload, src } = attributes;\n\n\tconst [ isCaptionSelected, setIsCaptionSelected ] = useState( false );\n\n\tconst onFileChange = ( { mediaId, mediaUrl } ) => {\n\t\tsetAttributes( { id: mediaId, src: mediaUrl } );\n\t};\n\n\tconst { wasBlockJustInserted } = useSelect( ( select ) => ( {\n\t\twasBlockJustInserted: select( blockEditorStore ).wasBlockJustInserted(\n\t\t\tclientId,\n\t\t\t'inserter_menu'\n\t\t),\n\t} ) );\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction toggleAttribute( attribute ) {\n\t\treturn ( newValue ) => {\n\t\t\tsetAttributes( { [ attribute ]: newValue } );\n\t\t};\n\t}\n\n\tfunction onSelectURL( newSrc ) {\n\t\tif ( newSrc !== src ) {\n\t\t\tif ( isURL( newSrc ) && /^https?:/.test( getProtocol( newSrc ) ) ) {\n\t\t\t\tsetAttributes( { src: newSrc, id: undefined } );\n\t\t\t} else {\n\t\t\t\tcreateErrorNotice( __( 'Invalid URL. Audio file not found.' ) );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction onSelectAudio( media ) {\n\t\tif ( ! media || ! media.url ) {\n\t\t\t// In this case there was an error and we should continue in the editing state\n\t\t\t// previous attributes should be removed because they may be temporary blob urls.\n\t\t\tsetAttributes( { src: undefined, id: undefined } );\n\t\t\treturn;\n\t\t}\n\t\t// Sets the block's attribute and updates the edit component from the\n\t\t// selected media, then switches off the editing UI.\n\t\tsetAttributes( { src: media.url, id: media.id } );\n\t}\n\n\tfunction onAudioPress() {\n\t\tsetIsCaptionSelected( false );\n\t}\n\n\tfunction onFocusCaption() {\n\t\tif ( ! isCaptionSelected ) {\n\t\t\tsetIsCaptionSelected( true );\n\t\t}\n\t}\n\n\tif ( ! src ) {\n\t\treturn (\n\t\t\t<View>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tonSelect={ onSelectAudio }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\taccept=\"audio/*\"\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tvalue={ attributes }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\tautoOpenMediaUpload={ isSelected && wasBlockJustInserted }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction getBlockControls( open ) {\n\t\treturn (\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Replace audio' ) }\n\t\t\t\t\t\ticon={ replace }\n\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t);\n\t}\n\n\tfunction getBlockUI( open, getMediaOptions ) {\n\t\treturn (\n\t\t\t<MediaUploadProgress\n\t\t\t\tmediaId={ id }\n\t\t\t\tonFinishMediaUploadWithSuccess={ onFileChange }\n\t\t\t\tonMediaUploadStateReset={ onFileChange }\n\t\t\t\tcontainerStyle={ styles.progressContainer }\n\t\t\t\tprogressBarStyle={ styles.progressBar }\n\t\t\t\tspinnerStyle={ styles.spinner }\n\t\t\t\trenderContent={ ( {\n\t\t\t\t\tisUploadInProgress,\n\t\t\t\t\tisUploadFailed,\n\t\t\t\t\tretryMessage,\n\t\t\t\t} ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isCaptionSelected &&\n\t\t\t\t\t\t\t\t! isUploadInProgress &&\n\t\t\t\t\t\t\t\tgetBlockControls( open ) }\n\t\t\t\t\t\t\t{ getMediaOptions() }\n\t\t\t\t\t\t\t<AudioPlayer\n\t\t\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\t\t\tisUploadFailed={ isUploadFailed }\n\t\t\t\t\t\t\t\tretryMessage={ retryMessage }\n\t\t\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessible={ ! isSelected }\n\t\t\tonPress={ onAudioPress }\n\t\t\tdisabled={ ! isSelected }\n\t\t>\n\t\t\t<View>\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Autoplay' ) }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'autoplay' ) }\n\t\t\t\t\t\t\tchecked={ autoplay }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Autoplay may cause usability issues for some users.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Loop' ) }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'loop' ) }\n\t\t\t\t\t\t\tchecked={ loop }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Preload',\n\t\t\t\t\t\t\t\t'noun; Audio block parameter'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ preload || '' }\n\t\t\t\t\t\t\t// `undefined` is required for the preload attribute to be unset.\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tpreload: value || undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t\t{ value: '', label: __( 'Browser default' ) },\n\t\t\t\t\t\t\t\t{ value: 'auto', label: __( 'Auto' ) },\n\t\t\t\t\t\t\t\t{ value: 'metadata', label: __( 'Metadata' ) },\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: 'none',\n\t\t\t\t\t\t\t\t\tlabel: _x( 'None', '\"Preload\" value' ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\thideCancelButton={ true }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</InspectorControls>\n\t\t\t\t<MediaUpload\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tisReplacingMedia={ true }\n\t\t\t\t\tonSelect={ onSelectAudio }\n\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\trender={ ( { open, getMediaOptions } ) => {\n\t\t\t\t\t\treturn getBlockUI( open, getMediaOptions );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<BlockCaption\n\t\t\t\t\taccessible={ true }\n\t\t\t\t\taccessibilityLabelCreator={ ( caption ) =>\n\t\t\t\t\t\tRichText.isEmpty( caption )\n\t\t\t\t\t\t\t? /* translators: accessibility text. Empty Audio caption. */\n\t\t\t\t\t\t\t __( 'Audio caption. Empty' )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: accessibility text. %s: Audio caption. */\n\t\t\t\t\t\t\t\t\t__( 'Audio caption. %s' ),\n\t\t\t\t\t\t\t\t\tcaption\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSelected={ isCaptionSelected }\n\t\t\t\t\tonFocus={ onFocusCaption }\n\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n}\nexport default AudioEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,wBAAwB,QAAQ,cAAc;;AAEvD;AACA;AACA;AACA,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SACCC,SAAS,EACTC,aAAa,EACbC,aAAa,EACbC,aAAa,EACbC,YAAY,EACZC,WAAW,QACL,uBAAuB;AAC9B,SACCC,YAAY,EAC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M,EAAE,iBAAkB;IACtC,CAAC,CACC;IACH+E,gBAAgB,EAAG;EAAM,CACzB,CACS,CACO,CAAC,EACpBjC,aAAA,CAACpD,WAAW;IACXuD,YAAY,EAAGrC,mBAAqB;IACpCoE,gBAAgB,EAAG,IAAM;IACzBjC,QAAQ,EAAGN,aAAe;IAC1BJ,WAAW,EAAGA,WAAa;IAC3B4C,MAAM,EAAGA,CAAE;MAAE5B,IAAI;MAAEI;IAAgB,CAAC,KAAM;MACzC,OAAOD,UAAU,CAAEH,IAAI,EAAEI,eAAgB,CAAC;IAC3C;EAAG,CACH,CAAC,EACFX,aAAA,CAACzD,YAAY;IACZkF,UAAU,EAAG,IAAM;IACnBW,yBAAyB,EAAKC,OAAO,IACpCvF,QAAQ,CAACwF,OAAO,CAAED,OAAQ,CAAC,GACxB;IACApF,EAAE,CAAE,sBAAuB,CAAC,GAC5BE,OAAO,EACP;IACAF,EAAE,CAAE,mBAAoB,CAAC,EACzBoF,OACA,CACH;IACD/D,QAAQ,EAAGA,QAAU;IACrBJ,UAAU,EAAGU,iBAAmB;IAChCR,OAAO,EAAG2B,cAAgB;IAC1B1B,MAAM,EAAGA,MAAQ;IACjBF,iBAAiB,EAAGA;EAAmB,CACvC,CACI,CACmB,CAAC;AAE7B;AACA,eAAeJ,SAAS"}
|
|
@@ -7,11 +7,13 @@ import classnames from 'classnames';
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { useRegistry, useSelect, useDispatch } from '@wordpress/data';
|
|
11
|
+
import { useRef, useMemo, useEffect } from '@wordpress/element';
|
|
12
|
+
import { useEntityProp, useEntityRecord } from '@wordpress/core-data';
|
|
11
13
|
import { Placeholder, Spinner, TextControl, PanelBody } from '@wordpress/components';
|
|
12
14
|
import { __ } from '@wordpress/i18n';
|
|
13
|
-
import { useInnerBlocksProps, __experimentalRecursionProvider as RecursionProvider, __experimentalUseHasRecursion as useHasRecursion, InnerBlocks, InspectorControls, useBlockProps, Warning, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
14
|
-
import {
|
|
15
|
+
import { useInnerBlocksProps, __experimentalRecursionProvider as RecursionProvider, __experimentalUseHasRecursion as useHasRecursion, InnerBlocks, InspectorControls, useBlockProps, Warning, privateApis as blockEditorPrivateApis, store as blockEditorStore } from '@wordpress/block-editor';
|
|
16
|
+
import { getBlockSupport, parse } from '@wordpress/blocks';
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Internal dependencies
|
|
@@ -20,6 +22,12 @@ import { unlock } from '../lock-unlock';
|
|
|
20
22
|
const {
|
|
21
23
|
useLayoutClasses
|
|
22
24
|
} = unlock(blockEditorPrivateApis);
|
|
25
|
+
function isPartiallySynced(block) {
|
|
26
|
+
return !!getBlockSupport(block.name, '__experimentalConnections', false) && !!block.attributes.connections?.attributes && Object.values(block.attributes.connections.attributes).some(connection => connection.source === 'pattern_attributes');
|
|
27
|
+
}
|
|
28
|
+
function getPartiallySyncedAttributes(block) {
|
|
29
|
+
return Object.entries(block.attributes.connections.attributes).filter(([, connection]) => connection.source === 'pattern_attributes').map(([attributeKey]) => attributeKey);
|
|
30
|
+
}
|
|
23
31
|
const fullAlignments = ['full', 'wide', 'left', 'right'];
|
|
24
32
|
const useInferredLayout = (blocks, parentLayout) => {
|
|
25
33
|
const initialInferredAlignmentRef = useRef();
|
|
@@ -45,27 +53,90 @@ const useInferredLayout = (blocks, parentLayout) => {
|
|
|
45
53
|
};
|
|
46
54
|
}, [blocks, parentLayout]);
|
|
47
55
|
};
|
|
56
|
+
function applyInitialOverrides(blocks, overrides = {}, defaultValues) {
|
|
57
|
+
return blocks.map(block => {
|
|
58
|
+
const innerBlocks = applyInitialOverrides(block.innerBlocks, overrides, defaultValues);
|
|
59
|
+
const blockId = block.attributes.metadata?.id;
|
|
60
|
+
if (!isPartiallySynced(block) || !blockId) return {
|
|
61
|
+
...block,
|
|
62
|
+
innerBlocks
|
|
63
|
+
};
|
|
64
|
+
const attributes = getPartiallySyncedAttributes(block);
|
|
65
|
+
const newAttributes = {
|
|
66
|
+
...block.attributes
|
|
67
|
+
};
|
|
68
|
+
for (const attributeKey of attributes) {
|
|
69
|
+
defaultValues[blockId] = block.attributes[attributeKey];
|
|
70
|
+
if (overrides[blockId]) {
|
|
71
|
+
newAttributes[attributeKey] = overrides[blockId];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
...block,
|
|
76
|
+
attributes: newAttributes,
|
|
77
|
+
innerBlocks
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function getOverridesFromBlocks(blocks, defaultValues) {
|
|
82
|
+
/** @type {Record<string, unknown>} */
|
|
83
|
+
const overrides = {};
|
|
84
|
+
for (const block of blocks) {
|
|
85
|
+
Object.assign(overrides, getOverridesFromBlocks(block.innerBlocks, defaultValues));
|
|
86
|
+
const blockId = block.attributes.metadata?.id;
|
|
87
|
+
if (!isPartiallySynced(block) || !blockId) continue;
|
|
88
|
+
const attributes = getPartiallySyncedAttributes(block);
|
|
89
|
+
for (const attributeKey of attributes) {
|
|
90
|
+
if (block.attributes[attributeKey] !== defaultValues[blockId]) {
|
|
91
|
+
overrides[blockId] = block.attributes[attributeKey];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return Object.keys(overrides).length > 0 ? overrides : undefined;
|
|
96
|
+
}
|
|
48
97
|
export default function ReusableBlockEdit({
|
|
49
98
|
name,
|
|
50
99
|
attributes: {
|
|
51
|
-
ref
|
|
100
|
+
ref,
|
|
101
|
+
overrides
|
|
52
102
|
},
|
|
53
|
-
__unstableParentLayout: parentLayout
|
|
103
|
+
__unstableParentLayout: parentLayout,
|
|
104
|
+
clientId: patternClientId
|
|
54
105
|
}) {
|
|
106
|
+
const registry = useRegistry();
|
|
55
107
|
const hasAlreadyRendered = useHasRecursion(ref);
|
|
56
108
|
const {
|
|
57
109
|
record,
|
|
58
110
|
hasResolved
|
|
59
111
|
} = useEntityRecord('postType', 'wp_block', ref);
|
|
60
112
|
const isMissing = hasResolved && !record;
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
113
|
+
const initialOverrides = useRef(overrides);
|
|
114
|
+
const defaultValuesRef = useRef({});
|
|
115
|
+
const {
|
|
116
|
+
replaceInnerBlocks,
|
|
117
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
118
|
+
setBlockEditingMode
|
|
119
|
+
} = useDispatch(blockEditorStore);
|
|
120
|
+
const {
|
|
121
|
+
getBlockEditingMode
|
|
122
|
+
} = useSelect(blockEditorStore);
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
if (!record?.content?.raw) return;
|
|
125
|
+
const initialBlocks = parse(record.content.raw);
|
|
126
|
+
const editingMode = getBlockEditingMode(patternClientId);
|
|
127
|
+
registry.batch(() => {
|
|
128
|
+
setBlockEditingMode(patternClientId, 'default');
|
|
129
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
130
|
+
replaceInnerBlocks(patternClientId, applyInitialOverrides(initialBlocks, initialOverrides.current, defaultValuesRef.current));
|
|
131
|
+
setBlockEditingMode(patternClientId, editingMode);
|
|
132
|
+
});
|
|
133
|
+
}, [__unstableMarkNextChangeAsNotPersistent, patternClientId, record, replaceInnerBlocks, registry, getBlockEditingMode, setBlockEditingMode]);
|
|
134
|
+
const innerBlocks = useSelect(select => select(blockEditorStore).getBlocks(patternClientId), [patternClientId]);
|
|
64
135
|
const [title, setTitle] = useEntityProp('postType', 'wp_block', 'title', ref);
|
|
65
136
|
const {
|
|
66
137
|
alignment,
|
|
67
138
|
layout
|
|
68
|
-
} = useInferredLayout(
|
|
139
|
+
} = useInferredLayout(innerBlocks, parentLayout);
|
|
69
140
|
const layoutClasses = useLayoutClasses({
|
|
70
141
|
layout
|
|
71
142
|
}, name);
|
|
@@ -75,12 +146,32 @@ export default function ReusableBlockEdit({
|
|
|
75
146
|
})
|
|
76
147
|
});
|
|
77
148
|
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
78
|
-
value: blocks,
|
|
79
149
|
layout,
|
|
80
|
-
|
|
81
|
-
onChange,
|
|
82
|
-
renderAppender: blocks?.length ? undefined : InnerBlocks.ButtonBlockAppender
|
|
150
|
+
renderAppender: innerBlocks?.length ? undefined : InnerBlocks.ButtonBlockAppender
|
|
83
151
|
});
|
|
152
|
+
|
|
153
|
+
// Sync the `overrides` attribute from the updated blocks.
|
|
154
|
+
// `syncDerivedBlockAttributes` is an action that just like `updateBlockAttributes`
|
|
155
|
+
// but won't create an undo level.
|
|
156
|
+
// This can be abstracted into a `useSyncDerivedAttributes` hook if needed.
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
const {
|
|
159
|
+
getBlocks
|
|
160
|
+
} = registry.select(blockEditorStore);
|
|
161
|
+
const {
|
|
162
|
+
syncDerivedBlockAttributes
|
|
163
|
+
} = unlock(registry.dispatch(blockEditorStore));
|
|
164
|
+
let prevBlocks = getBlocks(patternClientId);
|
|
165
|
+
return registry.subscribe(() => {
|
|
166
|
+
const blocks = getBlocks(patternClientId);
|
|
167
|
+
if (blocks !== prevBlocks) {
|
|
168
|
+
prevBlocks = blocks;
|
|
169
|
+
syncDerivedBlockAttributes(patternClientId, {
|
|
170
|
+
overrides: getOverridesFromBlocks(blocks, defaultValuesRef.current)
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}, blockEditorStore);
|
|
174
|
+
}, [patternClientId, registry]);
|
|
84
175
|
let children = null;
|
|
85
176
|
if (hasAlreadyRendered) {
|
|
86
177
|
children = createElement(Warning, null, __('Block cannot be rendered inside itself.'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useEntityBlockEditor","useEntityProp","useEntityRecord","Placeholder","Spinner","TextControl","PanelBody","__","useInnerBlocksProps","__experimentalRecursionProvider","RecursionProvider","__experimentalUseHasRecursion","useHasRecursion","InnerBlocks","InspectorControls","useBlockProps","Warning","privateApis","blockEditorPrivateApis","useRef","useMemo","unlock","useLayoutClasses","fullAlignments","useInferredLayout","blocks","parentLayout","initialInferredAlignmentRef","length","alignment","current","undefined","isConstrained","type","hasFullAlignment","some","block","includes","attributes","align","layout","ReusableBlockEdit","name","ref","__unstableParentLayout","hasAlreadyRendered","record","hasResolved","isMissing","onInput","onChange","id","title","setTitle","layoutClasses","blockProps","className","innerBlocksProps","value","renderAppender","ButtonBlockAppender","children","createElement","uniqueId","label","__nextHasNoMarginBottom","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/block/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseEntityBlockEditor,\n\tuseEntityProp,\n\tuseEntityRecord,\n} from '@wordpress/core-data';\nimport {\n\tPlaceholder,\n\tSpinner,\n\tTextControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseInnerBlocksProps,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n\tInnerBlocks,\n\tInspectorControls,\n\tuseBlockProps,\n\tWarning,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useRef, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { useLayoutClasses } = unlock( blockEditorPrivateApis );\nconst fullAlignments = [ 'full', 'wide', 'left', 'right' ];\n\nconst useInferredLayout = ( blocks, parentLayout ) => {\n\tconst initialInferredAlignmentRef = useRef();\n\n\treturn useMemo( () => {\n\t\t// Exit early if the pattern's blocks haven't loaded yet.\n\t\tif ( ! blocks?.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet alignment = initialInferredAlignmentRef.current;\n\n\t\t// Only track the initial alignment so that temporarily removed\n\t\t// alignments can be reapplied.\n\t\tif ( alignment === undefined ) {\n\t\t\tconst isConstrained = parentLayout?.type === 'constrained';\n\t\t\tconst hasFullAlignment = blocks.some( ( block ) =>\n\t\t\t\tfullAlignments.includes( block.attributes.align )\n\t\t\t);\n\n\t\t\talignment = isConstrained && hasFullAlignment ? 'full' : null;\n\t\t\tinitialInferredAlignmentRef.current = alignment;\n\t\t}\n\n\t\tconst layout = alignment ? parentLayout : undefined;\n\n\t\treturn { alignment, layout };\n\t}, [ blocks, parentLayout ] );\n};\n\nexport default function ReusableBlockEdit( {\n\tname,\n\tattributes: { ref },\n\t__unstableParentLayout: parentLayout,\n} ) {\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_block',\n\t\tref\n\t);\n\tconst isMissing = hasResolved && ! record;\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_block',\n\t\t{ id: ref }\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_block',\n\t\t'title',\n\t\tref\n\t);\n\n\tconst { alignment, layout } = useInferredLayout( blocks, parentLayout );\n\tconst layoutClasses = useLayoutClasses( { layout }, name );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames(\n\t\t\t'block-library-block__reusable-block-container',\n\t\t\tlayout && layoutClasses,\n\t\t\t{ [ `align${ alignment }` ]: alignment }\n\t\t),\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tvalue: blocks,\n\t\tlayout,\n\t\tonInput,\n\t\tonChange,\n\t\trenderAppender: blocks?.length\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\tlet children = null;\n\tif ( hasAlreadyRendered ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( isMissing ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block has been deleted or is unavailable.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( ! hasResolved ) {\n\t\tchildren = (\n\t\t\t<Placeholder>\n\t\t\t\t<Spinner />\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ ref }>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ children === null ? (\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t) : (\n\t\t\t\t<div { ...blockProps }>{ children }</div>\n\t\t\t) }\n\t\t</RecursionProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,oBAAoB,EACpBC,aAAa,EACbC,eAAe,QACT,sBAAsB;AAC7B,SACCC,WAAW,EACXC,OAAO,EACPC,WAAW,EACXC,SAAS,QACH,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,mBAAmB,EACnBC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe,EAChDC,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,OAAO,EACPC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,MAAM,EAAEC,OAAO,QAAQ,oBAAoB;;AAEpD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,gBAAgB;AAEvC,MAAM;EAAEC;AAAiB,CAAC,GAAGD,MAAM,CAAEH,sBAAuB,CAAC;AAC7D,MAAMK,cAAc,GAAG,CAAE,MAAM,EAAE,MAAM,EA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BAAiB,QACjBgD,aAAA,CAACxD,SAAS,QACTwD,aAAA,CAACzD,WAAW;IACX2D,KAAK,EAAGzD,EAAE,CAAE,MAAO,CAAG;IACtBmD,KAAK,EAAGN,KAAO;IACfF,QAAQ,EAAGG,QAAU;IACrBY,uBAAuB;IACvBC,qBAAqB;EAAA,CACrB,CACS,CACO,CAAC,EAClBL,QAAQ,KAAK,IAAI,GAClBC,aAAA;IAAA,GAAUL;EAAgB,CAAI,CAAC,GAE/BK,aAAA;IAAA,GAAUP;EAAU,GAAKM,QAAe,CAEvB,CAAC;AAEtB"}
|
|
1
|
+
{"version":3,"names":["classnames","useRegistry","useSelect","useDispatch","useRef","useMemo","useEffect","useEntityProp","useEntityRecord","Placeholder","Spinner","TextControl","PanelBody","__","useInnerBlocksProps","__experimentalRecursionProvider","RecursionProvider","__experimentalUseHasRecursion","useHasRecursion","InnerBlocks","InspectorControls","useBlockProps","Warning","privateApis","blockEditorPrivateApis","store","blockEditorStore","getBlockSupport","parse","unlock","useLayoutClasses","isPartiallySynced","block","name","attributes","connections","Object","values","some","connection","source","getPartiallySyncedAttributes","entries","filter","map","attributeKey","fullAlignments","useInferredLayout","blocks","parentLayout","initialInferredAlignmentRef","length","alignment","current","undefined","isConstrained","type","hasFullAlignment","includes","align","layout","applyInitialOverrides","overrides","defaultValues","innerBlocks","blockId","metadata","id","newAttributes","getOverridesFromBlocks","assign","keys","ReusableBlockEdit","ref","__unstableParentLayout","clientId","patternClientId","registry","hasAlreadyRendered","record","hasResolved","isMissing","initialOverrides","defaultValuesRef","replaceInnerBlocks","__unstableMarkNextChangeAsNotPersistent","setBlockEditingMode","getBlockEditingMode","content","raw","initialBlocks","editingMode","batch","select","getBlocks","title","setTitle","layoutClasses","blockProps","className","innerBlocksProps","renderAppender","ButtonBlockAppender","syncDerivedBlockAttributes","dispatch","prevBlocks","subscribe","children","createElement","uniqueId","label","value","onChange","__nextHasNoMarginBottom","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/block/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry, useSelect, useDispatch } from '@wordpress/data';\nimport { useRef, useMemo, useEffect } from '@wordpress/element';\nimport { useEntityProp, useEntityRecord } from '@wordpress/core-data';\nimport {\n\tPlaceholder,\n\tSpinner,\n\tTextControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseInnerBlocksProps,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n\tInnerBlocks,\n\tInspectorControls,\n\tuseBlockProps,\n\tWarning,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { getBlockSupport, parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { useLayoutClasses } = unlock( blockEditorPrivateApis );\n\nfunction isPartiallySynced( block ) {\n\treturn (\n\t\t!! getBlockSupport( block.name, '__experimentalConnections', false ) &&\n\t\t!! block.attributes.connections?.attributes &&\n\t\tObject.values( block.attributes.connections.attributes ).some(\n\t\t\t( connection ) => connection.source === 'pattern_attributes'\n\t\t)\n\t);\n}\nfunction getPartiallySyncedAttributes( block ) {\n\treturn Object.entries( block.attributes.connections.attributes )\n\t\t.filter(\n\t\t\t( [ , connection ] ) => connection.source === 'pattern_attributes'\n\t\t)\n\t\t.map( ( [ attributeKey ] ) => attributeKey );\n}\n\nconst fullAlignments = [ 'full', 'wide', 'left', 'right' ];\n\nconst useInferredLayout = ( blocks, parentLayout ) => {\n\tconst initialInferredAlignmentRef = useRef();\n\n\treturn useMemo( () => {\n\t\t// Exit early if the pattern's blocks haven't loaded yet.\n\t\tif ( ! blocks?.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet alignment = initialInferredAlignmentRef.current;\n\n\t\t// Only track the initial alignment so that temporarily removed\n\t\t// alignments can be reapplied.\n\t\tif ( alignment === undefined ) {\n\t\t\tconst isConstrained = parentLayout?.type === 'constrained';\n\t\t\tconst hasFullAlignment = blocks.some( ( block ) =>\n\t\t\t\tfullAlignments.includes( block.attributes.align )\n\t\t\t);\n\n\t\t\talignment = isConstrained && hasFullAlignment ? 'full' : null;\n\t\t\tinitialInferredAlignmentRef.current = alignment;\n\t\t}\n\n\t\tconst layout = alignment ? parentLayout : undefined;\n\n\t\treturn { alignment, layout };\n\t}, [ blocks, parentLayout ] );\n};\n\nfunction applyInitialOverrides( blocks, overrides = {}, defaultValues ) {\n\treturn blocks.map( ( block ) => {\n\t\tconst innerBlocks = applyInitialOverrides(\n\t\t\tblock.innerBlocks,\n\t\t\toverrides,\n\t\t\tdefaultValues\n\t\t);\n\t\tconst blockId = block.attributes.metadata?.id;\n\t\tif ( ! isPartiallySynced( block ) || ! blockId )\n\t\t\treturn { ...block, innerBlocks };\n\t\tconst attributes = getPartiallySyncedAttributes( block );\n\t\tconst newAttributes = { ...block.attributes };\n\t\tfor ( const attributeKey of attributes ) {\n\t\t\tdefaultValues[ blockId ] = block.attributes[ attributeKey ];\n\t\t\tif ( overrides[ blockId ] ) {\n\t\t\t\tnewAttributes[ attributeKey ] = overrides[ blockId ];\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\t...block,\n\t\t\tattributes: newAttributes,\n\t\t\tinnerBlocks,\n\t\t};\n\t} );\n}\n\nfunction getOverridesFromBlocks( blocks, defaultValues ) {\n\t/** @type {Record<string, unknown>} */\n\tconst overrides = {};\n\tfor ( const block of blocks ) {\n\t\tObject.assign(\n\t\t\toverrides,\n\t\t\tgetOverridesFromBlocks( block.innerBlocks, defaultValues )\n\t\t);\n\t\tconst blockId = block.attributes.metadata?.id;\n\t\tif ( ! isPartiallySynced( block ) || ! blockId ) continue;\n\t\tconst attributes = getPartiallySyncedAttributes( block );\n\t\tfor ( const attributeKey of attributes ) {\n\t\t\tif (\n\t\t\t\tblock.attributes[ attributeKey ] !== defaultValues[ blockId ]\n\t\t\t) {\n\t\t\t\toverrides[ blockId ] = block.attributes[ attributeKey ];\n\t\t\t}\n\t\t}\n\t}\n\treturn Object.keys( overrides ).length > 0 ? overrides : undefined;\n}\n\nexport default function ReusableBlockEdit( {\n\tname,\n\tattributes: { ref, overrides },\n\t__unstableParentLayout: parentLayout,\n\tclientId: patternClientId,\n} ) {\n\tconst registry = useRegistry();\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_block',\n\t\tref\n\t);\n\tconst isMissing = hasResolved && ! record;\n\tconst initialOverrides = useRef( overrides );\n\tconst defaultValuesRef = useRef( {} );\n\tconst {\n\t\treplaceInnerBlocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetBlockEditingMode,\n\t} = useDispatch( blockEditorStore );\n\tconst { getBlockEditingMode } = useSelect( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( ! record?.content?.raw ) return;\n\t\tconst initialBlocks = parse( record.content.raw );\n\n\t\tconst editingMode = getBlockEditingMode( patternClientId );\n\t\tregistry.batch( () => {\n\t\t\tsetBlockEditingMode( patternClientId, 'default' );\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\treplaceInnerBlocks(\n\t\t\t\tpatternClientId,\n\t\t\t\tapplyInitialOverrides(\n\t\t\t\t\tinitialBlocks,\n\t\t\t\t\tinitialOverrides.current,\n\t\t\t\t\tdefaultValuesRef.current\n\t\t\t\t)\n\t\t\t);\n\t\t\tsetBlockEditingMode( patternClientId, editingMode );\n\t\t} );\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tpatternClientId,\n\t\trecord,\n\t\treplaceInnerBlocks,\n\t\tregistry,\n\t\tgetBlockEditingMode,\n\t\tsetBlockEditingMode,\n\t] );\n\n\tconst innerBlocks = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlocks( patternClientId ),\n\t\t[ patternClientId ]\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_block',\n\t\t'title',\n\t\tref\n\t);\n\n\tconst { alignment, layout } = useInferredLayout(\n\t\tinnerBlocks,\n\t\tparentLayout\n\t);\n\tconst layoutClasses = useLayoutClasses( { layout }, name );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames(\n\t\t\t'block-library-block__reusable-block-container',\n\t\t\tlayout && layoutClasses,\n\t\t\t{ [ `align${ alignment }` ]: alignment }\n\t\t),\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tlayout,\n\t\trenderAppender: innerBlocks?.length\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\t// Sync the `overrides` attribute from the updated blocks.\n\t// `syncDerivedBlockAttributes` is an action that just like `updateBlockAttributes`\n\t// but won't create an undo level.\n\t// This can be abstracted into a `useSyncDerivedAttributes` hook if needed.\n\tuseEffect( () => {\n\t\tconst { getBlocks } = registry.select( blockEditorStore );\n\t\tconst { syncDerivedBlockAttributes } = unlock(\n\t\t\tregistry.dispatch( blockEditorStore )\n\t\t);\n\t\tlet prevBlocks = getBlocks( patternClientId );\n\t\treturn registry.subscribe( () => {\n\t\t\tconst blocks = getBlocks( patternClientId );\n\t\t\tif ( blocks !== prevBlocks ) {\n\t\t\t\tprevBlocks = blocks;\n\t\t\t\tsyncDerivedBlockAttributes( patternClientId, {\n\t\t\t\t\toverrides: getOverridesFromBlocks(\n\t\t\t\t\t\tblocks,\n\t\t\t\t\t\tdefaultValuesRef.current\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t}, blockEditorStore );\n\t}, [ patternClientId, registry ] );\n\n\tlet children = null;\n\n\tif ( hasAlreadyRendered ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( isMissing ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block has been deleted or is unavailable.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( ! hasResolved ) {\n\t\tchildren = (\n\t\t\t<Placeholder>\n\t\t\t\t<Spinner />\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ ref }>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ children === null ? (\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t) : (\n\t\t\t\t<div { ...blockProps }>{ children }</div>\n\t\t\t) }\n\t\t</RecursionProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,MAAM,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AAC/D,SAASC,aAAa,EAAEC,eAAe,QAAQ,sBAAsB;AACrE,SACCC,WAAW,EACXC,OAAO,EACPC,WAAW,EACXC,SAAS,QACH,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,mBAAmB,EACnBC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe,EAChDC,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,OAAO,EACPC,WAAW,IAAIC,sBAAsB,EACrCC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,eAAe,EAAEC,KAAK,QAAQ,m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AAE,CAAEkD,eAAe,EAAEC,QAAQ,CAAG,CAAC;EAElC,IAAI8B,QAAQ,GAAG,IAAI;EAEnB,IAAK7B,kBAAkB,EAAG;IACzB6B,QAAQ,GACPC,aAAA,CAACtF,OAAO,QACLT,EAAE,CAAE,yCAA0C,CACxC,CACT;EACF;EAEA,IAAKoE,SAAS,EAAG;IAChB0B,QAAQ,GACPC,aAAA,CAACtF,OAAO,QACLT,EAAE,CAAE,2CAA4C,CAC1C,CACT;EACF;EAEA,IAAK,CAAEmE,WAAW,EAAG;IACpB2B,QAAQ,GACPC,aAAA,CAACnG,WAAW,QACXmG,aAAA,CAAClG,OAAO,MAAE,CACE,CACb;EACF;EAEA,OACCkG,aAAA,CAAC5F,iBAAiB;IAAC6F,QAAQ,EAAGpC;EAAK,GAClCmC,aAAA,CAACxF,iBAAiB,QACjBwF,aAAA,CAAChG,SAAS,QACTgG,aAAA,CAACjG,WAAW;IACXmG,KAAK,EAAGjG,EAAE,CAAE,MAAO,CAAG;IACtBkG,KAAK,EAAGhB,KAAO;IACfiB,QAAQ,EAAGhB,QAAU;IACrBiB,uBAAuB;IACvBC,qBAAqB;EAAA,CACrB,CACS,CACO,CAAC,EAClBP,QAAQ,KAAK,IAAI,GAClBC,aAAA;IAAA,GAAUR;EAAgB,CAAI,CAAC,GAE/BQ,aAAA;IAAA,GAAUV;EAAU,GAAKS,QAAe,CAEvB,CAAC;AAEtB"}
|
|
@@ -28,13 +28,14 @@ const metadata = {
|
|
|
28
28
|
renaming: false
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
import
|
|
31
|
+
import editV1 from './v1/edit';
|
|
32
|
+
import editV2 from './edit';
|
|
32
33
|
const {
|
|
33
34
|
name
|
|
34
35
|
} = metadata;
|
|
35
36
|
export { metadata, name };
|
|
36
37
|
export const settings = {
|
|
37
|
-
edit,
|
|
38
|
+
edit: window.__experimentalPatternPartialSyncing ? editV2 : editV1,
|
|
38
39
|
icon
|
|
39
40
|
};
|
|
40
41
|
export const init = () => initBlock({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["symbol","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","ref","type","supports","customClassName","html","inserter","renaming","
|
|
1
|
+
{"version":3,"names":["symbol","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","ref","type","supports","customClassName","html","inserter","renaming","editV1","editV2","settings","edit","window","__experimentalPatternPartialSyncing","init"],"sources":["@wordpress/block-library/src/block/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { symbol as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport editV1 from './v1/edit';\nimport editV2 from './edit';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\tedit: window.__experimentalPatternPartialSyncing ? editV2 : editV1,\n\ticon,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,IAAIC,IAAI,QAAQ,kBAAkB;;AAEjD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,GAAA;MAAAC,IAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,eAAA;IAAAC,IAAA;IAAAC,QAAA;IAAAC,QAAA;EAAA;AAAA;AAE5C,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,MAAM,MAAM,QAAQ;AAE3B,MAAM;EAAEf;AAAK,CAAC,GAAGH,QAAQ;AAEzB,SAASA,QAAQ,EAAEG,IAAI;AAEvB,OAAO,MAAMgB,QAAQ,GAAG;EACvBC,IAAI,EAAEC,MAAM,CAACC,mCAAmC,GAAGJ,MAAM,GAAGD,MAAM;EAClEnB;AACD,CAAC;AAED,OAAO,MAAMyB,IAAI,GAAGA,CAAA,KAAMxB,SAAS,CAAE;EAAEI,IAAI;EAAEH,QAAQ;EAAEmB;AAAS,CAAE,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import classnames from 'classnames';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { useEntityBlockEditor, useEntityProp, useEntityRecord } from '@wordpress/core-data';
|
|
11
|
+
import { Placeholder, Spinner, TextControl, PanelBody } from '@wordpress/components';
|
|
12
|
+
import { __ } from '@wordpress/i18n';
|
|
13
|
+
import { useInnerBlocksProps, __experimentalRecursionProvider as RecursionProvider, __experimentalUseHasRecursion as useHasRecursion, InnerBlocks, InspectorControls, useBlockProps, Warning, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
14
|
+
import { useRef, useMemo } from '@wordpress/element';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
import { unlock } from '../../lock-unlock';
|
|
20
|
+
const {
|
|
21
|
+
useLayoutClasses
|
|
22
|
+
} = unlock(blockEditorPrivateApis);
|
|
23
|
+
const fullAlignments = ['full', 'wide', 'left', 'right'];
|
|
24
|
+
const useInferredLayout = (blocks, parentLayout) => {
|
|
25
|
+
const initialInferredAlignmentRef = useRef();
|
|
26
|
+
return useMemo(() => {
|
|
27
|
+
// Exit early if the pattern's blocks haven't loaded yet.
|
|
28
|
+
if (!blocks?.length) {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
let alignment = initialInferredAlignmentRef.current;
|
|
32
|
+
|
|
33
|
+
// Only track the initial alignment so that temporarily removed
|
|
34
|
+
// alignments can be reapplied.
|
|
35
|
+
if (alignment === undefined) {
|
|
36
|
+
const isConstrained = parentLayout?.type === 'constrained';
|
|
37
|
+
const hasFullAlignment = blocks.some(block => fullAlignments.includes(block.attributes.align));
|
|
38
|
+
alignment = isConstrained && hasFullAlignment ? 'full' : null;
|
|
39
|
+
initialInferredAlignmentRef.current = alignment;
|
|
40
|
+
}
|
|
41
|
+
const layout = alignment ? parentLayout : undefined;
|
|
42
|
+
return {
|
|
43
|
+
alignment,
|
|
44
|
+
layout
|
|
45
|
+
};
|
|
46
|
+
}, [blocks, parentLayout]);
|
|
47
|
+
};
|
|
48
|
+
export default function ReusableBlockEdit({
|
|
49
|
+
name,
|
|
50
|
+
attributes: {
|
|
51
|
+
ref
|
|
52
|
+
},
|
|
53
|
+
__unstableParentLayout: parentLayout
|
|
54
|
+
}) {
|
|
55
|
+
const hasAlreadyRendered = useHasRecursion(ref);
|
|
56
|
+
const {
|
|
57
|
+
record,
|
|
58
|
+
hasResolved
|
|
59
|
+
} = useEntityRecord('postType', 'wp_block', ref);
|
|
60
|
+
const isMissing = hasResolved && !record;
|
|
61
|
+
const [blocks, onInput, onChange] = useEntityBlockEditor('postType', 'wp_block', {
|
|
62
|
+
id: ref
|
|
63
|
+
});
|
|
64
|
+
const [title, setTitle] = useEntityProp('postType', 'wp_block', 'title', ref);
|
|
65
|
+
const {
|
|
66
|
+
alignment,
|
|
67
|
+
layout
|
|
68
|
+
} = useInferredLayout(blocks, parentLayout);
|
|
69
|
+
const layoutClasses = useLayoutClasses({
|
|
70
|
+
layout
|
|
71
|
+
}, name);
|
|
72
|
+
const blockProps = useBlockProps({
|
|
73
|
+
className: classnames('block-library-block__reusable-block-container', layout && layoutClasses, {
|
|
74
|
+
[`align${alignment}`]: alignment
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
78
|
+
value: blocks,
|
|
79
|
+
layout,
|
|
80
|
+
onInput,
|
|
81
|
+
onChange,
|
|
82
|
+
renderAppender: blocks?.length ? undefined : InnerBlocks.ButtonBlockAppender
|
|
83
|
+
});
|
|
84
|
+
let children = null;
|
|
85
|
+
if (hasAlreadyRendered) {
|
|
86
|
+
children = createElement(Warning, null, __('Block cannot be rendered inside itself.'));
|
|
87
|
+
}
|
|
88
|
+
if (isMissing) {
|
|
89
|
+
children = createElement(Warning, null, __('Block has been deleted or is unavailable.'));
|
|
90
|
+
}
|
|
91
|
+
if (!hasResolved) {
|
|
92
|
+
children = createElement(Placeholder, null, createElement(Spinner, null));
|
|
93
|
+
}
|
|
94
|
+
return createElement(RecursionProvider, {
|
|
95
|
+
uniqueId: ref
|
|
96
|
+
}, createElement(InspectorControls, null, createElement(PanelBody, null, createElement(TextControl, {
|
|
97
|
+
label: __('Name'),
|
|
98
|
+
value: title,
|
|
99
|
+
onChange: setTitle,
|
|
100
|
+
__nextHasNoMarginBottom: true,
|
|
101
|
+
__next40pxDefaultSize: true
|
|
102
|
+
}))), children === null ? createElement("div", {
|
|
103
|
+
...innerBlocksProps
|
|
104
|
+
}) : createElement("div", {
|
|
105
|
+
...blockProps
|
|
106
|
+
}, children));
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["classnames","useEntityBlockEditor","useEntityProp","useEntityRecord","Placeholder","Spinner","TextControl","PanelBody","__","useInnerBlocksProps","__experimentalRecursionProvider","RecursionProvider","__experimentalUseHasRecursion","useHasRecursion","InnerBlocks","InspectorControls","useBlockProps","Warning","privateApis","blockEditorPrivateApis","useRef","useMemo","unlock","useLayoutClasses","fullAlignments","useInferredLayout","blocks","parentLayout","initialInferredAlignmentRef","length","alignment","current","undefined","isConstrained","type","hasFullAlignment","some","block","includes","attributes","align","layout","ReusableBlockEdit","name","ref","__unstableParentLayout","hasAlreadyRendered","record","hasResolved","isMissing","onInput","onChange","id","title","setTitle","layoutClasses","blockProps","className","innerBlocksProps","value","renderAppender","ButtonBlockAppender","children","createElement","uniqueId","label","__nextHasNoMarginBottom","__next40pxDefaultSize"],"sources":["@wordpress/block-library/src/block/v1/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseEntityBlockEditor,\n\tuseEntityProp,\n\tuseEntityRecord,\n} from '@wordpress/core-data';\nimport {\n\tPlaceholder,\n\tSpinner,\n\tTextControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseInnerBlocksProps,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n\tInnerBlocks,\n\tInspectorControls,\n\tuseBlockProps,\n\tWarning,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useRef, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useLayoutClasses } = unlock( blockEditorPrivateApis );\nconst fullAlignments = [ 'full', 'wide', 'left', 'right' ];\n\nconst useInferredLayout = ( blocks, parentLayout ) => {\n\tconst initialInferredAlignmentRef = useRef();\n\n\treturn useMemo( () => {\n\t\t// Exit early if the pattern's blocks haven't loaded yet.\n\t\tif ( ! blocks?.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet alignment = initialInferredAlignmentRef.current;\n\n\t\t// Only track the initial alignment so that temporarily removed\n\t\t// alignments can be reapplied.\n\t\tif ( alignment === undefined ) {\n\t\t\tconst isConstrained = parentLayout?.type === 'constrained';\n\t\t\tconst hasFullAlignment = blocks.some( ( block ) =>\n\t\t\t\tfullAlignments.includes( block.attributes.align )\n\t\t\t);\n\n\t\t\talignment = isConstrained && hasFullAlignment ? 'full' : null;\n\t\t\tinitialInferredAlignmentRef.current = alignment;\n\t\t}\n\n\t\tconst layout = alignment ? parentLayout : undefined;\n\n\t\treturn { alignment, layout };\n\t}, [ blocks, parentLayout ] );\n};\n\nexport default function ReusableBlockEdit( {\n\tname,\n\tattributes: { ref },\n\t__unstableParentLayout: parentLayout,\n} ) {\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_block',\n\t\tref\n\t);\n\tconst isMissing = hasResolved && ! record;\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_block',\n\t\t{ id: ref }\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_block',\n\t\t'title',\n\t\tref\n\t);\n\n\tconst { alignment, layout } = useInferredLayout( blocks, parentLayout );\n\tconst layoutClasses = useLayoutClasses( { layout }, name );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames(\n\t\t\t'block-library-block__reusable-block-container',\n\t\t\tlayout && layoutClasses,\n\t\t\t{ [ `align${ alignment }` ]: alignment }\n\t\t),\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tvalue: blocks,\n\t\tlayout,\n\t\tonInput,\n\t\tonChange,\n\t\trenderAppender: blocks?.length\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\tlet children = null;\n\n\tif ( hasAlreadyRendered ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( isMissing ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block has been deleted or is unavailable.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( ! hasResolved ) {\n\t\tchildren = (\n\t\t\t<Placeholder>\n\t\t\t\t<Spinner />\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ ref }>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ children === null ? (\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t) : (\n\t\t\t\t<div { ...blockProps }>{ children }</div>\n\t\t\t) }\n\t\t</RecursionProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,oBAAoB,EACpBC,aAAa,EACbC,eAAe,QACT,sBAAsB;AAC7B,SACCC,WAAW,EACXC,OAAO,EACPC,WAAW,EACXC,SAAS,QACH,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,mBAAmB,EACnBC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe,EAChDC,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,OAAO,EACPC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,MAAM,EAAEC,OAAO,QAAQ,oBAAoB;;AAEpD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAiB,CAAC,GAAGD,MAAM,CAAEH,sBAAuB,CAAC;AAC7D,MAAMK,cAAc,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAE;AAE1D,MAAMC,iBAAiB,GAAGA,CAAEC,MAAM,EAAEC,YAAY,KAAM;EACrD,MAAMC,2BAA2B,GAAGR,MAAM,CAAC,CAAC;EAE5C,OAAOC,OAAO,CAAE,MAAM;IACrB;IACA,IAAK,CAAEK,MAAM,EAAEG,MAAM,EAAG;MACvB,OAAO,CAAC,CAAC;IACV;IAEA,IAAIC,SAAS,GAAGF,2BAA2B,CAACG,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AAC,GAE/BK,aAAA;IAAA,GAAUP;EAAU,GAAKM,QAAe,CAEvB,CAAC;AAEtB"}
|
|
@@ -22,8 +22,8 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
22
22
|
/**
|
|
23
23
|
* Internal dependencies
|
|
24
24
|
*/
|
|
25
|
-
import styles from '
|
|
26
|
-
import EditTitle from '
|
|
25
|
+
import styles from '../editor.scss';
|
|
26
|
+
import EditTitle from '../edit-title';
|
|
27
27
|
export default function ReusableBlockEdit({
|
|
28
28
|
attributes: {
|
|
29
29
|
ref
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ActivityIndicator","Platform","Text","TouchableWithoutFeedback","View","useState","useCallback","useEntityBlockEditor","useEntityProp","store","coreStore","BottomSheet","Icon","Disabled","TextControl","useSelect","useDispatch","__","sprintf","__experimentalRecursionProvider","RecursionProvider","__experimentalUseHasRecursion","useHasRecursion","InnerBlocks","Warning","blockEditorStore","usePreferredColorSchemeStyle","help","reusableBlocksStore","editorStore","noticesStore","styles","EditTitle","ReusableBlockEdit","attributes","ref","clientId","isSelected","hasAlreadyRendered","showHelp","setShowHelp","infoTextStyle","infoText","infoTextDark","infoTitleStyle","infoTitle","infoTitleDark","infoSheetIconStyle","infoSheetIcon","infoSheetIconDark","infoDescriptionStyle","infoDescription","infoDescriptionDark","actionButtonStyle","actionButton","actionButtonDark","spinnerStyle","spinner","spinnerDark","hasResolved","isEditing","isMissing","select","persistedBlock","getEntityRecord","hasResolvedBlock","hasFinishedResolution","getBlockCount","__experimentalIsEditingReusableBlock","innerBlockCount","hostAppNamespace","getEditorSettings","createSuccessNotice","__experimentalConvertBlockToStatic","convertBlockToStatic","clearSelectedBlock","blocks","onInput","onChange","id","title","openSheet","closeSheet","onConvertToRegularBlocks","successNotice","setImmediate","renderSheet","OS","createElement","isVisible","hideHeader","onClose","style","infoContainer","icon","color","size","label","separatorType","onPress","labelStyle","message","animating","element","value","uniqueId","disabled","accessibilityLabel","accessibilityRole","accessibilityHint"],"sources":["@wordpress/block-library/src/block/v1/edit.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tActivityIndicator,\n\tPlatform,\n\tText,\n\tTouchableWithoutFeedback,\n\tView,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useCallback } from '@wordpress/element';\nimport {\n\tuseEntityBlockEditor,\n\tuseEntityProp,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport {\n\tBottomSheet,\n\tIcon,\n\tDisabled,\n\tTextControl,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n\tInnerBlocks,\n\tWarning,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { help } from '@wordpress/icons';\nimport { store as reusableBlocksStore } from '@wordpress/reusable-blocks';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport styles from '../editor.scss';\nimport EditTitle from '../edit-title';\n\nexport default function ReusableBlockEdit( {\n\tattributes: { ref },\n\tclientId,\n\tisSelected,\n} ) {\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\n\tconst [ showHelp, setShowHelp ] = useState( false );\n\tconst infoTextStyle = usePreferredColorSchemeStyle(\n\t\tstyles.infoText,\n\t\tstyles.infoTextDark\n\t);\n\tconst infoTitleStyle = usePreferredColorSchemeStyle(\n\t\tstyles.infoTitle,\n\t\tstyles.infoTitleDark\n\t);\n\tconst infoSheetIconStyle = usePreferredColorSchemeStyle(\n\t\tstyles.infoSheetIcon,\n\t\tstyles.infoSheetIconDark\n\t);\n\tconst infoDescriptionStyle = usePreferredColorSchemeStyle(\n\t\tstyles.infoDescription,\n\t\tstyles.infoDescriptionDark\n\t);\n\tconst actionButtonStyle = usePreferredColorSchemeStyle(\n\t\tstyles.actionButton,\n\t\tstyles.actionButtonDark\n\t);\n\tconst spinnerStyle = usePreferredColorSchemeStyle(\n\t\tstyles.spinner,\n\t\tstyles.spinnerDark\n\t);\n\n\tconst { hasResolved, isEditing, isMissing } = useSelect(\n\t\t( select ) => {\n\t\t\tconst persistedBlock = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_block',\n\t\t\t\tref\n\t\t\t);\n\t\t\tconst hasResolvedBlock = select( coreStore ).hasFinishedResolution(\n\t\t\t\t'getEntityRecord',\n\t\t\t\t[ 'postType', 'wp_block', ref ]\n\t\t\t);\n\n\t\t\tconst { getBlockCount } = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\thasResolved: hasResolvedBlock,\n\t\t\t\tisEditing:\n\t\t\t\t\tselect(\n\t\t\t\t\t\treusableBlocksStore\n\t\t\t\t\t).__experimentalIsEditingReusableBlock( clientId ),\n\t\t\t\tisMissing: hasResolvedBlock && ! persistedBlock,\n\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ ref, clientId ]\n\t);\n\tconst hostAppNamespace = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().hostAppNamespace,\n\t\t[]\n\t);\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { __experimentalConvertBlockToStatic: convertBlockToStatic } =\n\t\tuseDispatch( reusableBlocksStore );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_block',\n\t\t{ id: ref }\n\t);\n\n\tconst [ title ] = useEntityProp( 'postType', 'wp_block', 'title', ref );\n\n\tfunction openSheet() {\n\t\tsetShowHelp( true );\n\t}\n\n\tfunction closeSheet() {\n\t\tsetShowHelp( false );\n\t}\n\n\tconst onConvertToRegularBlocks = useCallback( () => {\n\t\t/* translators: %s: name of the synced block */\n\t\tconst successNotice = __( '%s detached' );\n\t\tcreateSuccessNotice( sprintf( successNotice, title ) );\n\n\t\tclearSelectedBlock();\n\t\t// Convert action is executed at the end of the current JavaScript execution block\n\t\t// to prevent issues related to undo/redo actions.\n\t\tsetImmediate( () => convertBlockToStatic( clientId ) );\n\t}, [ title, clientId ] );\n\n\tfunction renderSheet() {\n\t\tconst infoTitle =\n\t\t\tPlatform.OS === 'android'\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: name of the host app (e.g. WordPress) */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Editing synced patterns is not yet supported on %s for Android'\n\t\t\t\t\t\t),\n\t\t\t\t\t\thostAppNamespace\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: name of the host app (e.g. WordPress) */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Editing synced patterns is not yet supported on %s for iOS'\n\t\t\t\t\t\t),\n\t\t\t\t\t\thostAppNamespace\n\t\t\t\t );\n\n\t\treturn (\n\t\t\t<BottomSheet\n\t\t\t\tisVisible={ showHelp }\n\t\t\t\thideHeader\n\t\t\t\tonClose={ closeSheet }\n\t\t\t>\n\t\t\t\t<View style={ styles.infoContainer }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ help }\n\t\t\t\t\t\tcolor={ infoSheetIconStyle.color }\n\t\t\t\t\t\tsize={ styles.infoSheetIcon.size }\n\t\t\t\t\t/>\n\t\t\t\t\t<Text style={ [ infoTextStyle, infoTitleStyle ] }>\n\t\t\t\t\t\t{ infoTitle }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<Text style={ [ infoTextStyle, infoDescriptionStyle ] }>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Alternatively, you can detach and edit this block separately by tapping “Detach”.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Detach' ) }\n\t\t\t\t\t\tseparatorType=\"topFullWidth\"\n\t\t\t\t\t\tonPress={ onConvertToRegularBlocks }\n\t\t\t\t\t\tlabelStyle={ actionButtonStyle }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</BottomSheet>\n\t\t);\n\t}\n\n\tif ( hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tmessage={ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isMissing ) {\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tmessage={ __( 'Block has been deleted or is unavailable.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( ! hasResolved ) {\n\t\treturn (\n\t\t\t<View style={ spinnerStyle }>\n\t\t\t\t<ActivityIndicator animating />\n\t\t\t</View>\n\t\t);\n\t}\n\n\tlet element = (\n\t\t<InnerBlocks\n\t\t\tvalue={ blocks }\n\t\t\tonChange={ onChange }\n\t\t\tonInput={ onInput }\n\t\t/>\n\t);\n\n\tif ( ! isEditing ) {\n\t\telement = <Disabled>{ element }</Disabled>;\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ ref }>\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\tdisabled={ ! isSelected }\n\t\t\t\taccessibilityLabel={ __( 'Help button' ) }\n\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\taccessibilityHint={ __( 'Tap here to show help' ) }\n\t\t\t\tonPress={ openSheet }\n\t\t\t>\n\t\t\t\t<View>\n\t\t\t\t\t{ isSelected && <EditTitle title={ title } /> }\n\t\t\t\t\t{ element }\n\t\t\t\t\t{ renderSheet() }\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t</RecursionProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,iBAAiB,EACjBC,QAAQ,EACRC,IAAI,EACJC,wBAAwB,EACxBC,IAAI,QACE,cAAc;;AAErB;A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AAQ,QAAG0F,OAAmB,CAAC;EAC3C;EAEA,OACCf,aAAA,CAACpE,iBAAiB;IAACqF,QAAQ,EAAGtE;EAAK,GAClCqD,aAAA,CAACrF,wBAAwB;IACxBuG,QAAQ,EAAG,CAAErE,UAAY;IACzBsE,kBAAkB,EAAG1F,EAAE,CAAE,aAAc,CAAG;IAC1C2F,iBAAiB,EAAG,QAAU;IAC9BC,iBAAiB,EAAG5F,EAAE,CAAE,uBAAwB,CAAG;IACnDkF,OAAO,EAAGlB;EAAW,GAErBO,aAAA,CAACpF,IAAI,QACFiC,UAAU,IAAImD,aAAA,CAACxD,SAAS;IAACgD,KAAK,EAAGA;EAAO,CAAE,CAAC,EAC3CuB,OAAO,EACPjB,WAAW,CAAC,CACT,CACmB,CACR,CAAC;AAEtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","RichText","useBlockProps","__experimentalGetBorderClassesAndStyles","getBorderClassesAndStyles","__experimentalGetColorClassesAndStyles","getColorClassesAndStyles","__experimentalGetSpacingClassesAndStyles","getSpacingClassesAndStyles","__experimentalGetElementClassName","save","attributes","className","tagName","type","textAlign","fontSize","linkTarget","rel","style","text","title","url","width","TagName","isButtonTag","buttonType","borderProps","colorProps","spacingProps","buttonClasses","border","radius","buttonStyle","wrapperClasses","typography","createElement","Content","href","value","target"],"sources":["@wordpress/block-library/src/button/save.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes, className } ) {\n\tconst {\n\t\ttagName,\n\t\ttype,\n\t\ttextAlign,\n\t\tfontSize,\n\t\tlinkTarget,\n\t\trel,\n\t\tstyle,\n\t\ttext,\n\t\ttitle,\n\t\turl,\n\t\twidth,\n\t} = attributes;\n\n\tif (
|
|
1
|
+
{"version":3,"names":["classnames","RichText","useBlockProps","__experimentalGetBorderClassesAndStyles","getBorderClassesAndStyles","__experimentalGetColorClassesAndStyles","getColorClassesAndStyles","__experimentalGetSpacingClassesAndStyles","getSpacingClassesAndStyles","__experimentalGetElementClassName","save","attributes","className","tagName","type","textAlign","fontSize","linkTarget","rel","style","text","title","url","width","isEmpty","TagName","isButtonTag","buttonType","borderProps","colorProps","spacingProps","buttonClasses","border","radius","buttonStyle","wrapperClasses","typography","createElement","Content","href","value","target"],"sources":["@wordpress/block-library/src/button/save.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes, className } ) {\n\tconst {\n\t\ttagName,\n\t\ttype,\n\t\ttextAlign,\n\t\tfontSize,\n\t\tlinkTarget,\n\t\trel,\n\t\tstyle,\n\t\ttext,\n\t\ttitle,\n\t\turl,\n\t\twidth,\n\t} = attributes;\n\n\tif ( RichText.isEmpty( text ) ) {\n\t\treturn null;\n\t}\n\n\tconst TagName = tagName || 'a';\n\tconst isButtonTag = 'button' === TagName;\n\tconst buttonType = type || 'button';\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\tconst spacingProps = getSpacingClassesAndStyles( attributes );\n\tconst buttonClasses = classnames(\n\t\t'wp-block-button__link',\n\t\tcolorProps.className,\n\t\tborderProps.className,\n\t\t{\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t\t// For backwards compatibility add style that isn't provided via\n\t\t\t// block support.\n\t\t\t'no-border-radius': style?.border?.radius === 0,\n\t\t},\n\t\t__experimentalGetElementClassName( 'button' )\n\t);\n\tconst buttonStyle = {\n\t\t...borderProps.style,\n\t\t...colorProps.style,\n\t\t...spacingProps.style,\n\t};\n\n\t// The use of a `title` attribute here is soft-deprecated, but still applied\n\t// if it had already been assigned, for the sake of backward-compatibility.\n\t// A title will no longer be assigned for new or updated button block links.\n\n\tconst wrapperClasses = classnames( className, {\n\t\t[ `has-custom-width wp-block-button__width-${ width }` ]: width,\n\t\t[ `has-custom-font-size` ]: fontSize || style?.typography?.fontSize,\n\t} );\n\n\treturn (\n\t\t<div { ...useBlockProps.save( { className: wrapperClasses } ) }>\n\t\t\t<RichText.Content\n\t\t\t\ttagName={ TagName }\n\t\t\t\ttype={ isButtonTag ? buttonType : null }\n\t\t\t\tclassName={ buttonClasses }\n\t\t\t\thref={ isButtonTag ? null : url }\n\t\t\t\ttitle={ title }\n\t\t\t\tstyle={ buttonStyle }\n\t\t\t\tvalue={ text }\n\t\t\t\ttarget={ isButtonTag ? null : linkTarget }\n\t\t\t\trel={ isButtonTag ? null : rel }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,QAAQ,EACRC,aAAa,EACbC,uCAAuC,IAAIC,yBAAyB,EACpEC,sCAAsC,IAAIC,wBAAwB,EAClEC,wCAAwC,IAAIC,0BAA0B,EACtEC,iCAAiC,QAC3B,yBAAyB;AAEhC,eAAe,SAASC,IAAIA,CAAE;EAAEC,UAAU;EAAEC;AAAU,CAAC,EAAG;EACzD,MAAM;IACLC,OAAO;IACPC,IAAI;IACJC,SAAS;IACTC,QAAQ;IACRC,UAAU;IACVC,GAAG;IACHC,KAAK;IACLC,IAAI;IACJC,KAAK;IACLC,GAAG;IACHC;EACD,CAAC,GAAGZ,UAAU;EAEd,IA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