@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
|
@@ -9,7 +9,6 @@ import { addFilter } from '@wordpress/hooks';
|
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
11
|
import { LINK_DESTINATION_ATTACHMENT, LINK_DESTINATION_NONE, LINK_DESTINATION_MEDIA } from './constants';
|
|
12
|
-
import { LINK_DESTINATION_ATTACHMENT as DEPRECATED_LINK_DESTINATION_ATTACHMENT, LINK_DESTINATION_MEDIA as DEPRECATED_LINK_DESTINATION_MEDIA } from './v1/constants';
|
|
13
12
|
import { pickRelevantMediaFiles, isGalleryV2Enabled } from './shared';
|
|
14
13
|
const parseShortcodeIds = ids => {
|
|
15
14
|
if (!ids) {
|
|
@@ -145,76 +144,12 @@ const transforms = {
|
|
|
145
144
|
}, {
|
|
146
145
|
type: 'shortcode',
|
|
147
146
|
tag: 'gallery',
|
|
148
|
-
attributes: {
|
|
149
|
-
images: {
|
|
150
|
-
type: 'array',
|
|
151
|
-
shortcode: ({
|
|
152
|
-
named: {
|
|
153
|
-
ids
|
|
154
|
-
}
|
|
155
|
-
}) => {
|
|
156
|
-
if (!isGalleryV2Enabled()) {
|
|
157
|
-
return parseShortcodeIds(ids).map(id => ({
|
|
158
|
-
id: id.toString()
|
|
159
|
-
}));
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
ids: {
|
|
164
|
-
type: 'array',
|
|
165
|
-
shortcode: ({
|
|
166
|
-
named: {
|
|
167
|
-
ids
|
|
168
|
-
}
|
|
169
|
-
}) => {
|
|
170
|
-
if (!isGalleryV2Enabled()) {
|
|
171
|
-
return parseShortcodeIds(ids);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
columns: {
|
|
176
|
-
type: 'number',
|
|
177
|
-
shortcode: ({
|
|
178
|
-
named: {
|
|
179
|
-
columns = '3'
|
|
180
|
-
}
|
|
181
|
-
}) => {
|
|
182
|
-
return parseInt(columns, 10);
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
linkTo: {
|
|
186
|
-
type: 'string',
|
|
187
|
-
shortcode: ({
|
|
188
|
-
named: {
|
|
189
|
-
link
|
|
190
|
-
}
|
|
191
|
-
}) => {
|
|
192
|
-
if (!isGalleryV2Enabled()) {
|
|
193
|
-
switch (link) {
|
|
194
|
-
case 'post':
|
|
195
|
-
return DEPRECATED_LINK_DESTINATION_ATTACHMENT;
|
|
196
|
-
case 'file':
|
|
197
|
-
return DEPRECATED_LINK_DESTINATION_MEDIA;
|
|
198
|
-
default:
|
|
199
|
-
return DEPRECATED_LINK_DESTINATION_ATTACHMENT;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
switch (link) {
|
|
203
|
-
case 'post':
|
|
204
|
-
return LINK_DESTINATION_ATTACHMENT;
|
|
205
|
-
case 'file':
|
|
206
|
-
return LINK_DESTINATION_MEDIA;
|
|
207
|
-
default:
|
|
208
|
-
return LINK_DESTINATION_NONE;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
147
|
transform({
|
|
214
148
|
named: {
|
|
215
149
|
ids,
|
|
216
150
|
columns = 3,
|
|
217
|
-
link
|
|
151
|
+
link,
|
|
152
|
+
orderby
|
|
218
153
|
}
|
|
219
154
|
}) {
|
|
220
155
|
const imageIds = parseShortcodeIds(ids).map(id => parseInt(id, 10));
|
|
@@ -226,7 +161,8 @@ const transforms = {
|
|
|
226
161
|
}
|
|
227
162
|
const galleryBlock = createBlock('core/gallery', {
|
|
228
163
|
columns: parseInt(columns, 10),
|
|
229
|
-
linkTo
|
|
164
|
+
linkTo,
|
|
165
|
+
randomOrder: orderby === 'rand'
|
|
230
166
|
}, imageIds.map(imageId => createBlock('core/image', {
|
|
231
167
|
id: imageId
|
|
232
168
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createBlock","createBlobURL","addFilter","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_NONE","LINK_DESTINATION_MEDIA","DEPRECATED_LINK_DESTINATION_ATTACHMENT","DEPRECATED_LINK_DESTINATION_MEDIA","pickRelevantMediaFiles","isGalleryV2Enabled","parseShortcodeIds","ids","split","map","id","parseInt","updateThirdPartyTransformToGallery","block","name","attributes","images","length","innerBlocks","url","alt","sizeSlug","linkDestination","updateThirdPartyTransformFromGallery","toBlock","fromBlocks","from","Array","isArray","galleryBlock","find","transformedBlock","includes","transforms","type","isMultiBlock","blocks","transform","align","every","attribute","undefined","validImages","filter","image","width","height","caption","toString","tag","shortcode","named","columns","linkTo","link","imageIds","imageId","isMatch","priority","files","file","indexOf","to","title","href","rel","linkClass","imageSizeSlug","linkTarget","anchor","className","index"],"sources":["@wordpress/block-library/src/gallery/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { createBlobURL } from '@wordpress/blob';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_NONE,\n\tLINK_DESTINATION_MEDIA,\n} from './constants';\nimport {\n\tLINK_DESTINATION_ATTACHMENT as DEPRECATED_LINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_MEDIA as DEPRECATED_LINK_DESTINATION_MEDIA,\n} from './v1/constants';\nimport { pickRelevantMediaFiles, isGalleryV2Enabled } from './shared';\n\nconst parseShortcodeIds = ( ids ) => {\n\tif ( ! ids ) {\n\t\treturn [];\n\t}\n\n\treturn ids.split( ',' ).map( ( id ) => parseInt( id, 10 ) );\n};\n\n/**\n * Third party block plugins don't have an easy way to detect if the\n * innerBlocks version of the Gallery is running when they run a\n * 3rdPartyBlock -> GalleryBlock transform so this tranform filter\n * will handle this. Once the innerBlocks version is the default\n * in a core release, this could be deprecated and removed after\n * plugin authors have been given time to update transforms.\n *\n * @typedef {Object} Attributes\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n * @param {Block} block The transformed block.\n * @return {Block} The transformed block.\n */\nfunction updateThirdPartyTransformToGallery( block ) {\n\tif (\n\t\tisGalleryV2Enabled() &&\n\t\tblock.name === 'core/gallery' &&\n\t\tblock.attributes?.images.length > 0\n\t) {\n\t\tconst innerBlocks = block.attributes.images.map(\n\t\t\t( { url, id, alt } ) => {\n\t\t\t\treturn createBlock( 'core/image', {\n\t\t\t\t\turl,\n\t\t\t\t\tid: id ? parseInt( id, 10 ) : null,\n\t\t\t\t\talt,\n\t\t\t\t\tsizeSlug: block.attributes.sizeSlug,\n\t\t\t\t\tlinkDestination: block.attributes.linkDestination,\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\n\t\tdelete block.attributes.ids;\n\t\tdelete block.attributes.images;\n\t\tblock.innerBlocks = innerBlocks;\n\t}\n\n\treturn block;\n}\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/gallery/update-third-party-transform-to',\n\tupdateThirdPartyTransformToGallery\n);\n\n/**\n * Third party block plugins don't have an easy way to detect if the\n * innerBlocks version of the Gallery is running when they run a\n * GalleryBlock -> 3rdPartyBlock transform so this transform filter\n * will handle this. Once the innerBlocks version is the default\n * in a core release, this could be deprecated and removed after\n * plugin authors have been given time to update transforms.\n *\n * @typedef {Object} Attributes\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n * @param {Block} toBlock The block to transform to.\n * @param {Block[]} fromBlocks The blocks to transform from.\n * @return {Block} The transformed block.\n */\nfunction updateThirdPartyTransformFromGallery( toBlock, fromBlocks ) {\n\tconst from = Array.isArray( fromBlocks ) ? fromBlocks : [ fromBlocks ];\n\tconst galleryBlock = from.find(\n\t\t( transformedBlock ) =>\n\t\t\ttransformedBlock.name === 'core/gallery' &&\n\t\t\ttransformedBlock.innerBlocks.length > 0 &&\n\t\t\t! transformedBlock.attributes.images?.length > 0 &&\n\t\t\t! toBlock.name.includes( 'core/' )\n\t);\n\n\tif ( galleryBlock ) {\n\t\tconst images = galleryBlock.innerBlocks.map(\n\t\t\t( { attributes: { url, id, alt } } ) => ( {\n\t\t\t\turl,\n\t\t\t\tid: id ? parseInt( id, 10 ) : null,\n\t\t\t\talt,\n\t\t\t} )\n\t\t);\n\t\tconst ids = images.map( ( { id } ) => id );\n\t\tgalleryBlock.attributes.images = images;\n\t\tgalleryBlock.attributes.ids = ids;\n\t}\n\n\treturn toBlock;\n}\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/gallery/update-third-party-transform-from',\n\tupdateThirdPartyTransformFromGallery\n);\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\t// Init the align and size from the first item which may be either the placeholder or an image.\n\t\t\t\tlet { align, sizeSlug } = attributes[ 0 ];\n\t\t\t\t// Loop through all the images and check if they have the same align and size.\n\t\t\t\talign = attributes.every(\n\t\t\t\t\t( attribute ) => attribute.align === align\n\t\t\t\t)\n\t\t\t\t\t? align\n\t\t\t\t\t: undefined;\n\t\t\t\tsizeSlug = attributes.every(\n\t\t\t\t\t( attribute ) => attribute.sizeSlug === sizeSlug\n\t\t\t\t)\n\t\t\t\t\t? sizeSlug\n\t\t\t\t\t: undefined;\n\n\t\t\t\tconst validImages = attributes.filter( ( { url } ) => url );\n\n\t\t\t\tif ( isGalleryV2Enabled() ) {\n\t\t\t\t\tconst innerBlocks = validImages.map( ( image ) => {\n\t\t\t\t\t\t// Gallery images can't currently be resized so make sure height and width are undefined.\n\t\t\t\t\t\timage.width = undefined;\n\t\t\t\t\t\timage.height = undefined;\n\t\t\t\t\t\treturn createBlock( 'core/image', image );\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\t'core/gallery',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\tsizeSlug,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinnerBlocks\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn createBlock( 'core/gallery', {\n\t\t\t\t\timages: validImages.map(\n\t\t\t\t\t\t( { id, url, alt, caption } ) => ( {\n\t\t\t\t\t\t\tid: id.toString(),\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t} )\n\t\t\t\t\t),\n\t\t\t\t\tids: validImages.map( ( { id } ) => parseInt( id, 10 ) ),\n\t\t\t\t\talign,\n\t\t\t\t\tsizeSlug,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'shortcode',\n\t\t\ttag: 'gallery',\n\n\t\t\tattributes: {\n\t\t\t\timages: {\n\t\t\t\t\ttype: 'array',\n\t\t\t\t\tshortcode: ( { named: { ids } } ) => {\n\t\t\t\t\t\tif ( ! isGalleryV2Enabled() ) {\n\t\t\t\t\t\t\treturn parseShortcodeIds( ids ).map( ( id ) => ( {\n\t\t\t\t\t\t\t\tid: id.toString(),\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\tids: {\n\t\t\t\t\ttype: 'array',\n\t\t\t\t\tshortcode: ( { named: { ids } } ) => {\n\t\t\t\t\t\tif ( ! isGalleryV2Enabled() ) {\n\t\t\t\t\t\t\treturn parseShortcodeIds( ids );\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tcolumns: {\n\t\t\t\t\ttype: 'number',\n\t\t\t\t\tshortcode: ( { named: { columns = '3' } } ) => {\n\t\t\t\t\t\treturn parseInt( columns, 10 );\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tlinkTo: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tshortcode: ( { named: { link } } ) => {\n\t\t\t\t\t\tif ( ! isGalleryV2Enabled() ) {\n\t\t\t\t\t\t\tswitch ( link ) {\n\t\t\t\t\t\t\t\tcase 'post':\n\t\t\t\t\t\t\t\t\treturn DEPRECATED_LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t\t\t\t\tcase 'file':\n\t\t\t\t\t\t\t\t\treturn DEPRECATED_LINK_DESTINATION_MEDIA;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn DEPRECATED_LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tswitch ( link ) {\n\t\t\t\t\t\t\tcase 'post':\n\t\t\t\t\t\t\t\treturn LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t\t\t\tcase 'file':\n\t\t\t\t\t\t\t\treturn LINK_DESTINATION_MEDIA;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn LINK_DESTINATION_NONE;\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\ttransform( { named: { ids, columns = 3, link } } ) {\n\t\t\t\tconst imageIds = parseShortcodeIds( ids ).map( ( id ) =>\n\t\t\t\t\tparseInt( id, 10 )\n\t\t\t\t);\n\n\t\t\t\tlet linkTo = LINK_DESTINATION_NONE;\n\t\t\t\tif ( link === 'post' ) {\n\t\t\t\t\tlinkTo = LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t} else if ( link === 'file' ) {\n\t\t\t\t\tlinkTo = LINK_DESTINATION_MEDIA;\n\t\t\t\t}\n\n\t\t\t\tconst galleryBlock = createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns: parseInt( columns, 10 ),\n\t\t\t\t\t\tlinkTo,\n\t\t\t\t\t},\n\t\t\t\t\timageIds.map( ( imageId ) =>\n\t\t\t\t\t\tcreateBlock( 'core/image', { id: imageId } )\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\treturn galleryBlock;\n\t\t\t},\n\t\t\tisMatch( { named } ) {\n\t\t\t\treturn undefined !== named.ids;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t// When created by drag and dropping multiple files on an insertion point. Because multiple\n\t\t\t// files must not be transformed to a gallery when dropped within a gallery there is another transform\n\t\t\t// within the image block to handle that case. Therefore this transform has to have priority 1\n\t\t\t// set so that it overrrides the image block transformation when mulitple images are dropped outside\n\t\t\t// of a gallery block.\n\t\t\ttype: 'files',\n\t\t\tpriority: 1,\n\t\t\tisMatch( files ) {\n\t\t\t\treturn (\n\t\t\t\t\tfiles.length !== 1 &&\n\t\t\t\t\tfiles.every(\n\t\t\t\t\t\t( file ) => file.type.indexOf( 'image/' ) === 0\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform( files ) {\n\t\t\t\tif ( isGalleryV2Enabled() ) {\n\t\t\t\t\tconst innerBlocks = files.map( ( file ) =>\n\t\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\t\turl: createBlobURL( file ),\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\treturn createBlock( 'core/gallery', {}, innerBlocks );\n\t\t\t\t}\n\t\t\t\tconst block = createBlock( 'core/gallery', {\n\t\t\t\t\timages: files.map( ( file ) =>\n\t\t\t\t\t\tpickRelevantMediaFiles( {\n\t\t\t\t\t\t\turl: createBlobURL( file ),\n\t\t\t\t\t\t} )\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t\treturn block;\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( { align, images, ids, sizeSlug }, innerBlocks ) => {\n\t\t\t\tif ( isGalleryV2Enabled() ) {\n\t\t\t\t\tif ( innerBlocks.length > 0 ) {\n\t\t\t\t\t\treturn innerBlocks.map(\n\t\t\t\t\t\t\t( {\n\t\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\thref,\n\t\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\tsizeSlug: imageSizeSlug,\n\t\t\t\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\t\t\t\tlinkTarget,\n\t\t\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} ) =>\n\t\t\t\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\thref,\n\t\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\tsizeSlug: imageSizeSlug,\n\t\t\t\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\t\t\t\tlinkTarget,\n\t\t\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t\t\tclassName,\n\t\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\treturn createBlock( 'core/image', { align } );\n\t\t\t\t}\n\t\t\t\tif ( images.length > 0 ) {\n\t\t\t\t\treturn images.map( ( { url, alt, caption }, index ) =>\n\t\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\t\tid: ids[ index ],\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\tsizeSlug,\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn createBlock( 'core/image', { align } );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,SAAS,QAAQ,kBAAkB;;AAE5C;AACA;AACA;AACA,SACCC,2BAA2B,EAC3BC,qBAAqB,EACrBC,sBAAsB,QAChB,aAAa;AACpB,SACCF,2BAA2B,IAAIG,sCAAsC,EACrED,sBAAsB,IAAIE,iCAAiC,QACrD,gBAAgB;AACvB,SAASC,sBAAsB,EAAEC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MAAM;YACNC;UACD,CAAE,CACJ,CAAC;QACF;QACA,OAAO1E,WAAW,CAAE,YAAY,EAAE;UAAE0C;QAAM,CAAE,CAAC;MAC9C;MACA,IAAKtB,MAAM,CAACC,MAAM,GAAG,CAAC,EAAG;QACxB,OAAOD,MAAM,CAACP,GAAG,CAAE,CAAE;UAAEU,GAAG;UAAEC,GAAG;UAAE2B;QAAQ,CAAC,EAAEwB,KAAK,KAChD3E,WAAW,CAAE,YAAY,EAAE;UAC1Bc,EAAE,EAAEH,GAAG,CAAEgE,KAAK,CAAE;UAChBpD,GAAG;UACHC,GAAG;UACH2B,OAAO;UACPT,KAAK;UACLjB;QACD,CAAE,CACH,CAAC;MACF;MACA,OAAOzB,WAAW,CAAE,YAAY,EAAE;QAAE0C;MAAM,CAAE,CAAC;IAC9C;EACD,CAAC;AAEH,CAAC;AAED,eAAeL,UAAU"}
|
|
1
|
+
{"version":3,"names":["createBlock","createBlobURL","addFilter","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_NONE","LINK_DESTINATION_MEDIA","pickRelevantMediaFiles","isGalleryV2Enabled","parseShortcodeIds","ids","split","map","id","parseInt","updateThirdPartyTransformToGallery","block","name","attributes","images","length","innerBlocks","url","alt","sizeSlug","linkDestination","updateThirdPartyTransformFromGallery","toBlock","fromBlocks","from","Array","isArray","galleryBlock","find","transformedBlock","includes","transforms","type","isMultiBlock","blocks","transform","align","every","attribute","undefined","validImages","filter","image","width","height","caption","toString","tag","named","columns","link","orderby","imageIds","linkTo","randomOrder","imageId","isMatch","priority","files","file","indexOf","to","title","href","rel","linkClass","imageSizeSlug","linkTarget","anchor","className","index"],"sources":["@wordpress/block-library/src/gallery/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { createBlobURL } from '@wordpress/blob';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_NONE,\n\tLINK_DESTINATION_MEDIA,\n} from './constants';\nimport { pickRelevantMediaFiles, isGalleryV2Enabled } from './shared';\n\nconst parseShortcodeIds = ( ids ) => {\n\tif ( ! ids ) {\n\t\treturn [];\n\t}\n\n\treturn ids.split( ',' ).map( ( id ) => parseInt( id, 10 ) );\n};\n\n/**\n * Third party block plugins don't have an easy way to detect if the\n * innerBlocks version of the Gallery is running when they run a\n * 3rdPartyBlock -> GalleryBlock transform so this tranform filter\n * will handle this. Once the innerBlocks version is the default\n * in a core release, this could be deprecated and removed after\n * plugin authors have been given time to update transforms.\n *\n * @typedef {Object} Attributes\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n * @param {Block} block The transformed block.\n * @return {Block} The transformed block.\n */\nfunction updateThirdPartyTransformToGallery( block ) {\n\tif (\n\t\tisGalleryV2Enabled() &&\n\t\tblock.name === 'core/gallery' &&\n\t\tblock.attributes?.images.length > 0\n\t) {\n\t\tconst innerBlocks = block.attributes.images.map(\n\t\t\t( { url, id, alt } ) => {\n\t\t\t\treturn createBlock( 'core/image', {\n\t\t\t\t\turl,\n\t\t\t\t\tid: id ? parseInt( id, 10 ) : null,\n\t\t\t\t\talt,\n\t\t\t\t\tsizeSlug: block.attributes.sizeSlug,\n\t\t\t\t\tlinkDestination: block.attributes.linkDestination,\n\t\t\t\t} );\n\t\t\t}\n\t\t);\n\n\t\tdelete block.attributes.ids;\n\t\tdelete block.attributes.images;\n\t\tblock.innerBlocks = innerBlocks;\n\t}\n\n\treturn block;\n}\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/gallery/update-third-party-transform-to',\n\tupdateThirdPartyTransformToGallery\n);\n\n/**\n * Third party block plugins don't have an easy way to detect if the\n * innerBlocks version of the Gallery is running when they run a\n * GalleryBlock -> 3rdPartyBlock transform so this transform filter\n * will handle this. Once the innerBlocks version is the default\n * in a core release, this could be deprecated and removed after\n * plugin authors have been given time to update transforms.\n *\n * @typedef {Object} Attributes\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n * @param {Block} toBlock The block to transform to.\n * @param {Block[]} fromBlocks The blocks to transform from.\n * @return {Block} The transformed block.\n */\nfunction updateThirdPartyTransformFromGallery( toBlock, fromBlocks ) {\n\tconst from = Array.isArray( fromBlocks ) ? fromBlocks : [ fromBlocks ];\n\tconst galleryBlock = from.find(\n\t\t( transformedBlock ) =>\n\t\t\ttransformedBlock.name === 'core/gallery' &&\n\t\t\ttransformedBlock.innerBlocks.length > 0 &&\n\t\t\t! transformedBlock.attributes.images?.length > 0 &&\n\t\t\t! toBlock.name.includes( 'core/' )\n\t);\n\n\tif ( galleryBlock ) {\n\t\tconst images = galleryBlock.innerBlocks.map(\n\t\t\t( { attributes: { url, id, alt } } ) => ( {\n\t\t\t\turl,\n\t\t\t\tid: id ? parseInt( id, 10 ) : null,\n\t\t\t\talt,\n\t\t\t} )\n\t\t);\n\t\tconst ids = images.map( ( { id } ) => id );\n\t\tgalleryBlock.attributes.images = images;\n\t\tgalleryBlock.attributes.ids = ids;\n\t}\n\n\treturn toBlock;\n}\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/gallery/update-third-party-transform-from',\n\tupdateThirdPartyTransformFromGallery\n);\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( attributes ) => {\n\t\t\t\t// Init the align and size from the first item which may be either the placeholder or an image.\n\t\t\t\tlet { align, sizeSlug } = attributes[ 0 ];\n\t\t\t\t// Loop through all the images and check if they have the same align and size.\n\t\t\t\talign = attributes.every(\n\t\t\t\t\t( attribute ) => attribute.align === align\n\t\t\t\t)\n\t\t\t\t\t? align\n\t\t\t\t\t: undefined;\n\t\t\t\tsizeSlug = attributes.every(\n\t\t\t\t\t( attribute ) => attribute.sizeSlug === sizeSlug\n\t\t\t\t)\n\t\t\t\t\t? sizeSlug\n\t\t\t\t\t: undefined;\n\n\t\t\t\tconst validImages = attributes.filter( ( { url } ) => url );\n\n\t\t\t\tif ( isGalleryV2Enabled() ) {\n\t\t\t\t\tconst innerBlocks = validImages.map( ( image ) => {\n\t\t\t\t\t\t// Gallery images can't currently be resized so make sure height and width are undefined.\n\t\t\t\t\t\timage.width = undefined;\n\t\t\t\t\t\timage.height = undefined;\n\t\t\t\t\t\treturn createBlock( 'core/image', image );\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\t'core/gallery',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\tsizeSlug,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinnerBlocks\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn createBlock( 'core/gallery', {\n\t\t\t\t\timages: validImages.map(\n\t\t\t\t\t\t( { id, url, alt, caption } ) => ( {\n\t\t\t\t\t\t\tid: id.toString(),\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t} )\n\t\t\t\t\t),\n\t\t\t\t\tids: validImages.map( ( { id } ) => parseInt( id, 10 ) ),\n\t\t\t\t\talign,\n\t\t\t\t\tsizeSlug,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'shortcode',\n\t\t\ttag: 'gallery',\n\t\t\ttransform( { named: { ids, columns = 3, link, orderby } } ) {\n\t\t\t\tconst imageIds = parseShortcodeIds( ids ).map( ( id ) =>\n\t\t\t\t\tparseInt( id, 10 )\n\t\t\t\t);\n\n\t\t\t\tlet linkTo = LINK_DESTINATION_NONE;\n\t\t\t\tif ( link === 'post' ) {\n\t\t\t\t\tlinkTo = LINK_DESTINATION_ATTACHMENT;\n\t\t\t\t} else if ( link === 'file' ) {\n\t\t\t\t\tlinkTo = LINK_DESTINATION_MEDIA;\n\t\t\t\t}\n\n\t\t\t\tconst galleryBlock = createBlock(\n\t\t\t\t\t'core/gallery',\n\t\t\t\t\t{\n\t\t\t\t\t\tcolumns: parseInt( columns, 10 ),\n\t\t\t\t\t\tlinkTo,\n\t\t\t\t\t\trandomOrder: orderby === 'rand',\n\t\t\t\t\t},\n\t\t\t\t\timageIds.map( ( imageId ) =>\n\t\t\t\t\t\tcreateBlock( 'core/image', { id: imageId } )\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\treturn galleryBlock;\n\t\t\t},\n\t\t\tisMatch( { named } ) {\n\t\t\t\treturn undefined !== named.ids;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t// When created by drag and dropping multiple files on an insertion point. Because multiple\n\t\t\t// files must not be transformed to a gallery when dropped within a gallery there is another transform\n\t\t\t// within the image block to handle that case. Therefore this transform has to have priority 1\n\t\t\t// set so that it overrrides the image block transformation when mulitple images are dropped outside\n\t\t\t// of a gallery block.\n\t\t\ttype: 'files',\n\t\t\tpriority: 1,\n\t\t\tisMatch( files ) {\n\t\t\t\treturn (\n\t\t\t\t\tfiles.length !== 1 &&\n\t\t\t\t\tfiles.every(\n\t\t\t\t\t\t( file ) => file.type.indexOf( 'image/' ) === 0\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform( files ) {\n\t\t\t\tif ( isGalleryV2Enabled() ) {\n\t\t\t\t\tconst innerBlocks = files.map( ( file ) =>\n\t\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\t\turl: createBlobURL( file ),\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\treturn createBlock( 'core/gallery', {}, innerBlocks );\n\t\t\t\t}\n\t\t\t\tconst block = createBlock( 'core/gallery', {\n\t\t\t\t\timages: files.map( ( file ) =>\n\t\t\t\t\t\tpickRelevantMediaFiles( {\n\t\t\t\t\t\t\turl: createBlobURL( file ),\n\t\t\t\t\t\t} )\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t\treturn block;\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( { align, images, ids, sizeSlug }, innerBlocks ) => {\n\t\t\t\tif ( isGalleryV2Enabled() ) {\n\t\t\t\t\tif ( innerBlocks.length > 0 ) {\n\t\t\t\t\t\treturn innerBlocks.map(\n\t\t\t\t\t\t\t( {\n\t\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\thref,\n\t\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\tsizeSlug: imageSizeSlug,\n\t\t\t\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\t\t\t\tlinkTarget,\n\t\t\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} ) =>\n\t\t\t\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\thref,\n\t\t\t\t\t\t\t\t\trel,\n\t\t\t\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\tsizeSlug: imageSizeSlug,\n\t\t\t\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\t\t\t\tlinkTarget,\n\t\t\t\t\t\t\t\t\tanchor,\n\t\t\t\t\t\t\t\t\tclassName,\n\t\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\treturn createBlock( 'core/image', { align } );\n\t\t\t\t}\n\t\t\t\tif ( images.length > 0 ) {\n\t\t\t\t\treturn images.map( ( { url, alt, caption }, index ) =>\n\t\t\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\t\t\tid: ids[ index ],\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\talt,\n\t\t\t\t\t\t\tcaption,\n\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\tsizeSlug,\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn createBlock( 'core/image', { align } );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,SAAS,QAAQ,kBAAkB;;AAE5C;AACA;AACA;AACA,SACCC,2BAA2B,EAC3BC,qBAAqB,EACrBC,sBAAsB,QAChB,aAAa;AACpB,SAASC,sBAAsB,EAAEC,kBAAkB,QAAQ,UAAU;AAErE,MAAMC,iBAAiB,GAAKC,GAAG,IAAM;EACpC,IAAK,CAAEA,GAAG,EAAG;IACZ,OAAO,EAAE;EACV;EAEA,OAAOA,GAAG,CAACC,KAAK,CAAE,GAAI,CAAC,CAACC,GAAG,CAAIC,EAAE,IAAMC,QAAQ,CAAED,EAAE,EAAE,EAAG,CAAE,CAAC;AAC5D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,kCAAkCA,CAAEC,KAAK,EAAG;EACpD,IACCR,kBAAkB,CAAC,CAAC,IACpBQ,KAAK,CAACC,IAAI,KAAK,cAAc,IAC7BD,KAAK,CAACE,UAAU,EAAEC,MAAM,CAACC,MAAM,GAAG,CAAC,EAClC;IACD,MAAMC,WAAW,GAAGL,KAAK,CAACE,UAAU,CAACC,MAAM,CAACP,GAAG,CAC9C,CAAE;MAAEU,GAAG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 import Tiles from './tiles';
|
|
|
16
16
|
* WordPress dependencies
|
|
17
17
|
*/
|
|
18
18
|
import { __, sprintf } from '@wordpress/i18n';
|
|
19
|
-
import { BlockCaption, store as blockEditorStore } from '@wordpress/block-editor';
|
|
19
|
+
import { BlockCaption, RichText, store as blockEditorStore } from '@wordpress/block-editor';
|
|
20
20
|
import { useState, useEffect } from '@wordpress/element';
|
|
21
21
|
import { mediaUploadSync } from '@wordpress/react-native-bridge';
|
|
22
22
|
import { useSelect } from '@wordpress/data';
|
|
@@ -115,7 +115,7 @@ export const Gallery = props => {
|
|
|
115
115
|
clientId: clientId,
|
|
116
116
|
isSelected: isCaptionSelected,
|
|
117
117
|
accessible: true,
|
|
118
|
-
accessibilityLabelCreator: caption =>
|
|
118
|
+
accessibilityLabelCreator: caption => RichText.isEmpty(caption) ? /* translators: accessibility text. Empty gallery caption. */
|
|
119
119
|
'Gallery caption. Empty' : sprintf( /* translators: accessibility text. %s: gallery caption. */
|
|
120
120
|
__('Gallery caption. %s'), caption),
|
|
121
121
|
onFocus: focusGalleryCaption,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","GalleryImage","defaultColumnsNumberV1","styles","Tiles","__","sprintf","BlockCaption","store","blockEditorStore","useState","useEffect","mediaUploadSync","useSelect","alignmentHelpers","TILE_SPACING","MAX_DISPLAYED_COLUMNS","MAX_DISPLAYED_COLUMNS_NARROW","isFullWidth","Gallery","props","isCaptionSelected","setIsCaptionSelected","isRTL","select","getSettings","clientId","selectedImage","mediaPlaceholder","onBlur","onMoveBackward","onMoveForward","onRemoveImage","onSelectImage","onSetImageAttributes","onFocusGalleryCaption","attributes","isSelected","isNarrow","onFocus","insertBlocksAfter","align","columns","imageCrop","images","displayedColumns","Math","min","selectImage","index","focusGalleryCaption","createElement","style","flex","spacing","galleryTilesContainerSelected","undefined","map","img","ariaLabel","length","key","id","url","alt","parseInt","isCropped","isFirstItem","isLastItem","isBlockSelected","onRemove","onSelect","onSelectBlock","setAttributes","attrs","caption","fullWidth","accessible","accessibilityLabelCreator"],"sources":["@wordpress/block-library/src/gallery/v1/gallery.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * Internal dependencies\n */\nimport GalleryImage from './gallery-image';\nimport { defaultColumnsNumberV1 } from '../deprecated';\nimport styles from './gallery-styles.scss';\nimport Tiles from './tiles';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockCaption,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useState, useEffect } from '@wordpress/element';\nimport { mediaUploadSync } from '@wordpress/react-native-bridge';\nimport { useSelect } from '@wordpress/data';\nimport { alignmentHelpers } from '@wordpress/components';\n\nconst TILE_SPACING = 15;\n\n// we must limit displayed columns since readable content max-width is 580px\nconst MAX_DISPLAYED_COLUMNS = 4;\nconst MAX_DISPLAYED_COLUMNS_NARROW = 2;\n\nconst { isFullWidth } = alignmentHelpers;\n\nexport const Gallery = ( props ) => {\n\tconst [ isCaptionSelected, setIsCaptionSelected ] = useState( false );\n\tuseEffect( mediaUploadSync, [] );\n\n\tconst isRTL = useSelect( ( select ) => {\n\t\treturn !! select( blockEditorStore ).getSettings().isRTL;\n\t}, [] );\n\n\tconst {\n\t\tclientId,\n\t\tselectedImage,\n\t\tmediaPlaceholder,\n\t\tonBlur,\n\t\tonMoveBackward,\n\t\tonMoveForward,\n\t\tonRemoveImage,\n\t\tonSelectImage,\n\t\tonSetImageAttributes,\n\t\tonFocusGalleryCaption,\n\t\tattributes,\n\t\tisSelected,\n\t\tisNarrow,\n\t\tonFocus,\n\t\tinsertBlocksAfter,\n\t} = props;\n\n\tconst {\n\t\talign,\n\t\tcolumns = defaultColumnsNumberV1( attributes ),\n\t\timageCrop,\n\t\timages,\n\t} = attributes;\n\n\t// limit displayed columns when isNarrow is true (i.e. when viewport width is\n\t// less than \"small\", where small = 600)\n\tconst displayedColumns = isNarrow\n\t\t? Math.min( columns, MAX_DISPLAYED_COLUMNS_NARROW )\n\t\t: Math.min( columns, MAX_DISPLAYED_COLUMNS );\n\n\tconst selectImage = ( index ) => {\n\t\treturn () => {\n\t\t\tif ( isCaptionSelected ) {\n\t\t\t\tsetIsCaptionSelected( false );\n\t\t\t}\n\t\t\t// We need to fully invoke the curried function here.\n\t\t\tonSelectImage( index )();\n\t\t};\n\t};\n\n\tconst focusGalleryCaption = () => {\n\t\tif ( ! isCaptionSelected ) {\n\t\t\tsetIsCaptionSelected( true );\n\t\t}\n\t\tonFocusGalleryCaption();\n\t};\n\n\treturn (\n\t\t<View style={ { flex: 1 } }>\n\t\t\t<Tiles\n\t\t\t\tcolumns={ displayedColumns }\n\t\t\t\tspacing={ TILE_SPACING }\n\t\t\t\tstyle={\n\t\t\t\t\tisSelected\n\t\t\t\t\t\t? styles.galleryTilesContainerSelected\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ images.map( ( img, index ) => {\n\t\t\t\t\tconst ariaLabel = sprintf(\n\t\t\t\t\t\t/* translators: 1: the order number of the image. 2: the total number of images. */\n\t\t\t\t\t\t__( 'image %1$d of %2$d in gallery' ),\n\t\t\t\t\t\tindex + 1,\n\t\t\t\t\t\timages.length\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<GalleryImage\n\t\t\t\t\t\t\tkey={ img.id ? `${ img.id }-${ index }` : img.url }\n\t\t\t\t\t\t\turl={ img.url }\n\t\t\t\t\t\t\talt={ img.alt }\n\t\t\t\t\t\t\tid={ parseInt( img.id, 10 ) } // make id an integer explicitly\n\t\t\t\t\t\t\tisCropped={ imageCrop }\n\t\t\t\t\t\t\tisFirstItem={ index === 0 }\n\t\t\t\t\t\t\tisLastItem={ index + 1 === images.length }\n\t\t\t\t\t\t\tisSelected={ isSelected && selectedImage === index }\n\t\t\t\t\t\t\tisBlockSelected={ isSelected }\n\t\t\t\t\t\t\tonMoveBackward={ onMoveBackward( index ) }\n\t\t\t\t\t\t\tonMoveForward={ onMoveForward( index ) }\n\t\t\t\t\t\t\tonRemove={ onRemoveImage( index ) }\n\t\t\t\t\t\t\tonSelect={ selectImage( index ) }\n\t\t\t\t\t\t\tonSelectBlock={ onFocus }\n\t\t\t\t\t\t\tsetAttributes={ ( attrs ) =>\n\t\t\t\t\t\t\t\tonSetImageAttributes( index, attrs )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcaption={ img.caption }\n\t\t\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t\t\t\tisRTL={ isRTL }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</Tiles>\n\t\t\t<View style={ isFullWidth( align ) && styles.fullWidth }>\n\t\t\t\t{ mediaPlaceholder }\n\t\t\t</View>\n\t\t\t<BlockCaption\n\t\t\t\tclientId={ clientId }\n\t\t\t\tisSelected={ isCaptionSelected }\n\t\t\t\taccessible={ true }\n\t\t\t\taccessibilityLabelCreator={ ( caption ) =>\n\t\t\t\t\
|
|
1
|
+
{"version":3,"names":["View","GalleryImage","defaultColumnsNumberV1","styles","Tiles","__","sprintf","BlockCaption","RichText","store","blockEditorStore","useState","useEffect","mediaUploadSync","useSelect","alignmentHelpers","TILE_SPACING","MAX_DISPLAYED_COLUMNS","MAX_DISPLAYED_COLUMNS_NARROW","isFullWidth","Gallery","props","isCaptionSelected","setIsCaptionSelected","isRTL","select","getSettings","clientId","selectedImage","mediaPlaceholder","onBlur","onMoveBackward","onMoveForward","onRemoveImage","onSelectImage","onSetImageAttributes","onFocusGalleryCaption","attributes","isSelected","isNarrow","onFocus","insertBlocksAfter","align","columns","imageCrop","images","displayedColumns","Math","min","selectImage","index","focusGalleryCaption","createElement","style","flex","spacing","galleryTilesContainerSelected","undefined","map","img","ariaLabel","length","key","id","url","alt","parseInt","isCropped","isFirstItem","isLastItem","isBlockSelected","onRemove","onSelect","onSelectBlock","setAttributes","attrs","caption","fullWidth","accessible","accessibilityLabelCreator","isEmpty"],"sources":["@wordpress/block-library/src/gallery/v1/gallery.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * Internal dependencies\n */\nimport GalleryImage from './gallery-image';\nimport { defaultColumnsNumberV1 } from '../deprecated';\nimport styles from './gallery-styles.scss';\nimport Tiles from './tiles';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tBlockCaption,\n\tRichText,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useState, useEffect } from '@wordpress/element';\nimport { mediaUploadSync } from '@wordpress/react-native-bridge';\nimport { useSelect } from '@wordpress/data';\nimport { alignmentHelpers } from '@wordpress/components';\n\nconst TILE_SPACING = 15;\n\n// we must limit displayed columns since readable content max-width is 580px\nconst MAX_DISPLAYED_COLUMNS = 4;\nconst MAX_DISPLAYED_COLUMNS_NARROW = 2;\n\nconst { isFullWidth } = alignmentHelpers;\n\nexport const Gallery = ( props ) => {\n\tconst [ isCaptionSelected, setIsCaptionSelected ] = useState( false );\n\tuseEffect( mediaUploadSync, [] );\n\n\tconst isRTL = useSelect( ( select ) => {\n\t\treturn !! select( blockEditorStore ).getSettings().isRTL;\n\t}, [] );\n\n\tconst {\n\t\tclientId,\n\t\tselectedImage,\n\t\tmediaPlaceholder,\n\t\tonBlur,\n\t\tonMoveBackward,\n\t\tonMoveForward,\n\t\tonRemoveImage,\n\t\tonSelectImage,\n\t\tonSetImageAttributes,\n\t\tonFocusGalleryCaption,\n\t\tattributes,\n\t\tisSelected,\n\t\tisNarrow,\n\t\tonFocus,\n\t\tinsertBlocksAfter,\n\t} = props;\n\n\tconst {\n\t\talign,\n\t\tcolumns = defaultColumnsNumberV1( attributes ),\n\t\timageCrop,\n\t\timages,\n\t} = attributes;\n\n\t// limit displayed columns when isNarrow is true (i.e. when viewport width is\n\t// less than \"small\", where small = 600)\n\tconst displayedColumns = isNarrow\n\t\t? Math.min( columns, MAX_DISPLAYED_COLUMNS_NARROW )\n\t\t: Math.min( columns, MAX_DISPLAYED_COLUMNS );\n\n\tconst selectImage = ( index ) => {\n\t\treturn () => {\n\t\t\tif ( isCaptionSelected ) {\n\t\t\t\tsetIsCaptionSelected( false );\n\t\t\t}\n\t\t\t// We need to fully invoke the curried function here.\n\t\t\tonSelectImage( index )();\n\t\t};\n\t};\n\n\tconst focusGalleryCaption = () => {\n\t\tif ( ! isCaptionSelected ) {\n\t\t\tsetIsCaptionSelected( true );\n\t\t}\n\t\tonFocusGalleryCaption();\n\t};\n\n\treturn (\n\t\t<View style={ { flex: 1 } }>\n\t\t\t<Tiles\n\t\t\t\tcolumns={ displayedColumns }\n\t\t\t\tspacing={ TILE_SPACING }\n\t\t\t\tstyle={\n\t\t\t\t\tisSelected\n\t\t\t\t\t\t? styles.galleryTilesContainerSelected\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ images.map( ( img, index ) => {\n\t\t\t\t\tconst ariaLabel = sprintf(\n\t\t\t\t\t\t/* translators: 1: the order number of the image. 2: the total number of images. */\n\t\t\t\t\t\t__( 'image %1$d of %2$d in gallery' ),\n\t\t\t\t\t\tindex + 1,\n\t\t\t\t\t\timages.length\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<GalleryImage\n\t\t\t\t\t\t\tkey={ img.id ? `${ img.id }-${ index }` : img.url }\n\t\t\t\t\t\t\turl={ img.url }\n\t\t\t\t\t\t\talt={ img.alt }\n\t\t\t\t\t\t\tid={ parseInt( img.id, 10 ) } // make id an integer explicitly\n\t\t\t\t\t\t\tisCropped={ imageCrop }\n\t\t\t\t\t\t\tisFirstItem={ index === 0 }\n\t\t\t\t\t\t\tisLastItem={ index + 1 === images.length }\n\t\t\t\t\t\t\tisSelected={ isSelected && selectedImage === index }\n\t\t\t\t\t\t\tisBlockSelected={ isSelected }\n\t\t\t\t\t\t\tonMoveBackward={ onMoveBackward( index ) }\n\t\t\t\t\t\t\tonMoveForward={ onMoveForward( index ) }\n\t\t\t\t\t\t\tonRemove={ onRemoveImage( index ) }\n\t\t\t\t\t\t\tonSelect={ selectImage( index ) }\n\t\t\t\t\t\t\tonSelectBlock={ onFocus }\n\t\t\t\t\t\t\tsetAttributes={ ( attrs ) =>\n\t\t\t\t\t\t\t\tonSetImageAttributes( index, attrs )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcaption={ img.caption }\n\t\t\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t\t\t\tisRTL={ isRTL }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</Tiles>\n\t\t\t<View style={ isFullWidth( align ) && styles.fullWidth }>\n\t\t\t\t{ mediaPlaceholder }\n\t\t\t</View>\n\t\t\t<BlockCaption\n\t\t\t\tclientId={ clientId }\n\t\t\t\tisSelected={ isCaptionSelected }\n\t\t\t\taccessible={ true }\n\t\t\t\taccessibilityLabelCreator={ ( caption ) =>\n\t\t\t\t\tRichText.isEmpty( caption )\n\t\t\t\t\t\t? /* translators: accessibility text. Empty gallery caption. */\n\t\t\t\t\t\t 'Gallery caption. Empty'\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: accessibility text. %s: gallery caption. */\n\t\t\t\t\t\t\t\t__( 'Gallery caption. %s' ),\n\t\t\t\t\t\t\t\tcaption\n\t\t\t\t\t\t )\n\t\t\t\t}\n\t\t\t\tonFocus={ focusGalleryCaption }\n\t\t\t\tonBlur={ onBlur } // Always assign onBlur as props.\n\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t/>\n\t\t</View>\n\t);\n};\n\nexport default Gallery;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,cAAc;;AAEnC;AACA;AACA;AACA,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,SAASC,sBAAsB,QAAQ,eAAe;AACtD,OAAOC,MAAM,MAAM,uBAAuB;AAC1C,OA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ect } from '@wordpress/data';
|
|
6
6
|
import { InnerBlocks, useBlockProps, InspectorControls, useInnerBlocksProps, store as blockEditorStore } from '@wordpress/block-editor';
|
|
7
7
|
import { SelectControl } from '@wordpress/components';
|
|
8
|
+
import { useRef } from '@wordpress/element';
|
|
8
9
|
import { __ } from '@wordpress/i18n';
|
|
9
10
|
import { View } from '@wordpress/primitives';
|
|
10
11
|
|
|
@@ -101,7 +102,10 @@ function GroupEdit({
|
|
|
101
102
|
const layoutSupportEnabled = themeSupportsLayout || type === 'flex' || type === 'grid';
|
|
102
103
|
|
|
103
104
|
// Hooks.
|
|
104
|
-
const
|
|
105
|
+
const ref = useRef();
|
|
106
|
+
const blockProps = useBlockProps({
|
|
107
|
+
ref
|
|
108
|
+
});
|
|
105
109
|
const [showPlaceholder, setShowPlaceholder] = useShouldShowPlaceHolder({
|
|
106
110
|
attributes,
|
|
107
111
|
usedLayoutType: type,
|
|
@@ -124,6 +128,7 @@ function GroupEdit({
|
|
|
124
128
|
const innerBlocksProps = useInnerBlocksProps(layoutSupportEnabled ? blockProps : {
|
|
125
129
|
className: 'wp-block-group__inner-container'
|
|
126
130
|
}, {
|
|
131
|
+
dropZoneElement: ref.current,
|
|
127
132
|
templateLock,
|
|
128
133
|
allowedBlocks,
|
|
129
134
|
renderAppender
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useSelect","InnerBlocks","useBlockProps","InspectorControls","useInnerBlocksProps","store","blockEditorStore","SelectControl","__","View","GroupPlaceHolder","useShouldShowPlaceHolder","GroupEditControls","tagName","onSelectTagName","htmlElementMessages","header","main","section","article","aside","footer","createElement","group","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help","GroupEdit","attributes","name","setAttributes","clientId","hasInnerBlocks","themeSupportsLayout","select","getBlock","getSettings","block","innerBlocks","length","supportsLayout","TagName","templateLock","allowedBlocks","layout","type","layoutSupportEnabled","blockProps","showPlaceholder","setShowPlaceholder","usedLayoutType","renderAppender","ButtonBlockAppender","innerBlocksProps","className","selectBlock","selectVariation","nextVariation","Fragment","children","onSelect"],"sources":["@wordpress/block-library/src/group/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';\n\n/**\n * Render inspector controls for the Group block.\n *\n * @param {Object} props Component props.\n * @param {string} props.tagName The HTML tag name.\n * @param {Function} props.onSelectTagName onChange function for the SelectControl.\n *\n * @return {JSX.Element} The control group.\n */\nfunction GroupEditControls( { tagName, onSelectTagName } ) {\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only. '\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName }\n\t\t\t\tonChange={ onSelectTagName }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nfunction GroupEdit( { attributes, name, setAttributes, clientId } ) {\n\tconst { hasInnerBlocks, themeSupportsLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getSettings } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t\tthemeSupportsLayout: getSettings()?.supportsLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\ttagName: TagName = 'div',\n\t\ttemplateLock,\n\t\tallowedBlocks,\n\t\tlayout = {},\n\t} = attributes;\n\n\t// Layout settings.\n\tconst { type = 'default' } = layout;\n\tconst layoutSupportEnabled =\n\t\tthemeSupportsLayout || type === 'flex' || type === 'grid';\n\n\t// Hooks.\n\tconst blockProps = useBlockProps();\n\n\tconst [ showPlaceholder, setShowPlaceholder ] = useShouldShowPlaceHolder( {\n\t\tattributes,\n\t\tusedLayoutType: type,\n\t\thasInnerBlocks,\n\t} );\n\n\t// Default to the regular appender being rendered.\n\tlet renderAppender;\n\tif ( showPlaceholder ) {\n\t\t// In the placeholder state, ensure the appender is not rendered.\n\t\t// This is needed because `...innerBlocksProps` is used in the placeholder\n\t\t// state so that blocks can dragged onto the placeholder area\n\t\t// from both the list view and in the editor canvas.\n\t\trenderAppender = false;\n\t} else if ( ! hasInnerBlocks ) {\n\t\t// When there is no placeholder, but the block is also empty,\n\t\t// use the larger button appender.\n\t\trenderAppender = InnerBlocks.ButtonBlockAppender;\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\tlayoutSupportEnabled\n\t\t\t? blockProps\n\t\t\t: { className: 'wp-block-group__inner-container' },\n\t\t{\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender,\n\t\t}\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst selectVariation = ( nextVariation ) => {\n\t\tsetAttributes( nextVariation.attributes );\n\t\tselectBlock( clientId, -1 );\n\t\tsetShowPlaceholder( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GroupEditControls\n\t\t\t\ttagName={ TagName }\n\t\t\t\tonSelectTagName={ ( value ) =>\n\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ showPlaceholder && (\n\t\t\t\t<View>\n\t\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t\t<GroupPlaceHolder\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tonSelect={ selectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...innerBlocksProps } />\n\t\t\t) }\n\t\t\t{ /* Ideally this is not needed but it's there for backward compatibility reason\n\t\t\t\tto keep this div for themes that might rely on its presence */ }\n\t\t\t{ ! layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default GroupEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,WAAW,EACXC,aAAa,EACbC,iBAAiB,EACjBC,mBAAmB,EACnBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SA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AAc,GAAGtD,WAAW,CAACuD,mBAAmB;EACjD;EAEA,MAAMC,gBAAgB,GAAGrD,mBAAmB,CAC3C8C,oBAAoB,GACjBC,UAAU,GACV;IAAEO,SAAS,EAAE;EAAkC,CAAC,EACnD;IACCZ,YAAY;IACZC,aAAa;IACbQ;EACD,CACD,CAAC;EAED,MAAM;IAAEI;EAAY,CAAC,GAAG5D,WAAW,CAAEO,gBAAiB,CAAC;EAEvD,MAAMsD,eAAe,GAAKC,aAAa,IAAM;IAC5C3B,aAAa,CAAE2B,aAAa,CAAC7B,UAAW,CAAC;IACzC2B,WAAW,CAAExB,QAAQ,EAAE,CAAC,CAAE,CAAC;IAC3BkB,kBAAkB,CAAE,KAAM,CAAC;EAC5B,CAAC;EAED,OACC/B,aAAA,CAAAwC,QAAA,QACCxC,aAAA,CAACV,iBAAiB;IACjBC,OAAO,EAAGgC,OAAS;IACnB/B,eAAe,EAAKc,KAAK,IACxBM,aAAa,CAAE;MAAErB,OAAO,EAAEe;IAAM,CAAE;EAClC,CACD,CAAC,EACAwB,eAAe,IAChB9B,aAAA,CAACb,IAAI,QACFgD,gBAAgB,CAACM,QAAQ,EAC3BzC,aAAA,CAACZ,gBAAgB;IAChBuB,IAAI,EAAGA,IAAM;IACb+B,QAAQ,EAAGJ;EAAiB,CAC5B,CACI,CACN,EACCV,oBAAoB,IAAI,CAAEE,eAAe,IAC1C9B,aAAA,CAACuB,OAAO;IAAA,GAAMY;EAAgB,CAAI,CAClC,EAGC,CAAEP,oBAAoB,IAAI,CAAEE,eAAe,IAC5C9B,aAAA,CAACuB,OAAO;IAAA,GAAMM;EAAU,GACvB7B,aAAA;IAAA,GAAUmC;EAAgB,CAAI,CACtB,CAET,CAAC;AAEL;AAEA,eAAe1B,SAAS"}
|
|
1
|
+
{"version":3,"names":["useDispatch","useSelect","InnerBlocks","useBlockProps","InspectorControls","useInnerBlocksProps","store","blockEditorStore","SelectControl","useRef","__","View","GroupPlaceHolder","useShouldShowPlaceHolder","GroupEditControls","tagName","onSelectTagName","htmlElementMessages","header","main","section","article","aside","footer","createElement","group","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help","GroupEdit","attributes","name","setAttributes","clientId","hasInnerBlocks","themeSupportsLayout","select","getBlock","getSettings","block","innerBlocks","length","supportsLayout","TagName","templateLock","allowedBlocks","layout","type","layoutSupportEnabled","ref","blockProps","showPlaceholder","setShowPlaceholder","usedLayoutType","renderAppender","ButtonBlockAppender","innerBlocksProps","className","dropZoneElement","current","selectBlock","selectVariation","nextVariation","Fragment","children","onSelect"],"sources":["@wordpress/block-library/src/group/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';\n\n/**\n * Render inspector controls for the Group block.\n *\n * @param {Object} props Component props.\n * @param {string} props.tagName The HTML tag name.\n * @param {Function} props.onSelectTagName onChange function for the SelectControl.\n *\n * @return {JSX.Element} The control group.\n */\nfunction GroupEditControls( { tagName, onSelectTagName } ) {\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only. '\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName }\n\t\t\t\tonChange={ onSelectTagName }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nfunction GroupEdit( { attributes, name, setAttributes, clientId } ) {\n\tconst { hasInnerBlocks, themeSupportsLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getSettings } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t\tthemeSupportsLayout: getSettings()?.supportsLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\ttagName: TagName = 'div',\n\t\ttemplateLock,\n\t\tallowedBlocks,\n\t\tlayout = {},\n\t} = attributes;\n\n\t// Layout settings.\n\tconst { type = 'default' } = layout;\n\tconst layoutSupportEnabled =\n\t\tthemeSupportsLayout || type === 'flex' || type === 'grid';\n\n\t// Hooks.\n\tconst ref = useRef();\n\tconst blockProps = useBlockProps( { ref } );\n\n\tconst [ showPlaceholder, setShowPlaceholder ] = useShouldShowPlaceHolder( {\n\t\tattributes,\n\t\tusedLayoutType: type,\n\t\thasInnerBlocks,\n\t} );\n\n\t// Default to the regular appender being rendered.\n\tlet renderAppender;\n\tif ( showPlaceholder ) {\n\t\t// In the placeholder state, ensure the appender is not rendered.\n\t\t// This is needed because `...innerBlocksProps` is used in the placeholder\n\t\t// state so that blocks can dragged onto the placeholder area\n\t\t// from both the list view and in the editor canvas.\n\t\trenderAppender = false;\n\t} else if ( ! hasInnerBlocks ) {\n\t\t// When there is no placeholder, but the block is also empty,\n\t\t// use the larger button appender.\n\t\trenderAppender = InnerBlocks.ButtonBlockAppender;\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\tlayoutSupportEnabled\n\t\t\t? blockProps\n\t\t\t: { className: 'wp-block-group__inner-container' },\n\t\t{\n\t\t\tdropZoneElement: ref.current,\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender,\n\t\t}\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst selectVariation = ( nextVariation ) => {\n\t\tsetAttributes( nextVariation.attributes );\n\t\tselectBlock( clientId, -1 );\n\t\tsetShowPlaceholder( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GroupEditControls\n\t\t\t\ttagName={ TagName }\n\t\t\t\tonSelectTagName={ ( value ) =>\n\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ showPlaceholder && (\n\t\t\t\t<View>\n\t\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t\t<GroupPlaceHolder\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tonSelect={ selectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...innerBlocksProps } />\n\t\t\t) }\n\t\t\t{ /* Ideally this is not needed but it's there for backward compatibility reason\n\t\t\t\tto keep this div for themes that might rely on its presence */ }\n\t\t\t{ ! layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default GroupEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,WAAW,EACXC,aAAa,EACbC,iBAAiB,EACjBC,mBAAmB,EACnBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,QAAQ,uBAAuB;;AAE5C;AACA;AACA;AACA,OAAOC,gBAAgB,IAAIC,wBAAwB,QAAQ,eAAe;;AAE1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAAE;EAAEC,OAAO;EAAEC;AAAgB,CAAC,EAAG;EAC1D,MAAMC,mBAAmB,GAAG;IAC3BC,MAAM,EAAER,EAAE,CACT,qHACD,CAAC;IACDS,IAAI,EAAET,EAAE,CACP,mFACD,CAAC;IACDU,OAAO,EAAEV,EAAE,CACV,kIACD,CAAC;IACDW,OAAO,EAAEX,EAAE,CACV,gGACD,CAAC;IACDY,KAAK,EAAEZ,EAAE,CACR,uIACD,CAAC;IACDa,MAAM,EAAEb,EAAE,CACT,8HACD;EACD,CAAC;EACD,OACCc,aAAA,CAACpB,iBAAiB;IAACqB,KAAK,EAAC;EAAU,GAClCD,aAAA,CAAChB,aAAa;IACbkB,uBAAuB;IACvBC,qBAAqB;IACrBC,KAAK,EAAGlB,EAAE,CAAE,cAAe,CAAG;IAC9BmB,OAAO,EAAG,CACT;MAAED,KAAK,EAAElB,EAAE,CAAE,iBAAkB,CAAC;MAAEoB,KAAK,EAAE;IAAM,CAAC,EAChD;MAAEF,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ACZ,gBAAgB;IAChBuB,IAAI,EAAGA,IAAM;IACbkC,QAAQ,EAAGJ;EAAiB,CAC5B,CACI,CACN,EACCb,oBAAoB,IAAI,CAAEG,eAAe,IAC1C/B,aAAA,CAACuB,OAAO;IAAA,GAAMa;EAAgB,CAAI,CAClC,EAGC,CAAER,oBAAoB,IAAI,CAAEG,eAAe,IAC5C/B,aAAA,CAACuB,OAAO;IAAA,GAAMO;EAAU,GACvB9B,aAAA;IAAA,GAAUoC;EAAgB,CAAI,CACtB,CAET,CAAC;AAEL;AAEA,eAAe3B,SAAS"}
|
|
@@ -41,7 +41,11 @@ const metadata = {
|
|
|
41
41
|
ariaLabel: true,
|
|
42
42
|
html: false,
|
|
43
43
|
background: {
|
|
44
|
-
backgroundImage: true
|
|
44
|
+
backgroundImage: true,
|
|
45
|
+
backgroundSize: true,
|
|
46
|
+
__experimentalDefaultControls: {
|
|
47
|
+
backgroundImage: true
|
|
48
|
+
}
|
|
45
49
|
},
|
|
46
50
|
color: {
|
|
47
51
|
gradients: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","group","icon","initBlock","deprecated","edit","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","tagName","type","templateLock","allowedBlocks","supports","__experimentalOnEnter","__experimentalOnMerge","__experimentalSettings","align","anchor","ariaLabel","html","background","backgroundImage","color","gradients","heading","button","link","
|
|
1
|
+
{"version":3,"names":["__","group","icon","initBlock","deprecated","edit","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","tagName","type","templateLock","allowedBlocks","supports","__experimentalOnEnter","__experimentalOnMerge","__experimentalSettings","align","anchor","ariaLabel","html","background","backgroundImage","backgroundSize","__experimentalDefaultControls","color","gradients","heading","button","link","text","spacing","margin","padding","blockGap","dimensions","minHeight","__experimentalBorder","radius","style","width","position","sticky","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","layout","allowSizingOnChildren","editorStyle","save","transforms","variations","settings","example","innerBlocks","customTextColor","content","init"],"sources":["@wordpress/block-library/src/group/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { group as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tstyle: {\n\t\t\t\tcolor: {\n\t\t\t\t\ttext: '#000000',\n\t\t\t\t\tbackground: '#ffffff',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#cf2e2e',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'One.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#ff6900',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Two.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#fcb900',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Three.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#00d084',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Four.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#0693e3',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Five.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#9b51e0',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Six.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,IAAI,QAAQ,kBAAkB;;AAEhD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAC3C,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,IAAI,MAAM,QAAQ;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,OAAA;MAAAC,IAAA;MAAA;IAAA;IAAAC,YAAA;MAAAD,IAAA;MAAA;IAAA;IAAAE,aAAA;MAAAF,IAAA;IAAA;EAAA;EAAAG,QAAA;IAAAC,qBAAA;IAAAC,qBAAA;IAAAC,sBAAA;IAAAC,KAAA;IAAAC,MAAA;IAAAC,SAAA;IAAAC,IAAA;IAAAC,UAAA;MAAAC,eAAA;MAAAC,cAAA;MAAAC,6BAAA;QAAAF,eAAA;MAAA;IAAA;IAAAG,KAAA;MAAAC,SAAA;MAAAC,OAAA;MAAAC,MAAA;MAAAC,IAAA;MAAAL,6BAAA;QAAAH,UAAA;QAAAS,IAAA;MAAA;IAAA;IAAAC,OAAA;MAAAC,MAAA;MAAAC,OAAA;MAAAC,QAA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IAAI,EAAE,gBAAgB;MACtBM,UAAU,EAAE;QACXqD,eAAe,EAAE,SAAS;QAC1BjB,QAAQ,EAAE,OAAO;QACjBkB,OAAO,EAAErE,EAAE,CAAE,QAAS;MACvB;IACD,CAAC,EACD;MACCS,IAAI,EAAE,gBAAgB;MACtBM,UAAU,EAAE;QACXqD,eAAe,EAAE,SAAS;QAC1BjB,QAAQ,EAAE,OAAO;QACjBkB,OAAO,EAAErE,EAAE,CAAE,OAAQ;MACtB;IACD,CAAC,EACD;MACCS,IAAI,EAAE,gBAAgB;MACtBM,UAAU,EAAE;QACXqD,eAAe,EAAE,SAAS;QAC1BjB,QAAQ,EAAE,OAAO;QACjBkB,OAAO,EAAErE,EAAE,CAAE,OAAQ;MACtB;IACD,CAAC,EACD;MACCS,IAAI,EAAE,gBAAgB;MACtBM,UAAU,EAAE;QACXqD,eAAe,EAAE,SAAS;QAC1BjB,QAAQ,EAAE,OAAO;QACjBkB,OAAO,EAAErE,EAAE,CAAE,MAAO;MACrB;IACD,CAAC;EAEH,CAAC;EACD+D,UAAU;EACV1D,IAAI;EACJyD,IAAI;EACJ1D,UAAU;EACV4D;AACD,CAAC;AAED,OAAO,MAAMM,IAAI,GAAGA,CAAA,KAAMnE,SAAS,CAAE;EAAEM,IAAI;EAAEH,QAAQ;EAAE2D;AAAS,CAAE,CAAC"}
|
|
@@ -24,10 +24,9 @@ const metadata = {
|
|
|
24
24
|
type: "string"
|
|
25
25
|
},
|
|
26
26
|
content: {
|
|
27
|
-
type: "
|
|
28
|
-
source: "
|
|
27
|
+
type: "rich-text",
|
|
28
|
+
source: "rich-text",
|
|
29
29
|
selector: "h1,h2,h3,h4,h5,h6",
|
|
30
|
-
"default": "",
|
|
31
30
|
__experimentalRole: "content"
|
|
32
31
|
},
|
|
33
32
|
level: {
|
|
@@ -69,9 +68,7 @@ const metadata = {
|
|
|
69
68
|
__experimentalTextDecoration: true,
|
|
70
69
|
__experimentalWritingMode: true,
|
|
71
70
|
__experimentalDefaultControls: {
|
|
72
|
-
fontSize: true
|
|
73
|
-
fontAppearance: true,
|
|
74
|
-
textTransform: true
|
|
71
|
+
fontSize: true
|
|
75
72
|
}
|
|
76
73
|
},
|
|
77
74
|
__unstablePasteTextInline: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["heading","icon","__","sprintf","initBlock","deprecated","edit","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","textAlign","type","content","source","selector","__experimentalRole","level","placeholder","supports","align","anchor","className","color","gradients","link","__experimentalDefaultControls","background","text","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontStyle","__experimentalFontWeight","__experimentalLetterSpacing","__experimentalTextTransform","__experimentalTextDecoration","__experimentalWritingMode","
|
|
1
|
+
{"version":3,"names":["heading","icon","__","sprintf","initBlock","deprecated","edit","metadata","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","textAlign","type","content","source","selector","__experimentalRole","level","placeholder","supports","align","anchor","className","color","gradients","link","__experimentalDefaultControls","background","text","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontStyle","__experimentalFontWeight","__experimentalLetterSpacing","__experimentalTextTransform","__experimentalTextDecoration","__experimentalWritingMode","__unstablePasteTextInline","__experimentalSlashInserter","editorStyle","style","save","transforms","settings","example","__experimentalLabel","context","customName","length","merge","attributesToMerge","init"],"sources":["@wordpress/block-library/src/heading/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { heading as icon } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcontent: __( 'Code is Poetry' ),\n\t\t\tlevel: 2,\n\t\t},\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { content, level } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\n\t\t// In the list view, use the block's content as the label.\n\t\t// If the content is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || content ) ) {\n\t\t\treturn attributes?.metadata?.name || content;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\treturn ! content || content.length === 0\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. %s: heading level. */\n\t\t\t\t\t\t__( 'Level %s. Empty.' ),\n\t\t\t\t\t\tlevel\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. 1: heading level. 2: heading content. */\n\t\t\t\t\t\t__( 'Level %1$s. %2$s' ),\n\t\t\t\t\t\tlevel,\n\t\t\t\t\t\tcontent\n\t\t\t\t );\n\t\t}\n\t},\n\ttransforms,\n\tdeprecated,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent:\n\t\t\t\t( attributes.content || '' ) +\n\t\t\t\t( attributesToMerge.content || '' ),\n\t\t};\n\t},\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,IAAI,QAAQ,kBAAkB;AAClD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAC3C,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,IAAI,MAAM,QAAQ;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,SAAA;MAAAC,IAAA;IAAA;IAAAC,OAAA;MAAAD,IAAA;MAAAE,MAAA;MAAAC,QAAA;MAAAC,kB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A,IAAKsC,OAAO,KAAK,eAAe,EAAG;MAClC,OAAO,CAAEtC,OAAO,IAAIA,OAAO,CAACwC,MAAM,KAAK,CAAC,GACrCxD,OAAO,EACP;MACAD,EAAE,CAAE,kBAAmB,CAAC,EACxBqB,KACA,CAAC,GACDpB,OAAO,EACP;MACAD,EAAE,CAAE,kBAAmB,CAAC,EACxBqB,KAAK,EACLJ,OACA,CAAC;IACL;EACD,CAAC;EACDkC,UAAU;EACVhD,UAAU;EACVuD,KAAKA,CAAE5C,UAAU,EAAE6C,iBAAiB,EAAG;IACtC,OAAO;MACN1C,OAAO,EACN,CAAEH,UAAU,CAACG,OAAO,IAAI,EAAE,KACxB0C,iBAAiB,CAAC1C,OAAO,IAAI,EAAE;IACnC,CAAC;EACF,CAAC;EACDb,IAAI;EACJ8C;AACD,CAAC;AAED,OAAO,MAAMU,IAAI,GAAGA,CAAA,KAAM1D,SAAS,CAAE;EAAEM,IAAI;EAAEH,QAAQ;EAAE+C;AAAS,CAAE,CAAC"}
|
|
@@ -643,6 +643,17 @@ const v6 = {
|
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
645
|
},
|
|
646
|
+
migrate(attributes) {
|
|
647
|
+
const {
|
|
648
|
+
height,
|
|
649
|
+
width
|
|
650
|
+
} = attributes;
|
|
651
|
+
return {
|
|
652
|
+
...attributes,
|
|
653
|
+
width: typeof width === 'number' ? `${width}px` : width,
|
|
654
|
+
height: typeof height === 'number' ? `${height}px` : height
|
|
655
|
+
};
|
|
656
|
+
},
|
|
646
657
|
save({
|
|
647
658
|
attributes
|
|
648
659
|
}) {
|