@wordpress/block-library 8.24.1 → 8.25.1-next.79a6196f.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/LICENSE.md +1 -1
- package/build/audio/edit.js +15 -62
- 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 +157 -19
- 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/comments-title/deprecated.js +1 -1
- package/build/comments-title/index.js +1 -1
- package/build/cover/edit/inspector-controls.js +1 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/edit.native.js +1 -0
- package/build/cover/edit.native.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 +6 -6
- package/build/embed/util.js.map +1 -1
- package/build/file/edit.js +20 -28
- 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 +38 -58
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +19 -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 +8 -4
- package/build/gallery/index.js.map +1 -1
- package/build/gallery/transforms.js +4 -68
- package/build/gallery/transforms.js.map +1 -1
- 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/group/index.js +5 -1
- package/build/group/index.js.map +1 -1
- package/build/heading/index.js +3 -6
- package/build/heading/index.js.map +1 -1
- package/build/image/deprecated.js +11 -0
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.native.js +4 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +35 -71
- 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/image/view.js +7 -1
- package/build/image/view.js.map +1 -1
- package/build/list/edit.js +10 -15
- package/build/list/edit.js.map +1 -1
- package/build/list-item/edit.js +17 -2
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/hooks/use-enter.js +5 -3
- package/build/list-item/hooks/use-enter.js.map +1 -1
- package/build/list-item/hooks/use-enter.native.js +4 -3
- package/build/list-item/hooks/use-enter.native.js.map +1 -1
- package/build/list-item/hooks/use-indent-list-item.js +2 -3
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +1 -1
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +3 -17
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-space.js +8 -4
- package/build/list-item/hooks/use-space.js.map +1 -1
- package/build/list-item/index.js +10 -3
- package/build/list-item/index.js.map +1 -1
- package/build/media-text/media-container.native.js +3 -0
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/navigation/constants.js +3 -1
- package/build/navigation/constants.js.map +1 -1
- package/build/navigation/edit/index.js +5 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/view.js +25 -1
- package/build/navigation/view.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 -4
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +2 -4
- package/build/paragraph/transforms.js.map +1 -1
- package/build/pattern/edit.js +24 -2
- package/build/pattern/edit.js.map +1 -1
- package/build/pattern/recursion-detector.js +147 -0
- package/build/pattern/recursion-detector.js.map +1 -0
- package/build/post-featured-image/edit.js +19 -2
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +4 -0
- package/build/post-featured-image/index.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/index.js +3 -1
- package/build/query/edit/inspector-controls/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-pagination-numbers/index.js +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/search/edit.js +3 -5
- package/build/search/edit.js.map +1 -1
- package/build/search/index.js +0 -4
- package/build/search/index.js.map +1 -1
- package/build/site-logo/edit.js +7 -6
- package/build/site-logo/edit.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/spacer/edit.native.js +2 -2
- package/build/spacer/edit.native.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/tag-cloud/edit.js +5 -9
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/utils/caption.js +90 -0
- package/build/utils/caption.js.map +1 -0
- package/build/utils/constants.js +16 -0
- package/build/utils/constants.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 +16 -57
- 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 +19 -66
- 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 +160 -22
- 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/comments-title/deprecated.js +1 -1
- package/build-module/comments-title/index.js +1 -1
- package/build-module/cover/edit/inspector-controls.js +1 -1
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/edit.native.js +1 -0
- package/build-module/cover/edit.native.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 +6 -6
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/edit.js +20 -28
- 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 +41 -61
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +18 -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 +8 -4
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/gallery/transforms.js +4 -68
- package/build-module/gallery/transforms.js.map +1 -1
- 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/group/index.js +5 -1
- package/build-module/group/index.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/deprecated.js +11 -0
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.native.js +5 -2
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +35 -71
- 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/image/view.js +7 -1
- package/build-module/image/view.js.map +1 -1
- package/build-module/list/edit.js +10 -15
- package/build-module/list/edit.js.map +1 -1
- package/build-module/list-item/edit.js +18 -3
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/hooks/use-enter.js +5 -3
- package/build-module/list-item/hooks/use-enter.js.map +1 -1
- package/build-module/list-item/hooks/use-enter.native.js +4 -3
- package/build-module/list-item/hooks/use-enter.native.js.map +1 -1
- package/build-module/list-item/hooks/use-indent-list-item.js +2 -3
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +1 -1
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +3 -17
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-space.js +8 -4
- package/build-module/list-item/hooks/use-space.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/media-text/media-container.native.js +3 -0
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/navigation/constants.js +1 -0
- package/build-module/navigation/constants.js.map +1 -1
- package/build-module/navigation/edit/index.js +7 -3
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/view.js +25 -1
- package/build-module/navigation/view.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 -4
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +2 -4
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/pattern/edit.js +26 -4
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/pattern/recursion-detector.js +139 -0
- package/build-module/pattern/recursion-detector.js.map +1 -0
- package/build-module/post-featured-image/edit.js +19 -2
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +4 -0
- package/build-module/post-featured-image/index.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/index.js +3 -1
- package/build-module/query/edit/inspector-controls/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-pagination-numbers/index.js +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/search/edit.js +3 -5
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/index.js +0 -4
- package/build-module/search/index.js.map +1 -1
- package/build-module/site-logo/edit.js +7 -6
- package/build-module/site-logo/edit.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/spacer/edit.native.js +2 -2
- package/build-module/spacer/edit.native.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/tag-cloud/edit.js +6 -10
- package/build-module/tag-cloud/edit.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/constants.js +9 -0
- package/build-module/utils/constants.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 +21 -62
- 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/button/editor-rtl.css +0 -37
- package/build-style/button/editor.css +0 -37
- package/build-style/button/style-rtl.css +6 -6
- package/build-style/button/style.css +6 -6
- package/build-style/editor-rtl.css +3 -55
- package/build-style/editor.css +3 -55
- package/build-style/navigation/editor-rtl.css +2 -4
- package/build-style/navigation/editor.css +2 -4
- package/build-style/navigation/style-rtl.css +14 -18
- package/build-style/navigation/style.css +14 -18
- package/build-style/search/style-rtl.css +26 -27
- package/build-style/search/style.css +26 -27
- 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 +60 -53
- package/build-style/style.css +60 -53
- package/build-style/table/editor-rtl.css +1 -14
- package/build-style/table/editor.css +1 -14
- package/package.json +32 -32
- package/src/audio/block.json +2 -2
- package/src/audio/edit.js +29 -92
- package/src/audio/edit.native.js +2 -1
- package/src/audio/test/__snapshots__/edit.native.js.snap +12 -0
- package/src/audio/test/edit.native.js +29 -0
- package/src/block/edit.js +218 -37
- 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/editor.scss +0 -43
- package/src/button/save.js +1 -1
- package/src/button/style.scss +6 -6
- package/src/buttons/test/__snapshots__/edit.native.js.snap +6 -0
- package/src/buttons/test/edit.native.js +49 -0
- 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/comments-title/block.json +1 -1
- package/src/cover/edit/inspector-controls.js +1 -1
- package/src/cover/edit.native.js +1 -0
- 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/embed/util.js +2 -2
- package/src/file/block.json +4 -4
- package/src/file/edit.js +18 -25
- 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 +8 -4
- package/src/gallery/edit.js +70 -98
- package/src/gallery/gallery.js +22 -36
- package/src/gallery/gallery.native.js +6 -2
- package/src/gallery/index.php +15 -0
- package/src/gallery/transforms.js +2 -55
- package/src/gallery/v1/gallery.native.js +2 -1
- package/src/group/block.json +5 -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/deprecated.js +8 -0
- package/src/image/edit.native.js +5 -3
- package/src/image/image.js +77 -127
- package/src/image/index.php +1 -6
- package/src/image/save.js +3 -1
- package/src/image/view.js +5 -2
- package/src/list/edit.js +27 -35
- package/src/list-item/block.json +10 -3
- package/src/list-item/edit.js +18 -2
- package/src/list-item/hooks/use-enter.js +63 -62
- package/src/list-item/hooks/use-enter.native.js +9 -5
- package/src/list-item/hooks/use-indent-list-item.js +43 -53
- package/src/list-item/hooks/use-merge.js +1 -1
- package/src/list-item/hooks/use-outdent-list-item.js +50 -69
- package/src/list-item/hooks/use-space.js +7 -4
- package/src/media-text/media-container.native.js +3 -1
- package/src/navigation/constants.js +2 -0
- package/src/navigation/edit/index.js +18 -3
- package/src/navigation/editor.scss +1 -1
- package/src/navigation/index.php +1 -1
- package/src/navigation/style.scss +18 -16
- package/src/navigation/view.js +29 -3
- 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 -4
- package/src/paragraph/edit.js +53 -40
- package/src/paragraph/test/__snapshots__/edit.native.js.snap +12 -0
- package/src/paragraph/test/edit.native.js +114 -0
- package/src/pattern/edit.js +35 -3
- package/src/pattern/index.php +16 -0
- package/src/pattern/recursion-detector.js +145 -0
- package/src/pattern/test/index.js +74 -0
- package/src/post-featured-image/block.json +4 -0
- package/src/post-featured-image/edit.js +32 -1
- package/src/post-featured-image/index.php +31 -0
- 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/index.js +2 -0
- package/src/query/edit/inspector-controls/taxonomy-controls.js +2 -0
- package/src/query-pagination-numbers/block.json +1 -1
- package/src/query-title/block.json +1 -3
- package/src/quote/block.json +3 -5
- package/src/quote/transforms.js +12 -11
- package/src/search/block.json +0 -4
- package/src/search/edit.js +2 -8
- package/src/search/index.php +3 -7
- package/src/search/style.scss +27 -29
- package/src/site-logo/edit.js +3 -4
- 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 +5 -1
- 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/spacer/edit.native.js +4 -2
- package/src/table/block.json +9 -10
- package/src/table/edit.js +3 -1
- package/src/table/editor.scss +1 -17
- package/src/table-of-contents/edit.js +1 -1
- package/src/table-of-contents/index.js +5 -1
- package/src/tag-cloud/edit.js +7 -7
- package/src/template-part/index.php +6 -0
- package/src/utils/caption.js +108 -0
- package/src/utils/constants.js +8 -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 +40 -100
- 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
|
@@ -7,11 +7,13 @@ import classnames from 'classnames';
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useRegistry, useSelect, useDispatch } from '@wordpress/data';
|
|
11
|
+
import { useRef, useMemo, useEffect } from '@wordpress/element';
|
|
12
|
+
import { useEntityRecord, store as coreStore } from '@wordpress/core-data';
|
|
13
|
+
import { Placeholder, Spinner, ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
12
14
|
import { __ } from '@wordpress/i18n';
|
|
13
|
-
import { useInnerBlocksProps, __experimentalRecursionProvider as RecursionProvider, __experimentalUseHasRecursion as useHasRecursion, InnerBlocks,
|
|
14
|
-
import {
|
|
15
|
+
import { useInnerBlocksProps, __experimentalRecursionProvider as RecursionProvider, __experimentalUseHasRecursion as useHasRecursion, InnerBlocks, useBlockProps, Warning, privateApis as blockEditorPrivateApis, store as blockEditorStore, BlockControls } from '@wordpress/block-editor';
|
|
16
|
+
import { parse, cloneBlock } 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 'core/paragraph' === block.name && !!block.attributes.metadata?.bindings && Object.values(block.attributes.metadata.bindings).some(binding => binding.source.name === 'pattern_attributes');
|
|
27
|
+
}
|
|
28
|
+
function getPartiallySyncedAttributes(block) {
|
|
29
|
+
return Object.entries(block.attributes.metadata.bindings).filter(([, binding]) => binding.source.name === '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,138 @@ 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
|
+
var _defaultValues$blockI;
|
|
70
|
+
(_defaultValues$blockI = defaultValues[blockId]) !== null && _defaultValues$blockI !== void 0 ? _defaultValues$blockI : defaultValues[blockId] = {};
|
|
71
|
+
defaultValues[blockId][attributeKey] = block.attributes[attributeKey];
|
|
72
|
+
if (overrides[blockId]) {
|
|
73
|
+
newAttributes[attributeKey] = overrides[blockId][attributeKey];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
...block,
|
|
78
|
+
attributes: newAttributes,
|
|
79
|
+
innerBlocks
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function getOverridesFromBlocks(blocks, defaultValues) {
|
|
84
|
+
/** @type {Record<string, Record<string, unknown>>} */
|
|
85
|
+
const overrides = {};
|
|
86
|
+
for (const block of blocks) {
|
|
87
|
+
Object.assign(overrides, getOverridesFromBlocks(block.innerBlocks, defaultValues));
|
|
88
|
+
const blockId = block.attributes.metadata?.id;
|
|
89
|
+
if (!isPartiallySynced(block) || !blockId) continue;
|
|
90
|
+
const attributes = getPartiallySyncedAttributes(block);
|
|
91
|
+
for (const attributeKey of attributes) {
|
|
92
|
+
if (block.attributes[attributeKey] !== defaultValues[blockId][attributeKey]) {
|
|
93
|
+
var _overrides$blockId;
|
|
94
|
+
(_overrides$blockId = overrides[blockId]) !== null && _overrides$blockId !== void 0 ? _overrides$blockId : overrides[blockId] = {};
|
|
95
|
+
overrides[blockId][attributeKey] = block.attributes[attributeKey];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return Object.keys(overrides).length > 0 ? overrides : undefined;
|
|
100
|
+
}
|
|
101
|
+
function setBlockEditMode(setEditMode, blocks, mode) {
|
|
102
|
+
blocks.forEach(block => {
|
|
103
|
+
const editMode = mode || (isPartiallySynced(block) ? 'contentOnly' : 'disabled');
|
|
104
|
+
setEditMode(block.clientId, editMode);
|
|
105
|
+
setBlockEditMode(setEditMode, block.innerBlocks, mode);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
48
108
|
export default function ReusableBlockEdit({
|
|
49
109
|
name,
|
|
50
110
|
attributes: {
|
|
51
|
-
ref
|
|
111
|
+
ref,
|
|
112
|
+
overrides
|
|
52
113
|
},
|
|
53
|
-
__unstableParentLayout: parentLayout
|
|
114
|
+
__unstableParentLayout: parentLayout,
|
|
115
|
+
clientId: patternClientId,
|
|
116
|
+
setAttributes
|
|
54
117
|
}) {
|
|
118
|
+
const registry = useRegistry();
|
|
55
119
|
const hasAlreadyRendered = useHasRecursion(ref);
|
|
56
120
|
const {
|
|
57
121
|
record,
|
|
122
|
+
editedRecord,
|
|
58
123
|
hasResolved
|
|
59
124
|
} = useEntityRecord('postType', 'wp_block', ref);
|
|
60
125
|
const isMissing = hasResolved && !record;
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
126
|
+
const initialOverrides = useRef(overrides);
|
|
127
|
+
const defaultValuesRef = useRef({});
|
|
128
|
+
const {
|
|
129
|
+
replaceInnerBlocks,
|
|
130
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
131
|
+
setBlockEditingMode
|
|
132
|
+
} = useDispatch(blockEditorStore);
|
|
133
|
+
const {
|
|
134
|
+
syncDerivedUpdates
|
|
135
|
+
} = unlock(useDispatch(blockEditorStore));
|
|
136
|
+
const {
|
|
137
|
+
innerBlocks,
|
|
138
|
+
userCanEdit,
|
|
139
|
+
getBlockEditingMode,
|
|
140
|
+
getPostLinkProps
|
|
141
|
+
} = useSelect(select => {
|
|
142
|
+
const {
|
|
143
|
+
canUser
|
|
144
|
+
} = select(coreStore);
|
|
145
|
+
const {
|
|
146
|
+
getBlocks,
|
|
147
|
+
getBlockEditingMode: editingMode,
|
|
148
|
+
getSettings
|
|
149
|
+
} = select(blockEditorStore);
|
|
150
|
+
const blocks = getBlocks(patternClientId);
|
|
151
|
+
const canEdit = canUser('update', 'blocks', ref);
|
|
152
|
+
|
|
153
|
+
// For editing link to the site editor if the theme and user permissions support it.
|
|
154
|
+
return {
|
|
155
|
+
innerBlocks: blocks,
|
|
156
|
+
userCanEdit: canEdit,
|
|
157
|
+
getBlockEditingMode: editingMode,
|
|
158
|
+
getPostLinkProps: getSettings().getPostLinkProps
|
|
159
|
+
};
|
|
160
|
+
}, [patternClientId, ref]);
|
|
161
|
+
const editOriginalProps = getPostLinkProps ? getPostLinkProps({
|
|
162
|
+
postId: ref,
|
|
163
|
+
postType: 'wp_block',
|
|
164
|
+
canvas: 'edit'
|
|
165
|
+
}) : {};
|
|
166
|
+
useEffect(() => setBlockEditMode(setBlockEditingMode, innerBlocks), [innerBlocks, setBlockEditingMode]);
|
|
167
|
+
|
|
168
|
+
// Apply the initial overrides from the pattern block to the inner blocks.
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
var _editedRecord$blocks$;
|
|
171
|
+
const initialBlocks = // Clone the blocks to generate new client IDs.
|
|
172
|
+
(_editedRecord$blocks$ = editedRecord.blocks?.map(block => cloneBlock(block))) !== null && _editedRecord$blocks$ !== void 0 ? _editedRecord$blocks$ : editedRecord.content && typeof editedRecord.content !== 'function' ? parse(editedRecord.content) : [];
|
|
173
|
+
defaultValuesRef.current = {};
|
|
174
|
+
const editingMode = getBlockEditingMode(patternClientId);
|
|
175
|
+
// Replace the contents of the blocks with the overrides.
|
|
176
|
+
registry.batch(() => {
|
|
177
|
+
setBlockEditingMode(patternClientId, 'default');
|
|
178
|
+
syncDerivedUpdates(() => {
|
|
179
|
+
replaceInnerBlocks(patternClientId, applyInitialOverrides(initialBlocks, initialOverrides.current, defaultValuesRef.current));
|
|
180
|
+
});
|
|
181
|
+
setBlockEditingMode(patternClientId, editingMode);
|
|
182
|
+
});
|
|
183
|
+
}, [__unstableMarkNextChangeAsNotPersistent, patternClientId, editedRecord, replaceInnerBlocks, registry, getBlockEditingMode, setBlockEditingMode, syncDerivedUpdates]);
|
|
65
184
|
const {
|
|
66
185
|
alignment,
|
|
67
186
|
layout
|
|
68
|
-
} = useInferredLayout(
|
|
187
|
+
} = useInferredLayout(innerBlocks, parentLayout);
|
|
69
188
|
const layoutClasses = useLayoutClasses({
|
|
70
189
|
layout
|
|
71
190
|
}, name);
|
|
@@ -75,12 +194,34 @@ export default function ReusableBlockEdit({
|
|
|
75
194
|
})
|
|
76
195
|
});
|
|
77
196
|
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
78
|
-
|
|
197
|
+
templateLock: 'all',
|
|
79
198
|
layout,
|
|
80
|
-
|
|
81
|
-
onChange,
|
|
82
|
-
renderAppender: blocks?.length ? undefined : InnerBlocks.ButtonBlockAppender
|
|
199
|
+
renderAppender: innerBlocks?.length ? undefined : InnerBlocks.ButtonBlockAppender
|
|
83
200
|
});
|
|
201
|
+
|
|
202
|
+
// Sync the `overrides` attribute from the updated blocks to the pattern block.
|
|
203
|
+
// `syncDerivedUpdates` is used here to avoid creating an additional undo level.
|
|
204
|
+
useEffect(() => {
|
|
205
|
+
const {
|
|
206
|
+
getBlocks
|
|
207
|
+
} = registry.select(blockEditorStore);
|
|
208
|
+
let prevBlocks = getBlocks(patternClientId);
|
|
209
|
+
return registry.subscribe(() => {
|
|
210
|
+
const blocks = getBlocks(patternClientId);
|
|
211
|
+
if (blocks !== prevBlocks) {
|
|
212
|
+
prevBlocks = blocks;
|
|
213
|
+
syncDerivedUpdates(() => {
|
|
214
|
+
setAttributes({
|
|
215
|
+
overrides: getOverridesFromBlocks(blocks, defaultValuesRef.current)
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}, blockEditorStore);
|
|
220
|
+
}, [syncDerivedUpdates, patternClientId, registry, setAttributes]);
|
|
221
|
+
const handleEditOriginal = event => {
|
|
222
|
+
setBlockEditMode(setBlockEditingMode, innerBlocks, 'default');
|
|
223
|
+
editOriginalProps.onClick(event);
|
|
224
|
+
};
|
|
84
225
|
let children = null;
|
|
85
226
|
if (hasAlreadyRendered) {
|
|
86
227
|
children = createElement(Warning, null, __('Block cannot be rendered inside itself.'));
|
|
@@ -93,13 +234,10 @@ export default function ReusableBlockEdit({
|
|
|
93
234
|
}
|
|
94
235
|
return createElement(RecursionProvider, {
|
|
95
236
|
uniqueId: ref
|
|
96
|
-
}, createElement(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
__nextHasNoMarginBottom: true,
|
|
101
|
-
__next40pxDefaultSize: true
|
|
102
|
-
}))), children === null ? createElement("div", {
|
|
237
|
+
}, userCanEdit && editOriginalProps && createElement(BlockControls, null, createElement(ToolbarGroup, null, createElement(ToolbarButton, {
|
|
238
|
+
href: editOriginalProps.href,
|
|
239
|
+
onClick: handleEditOriginal
|
|
240
|
+
}, __('Edit original')))), children === null ? createElement("div", {
|
|
103
241
|
...innerBlocksProps
|
|
104
242
|
}) : createElement("div", {
|
|
105
243
|
...blockProps
|
|
@@ -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,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,OAAO;;IAEnD;IACA;IACA,IAAKD,SAAS,KAAKE,SAAS,EAAG;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,CAAC;AAEtB"}
|
|
1
|
+
{"version":3,"names":["classnames","useRegistry","useSelect","useDispatch","useRef","useMemo","useEffect","useEntityRecord","store","coreStore","Placeholder","Spinner","ToolbarButton","ToolbarGroup","__","useInnerBlocksProps","__experimentalRecursionProvider","RecursionProvider","__experimentalUseHasRecursion","useHasRecursion","InnerBlocks","useBlockProps","Warning","privateApis","blockEditorPrivateApis","blockEditorStore","BlockControls","parse","cloneBlock","unlock","useLayoutClasses","isPartiallySynced","block","name","attributes","metadata","bindings","Object","values","some","binding","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","id","newAttributes","_defaultValues$blockI","getOverridesFromBlocks","assign","_overrides$blockId","keys","setBlockEditMode","setEditMode","mode","forEach","editMode","clientId","ReusableBlockEdit","ref","__unstableParentLayout","patternClientId","setAttributes","registry","hasAlreadyRendered","record","editedRecord","hasResolved","isMissing","initialOverrides","defaultValuesRef","replaceInnerBlocks","__unstableMarkNextChangeAsNotPersistent","setBlockEditingMode","syncDerivedUpdates","userCanEdit","getBlockEditingMode","getPostLinkProps","select","canUser","getBlocks","editingMode","getSettings","canEdit","editOriginalProps","postId","postType","canvas","_editedRecord$blocks$","initialBlocks","content","batch","layoutClasses","blockProps","className","innerBlocksProps","templateLock","renderAppender","ButtonBlockAppender","prevBlocks","subscribe","handleEditOriginal","event","onClick","children","createElement","uniqueId","href"],"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 { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport {\n\tPlaceholder,\n\tSpinner,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseInnerBlocksProps,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n\tInnerBlocks,\n\tuseBlockProps,\n\tWarning,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tBlockControls,\n} from '@wordpress/block-editor';\nimport { parse, cloneBlock } 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'core/paragraph' === block.name &&\n\t\t!! block.attributes.metadata?.bindings &&\n\t\tObject.values( block.attributes.metadata.bindings ).some(\n\t\t\t( binding ) => binding.source.name === 'pattern_attributes'\n\t\t)\n\t);\n}\nfunction getPartiallySyncedAttributes( block ) {\n\treturn Object.entries( block.attributes.metadata.bindings )\n\t\t.filter(\n\t\t\t( [ , binding ] ) => binding.source.name === '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 ] ??= {};\n\t\t\tdefaultValues[ blockId ][ attributeKey ] =\n\t\t\t\tblock.attributes[ attributeKey ];\n\t\t\tif ( overrides[ blockId ] ) {\n\t\t\t\tnewAttributes[ attributeKey ] =\n\t\t\t\t\toverrides[ blockId ][ attributeKey ];\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, 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 ] !==\n\t\t\t\tdefaultValues[ blockId ][ attributeKey ]\n\t\t\t) {\n\t\t\t\toverrides[ blockId ] ??= {};\n\t\t\t\toverrides[ blockId ][ attributeKey ] =\n\t\t\t\t\tblock.attributes[ attributeKey ];\n\t\t\t}\n\t\t}\n\t}\n\treturn Object.keys( overrides ).length > 0 ? overrides : undefined;\n}\n\nfunction setBlockEditMode( setEditMode, blocks, mode ) {\n\tblocks.forEach( ( block ) => {\n\t\tconst editMode =\n\t\t\tmode || ( isPartiallySynced( block ) ? 'contentOnly' : 'disabled' );\n\t\tsetEditMode( block.clientId, editMode );\n\t\tsetBlockEditMode( setEditMode, block.innerBlocks, mode );\n\t} );\n}\n\nexport default function ReusableBlockEdit( {\n\tname,\n\tattributes: { ref, overrides },\n\t__unstableParentLayout: parentLayout,\n\tclientId: patternClientId,\n\tsetAttributes,\n} ) {\n\tconst registry = useRegistry();\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\tconst { record, editedRecord, 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\n\tconst {\n\t\treplaceInnerBlocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetBlockEditingMode,\n\t} = useDispatch( blockEditorStore );\n\tconst { syncDerivedUpdates } = unlock( useDispatch( blockEditorStore ) );\n\n\tconst { innerBlocks, userCanEdit, getBlockEditingMode, getPostLinkProps } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { canUser } = select( coreStore );\n\t\t\t\tconst {\n\t\t\t\t\tgetBlocks,\n\t\t\t\t\tgetBlockEditingMode: editingMode,\n\t\t\t\t\tgetSettings,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\tconst blocks = getBlocks( patternClientId );\n\t\t\t\tconst canEdit = canUser( 'update', 'blocks', ref );\n\n\t\t\t\t// For editing link to the site editor if the theme and user permissions support it.\n\t\t\t\treturn {\n\t\t\t\t\tinnerBlocks: blocks,\n\t\t\t\t\tuserCanEdit: canEdit,\n\t\t\t\t\tgetBlockEditingMode: editingMode,\n\t\t\t\t\tgetPostLinkProps: getSettings().getPostLinkProps,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ patternClientId, ref ]\n\t\t);\n\n\tconst editOriginalProps = getPostLinkProps\n\t\t? getPostLinkProps( {\n\t\t\t\tpostId: ref,\n\t\t\t\tpostType: 'wp_block',\n\t\t\t\tcanvas: 'edit',\n\t\t } )\n\t\t: {};\n\n\tuseEffect(\n\t\t() => setBlockEditMode( setBlockEditingMode, innerBlocks ),\n\t\t[ innerBlocks, setBlockEditingMode ]\n\t);\n\n\t// Apply the initial overrides from the pattern block to the inner blocks.\n\tuseEffect( () => {\n\t\tconst initialBlocks =\n\t\t\t// Clone the blocks to generate new client IDs.\n\t\t\teditedRecord.blocks?.map( ( block ) => cloneBlock( block ) ) ??\n\t\t\t( editedRecord.content && typeof editedRecord.content !== 'function'\n\t\t\t\t? parse( editedRecord.content )\n\t\t\t\t: [] );\n\n\t\tdefaultValuesRef.current = {};\n\t\tconst editingMode = getBlockEditingMode( patternClientId );\n\t\t// Replace the contents of the blocks with the overrides.\n\t\tregistry.batch( () => {\n\t\t\tsetBlockEditingMode( patternClientId, 'default' );\n\t\t\tsyncDerivedUpdates( () => {\n\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\tpatternClientId,\n\t\t\t\t\tapplyInitialOverrides(\n\t\t\t\t\t\tinitialBlocks,\n\t\t\t\t\t\tinitialOverrides.current,\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\tsetBlockEditingMode( patternClientId, editingMode );\n\t\t} );\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tpatternClientId,\n\t\teditedRecord,\n\t\treplaceInnerBlocks,\n\t\tregistry,\n\t\tgetBlockEditingMode,\n\t\tsetBlockEditingMode,\n\t\tsyncDerivedUpdates,\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\ttemplateLock: 'all',\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 to the pattern block.\n\t// `syncDerivedUpdates` is used here to avoid creating an additional undo level.\n\tuseEffect( () => {\n\t\tconst { getBlocks } = registry.select( blockEditorStore );\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\tsyncDerivedUpdates( () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\toverrides: getOverridesFromBlocks(\n\t\t\t\t\t\t\tblocks,\n\t\t\t\t\t\t\tdefaultValuesRef.current\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}, blockEditorStore );\n\t}, [ syncDerivedUpdates, patternClientId, registry, setAttributes ] );\n\n\tconst handleEditOriginal = ( event ) => {\n\t\tsetBlockEditMode( setBlockEditingMode, innerBlocks, 'default' );\n\t\teditOriginalProps.onClick( event );\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{ userCanEdit && editOriginalProps && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\thref={ editOriginalProps.href }\n\t\t\t\t\t\t\tonClick={ handleEditOriginal }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Edit original' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\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,eAAe,EAAEC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAC1E,SACCC,WAAW,EACXC,OAAO,EACPC,aAAa,EACbC,YAAY,QACN,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,mBAAmB,EACnBC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe,EAChDC,WAAW,EACXC,aAAa,EACbC,OAAO,EACPC,WAAW,IAAIC,sBAAsB,EACrChB,KAAK,IAAIiB,gBAAgB,EACzBC,aAAa,QACP,yBAAyB;AAChC,SAASC,KAAK,EAAEC,UAAU,QAAQ,mBAAmB;;AAErD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,gBAAgB;AAEvC,MAAM;EAAEC;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B,IAAM;IAC/BJ,OAAO,EAAGF;EAAoB,GAE5B7G,EAAE,CAAE,eAAgB,CACR,CACF,CACA,CACf,EACCgH,QAAQ,KAAK,IAAI,GAClBC,aAAA;IAAA,GAAUV;EAAgB,CAAI,CAAC,GAE/BU,aAAA;IAAA,GAAUZ;EAAU,GAAKW,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,iBA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;IAChBa,QAAQ,GACPC,aAAA,CAAC9C,OAAO,QACLT,EAAE,CAAE,2CAA4C,CAC1C,CACT;EACF;EAEA,IAAK,CAAEwC,WAAW,EAAG;IACpBc,QAAQ,GACPC,aAAA,CAAC3D,WAAW,QACX2D,aAAA,CAAC1D,OAAO,MAAE,CACE,CACb;EACF;EAEA,OACC0D,aAAA,CAACpD,iBAAiB;IAACqD,QAAQ,EAAGpB;EAAK,GAClCmB,aAAA,CAAChD,iBAAiB,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"}
|
|
@@ -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;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,WAAW,QAAQ,oBAAoB;AAC1D,SACCC,oBAAoB,EACpBC,aAAa,EACbC,KAAK,IAAIC,SAAS,QACZ,sBAAsB;AAC7B,SACCC,WAAW,EACXC,IAAI,EACJC,QAAQ,EACRC,WAAW,QACL,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,+BAA+B,IAAIC,iBAAiB,EACpDC,6BAA6B,IAAIC,eAAe,EAChDC,WAAW,EACXC,OAAO,EACPf,KAAK,IAAIgB,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,4BAA4B,QAAQ,oBAAoB;AACjE,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASlB,KAAK,IAAImB,mBAAmB,QAAQ,4BAA4B;AACzE,SAASnB,KAAK,IAAIoB,WAAW,QAAQ,mBAAmB;AACxD,SAASpB,KAAK,IAAIqB,YAAY,QAAQ,oBAAoB;;A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AAChE,OAAO;MACP6E,OAAO,EAAGpF,EAAE,CAAE,yCAA0C;IAAG,CAC3D,CAAC;EAEJ;EAEA,IAAK4C,SAAS,EAAG;IAChB,OACC2B,aAAA,CAAChE,OAAO;MACP6E,OAAO,EAAGpF,EAAE,CAAE,2CAA4C;IAAG,CAC7D,CAAC;EAEJ;EAEA,IAAK,CAAE0C,WAAW,EAAG;IACpB,OACC6B,aAAA,CAACpF,IAAI;MAACwF,KAAK,EAAGpC;IAAc,GAC3BgC,aAAA,CAACxF,iBAAiB;MAACsG,SAAS;IAAA,CAAE,CACzB,CAAC;EAET;EAEA,IAAIC,OAAO,GACVf,aAAA,CAACjE,WAAW;IACXiF,KAAK,EAAG5B,MAAQ;IAChBE,QAAQ,EAAGA,QAAU;IACrBD,OAAO,EAAGA;EAAS,CACnB,CACD;EAED,IAAK,CAAEjB,SAAS,EAAG;IAClB2C,OAAO,GAAGf,aAAA,CAAC3E,QAAQ,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\tval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AS,CAC7C,CAAC;EACD,MAAMyB,WAAW,GAAG;IACnB,GAAGN,WAAW,CAACT,KAAK;IACpB,GAAGU,UAAU,CAACV,KAAK;IACnB,GAAGW,YAAY,CAACX;EACjB,CAAC;;EAED;EACA;EACA;;EAEA,MAAMgB,cAAc,GAAGnC,UAAU,CAAEY,SAAS,EAAE;IAC7C,CAAG,2CAA2CW,KAAO,EAAC,GAAIA,KAAK;IAC/D,CAAG,sBAAqB,GAAIP,QAAQ,IAAIG,KAAK,EAAEiB,UAAU,EAAEpB;EAC5D,CAAE,CAAC;EAEH,OACCqB,aAAA;IAAA,GAAUnC,aAAa,CAACQ,IAAI,CAAE;MAAEE,SAAS,EAAEuB;IAAe,CAAE;EAAC,GAC5DE,aAAA,CAACpC,QAAQ,CAACqC,OAAO;IAChBzB,OAAO,EAAGY,OAAS;IACnBX,IAAI,EAAGY,WAAW,GAAGC,UAAU,GAAG,IAAM;IACxCf,SAAS,EAAGmB,aAAe;IAC3BQ,IAAI,EAAGb,WAAW,GAAG,IAAI,GAAGJ,GAAK;IACjCD,KAAK,EAAGA,KAAO;IACfF,KAAK,EAAGe,WAAa;IACrBM,KAAK,EAAGpB,IAAM;IACdqB,MAAM,EAAGf,WAAW,GAAG,IAAI,GAAGT,UAAY;IAC1CC,GAAG,EAAGQ,WAAW,GAAG,IAAI,GAAGR;EAAK,CAChC,CACG,CAAC;AAER"}
|
|
@@ -7,7 +7,7 @@ import { View } from 'react-native';
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { RichText } from '@wordpress/block-editor';
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
13
13
|
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
@@ -20,42 +20,40 @@ import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
|
20
20
|
* Block code style
|
|
21
21
|
*/
|
|
22
22
|
import styles from './theme.scss';
|
|
23
|
-
|
|
24
|
-
// Note: styling is applied directly to the (nested) PlainText component. Web-side components
|
|
25
|
-
// apply it to the container 'div' but we don't have a proper proposal for cascading styling yet.
|
|
26
23
|
export function CodeEdit(props) {
|
|
27
24
|
const {
|
|
28
25
|
attributes,
|
|
29
26
|
setAttributes,
|
|
30
|
-
|
|
31
|
-
onBlur,
|
|
27
|
+
onRemove,
|
|
32
28
|
style,
|
|
33
29
|
insertBlocksAfter,
|
|
34
30
|
mergeBlocks
|
|
35
31
|
} = props;
|
|
36
32
|
const codeStyle = {
|
|
37
|
-
...usePreferredColorSchemeStyle(styles.blockCode, styles.blockCodeDark)
|
|
38
|
-
...(style?.fontSize && {
|
|
39
|
-
fontSize: style.fontSize
|
|
40
|
-
})
|
|
33
|
+
...usePreferredColorSchemeStyle(styles.blockCode, styles.blockCodeDark)
|
|
41
34
|
};
|
|
35
|
+
const textStyle = style?.fontSize ? {
|
|
36
|
+
fontSize: style.fontSize
|
|
37
|
+
} : {};
|
|
42
38
|
const placeholderStyle = usePreferredColorSchemeStyle(styles.placeholder, styles.placeholderDark);
|
|
43
|
-
return createElement(View,
|
|
39
|
+
return createElement(View, {
|
|
40
|
+
style: codeStyle
|
|
41
|
+
}, createElement(RichText, {
|
|
42
|
+
tagName: "pre",
|
|
44
43
|
value: attributes.content,
|
|
45
44
|
identifier: "content",
|
|
46
|
-
style:
|
|
47
|
-
multiline: true,
|
|
45
|
+
style: textStyle,
|
|
48
46
|
underlineColorAndroid: "transparent",
|
|
49
47
|
onChange: content => setAttributes({
|
|
50
48
|
content
|
|
51
49
|
}),
|
|
52
50
|
onMerge: mergeBlocks,
|
|
51
|
+
onRemove: onRemove,
|
|
53
52
|
placeholder: __('Write code…'),
|
|
54
53
|
"aria-label": __('Code'),
|
|
55
|
-
isSelected: props.isSelected,
|
|
56
|
-
onFocus: onFocus,
|
|
57
|
-
onBlur: onBlur,
|
|
58
54
|
placeholderTextColor: placeholderStyle.color,
|
|
55
|
+
preserveWhiteSpace: true,
|
|
56
|
+
__unstablePastePlainText: true,
|
|
59
57
|
__unstableOnSplitAtDoubleLineEnd: () => insertBlocksAfter(createBlock(getDefaultBlockName()))
|
|
60
58
|
}));
|
|
61
59
|
}
|