@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["G","Path","SVG","embedContentIcon","createElement","viewBox","xmlns","d","embedAudioIcon","embedPhotoIcon","embedVideoIcon","embedTwitterIcon","foreground","src","embedYouTubeIcon","embedFacebookIcon","embedInstagramIcon","embedWordPressIcon","embedSpotifyIcon","embedFlickrIcon","embedVimeoIcon","embedRedditIcon","embedTumblrIcon","embedAmazonIcon","embedAnimotoIcon","fill","embedDailymotionIcon","embedPinterestIcon","width","height","version","embedWolframIcon","embedPocketCastsIcon","fillRule","clipRule"],"sources":["@wordpress/block-library/src/embed/icons.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { G, Path, SVG } from '@wordpress/components';\n\nexport const embedContentIcon = (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zm-6-9.5L16 12l-2.5 2.8 1.1 1L18 12l-3.5-3.5-1 1zm-3 0l-1-1L6 12l3.5 3.8 1.1-1L8 12l2.5-2.5z\" />\n\t</SVG>\n);\nexport const embedAudioIcon = (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zM13.2 7.7c-.4.4-.7 1.1-.7 1.9v3.7c-.4-.3-.8-.4-1.3-.4-1.2 0-2.2 1-2.2 2.2 0 1.2 1 2.2 2.2 2.2.5 0 1-.2 1.4-.5.9-.6 1.4-1.6 1.4-2.6V9.6c0-.4.1-.6.2-.8.3-.3 1-.3 1.6-.3h.2V7h-.2c-.7 0-1.8 0-2.6.7z\" />\n\t</SVG>\n);\nexport const embedPhotoIcon = (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9.2 4.5H19c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V9.8l4.6-5.3zm9.8 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z\" />\n\t</SVG>\n);\nexport const embedVideoIcon = (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zM10 15l5-3-5-3v6z\" />\n\t</SVG>\n);\nexport const embedTwitterIcon = {\n\tforeground: '#1da1f2',\n\tsrc: (\n\t\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t\t<G>\n\t\t\t\t<Path d=\"M22.23 5.924c-.736.326-1.527.547-2.357.646.847-.508 1.498-1.312 1.804-2.27-.793.47-1.67.812-2.606.996C18.325 4.498 17.258 4 16.078 4c-2.266 0-4.103 1.837-4.103 4.103 0 .322.036.635.106.935-3.41-.17-6.433-1.804-8.457-4.287-.353.607-.556 1.312-.556 2.064 0 1.424.724 2.68 1.825 3.415-.673-.022-1.305-.207-1.86-.514v.052c0 1.988 1.415 3.647 3.293 4.023-.344.095-.707.145-1.08.145-.265 0-.522-.026-.773-.074.522 1.63 2.038 2.817 3.833 2.85-1.404 1.1-3.174 1.757-5.096 1.757-.332 0-.66-.02-.98-.057 1.816 1.164 3.973 1.843 6.29 1.843 7.547 0 11.675-6.252 11.675-11.675 0-.178-.004-.355-.012-.53.802-.578 1.497-1.3 2.047-2.124z\"></Path>\n\t\t\t</G>\n\t\t</SVG>\n\t),\n};\nexport const embedYouTubeIcon = {\n\tforeground: '#ff0000',\n\tsrc: (\n\t\t<SVG viewBox=\"0 0 24 24\">\n\t\t\t<Path d=\"M21.8 8s-.195-1.377-.795-1.984c-.76-.797-1.613-.8-2.004-.847-2.798-.203-6.996-.203-6.996-.203h-.01s-4.197 0-6.996.202c-.39.046-1.242.05-2.003.846C2.395 6.623 2.2 8 2.2 8S2 9.62 2 11.24v1.517c0 1.618.2 3.237.2 3.237s.195 1.378.795 1.985c.76.797 1.76.77 2.205.855 1.6.153 6.8.2 6.8.2s4.203-.005 7-.208c.392-.047 1.244-.05 2.005-.847.6-.607.795-1.985.795-1.985s.2-1.618.2-3.237v-1.517C22 9.62 21.8 8 21.8 8zM9.935 14.595v-5.62l5.403 2.82-5.403 2.8z\" />\n\t\t</SVG>\n\t),\n};\nexport const embedFacebookIcon = {\n\tforeground: '#3b5998',\n\tsrc: (\n\t\t<SVG viewBox=\"0 0 24 24\">\n\t\t\t<Path d=\"M20 3H4c-.6 0-1 .4-1 1v16c0 .5.4 1 1 1h8.6v-7h-2.3v-2.7h2.3v-2c0-2.3 1.4-3.6 3.5-3.6 1 0 1.8.1 2.1.1v2.4h-1.4c-1.1 0-1.3.5-1.3 1.3v1.7h2.7l-.4 2.8h-2.3v7H20c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1z\" />\n\t\t</SVG>\n\t),\n};\nexport const embedInstagramIcon = (\n\t<SVG viewBox=\"0 0 24 24\">\n\t\t<G>\n\t\t\t<Path d=\"M12 4.622c2.403 0 2.688.01 3.637.052.877.04 1.354.187 1.67.31.42.163.72.358 1.036.673.315.315.51.615.673 1.035.123.317.27.794.31 1.67.043.95.052 1.235.052 3.638s-.01 2.688-.052 3.637c-.04.877-.187 1.354-.31 1.67-.163.42-.358.72-.673 1.036-.315.315-.615.51-1.035.673-.317.123-.794.27-1.67.31-.95.043-1.234.052-3.638.052s-2.688-.01-3.637-.052c-.877-.04-1.354-.187-1.67-.31-.42-.163-.72-.358-1.036-.673-.315-.315-.51-.615-.673-1.035-.123-.317-.27-.794-.31-1.67-.043-.95-.052-1.235-.052-3.638s.01-2.688.052-3.637c.04-.877.187-1.354.31-1.67.163-.42.358-.72.673-1.036.315-.315.615-.51 1.035-.673.317-.123.794-.27 1.67-.31.95-.043 1.235-.052 3.638-.052M12 3c-2.444 0-2.75.01-3.71.054s-1.613.196-2.185.418c-.592.23-1.094.538-1.594 1.04-.5.5-.807 1-1.037 1.593-.223.572-.375 1.226-.42 2.184C3.01 9.25 3 9.555 3 12s.01 2.75.054 3.71.196 1.613.418 2.186c.23.592.538 1.094 1.038 1.594s1.002.808 1.594 1.038c.572.222 1.227.375 2.185.418.96.044 1.266.054 3.71.054s2.75-.01 3.71-.054 1.613-.196 2.186-.418c.592-.23 1.094-.538 1.594-1.038s.808-1.002 1.038-1.594c.222-.572.375-1.227.418-2.185.044-.96.054-1.266.054-3.71s-.01-2.75-.054-3.71-.196-1.613-.418-2.186c-.23-.592-.538-1.094-1.038-1.594s-1.002-.808-1.594-1.038c-.572-.222-1.227-.375-2.185-.418C14.75 3.01 14.445 3 12 3zm0 4.378c-2.552 0-4.622 2.07-4.622 4.622s2.07 4.622 4.622 4.622 4.622-2.07 4.622-4.622S14.552 7.378 12 7.378zM12 15c-1.657 0-3-1.343-3-3s1.343-3 3-3 3 1.343 3 3-1.343 3-3 3zm4.804-8.884c-.596 0-1.08.484-1.08 1.08s.484 1.08 1.08 1.08c.596 0 1.08-.484 1.08-1.08s-.483-1.08-1.08-1.08z\"></Path>\n\t\t</G>\n\t</SVG>\n);\nexport const embedWordPressIcon = {\n\tforeground: '#0073AA',\n\tsrc: (\n\t\t<SVG viewBox=\"0 0 24 24\">\n\t\t\t<G>\n\t\t\t\t<Path d=\"M12.158 12.786l-2.698 7.84c.806.236 1.657.365 2.54.365 1.047 0 2.05-.18 2.986-.51-.024-.037-.046-.078-.065-.123l-2.762-7.57zM3.008 12c0 3.56 2.07 6.634 5.068 8.092L3.788 8.342c-.5 1.117-.78 2.354-.78 3.658zm15.06-.454c0-1.112-.398-1.88-.74-2.48-.456-.74-.883-1.368-.883-2.11 0-.825.627-1.595 1.51-1.595.04 0 .078.006.116.008-1.598-1.464-3.73-2.36-6.07-2.36-3.14 0-5.904 1.613-7.512 4.053.21.008.41.012.58.012.94 0 2.395-.114 2.395-.114.484-.028.54.684.057.74 0 0-.487.058-1.03.086l3.275 9.74 1.968-5.902-1.4-3.838c-.485-.028-.944-.085-.944-.085-.486-.03-.43-.77.056-.742 0 0 1.484.114 2.368.114.94 0 2.397-.114 2.397-.114.486-.028.543.684.058.74 0 0-.488.058-1.03.086l3.25 9.665.897-2.997c.456-1.17.684-2.137.684-2.907zm1.82-3.86c.04.286.06.593.06.924 0 .912-.17 1.938-.683 3.22l-2.746 7.94c2.672-1.558 4.47-4.454 4.47-7.77 0-1.564-.4-3.033-1.1-4.314zM12 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10z\"></Path>\n\t\t\t</G>\n\t\t</SVG>\n\t),\n};\nexport const embedSpotifyIcon = {\n\tforeground: '#1db954',\n\tsrc: (\n\t\t<SVG viewBox=\"0 0 24 24\">\n\t\t\t<Path d=\"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2m4.586 14.424c-.18.295-.563.387-.857.207-2.35-1.434-5.305-1.76-8.786-.963-.335.077-.67-.133-.746-.47-.077-.334.132-.67.47-.745 3.808-.87 7.076-.496 9.712 1.115.293.18.386.563.206.857M17.81 13.7c-.226.367-.706.482-1.072.257-2.687-1.652-6.785-2.13-9.965-1.166-.413.127-.848-.106-.973-.517-.125-.413.108-.848.52-.973 3.632-1.102 8.147-.568 11.234 1.328.366.226.48.707.256 1.072m.105-2.835C14.692 8.95 9.375 8.775 6.297 9.71c-.493.15-1.016-.13-1.166-.624-.148-.495.13-1.017.625-1.167 3.532-1.073 9.404-.866 13.115 1.337.445.264.59.838.327 1.282-.264.443-.838.59-1.282.325\" />\n\t\t</SVG>\n\t),\n};\nexport const embedFlickrIcon = (\n\t<SVG viewBox=\"0 0 24 24\">\n\t\t<Path d=\"m6.5 7c-2.75 0-5 2.25-5 5s2.25 5 5 5 5-2.25 5-5-2.25-5-5-5zm11 0c-2.75 0-5 2.25-5 5s2.25 5 5 5 5-2.25 5-5-2.25-5-5-5z\" />\n\t</SVG>\n);\nexport const embedVimeoIcon = {\n\tforeground: '#1ab7ea',\n\tsrc: (\n\t\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t\t<G>\n\t\t\t\t<Path d=\"M22.396 7.164c-.093 2.026-1.507 4.8-4.245 8.32C15.323 19.16 12.93 21 10.97 21c-1.214 0-2.24-1.12-3.08-3.36-.56-2.052-1.118-4.105-1.68-6.158-.622-2.24-1.29-3.36-2.004-3.36-.156 0-.7.328-1.634.98l-.978-1.26c1.027-.903 2.04-1.806 3.037-2.71C6 3.95 7.03 3.328 7.716 3.265c1.62-.156 2.616.95 2.99 3.32.404 2.558.685 4.148.84 4.77.468 2.12.982 3.18 1.543 3.18.435 0 1.09-.687 1.963-2.064.872-1.376 1.34-2.422 1.402-3.142.125-1.187-.343-1.782-1.4-1.782-.5 0-1.013.115-1.542.34 1.023-3.35 2.977-4.976 5.862-4.883 2.14.063 3.148 1.45 3.024 4.16z\"></Path>\n\t\t\t</G>\n\t\t</SVG>\n\t),\n};\nexport const embedRedditIcon = (\n\t<SVG viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M22 12.068a2.184 2.184 0 0 0-2.186-2.186c-.592 0-1.13.233-1.524.609-1.505-1.075-3.566-1.774-5.86-1.864l1.004-4.695 3.261.699A1.56 1.56 0 1 0 18.255 3c-.61-.001-1.147.357-1.398.877l-3.638-.77a.382.382 0 0 0-.287.053.348.348 0 0 0-.161.251l-1.112 5.233c-2.33.072-4.426.77-5.95 1.864a2.201 2.201 0 0 0-1.523-.61 2.184 2.184 0 0 0-.896 4.176c-.036.215-.053.43-.053.663 0 3.37 3.924 6.111 8.763 6.111s8.763-2.724 8.763-6.11c0-.216-.017-.449-.053-.664A2.207 2.207 0 0 0 22 12.068Zm-15.018 1.56a1.56 1.56 0 0 1 3.118 0c0 .86-.699 1.558-1.559 1.558-.86.018-1.559-.699-1.559-1.559Zm8.728 4.139c-1.076 1.075-3.119 1.147-3.71 1.147-.61 0-2.652-.09-3.71-1.147a.4.4 0 0 1 0-.573.4.4 0 0 1 .574 0c.68.68 2.114.914 3.136.914 1.022 0 2.473-.233 3.136-.914a.4.4 0 0 1 .574 0 .436.436 0 0 1 0 .573Zm-.287-2.563a1.56 1.56 0 0 1 0-3.118c.86 0 1.56.699 1.56 1.56 0 .841-.7 1.558-1.56 1.558Z\" />\n\t</SVG>\n);\nexport const embedTumblrIcon = {\n\tforeground: '#35465c',\n\tsrc: (\n\t\t<SVG viewBox=\"0 0 24 24\">\n\t\t\t<Path d=\"M19 3H5a2 2 0 00-2 2v14c0 1.1.9 2 2 2h14a2 2 0 002-2V5a2 2 0 00-2-2zm-5.69 14.66c-2.72 0-3.1-1.9-3.1-3.16v-3.56H8.49V8.99c1.7-.62 2.54-1.99 2.64-2.87 0-.06.06-.41.06-.58h1.9v3.1h2.17v2.3h-2.18v3.1c0 .47.13 1.3 1.2 1.26h1.1v2.36c-1.01.02-2.07 0-2.07 0z\" />\n\t\t</SVG>\n\t),\n};\nexport const embedAmazonIcon = (\n\t<SVG viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M18.42 14.58c-.51-.66-1.05-1.23-1.05-2.5V7.87c0-1.8.15-3.45-1.2-4.68-1.05-1.02-2.79-1.35-4.14-1.35-2.6 0-5.52.96-6.12 4.14-.06.36.18.54.4.57l2.66.3c.24-.03.42-.27.48-.5.24-1.12 1.17-1.63 2.2-1.63.56 0 1.22.21 1.55.7.4.56.33 1.31.33 1.97v.36c-1.59.18-3.66.27-5.16.93a4.63 4.63 0 0 0-2.93 4.44c0 2.82 1.8 4.23 4.1 4.23 1.95 0 3.03-.45 4.53-1.98.51.72.66 1.08 1.59 1.83.18.09.45.09.63-.1v.04l2.1-1.8c.24-.21.2-.48.03-.75zm-5.4-1.2c-.45.75-1.14 1.23-1.92 1.23-1.05 0-1.65-.81-1.65-1.98 0-2.31 2.1-2.73 4.08-2.73v.6c0 1.05.03 1.92-.5 2.88z\" />\n\t\t<Path d=\"M21.69 19.2a17.62 17.62 0 0 1-21.6-1.57c-.23-.2 0-.5.28-.33a23.88 23.88 0 0 0 20.93 1.3c.45-.19.84.3.39.6z\" />\n\t\t<Path d=\"M22.8 17.96c-.36-.45-2.22-.2-3.1-.12-.23.03-.3-.18-.05-.36 1.5-1.05 3.96-.75 4.26-.39.3.36-.1 2.82-1.5 4.02-.21.18-.42.1-.3-.15.3-.8 1.02-2.58.69-3z\" />\n\t</SVG>\n);\nexport const embedAnimotoIcon = (\n\t<SVG viewBox=\"0 0 24 24\">\n\t\t<Path\n\t\t\td=\"m.0206909 21 19.8160091-13.07806 3.5831 6.20826z\"\n\t\t\tfill=\"#4bc7ee\"\n\t\t/>\n\t\t<Path\n\t\t\td=\"m23.7254 19.0205-10.1074-17.18468c-.6421-1.114428-1.7087-1.114428-2.3249 0l-11.2931 19.16418h22.5655c1.279 0 1.8019-.8905 1.1599-1.9795z\"\n\t\t\tfill=\"#d4cdcb\"\n\t\t/>\n\t\t<Path\n\t\t\td=\"m.0206909 21 15.2439091-16.38571 4.3029 7.32271z\"\n\t\t\tfill=\"#c3d82e\"\n\t\t/>\n\t\t<Path\n\t\t\td=\"m13.618 1.83582c-.6421-1.114428-1.7087-1.114428-2.3249 0l-11.2931 19.16418 15.2646-16.38573z\"\n\t\t\tfill=\"#e4ecb0\"\n\t\t/>\n\t\t<Path d=\"m.0206909 21 19.5468091-9.063 1.6621 2.8344z\" fill=\"#209dbd\" />\n\t\t<Path\n\t\t\td=\"m.0206909 21 17.9209091-11.82623 1.6259 2.76323z\"\n\t\t\tfill=\"#7cb3c9\"\n\t\t/>\n\t</SVG>\n);\nexport const embedDailymotionIcon = (\n\t<SVG viewBox=\"0 0 24 24\">\n\t\t<Path\n\t\t\td=\"m12.1479 18.5957c-2.4949 0-4.28131-1.7558-4.28131-4.0658 0-2.2176 1.78641-4.0965 4.09651-4.0965 2.2793 0 4.0349 1.7864 4.0349 4.1581 0 2.2794-1.7556 4.0042-3.8501 4.0042zm8.3521-18.5957-4.5329 1v7c-1.1088-1.41691-2.8028-1.8787-4.8049-1.8787-2.09443 0-3.97329.76993-5.5133 2.27917-1.72483 1.66323-2.6489 3.78863-2.6489 6.16033 0 2.5873.98562 4.8049 2.89526 6.499 1.44763 1.2936 3.17251 1.9402 5.17454 1.9402 1.9713 0 3.4498-.5236 4.8973-1.9402v1.9402h4.5329c0-7.6359 0-15.3641 0-23z\"\n\t\t\tfill=\"#333436\"\n\t\t/>\n\t</SVG>\n);\nexport const embedPinterestIcon = (\n\t<SVG width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\">\n\t\t<Path d=\"M12.289,2C6.617,2,3.606,5.648,3.606,9.622c0,1.846,1.025,4.146,2.666,4.878c0.25,0.111,0.381,0.063,0.439-0.169 c0.044-0.175,0.267-1.029,0.365-1.428c0.032-0.128,0.017-0.237-0.091-0.362C6.445,11.911,6.01,10.75,6.01,9.668 c0-2.777,2.194-5.464,5.933-5.464c3.23,0,5.49,2.108,5.49,5.122c0,3.407-1.794,5.768-4.13,5.768c-1.291,0-2.257-1.021-1.948-2.277 c0.372-1.495,1.089-3.112,1.089-4.191c0-0.967-0.542-1.775-1.663-1.775c-1.319,0-2.379,1.309-2.379,3.059 c0,1.115,0.394,1.869,0.394,1.869s-1.302,5.279-1.54,6.261c-0.405,1.666,0.053,4.368,0.094,4.604 c0.021,0.126,0.167,0.169,0.25,0.063c0.129-0.165,1.699-2.419,2.142-4.051c0.158-0.59,0.817-2.995,0.817-2.995 c0.43,0.784,1.681,1.446,3.013,1.446c3.963,0,6.822-3.494,6.822-7.833C20.394,5.112,16.849,2,12.289,2\" />\n\t</SVG>\n);\n\nexport const embedWolframIcon = (\n\t<SVG viewBox=\"0 0 44 44\">\n\t\t<Path d=\"M32.59521,22.001l4.31885-4.84473-6.34131-1.38379.646-6.459-5.94336,2.61035L22,6.31934l-3.27344,5.60351L12.78418,9.3125l.645,6.458L7.08643,17.15234,11.40479,21.999,7.08594,26.84375l6.34131,1.38379-.64551,6.458,5.94287-2.60938L22,37.68066l3.27344-5.60351,5.94287,2.61035-.64551-6.458,6.34277-1.38183Zm.44385,2.75244L30.772,23.97827l-1.59558-2.07391,1.97888.735Zm-8.82147,6.1579L22.75,33.424V30.88977l1.52228-2.22168ZM18.56226,13.48816,19.819,15.09534l-2.49219-.88642L15.94037,12.337Zm6.87719.00116,2.62043-1.15027-1.38654,1.86981L24.183,15.0946Zm3.59357,2.6029-1.22546,1.7381.07525-2.73486,1.44507-1.94867ZM22,29.33008l-2.16406-3.15686L22,23.23688l2.16406,2.93634Zm-4.25458-9.582-.10528-3.836,3.60986,1.284v3.73242Zm5.00458-2.552,3.60986-1.284-.10528,3.836L22.75,20.92853Zm-7.78174-1.10559-.29352-2.94263,1.44245,1.94739.07519,2.73321Zm2.30982,5.08319,3.50817,1.18164-2.16247,2.9342-3.678-1.08447Zm2.4486,7.49285L21.25,30.88977v2.53485L19.78052,30.91Zm3.48707-6.31121,3.50817-1.18164,2.33228,3.03137-3.678,1.08447Zm10.87219-4.28113-2.714,3.04529L28.16418,19.928l1.92176-2.72565ZM24.06036,12.81769l-2.06012,2.6322-2.059-2.63318L22,9.292ZM9.91455,18.07227l4.00079-.87195,1.921,2.72735-3.20794,1.19019Zm2.93024,4.565,1.9801-.73462L13.228,23.97827l-2.26838.77429Zm-1.55591,3.58819L13.701,25.4021l2.64935.78058-2.14447.67853Zm3.64868,1.977L18.19,27.17334l.08313,3.46332L14.52979,32.2793Zm10.7876,2.43549.08447-3.464,3.25165,1.03052.407,4.07684Zm4.06824-3.77478-2.14545-.68,2.65063-.781,2.41266.825Z\" />\n\t</SVG>\n);\n\nexport const embedPocketCastsIcon = {\n\tforeground: '#f43e37',\n\tsrc: (\n\t\t<SVG\n\t\t\twidth=\"24\"\n\t\t\theight=\"24\"\n\t\t\tviewBox=\"0 0 24 24\"\n\t\t\tfill=\"none\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<Path\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M24,12A12,12,0,1,1,12,0,12,12,0,0,1,24,12Z\"\n\t\t\t/>\n\t\t\t<Path\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M2.67,12a9.33,9.33,0,0,1,18.66,0H19a7,7,0,1,0-7,7v2.33A9.33,9.33,0,0,1,2.67,12ZM12,17.6A5.6,5.6,0,1,1,17.6,12h-2A3.56,3.56,0,1,0,12,15.56Z\"\n\t\t\t\tfill=\"#fff\"\n\t\t\t/>\n\t\t</SVG>\n\t),\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,CAAC,EAAEC,IAAI,EAAEC,GAAG,QAAQ,uBAAuB;AAEpD,OAAO,MAAMC,gBAAgB,GAC5BC,aAAA,CAACF,GAAG;EAACG,OAAO,EAAC,WAAW;EAACC,KAAK,EAAC;AAA4B,GAC1DF,aAAA,CAACH,IAAI;EAACM,CAAC,EAAC;AAAmP,CAAE,CACzP,CACL;AACD,OAAO,MAAMC,cAAc,GAC1BJ,aAAA,CAACF,GAAG;EAACG,OAAO,EAAC,WAAW;EAACC,KAAK,EAAC;AAA4B,GAC1DF,aAAA,CAACH,IAAI;EAACM,CAAC,EAAC;AAA0V,CAAE,CAChW,CACL;AACD,OAAO,MAAME,cAAc,GAC1BL,aAAA,CAACF,GAAG;EAACG,OAAO,EAAC,WAAW;EAACC,KAAK,EAAC;AAA4B,GAC1DF,aAAA,CAACH,IAAI;EAACM,CAAC,EAAC;AAAmR,CAAE,CACzR,CACL;AACD,OAAO,MAAMG,cAAc,GAC1BN,aAAA,CAACF,GAAG;EAACG,OAAO,EAAC,WAAW;EAACC,KAAK,EAAC;AAA4B,G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;EAA4B,GAElCF,aAAA,CAACH,IAAI;IACJgC,QAAQ,EAAC,SAAS;IAClBC,QAAQ,EAAC,SAAS;IAClB3B,CAAC,EAAC;EAA4C,CAC9C,CAAC,EACFH,aAAA,CAACH,IAAI;IACJgC,QAAQ,EAAC,SAAS;IAClBC,QAAQ,EAAC,SAAS;IAClB3B,CAAC,EAAC,4IAA4I;IAC9IkB,IAAI,EAAC;EAAM,CACX,CACG;AAEP,CAAC"}
|
|
1
|
+
{"version":3,"names":["G","Path","SVG","embedContentIcon","createElement","viewBox","xmlns","d","embedAudioIcon","embedPhotoIcon","embedVideoIcon","embedTwitterIcon","foreground","src","embedYouTubeIcon","embedFacebookIcon","embedInstagramIcon","embedWordPressIcon","embedSpotifyIcon","embedFlickrIcon","embedVimeoIcon","embedRedditIcon","embedTumblrIcon","embedAmazonIcon","embedAnimotoIcon","fill","embedDailymotionIcon","embedPinterestIcon","width","height","version","embedWolframIcon","embedPocketCastsIcon","fillRule","clipRule"],"sources":["@wordpress/block-library/src/embed/icons.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { G, Path, SVG } from '@wordpress/components';\n\nexport const embedContentIcon = (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zm-6-9.5L16 12l-2.5 2.8 1.1 1L18 12l-3.5-3.5-1 1zm-3 0l-1-1L6 12l3.5 3.8 1.1-1L8 12l2.5-2.5z\" />\n\t</SVG>\n);\nexport const embedAudioIcon = (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zM13.2 7.7c-.4.4-.7 1.1-.7 1.9v3.7c-.4-.3-.8-.4-1.3-.4-1.2 0-2.2 1-2.2 2.2 0 1.2 1 2.2 2.2 2.2.5 0 1-.2 1.4-.5.9-.6 1.4-1.6 1.4-2.6V9.6c0-.4.1-.6.2-.8.3-.3 1-.3 1.6-.3h.2V7h-.2c-.7 0-1.8 0-2.6.7z\" />\n\t</SVG>\n);\nexport const embedPhotoIcon = (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9.2 4.5H19c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V9.8l4.6-5.3zm9.8 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z\" />\n\t</SVG>\n);\nexport const embedVideoIcon = (\n\t<SVG viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zM10 15l5-3-5-3v6z\" />\n\t</SVG>\n);\nexport const embedTwitterIcon = {\n\tforeground: '#1da1f2',\n\tsrc: (\n\t\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t\t<G>\n\t\t\t\t<Path d=\"M22.23 5.924c-.736.326-1.527.547-2.357.646.847-.508 1.498-1.312 1.804-2.27-.793.47-1.67.812-2.606.996C18.325 4.498 17.258 4 16.078 4c-2.266 0-4.103 1.837-4.103 4.103 0 .322.036.635.106.935-3.41-.17-6.433-1.804-8.457-4.287-.353.607-.556 1.312-.556 2.064 0 1.424.724 2.68 1.825 3.415-.673-.022-1.305-.207-1.86-.514v.052c0 1.988 1.415 3.647 3.293 4.023-.344.095-.707.145-1.08.145-.265 0-.522-.026-.773-.074.522 1.63 2.038 2.817 3.833 2.85-1.404 1.1-3.174 1.757-5.096 1.757-.332 0-.66-.02-.98-.057 1.816 1.164 3.973 1.843 6.29 1.843 7.547 0 11.675-6.252 11.675-11.675 0-.178-.004-.355-.012-.53.802-.578 1.497-1.3 2.047-2.124z\"></Path>\n\t\t\t</G>\n\t\t</SVG>\n\t),\n};\nexport const embedYouTubeIcon = {\n\tforeground: '#ff0000',\n\tsrc: (\n\t\t<SVG viewBox=\"0 0 24 24\">\n\t\t\t<Path d=\"M21.8 8s-.195-1.377-.795-1.984c-.76-.797-1.613-.8-2.004-.847-2.798-.203-6.996-.203-6.996-.203h-.01s-4.197 0-6.996.202c-.39.046-1.242.05-2.003.846C2.395 6.623 2.2 8 2.2 8S2 9.62 2 11.24v1.517c0 1.618.2 3.237.2 3.237s.195 1.378.795 1.985c.76.797 1.76.77 2.205.855 1.6.153 6.8.2 6.8.2s4.203-.005 7-.208c.392-.047 1.244-.05 2.005-.847.6-.607.795-1.985.795-1.985s.2-1.618.2-3.237v-1.517C22 9.62 21.8 8 21.8 8zM9.935 14.595v-5.62l5.403 2.82-5.403 2.8z\" />\n\t\t</SVG>\n\t),\n};\nexport const embedFacebookIcon = {\n\tforeground: '#3b5998',\n\tsrc: (\n\t\t<SVG viewBox=\"0 0 24 24\">\n\t\t\t<Path d=\"M20 3H4c-.6 0-1 .4-1 1v16c0 .5.4 1 1 1h8.6v-7h-2.3v-2.7h2.3v-2c0-2.3 1.4-3.6 3.5-3.6 1 0 1.8.1 2.1.1v2.4h-1.4c-1.1 0-1.3.5-1.3 1.3v1.7h2.7l-.4 2.8h-2.3v7H20c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1z\" />\n\t\t</SVG>\n\t),\n};\nexport const embedInstagramIcon = (\n\t<SVG viewBox=\"0 0 24 24\">\n\t\t<G>\n\t\t\t<Path d=\"M12 4.622c2.403 0 2.688.01 3.637.052.877.04 1.354.187 1.67.31.42.163.72.358 1.036.673.315.315.51.615.673 1.035.123.317.27.794.31 1.67.043.95.052 1.235.052 3.638s-.01 2.688-.052 3.637c-.04.877-.187 1.354-.31 1.67-.163.42-.358.72-.673 1.036-.315.315-.615.51-1.035.673-.317.123-.794.27-1.67.31-.95.043-1.234.052-3.638.052s-2.688-.01-3.637-.052c-.877-.04-1.354-.187-1.67-.31-.42-.163-.72-.358-1.036-.673-.315-.315-.51-.615-.673-1.035-.123-.317-.27-.794-.31-1.67-.043-.95-.052-1.235-.052-3.638s.01-2.688.052-3.637c.04-.877.187-1.354.31-1.67.163-.42.358-.72.673-1.036.315-.315.615-.51 1.035-.673.317-.123.794-.27 1.67-.31.95-.043 1.235-.052 3.638-.052M12 3c-2.444 0-2.75.01-3.71.054s-1.613.196-2.185.418c-.592.23-1.094.538-1.594 1.04-.5.5-.807 1-1.037 1.593-.223.572-.375 1.226-.42 2.184C3.01 9.25 3 9.555 3 12s.01 2.75.054 3.71.196 1.613.418 2.186c.23.592.538 1.094 1.038 1.594s1.002.808 1.594 1.038c.572.222 1.227.375 2.185.418.96.044 1.266.054 3.71.054s2.75-.01 3.71-.054 1.613-.196 2.186-.418c.592-.23 1.094-.538 1.594-1.038s.808-1.002 1.038-1.594c.222-.572.375-1.227.418-2.185.044-.96.054-1.266.054-3.71s-.01-2.75-.054-3.71-.196-1.613-.418-2.186c-.23-.592-.538-1.094-1.038-1.594s-1.002-.808-1.594-1.038c-.572-.222-1.227-.375-2.185-.418C14.75 3.01 14.445 3 12 3zm0 4.378c-2.552 0-4.622 2.07-4.622 4.622s2.07 4.622 4.622 4.622 4.622-2.07 4.622-4.622S14.552 7.378 12 7.378zM12 15c-1.657 0-3-1.343-3-3s1.343-3 3-3 3 1.343 3 3-1.343 3-3 3zm4.804-8.884c-.596 0-1.08.484-1.08 1.08s.484 1.08 1.08 1.08c.596 0 1.08-.484 1.08-1.08s-.483-1.08-1.08-1.08z\"></Path>\n\t\t</G>\n\t</SVG>\n);\nexport const embedWordPressIcon = {\n\tforeground: '#0073AA',\n\tsrc: (\n\t\t<SVG viewBox=\"0 0 24 24\">\n\t\t\t<G>\n\t\t\t\t<Path d=\"M12.158 12.786l-2.698 7.84c.806.236 1.657.365 2.54.365 1.047 0 2.05-.18 2.986-.51-.024-.037-.046-.078-.065-.123l-2.762-7.57zM3.008 12c0 3.56 2.07 6.634 5.068 8.092L3.788 8.342c-.5 1.117-.78 2.354-.78 3.658zm15.06-.454c0-1.112-.398-1.88-.74-2.48-.456-.74-.883-1.368-.883-2.11 0-.825.627-1.595 1.51-1.595.04 0 .078.006.116.008-1.598-1.464-3.73-2.36-6.07-2.36-3.14 0-5.904 1.613-7.512 4.053.21.008.41.012.58.012.94 0 2.395-.114 2.395-.114.484-.028.54.684.057.74 0 0-.487.058-1.03.086l3.275 9.74 1.968-5.902-1.4-3.838c-.485-.028-.944-.085-.944-.085-.486-.03-.43-.77.056-.742 0 0 1.484.114 2.368.114.94 0 2.397-.114 2.397-.114.486-.028.543.684.058.74 0 0-.488.058-1.03.086l3.25 9.665.897-2.997c.456-1.17.684-2.137.684-2.907zm1.82-3.86c.04.286.06.593.06.924 0 .912-.17 1.938-.683 3.22l-2.746 7.94c2.672-1.558 4.47-4.454 4.47-7.77 0-1.564-.4-3.033-1.1-4.314zM12 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10z\"></Path>\n\t\t\t</G>\n\t\t</SVG>\n\t),\n};\nexport const embedSpotifyIcon = {\n\tforeground: '#1db954',\n\tsrc: (\n\t\t<SVG viewBox=\"0 0 24 24\">\n\t\t\t<Path d=\"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2m4.586 14.424c-.18.295-.563.387-.857.207-2.35-1.434-5.305-1.76-8.786-.963-.335.077-.67-.133-.746-.47-.077-.334.132-.67.47-.745 3.808-.87 7.076-.496 9.712 1.115.293.18.386.563.206.857M17.81 13.7c-.226.367-.706.482-1.072.257-2.687-1.652-6.785-2.13-9.965-1.166-.413.127-.848-.106-.973-.517-.125-.413.108-.848.52-.973 3.632-1.102 8.147-.568 11.234 1.328.366.226.48.707.256 1.072m.105-2.835C14.692 8.95 9.375 8.775 6.297 9.71c-.493.15-1.016-.13-1.166-.624-.148-.495.13-1.017.625-1.167 3.532-1.073 9.404-.866 13.115 1.337.445.264.59.838.327 1.282-.264.443-.838.59-1.282.325\" />\n\t\t</SVG>\n\t),\n};\nexport const embedFlickrIcon = (\n\t<SVG viewBox=\"0 0 24 24\">\n\t\t<Path d=\"m6.5 7c-2.75 0-5 2.25-5 5s2.25 5 5 5 5-2.25 5-5-2.25-5-5-5zm11 0c-2.75 0-5 2.25-5 5s2.25 5 5 5 5-2.25 5-5-2.25-5-5-5z\" />\n\t</SVG>\n);\nexport const embedVimeoIcon = {\n\tforeground: '#1ab7ea',\n\tsrc: (\n\t\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t\t<G>\n\t\t\t\t<Path d=\"M22.396 7.164c-.093 2.026-1.507 4.8-4.245 8.32C15.323 19.16 12.93 21 10.97 21c-1.214 0-2.24-1.12-3.08-3.36-.56-2.052-1.118-4.105-1.68-6.158-.622-2.24-1.29-3.36-2.004-3.36-.156 0-.7.328-1.634.98l-.978-1.26c1.027-.903 2.04-1.806 3.037-2.71C6 3.95 7.03 3.328 7.716 3.265c1.62-.156 2.616.95 2.99 3.32.404 2.558.685 4.148.84 4.77.468 2.12.982 3.18 1.543 3.18.435 0 1.09-.687 1.963-2.064.872-1.376 1.34-2.422 1.402-3.142.125-1.187-.343-1.782-1.4-1.782-.5 0-1.013.115-1.542.34 1.023-3.35 2.977-4.976 5.862-4.883 2.14.063 3.148 1.45 3.024 4.16z\"></Path>\n\t\t\t</G>\n\t\t</SVG>\n\t),\n};\nexport const embedRedditIcon = (\n\t<SVG viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M22 12.068a2.184 2.184 0 0 0-2.186-2.186c-.592 0-1.13.233-1.524.609-1.505-1.075-3.566-1.774-5.86-1.864l1.004-4.695 3.261.699A1.56 1.56 0 1 0 18.255 3c-.61-.001-1.147.357-1.398.877l-3.638-.77a.382.382 0 0 0-.287.053.348.348 0 0 0-.161.251l-1.112 5.233c-2.33.072-4.426.77-5.95 1.864a2.201 2.201 0 0 0-1.523-.61 2.184 2.184 0 0 0-.896 4.176c-.036.215-.053.43-.053.663 0 3.37 3.924 6.111 8.763 6.111s8.763-2.724 8.763-6.11c0-.216-.017-.449-.053-.664A2.207 2.207 0 0 0 22 12.068Zm-15.018 1.56a1.56 1.56 0 0 1 3.118 0c0 .86-.699 1.558-1.559 1.558-.86.018-1.559-.699-1.559-1.559Zm8.728 4.139c-1.076 1.075-3.119 1.147-3.71 1.147-.61 0-2.652-.09-3.71-1.147a.4.4 0 0 1 0-.573.4.4 0 0 1 .574 0c.68.68 2.114.914 3.136.914 1.022 0 2.473-.233 3.136-.914a.4.4 0 0 1 .574 0 .436.436 0 0 1 0 .573Zm-.287-2.563a1.56 1.56 0 0 1 0-3.118c.86 0 1.56.699 1.56 1.56 0 .841-.7 1.558-1.56 1.558Z\" />\n\t</SVG>\n);\nexport const embedTumblrIcon = {\n\tforeground: '#35465c',\n\tsrc: (\n\t\t<SVG viewBox=\"0 0 24 24\">\n\t\t\t<Path d=\"M19 3H5a2 2 0 00-2 2v14c0 1.1.9 2 2 2h14a2 2 0 002-2V5a2 2 0 00-2-2zm-5.69 14.66c-2.72 0-3.1-1.9-3.1-3.16v-3.56H8.49V8.99c1.7-.62 2.54-1.99 2.64-2.87 0-.06.06-.41.06-.58h1.9v3.1h2.17v2.3h-2.18v3.1c0 .47.13 1.3 1.2 1.26h1.1v2.36c-1.01.02-2.07 0-2.07 0z\" />\n\t\t</SVG>\n\t),\n};\nexport const embedAmazonIcon = (\n\t<SVG viewBox=\"0 0 24 24\">\n\t\t<Path d=\"M18.42 14.58c-.51-.66-1.05-1.23-1.05-2.5V7.87c0-1.8.15-3.45-1.2-4.68-1.05-1.02-2.79-1.35-4.14-1.35-2.6 0-5.52.96-6.12 4.14-.06.36.18.54.4.57l2.66.3c.24-.03.42-.27.48-.5.24-1.12 1.17-1.63 2.2-1.63.56 0 1.22.21 1.55.7.4.56.33 1.31.33 1.97v.36c-1.59.18-3.66.27-5.16.93a4.63 4.63 0 0 0-2.93 4.44c0 2.82 1.8 4.23 4.1 4.23 1.95 0 3.03-.45 4.53-1.98.51.72.66 1.08 1.59 1.83.18.09.45.09.63-.1v.04l2.1-1.8c.24-.21.2-.48.03-.75zm-5.4-1.2c-.45.75-1.14 1.23-1.92 1.23-1.05 0-1.65-.81-1.65-1.98 0-2.31 2.1-2.73 4.08-2.73v.6c0 1.05.03 1.92-.5 2.88z\" />\n\t\t<Path d=\"M21.69 19.2a17.62 17.62 0 0 1-21.6-1.57c-.23-.2 0-.5.28-.33a23.88 23.88 0 0 0 20.93 1.3c.45-.19.84.3.39.6z\" />\n\t\t<Path d=\"M22.8 17.96c-.36-.45-2.22-.2-3.1-.12-.23.03-.3-.18-.05-.36 1.5-1.05 3.96-.75 4.26-.39.3.36-.1 2.82-1.5 4.02-.21.18-.42.1-.3-.15.3-.8 1.02-2.58.69-3z\" />\n\t</SVG>\n);\nexport const embedAnimotoIcon = (\n\t<SVG viewBox=\"0 0 24 24\">\n\t\t<Path\n\t\t\td=\"m.0206909 21 19.8160091-13.07806 3.5831 6.20826z\"\n\t\t\tfill=\"#4bc7ee\"\n\t\t/>\n\t\t<Path\n\t\t\td=\"m23.7254 19.0205-10.1074-17.18468c-.6421-1.114428-1.7087-1.114428-2.3249 0l-11.2931 19.16418h22.5655c1.279 0 1.8019-.8905 1.1599-1.9795z\"\n\t\t\tfill=\"#d4cdcb\"\n\t\t/>\n\t\t<Path\n\t\t\td=\"m.0206909 21 15.2439091-16.38571 4.3029 7.32271z\"\n\t\t\tfill=\"#c3d82e\"\n\t\t/>\n\t\t<Path\n\t\t\td=\"m13.618 1.83582c-.6421-1.114428-1.7087-1.114428-2.3249 0l-11.2931 19.16418 15.2646-16.38573z\"\n\t\t\tfill=\"#e4ecb0\"\n\t\t/>\n\t\t<Path d=\"m.0206909 21 19.5468091-9.063 1.6621 2.8344z\" fill=\"#209dbd\" />\n\t\t<Path\n\t\t\td=\"m.0206909 21 17.9209091-11.82623 1.6259 2.76323z\"\n\t\t\tfill=\"#7cb3c9\"\n\t\t/>\n\t</SVG>\n);\nexport const embedDailymotionIcon = (\n\t<SVG viewBox=\"0 0 24 24\">\n\t\t<Path\n\t\t\td=\"M11.903 16.568c-1.82 0-3.124-1.281-3.124-2.967a2.987 2.987 0 0 1 2.989-2.989c1.663 0 2.944 1.304 2.944 3.034 0 1.663-1.281 2.922-2.81 2.922ZM17.997 3l-3.308.73v5.107c-.809-1.034-2.045-1.37-3.505-1.37-1.529 0-2.9.561-4.023 1.662-1.259 1.214-1.933 2.764-1.933 4.495 0 1.888.72 3.506 2.113 4.742 1.056.944 2.314 1.415 3.775 1.415 1.438 0 2.517-.382 3.573-1.415v1.415h3.308V3Z\"\n\t\t\tfill=\"#333436\"\n\t\t/>\n\t</SVG>\n);\nexport const embedPinterestIcon = (\n\t<SVG width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\">\n\t\t<Path d=\"M12.289,2C6.617,2,3.606,5.648,3.606,9.622c0,1.846,1.025,4.146,2.666,4.878c0.25,0.111,0.381,0.063,0.439-0.169 c0.044-0.175,0.267-1.029,0.365-1.428c0.032-0.128,0.017-0.237-0.091-0.362C6.445,11.911,6.01,10.75,6.01,9.668 c0-2.777,2.194-5.464,5.933-5.464c3.23,0,5.49,2.108,5.49,5.122c0,3.407-1.794,5.768-4.13,5.768c-1.291,0-2.257-1.021-1.948-2.277 c0.372-1.495,1.089-3.112,1.089-4.191c0-0.967-0.542-1.775-1.663-1.775c-1.319,0-2.379,1.309-2.379,3.059 c0,1.115,0.394,1.869,0.394,1.869s-1.302,5.279-1.54,6.261c-0.405,1.666,0.053,4.368,0.094,4.604 c0.021,0.126,0.167,0.169,0.25,0.063c0.129-0.165,1.699-2.419,2.142-4.051c0.158-0.59,0.817-2.995,0.817-2.995 c0.43,0.784,1.681,1.446,3.013,1.446c3.963,0,6.822-3.494,6.822-7.833C20.394,5.112,16.849,2,12.289,2\" />\n\t</SVG>\n);\n\nexport const embedWolframIcon = (\n\t<SVG viewBox=\"0 0 44 44\">\n\t\t<Path d=\"M32.59521,22.001l4.31885-4.84473-6.34131-1.38379.646-6.459-5.94336,2.61035L22,6.31934l-3.27344,5.60351L12.78418,9.3125l.645,6.458L7.08643,17.15234,11.40479,21.999,7.08594,26.84375l6.34131,1.38379-.64551,6.458,5.94287-2.60938L22,37.68066l3.27344-5.60351,5.94287,2.61035-.64551-6.458,6.34277-1.38183Zm.44385,2.75244L30.772,23.97827l-1.59558-2.07391,1.97888.735Zm-8.82147,6.1579L22.75,33.424V30.88977l1.52228-2.22168ZM18.56226,13.48816,19.819,15.09534l-2.49219-.88642L15.94037,12.337Zm6.87719.00116,2.62043-1.15027-1.38654,1.86981L24.183,15.0946Zm3.59357,2.6029-1.22546,1.7381.07525-2.73486,1.44507-1.94867ZM22,29.33008l-2.16406-3.15686L22,23.23688l2.16406,2.93634Zm-4.25458-9.582-.10528-3.836,3.60986,1.284v3.73242Zm5.00458-2.552,3.60986-1.284-.10528,3.836L22.75,20.92853Zm-7.78174-1.10559-.29352-2.94263,1.44245,1.94739.07519,2.73321Zm2.30982,5.08319,3.50817,1.18164-2.16247,2.9342-3.678-1.08447Zm2.4486,7.49285L21.25,30.88977v2.53485L19.78052,30.91Zm3.48707-6.31121,3.50817-1.18164,2.33228,3.03137-3.678,1.08447Zm10.87219-4.28113-2.714,3.04529L28.16418,19.928l1.92176-2.72565ZM24.06036,12.81769l-2.06012,2.6322-2.059-2.63318L22,9.292ZM9.91455,18.07227l4.00079-.87195,1.921,2.72735-3.20794,1.19019Zm2.93024,4.565,1.9801-.73462L13.228,23.97827l-2.26838.77429Zm-1.55591,3.58819L13.701,25.4021l2.64935.78058-2.14447.67853Zm3.64868,1.977L18.19,27.17334l.08313,3.46332L14.52979,32.2793Zm10.7876,2.43549.08447-3.464,3.25165,1.03052.407,4.07684Zm4.06824-3.77478-2.14545-.68,2.65063-.781,2.41266.825Z\" />\n\t</SVG>\n);\n\nexport const embedPocketCastsIcon = {\n\tforeground: '#f43e37',\n\tsrc: (\n\t\t<SVG\n\t\t\twidth=\"24\"\n\t\t\theight=\"24\"\n\t\t\tviewBox=\"0 0 24 24\"\n\t\t\tfill=\"none\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<Path\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M24,12A12,12,0,1,1,12,0,12,12,0,0,1,24,12Z\"\n\t\t\t/>\n\t\t\t<Path\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M2.67,12a9.33,9.33,0,0,1,18.66,0H19a7,7,0,1,0-7,7v2.33A9.33,9.33,0,0,1,2.67,12ZM12,17.6A5.6,5.6,0,1,1,17.6,12h-2A3.56,3.56,0,1,0,12,15.56Z\"\n\t\t\t\tfill=\"#fff\"\n\t\t\t/>\n\t\t</SVG>\n\t),\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,CAAC,EAAEC,IAAI,EAAEC,GAAG,QAAQ,uBAAuB;AAEpD,OAAO,MAAMC,gBAAgB,GAC5BC,aAAA,CAACF,GAAG;EAACG,OAAO,EAAC,WA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EAAC0B,KAAK,EAAC,IAAI;EAACC,MAAM,EAAC,IAAI;EAACxB,OAAO,EAAC,WAAW;EAACyB,OAAO,EAAC;AAAK,GAC5D1B,aAAA,CAACH,IAAI;EAACM,CAAC,EAAC;AAA0uB,CAAE,CAChvB,CACL;AAED,OAAO,MAAMwB,gBAAgB,GAC5B3B,aAAA,CAACF,GAAG;EAACG,OAAO,EAAC;AAAW,GACvBD,aAAA,CAACH,IAAI;EAACM,CAAC,EAAC;AAAq9C,CAAE,CAC39C,CACL;AAED,OAAO,MAAMyB,oBAAoB,GAAG;EACnCpB,UAAU,EAAE,SAAS;EACrBC,GAAG,EACFT,aAAA,CAACF,GAAG;IACH0B,KAAK,EAAC,IAAI;IACVC,MAAM,EAAC,IAAI;IACXxB,OAAO,EAAC,WAAW;IACnBoB,IAAI,EAAC,MAAM;IACXnB,KAAK,EAAC;EAA4B,GAElCF,aAAA,CAACH,IAAI;IACJgC,QAAQ,EAAC,SAAS;IAClBC,QAAQ,EAAC,SAAS;IAClB3B,CAAC,EAAC;EAA4C,CAC9C,CAAC,EACFH,aAAA,CAACH,IAAI;IACJgC,QAAQ,EAAC,SAAS;IAClBC,QAAQ,EAAC,SAAS;IAClB3B,CAAC,EAAC,4IAA4I;IAC9IkB,IAAI,EAAC;EAAM,CACX,CACG;AAEP,CAAC"}
|
|
@@ -8,7 +8,7 @@ import memoize from 'memize';
|
|
|
8
8
|
/**
|
|
9
9
|
* WordPress dependencies
|
|
10
10
|
*/
|
|
11
|
-
import { privateApis as
|
|
11
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
12
12
|
import { renderToString } from '@wordpress/element';
|
|
13
13
|
import { createBlock, getBlockType, getBlockVariations } from '@wordpress/blocks';
|
|
14
14
|
|
|
@@ -29,8 +29,8 @@ const metadata = {
|
|
|
29
29
|
__experimentalRole: "content"
|
|
30
30
|
},
|
|
31
31
|
caption: {
|
|
32
|
-
type: "
|
|
33
|
-
source: "
|
|
32
|
+
type: "rich-text",
|
|
33
|
+
source: "rich-text",
|
|
34
34
|
selector: "figcaption",
|
|
35
35
|
__experimentalRole: "content"
|
|
36
36
|
},
|
|
@@ -71,9 +71,6 @@ import { unlock } from '../lock-unlock';
|
|
|
71
71
|
const {
|
|
72
72
|
name: DEFAULT_EMBED_BLOCK
|
|
73
73
|
} = metadata;
|
|
74
|
-
const {
|
|
75
|
-
kebabCase
|
|
76
|
-
} = unlock(blockEditorPrivateApis);
|
|
77
74
|
|
|
78
75
|
/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */
|
|
79
76
|
|
|
@@ -305,6 +302,9 @@ export const getAttributesFromPreview = memoize((preview, title, currentClassNam
|
|
|
305
302
|
html,
|
|
306
303
|
provider_name: providerName
|
|
307
304
|
} = preview;
|
|
305
|
+
const {
|
|
306
|
+
kebabCase
|
|
307
|
+
} = unlock(componentsPrivateApis);
|
|
308
308
|
const providerNameSlug = kebabCase((providerName || title).toLowerCase());
|
|
309
309
|
if (isFromWordPress(html)) {
|
|
310
310
|
type = WP_EMBED_TYPE;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","memoize","privateApis","blockEditorPrivateApis","renderToString","createBlock","getBlockType","getBlockVariations","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","url","type","__experimentalRole","caption","source","selector","providerNameSlug","allowResponsive","responsive","previewable","supports","align","spacing","margin","editorStyle","style","ASPECT_RATIOS","WP_EMBED_TYPE","unlock","DEFAULT_EMBED_BLOCK","kebabCase","getEmbedInfoByProvider","provider","find","matchesPatterns","patterns","some","pattern","match","findMoreSuitableBlock","isFromWordPress","html","includes","getPhotoHtml","photo","imageUrl","thumbnail_url","photoPreview","createElement","src","alt","width","createUpgradedEmbedBlock","props","attributesFromPreview","preview","restAttributes","matchedBlock","isCurrentBlockWP","shouldCreateNewBlock","wpVariation","hasAspectRatioClass","existingClassNames","className","removeAspectRatioClasses","aspectRatioClassNames","reduce","accumulator","getClassNames","previewDocument","document","implementation","createHTMLDocument","body","innerHTML","iframe","querySelector","height","aspectRatio","toFixed","ratioIndex","length","potentialRatio","ratio","ratioDiff","fallback","onReplace","link","href","content","getAttributesFromPreview","currentClassNames","isResponsive","provider_name","providerName","toLowerCase","getMergedAttributesWithPreview","currentAttributes"],"sources":["@wordpress/block-library/src/embed/util.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames/dedupe';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { renderToString } from '@wordpress/element';\nimport {\n\tcreateBlock,\n\tgetBlockType,\n\tgetBlockVariations,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport { ASPECT_RATIOS, WP_EMBED_TYPE } from './constants';\nimport { unlock } from '../lock-unlock';\n\nconst { name: DEFAULT_EMBED_BLOCK } = metadata;\nconst { kebabCase } = unlock( blockEditorPrivateApis );\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * Returns the embed block's information by matching the provided service provider\n *\n * @param {string} provider The embed block's provider\n * @return {WPBlockVariation} The embed block's information\n */\nexport const getEmbedInfoByProvider = ( provider ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === provider\n\t);\n\n/**\n * Returns true if any of the regular expressions match the URL.\n *\n * @param {string} url The URL to test.\n * @param {Array} patterns The list of regular expressions to test agains.\n * @return {boolean} True if any of the regular expressions match the URL.\n */\nexport const matchesPatterns = ( url, patterns = [] ) =>\n\tpatterns.some( ( pattern ) => url.match( pattern ) );\n\n/**\n * Finds the block variation that should be used for the URL,\n * based on the provided URL and the variation's patterns.\n *\n * @param {string} url The URL to test.\n * @return {WPBlockVariation} The block variation that should be used for this URL\n */\nexport const findMoreSuitableBlock = ( url ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find( ( { patterns } ) =>\n\t\tmatchesPatterns( url, patterns )\n\t);\n\nexport const isFromWordPress = ( html ) =>\n\thtml && html.includes( 'class=\"wp-embedded-content\"' );\n\nexport const getPhotoHtml = ( photo ) => {\n\t// If full image url not found use thumbnail.\n\tconst imageUrl = photo.url || photo.thumbnail_url;\n\n\t// 100% width for the preview so it fits nicely into the document, some \"thumbnails\" are\n\t// actually the full size photo.\n\tconst photoPreview = (\n\t\t<p>\n\t\t\t<img src={ imageUrl } alt={ photo.title } width=\"100%\" />\n\t\t</p>\n\t);\n\treturn renderToString( photoPreview );\n};\n\n/**\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} [attributesFromPreview] Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\nexport const createUpgradedEmbedBlock = (\n\tprops,\n\tattributesFromPreview = {}\n) => {\n\tconst { preview, attributes = {} } = props;\n\tconst { url, providerNameSlug, type, ...restAttributes } = attributes;\n\n\tif ( ! url || ! getBlockType( DEFAULT_EMBED_BLOCK ) ) return;\n\n\tconst matchedBlock = findMoreSuitableBlock( url );\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tconst isCurrentBlockWP =\n\t\tproviderNameSlug === 'wordpress' || type === WP_EMBED_TYPE;\n\t// If current block is not WordPress and a more suitable block found\n\t// that is different from the current one, create the new matched block.\n\tconst shouldCreateNewBlock =\n\t\t! isCurrentBlockWP &&\n\t\tmatchedBlock &&\n\t\t( matchedBlock.attributes.providerNameSlug !== providerNameSlug ||\n\t\t\t! providerNameSlug );\n\tif ( shouldCreateNewBlock ) {\n\t\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\t\turl,\n\t\t\t...restAttributes,\n\t\t\t...matchedBlock.attributes,\n\t\t} );\n\t}\n\n\tconst wpVariation = getBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === 'wordpress'\n\t);\n\n\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\tif (\n\t\t! wpVariation ||\n\t\t! preview ||\n\t\t! isFromWordPress( preview.html ) ||\n\t\tisCurrentBlockWP\n\t) {\n\t\treturn;\n\t}\n\n\t// This is not the WordPress embed block so transform it into one.\n\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\turl,\n\t\t...wpVariation.attributes,\n\t\t// By now we have the preview, but when the new block first renders, it\n\t\t// won't have had all the attributes set, and so won't get the correct\n\t\t// type and it won't render correctly. So, we pass through the current attributes\n\t\t// here so that the initial render works when we switch to the WordPress\n\t\t// block. This only affects the WordPress block because it can't be\n\t\t// rendered in the usual Sandbox (it has a sandbox of its own) and it\n\t\t// relies on the preview to set the correct render type.\n\t\t...attributesFromPreview,\n\t} );\n};\n\n/**\n * Determine if the block already has an aspect ratio class applied.\n *\n * @param {string} existingClassNames Existing block classes.\n * @return {boolean} True or false if the classnames contain an aspect ratio class.\n */\nexport const hasAspectRatioClass = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\treturn false;\n\t}\n\treturn ASPECT_RATIOS.some( ( { className } ) =>\n\t\texistingClassNames.includes( className )\n\t);\n};\n\n/**\n * Removes all previously set aspect ratio related classes and return the rest\n * existing class names.\n *\n * @param {string} existingClassNames Any existing class names.\n * @return {string} The class names without any aspect ratio related class.\n */\nexport const removeAspectRatioClasses = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\t// Avoids extraneous work and also, by returning the same value as\n\t\t// received, ensures the post is not dirtied by a change of the block\n\t\t// attribute from `undefined` to an emtpy string.\n\t\treturn existingClassNames;\n\t}\n\tconst aspectRatioClassNames = ASPECT_RATIOS.reduce(\n\t\t( accumulator, { className } ) => {\n\t\t\taccumulator[ className ] = false;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ 'wp-has-aspect-ratio': false }\n\t);\n\treturn classnames( existingClassNames, aspectRatioClassNames );\n};\n\n/**\n * Returns class names with any relevant responsive aspect ratio names.\n *\n * @param {string} html The preview HTML that possibly contains an iframe with width and height set.\n * @param {string} existingClassNames Any existing class names.\n * @param {boolean} allowResponsive If the responsive class names should be added, or removed.\n * @return {string} Deduped class names.\n */\nexport function getClassNames(\n\thtml,\n\texistingClassNames,\n\tallowResponsive = true\n) {\n\tif ( ! allowResponsive ) {\n\t\treturn removeAspectRatioClasses( existingClassNames );\n\t}\n\n\tconst previewDocument = document.implementation.createHTMLDocument( '' );\n\tpreviewDocument.body.innerHTML = html;\n\tconst iframe = previewDocument.body.querySelector( 'iframe' );\n\n\t// If we have a fixed aspect iframe, and it's a responsive embed block.\n\tif ( iframe && iframe.height && iframe.width ) {\n\t\tconst aspectRatio = ( iframe.width / iframe.height ).toFixed( 2 );\n\t\t// Given the actual aspect ratio, find the widest ratio to support it.\n\t\tfor (\n\t\t\tlet ratioIndex = 0;\n\t\t\tratioIndex < ASPECT_RATIOS.length;\n\t\t\tratioIndex++\n\t\t) {\n\t\t\tconst potentialRatio = ASPECT_RATIOS[ ratioIndex ];\n\t\t\tif ( aspectRatio >= potentialRatio.ratio ) {\n\t\t\t\t// Evaluate the difference between actual aspect ratio and closest match.\n\t\t\t\t// If the difference is too big, do not scale the embed according to aspect ratio.\n\t\t\t\tconst ratioDiff = aspectRatio - potentialRatio.ratio;\n\t\t\t\tif ( ratioDiff > 0.1 ) {\n\t\t\t\t\t// No close aspect ratio match found.\n\t\t\t\t\treturn removeAspectRatioClasses( existingClassNames );\n\t\t\t\t}\n\t\t\t\t// Close aspect ratio match found.\n\t\t\t\treturn classnames(\n\t\t\t\t\tremoveAspectRatioClasses( existingClassNames ),\n\t\t\t\t\tpotentialRatio.className,\n\t\t\t\t\t'wp-has-aspect-ratio'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn existingClassNames;\n}\n\n/**\n * Fallback behaviour for unembeddable URLs.\n * Creates a paragraph block containing a link to the URL, and calls `onReplace`.\n *\n * @param {string} url The URL that could not be embedded.\n * @param {Function} onReplace Function to call with the created fallback block.\n */\nexport function fallback( url, onReplace ) {\n\tconst link = <a href={ url }>{ url }</a>;\n\tonReplace(\n\t\tcreateBlock( 'core/paragraph', { content: renderToString( link ) } )\n\t);\n}\n\n/***\n * Gets block attributes based on the preview and responsive state.\n *\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {Object} currentClassNames The block's current class names.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @param {boolean} allowResponsive Apply responsive classes to fixed size content.\n * @return {Object} Attributes and values.\n */\nexport const getAttributesFromPreview = memoize(\n\t(\n\t\tpreview,\n\t\ttitle,\n\t\tcurrentClassNames,\n\t\tisResponsive,\n\t\tallowResponsive = true\n\t) => {\n\t\tif ( ! preview ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst attributes = {};\n\t\t// Some plugins only return HTML with no type info, so default this to 'rich'.\n\t\tlet { type = 'rich' } = preview;\n\t\t// If we got a provider name from the API, use it for the slug, otherwise we use the title,\n\t\t// because not all embed code gives us a provider name.\n\t\tconst { html, provider_name: providerName } = preview;\n\t\tconst providerNameSlug = kebabCase(\n\t\t\t( providerName || title ).toLowerCase()\n\t\t);\n\n\t\tif ( isFromWordPress( html ) ) {\n\t\t\ttype = WP_EMBED_TYPE;\n\t\t}\n\n\t\tif ( html || 'photo' === type ) {\n\t\t\tattributes.type = type;\n\t\t\tattributes.providerNameSlug = providerNameSlug;\n\t\t}\n\n\t\t// Aspect ratio classes are removed when the embed URL is updated.\n\t\t// If the embed already has an aspect ratio class, that means the URL has not changed.\n\t\t// Which also means no need to regenerate it with getClassNames.\n\t\tif ( hasAspectRatioClass( currentClassNames ) ) {\n\t\t\treturn attributes;\n\t\t}\n\n\t\tattributes.className = getClassNames(\n\t\t\thtml,\n\t\t\tcurrentClassNames,\n\t\t\tisResponsive && allowResponsive\n\t\t);\n\n\t\treturn attributes;\n\t}\n);\n\n/**\n * Returns the attributes derived from the preview, merged with the current attributes.\n *\n * @param {Object} currentAttributes The current attributes of the block.\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @return {Object} Merged attributes.\n */\nexport const getMergedAttributesWithPreview = (\n\tcurrentAttributes,\n\tpreview,\n\ttitle,\n\tisResponsive\n) => {\n\tconst { allowResponsive, className } = currentAttributes;\n\n\treturn {\n\t\t...currentAttributes,\n\t\t...getAttributesFromPreview(\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tclassName,\n\t\t\tisResponsive,\n\t\t\tallowResponsive\n\t\t),\n\t};\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,OAAO,MAAM,QAAQ;;AAE5B;AACA;AACA;AACA,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SACCC,WAAW,EACXC,YAAY,EACZC,kBAAkB,QACZ,mBAAmB;;AAE1B;AACA;AACA;AAFA,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,GAAA;MAAAC,IAAA;MAAAC,kBAAA;IAAA;IAAAC,OAAA;MAAAF,IAAA;MAAAG,MAAA;MAAAC,QAAA;MAAAH,kBAAA;IAAA;IAAAD,IAAA;MAAAA,IAAA;MAAAC,kBAAA;IAAA;IAAAI,gBAAA;MAAAL,IAAA;MAAAC,kBAAA;IAAA;IAAAK,eAAA;MAAAN,IAAA;MAAA;IAAA;IAAAO,UAAA;MAAAP,IAAA;MAAA;MAAAC,kBAAA;IAAA;IAA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AK,EACL0D,SAAS,EACT6B,YAAY,EACZ3E,eACD;EACD,CAAC;AACF,CAAC"}
|
|
1
|
+
{"version":3,"names":["classnames","memoize","privateApis","componentsPrivateApis","renderToString","createBlock","getBlockType","getBlockVariations","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","url","type","__experimentalRole","caption","source","selector","providerNameSlug","allowResponsive","responsive","previewable","supports","align","spacing","margin","editorStyle","style","ASPECT_RATIOS","WP_EMBED_TYPE","unlock","DEFAULT_EMBED_BLOCK","getEmbedInfoByProvider","provider","find","matchesPatterns","patterns","some","pattern","match","findMoreSuitableBlock","isFromWordPress","html","includes","getPhotoHtml","photo","imageUrl","thumbnail_url","photoPreview","createElement","src","alt","width","createUpgradedEmbedBlock","props","attributesFromPreview","preview","restAttributes","matchedBlock","isCurrentBlockWP","shouldCreateNewBlock","wpVariation","hasAspectRatioClass","existingClassNames","className","removeAspectRatioClasses","aspectRatioClassNames","reduce","accumulator","getClassNames","previewDocument","document","implementation","createHTMLDocument","body","innerHTML","iframe","querySelector","height","aspectRatio","toFixed","ratioIndex","length","potentialRatio","ratio","ratioDiff","fallback","onReplace","link","href","content","getAttributesFromPreview","currentClassNames","isResponsive","provider_name","providerName","kebabCase","toLowerCase","getMergedAttributesWithPreview","currentAttributes"],"sources":["@wordpress/block-library/src/embed/util.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames/dedupe';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { renderToString } from '@wordpress/element';\nimport {\n\tcreateBlock,\n\tgetBlockType,\n\tgetBlockVariations,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport { ASPECT_RATIOS, WP_EMBED_TYPE } from './constants';\nimport { unlock } from '../lock-unlock';\n\nconst { name: DEFAULT_EMBED_BLOCK } = metadata;\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * Returns the embed block's information by matching the provided service provider\n *\n * @param {string} provider The embed block's provider\n * @return {WPBlockVariation} The embed block's information\n */\nexport const getEmbedInfoByProvider = ( provider ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === provider\n\t);\n\n/**\n * Returns true if any of the regular expressions match the URL.\n *\n * @param {string} url The URL to test.\n * @param {Array} patterns The list of regular expressions to test agains.\n * @return {boolean} True if any of the regular expressions match the URL.\n */\nexport const matchesPatterns = ( url, patterns = [] ) =>\n\tpatterns.some( ( pattern ) => url.match( pattern ) );\n\n/**\n * Finds the block variation that should be used for the URL,\n * based on the provided URL and the variation's patterns.\n *\n * @param {string} url The URL to test.\n * @return {WPBlockVariation} The block variation that should be used for this URL\n */\nexport const findMoreSuitableBlock = ( url ) =>\n\tgetBlockVariations( DEFAULT_EMBED_BLOCK )?.find( ( { patterns } ) =>\n\t\tmatchesPatterns( url, patterns )\n\t);\n\nexport const isFromWordPress = ( html ) =>\n\thtml && html.includes( 'class=\"wp-embedded-content\"' );\n\nexport const getPhotoHtml = ( photo ) => {\n\t// If full image url not found use thumbnail.\n\tconst imageUrl = photo.url || photo.thumbnail_url;\n\n\t// 100% width for the preview so it fits nicely into the document, some \"thumbnails\" are\n\t// actually the full size photo.\n\tconst photoPreview = (\n\t\t<p>\n\t\t\t<img src={ imageUrl } alt={ photo.title } width=\"100%\" />\n\t\t</p>\n\t);\n\treturn renderToString( photoPreview );\n};\n\n/**\n * Creates a more suitable embed block based on the passed in props\n * and attributes generated from an embed block's preview.\n *\n * We require `attributesFromPreview` to be generated from the latest attributes\n * and preview, and because of the way the react lifecycle operates, we can't\n * guarantee that the attributes contained in the block's props are the latest\n * versions, so we require that these are generated separately.\n * See `getAttributesFromPreview` in the generated embed edit component.\n *\n * @param {Object} props The block's props.\n * @param {Object} [attributesFromPreview] Attributes generated from the block's most up to date preview.\n * @return {Object|undefined} A more suitable embed block if one exists.\n */\nexport const createUpgradedEmbedBlock = (\n\tprops,\n\tattributesFromPreview = {}\n) => {\n\tconst { preview, attributes = {} } = props;\n\tconst { url, providerNameSlug, type, ...restAttributes } = attributes;\n\n\tif ( ! url || ! getBlockType( DEFAULT_EMBED_BLOCK ) ) return;\n\n\tconst matchedBlock = findMoreSuitableBlock( url );\n\n\t// WordPress blocks can work on multiple sites, and so don't have patterns,\n\t// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.\n\tconst isCurrentBlockWP =\n\t\tproviderNameSlug === 'wordpress' || type === WP_EMBED_TYPE;\n\t// If current block is not WordPress and a more suitable block found\n\t// that is different from the current one, create the new matched block.\n\tconst shouldCreateNewBlock =\n\t\t! isCurrentBlockWP &&\n\t\tmatchedBlock &&\n\t\t( matchedBlock.attributes.providerNameSlug !== providerNameSlug ||\n\t\t\t! providerNameSlug );\n\tif ( shouldCreateNewBlock ) {\n\t\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\t\turl,\n\t\t\t...restAttributes,\n\t\t\t...matchedBlock.attributes,\n\t\t} );\n\t}\n\n\tconst wpVariation = getBlockVariations( DEFAULT_EMBED_BLOCK )?.find(\n\t\t( { name } ) => name === 'wordpress'\n\t);\n\n\t// We can't match the URL for WordPress embeds, we have to check the HTML instead.\n\tif (\n\t\t! wpVariation ||\n\t\t! preview ||\n\t\t! isFromWordPress( preview.html ) ||\n\t\tisCurrentBlockWP\n\t) {\n\t\treturn;\n\t}\n\n\t// This is not the WordPress embed block so transform it into one.\n\treturn createBlock( DEFAULT_EMBED_BLOCK, {\n\t\turl,\n\t\t...wpVariation.attributes,\n\t\t// By now we have the preview, but when the new block first renders, it\n\t\t// won't have had all the attributes set, and so won't get the correct\n\t\t// type and it won't render correctly. So, we pass through the current attributes\n\t\t// here so that the initial render works when we switch to the WordPress\n\t\t// block. This only affects the WordPress block because it can't be\n\t\t// rendered in the usual Sandbox (it has a sandbox of its own) and it\n\t\t// relies on the preview to set the correct render type.\n\t\t...attributesFromPreview,\n\t} );\n};\n\n/**\n * Determine if the block already has an aspect ratio class applied.\n *\n * @param {string} existingClassNames Existing block classes.\n * @return {boolean} True or false if the classnames contain an aspect ratio class.\n */\nexport const hasAspectRatioClass = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\treturn false;\n\t}\n\treturn ASPECT_RATIOS.some( ( { className } ) =>\n\t\texistingClassNames.includes( className )\n\t);\n};\n\n/**\n * Removes all previously set aspect ratio related classes and return the rest\n * existing class names.\n *\n * @param {string} existingClassNames Any existing class names.\n * @return {string} The class names without any aspect ratio related class.\n */\nexport const removeAspectRatioClasses = ( existingClassNames ) => {\n\tif ( ! existingClassNames ) {\n\t\t// Avoids extraneous work and also, by returning the same value as\n\t\t// received, ensures the post is not dirtied by a change of the block\n\t\t// attribute from `undefined` to an emtpy string.\n\t\treturn existingClassNames;\n\t}\n\tconst aspectRatioClassNames = ASPECT_RATIOS.reduce(\n\t\t( accumulator, { className } ) => {\n\t\t\taccumulator[ className ] = false;\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ 'wp-has-aspect-ratio': false }\n\t);\n\treturn classnames( existingClassNames, aspectRatioClassNames );\n};\n\n/**\n * Returns class names with any relevant responsive aspect ratio names.\n *\n * @param {string} html The preview HTML that possibly contains an iframe with width and height set.\n * @param {string} existingClassNames Any existing class names.\n * @param {boolean} allowResponsive If the responsive class names should be added, or removed.\n * @return {string} Deduped class names.\n */\nexport function getClassNames(\n\thtml,\n\texistingClassNames,\n\tallowResponsive = true\n) {\n\tif ( ! allowResponsive ) {\n\t\treturn removeAspectRatioClasses( existingClassNames );\n\t}\n\n\tconst previewDocument = document.implementation.createHTMLDocument( '' );\n\tpreviewDocument.body.innerHTML = html;\n\tconst iframe = previewDocument.body.querySelector( 'iframe' );\n\n\t// If we have a fixed aspect iframe, and it's a responsive embed block.\n\tif ( iframe && iframe.height && iframe.width ) {\n\t\tconst aspectRatio = ( iframe.width / iframe.height ).toFixed( 2 );\n\t\t// Given the actual aspect ratio, find the widest ratio to support it.\n\t\tfor (\n\t\t\tlet ratioIndex = 0;\n\t\t\tratioIndex < ASPECT_RATIOS.length;\n\t\t\tratioIndex++\n\t\t) {\n\t\t\tconst potentialRatio = ASPECT_RATIOS[ ratioIndex ];\n\t\t\tif ( aspectRatio >= potentialRatio.ratio ) {\n\t\t\t\t// Evaluate the difference between actual aspect ratio and closest match.\n\t\t\t\t// If the difference is too big, do not scale the embed according to aspect ratio.\n\t\t\t\tconst ratioDiff = aspectRatio - potentialRatio.ratio;\n\t\t\t\tif ( ratioDiff > 0.1 ) {\n\t\t\t\t\t// No close aspect ratio match found.\n\t\t\t\t\treturn removeAspectRatioClasses( existingClassNames );\n\t\t\t\t}\n\t\t\t\t// Close aspect ratio match found.\n\t\t\t\treturn classnames(\n\t\t\t\t\tremoveAspectRatioClasses( existingClassNames ),\n\t\t\t\t\tpotentialRatio.className,\n\t\t\t\t\t'wp-has-aspect-ratio'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn existingClassNames;\n}\n\n/**\n * Fallback behaviour for unembeddable URLs.\n * Creates a paragraph block containing a link to the URL, and calls `onReplace`.\n *\n * @param {string} url The URL that could not be embedded.\n * @param {Function} onReplace Function to call with the created fallback block.\n */\nexport function fallback( url, onReplace ) {\n\tconst link = <a href={ url }>{ url }</a>;\n\tonReplace(\n\t\tcreateBlock( 'core/paragraph', { content: renderToString( link ) } )\n\t);\n}\n\n/***\n * Gets block attributes based on the preview and responsive state.\n *\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {Object} currentClassNames The block's current class names.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @param {boolean} allowResponsive Apply responsive classes to fixed size content.\n * @return {Object} Attributes and values.\n */\nexport const getAttributesFromPreview = memoize(\n\t(\n\t\tpreview,\n\t\ttitle,\n\t\tcurrentClassNames,\n\t\tisResponsive,\n\t\tallowResponsive = true\n\t) => {\n\t\tif ( ! preview ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst attributes = {};\n\t\t// Some plugins only return HTML with no type info, so default this to 'rich'.\n\t\tlet { type = 'rich' } = preview;\n\t\t// If we got a provider name from the API, use it for the slug, otherwise we use the title,\n\t\t// because not all embed code gives us a provider name.\n\t\tconst { html, provider_name: providerName } = preview;\n\t\tconst { kebabCase } = unlock( componentsPrivateApis );\n\t\tconst providerNameSlug = kebabCase(\n\t\t\t( providerName || title ).toLowerCase()\n\t\t);\n\n\t\tif ( isFromWordPress( html ) ) {\n\t\t\ttype = WP_EMBED_TYPE;\n\t\t}\n\n\t\tif ( html || 'photo' === type ) {\n\t\t\tattributes.type = type;\n\t\t\tattributes.providerNameSlug = providerNameSlug;\n\t\t}\n\n\t\t// Aspect ratio classes are removed when the embed URL is updated.\n\t\t// If the embed already has an aspect ratio class, that means the URL has not changed.\n\t\t// Which also means no need to regenerate it with getClassNames.\n\t\tif ( hasAspectRatioClass( currentClassNames ) ) {\n\t\t\treturn attributes;\n\t\t}\n\n\t\tattributes.className = getClassNames(\n\t\t\thtml,\n\t\t\tcurrentClassNames,\n\t\t\tisResponsive && allowResponsive\n\t\t);\n\n\t\treturn attributes;\n\t}\n);\n\n/**\n * Returns the attributes derived from the preview, merged with the current attributes.\n *\n * @param {Object} currentAttributes The current attributes of the block.\n * @param {Object} preview The preview data.\n * @param {string} title The block's title, e.g. Twitter.\n * @param {boolean} isResponsive Boolean indicating if the block supports responsive content.\n * @return {Object} Merged attributes.\n */\nexport const getMergedAttributesWithPreview = (\n\tcurrentAttributes,\n\tpreview,\n\ttitle,\n\tisResponsive\n) => {\n\tconst { allowResponsive, className } = currentAttributes;\n\n\treturn {\n\t\t...currentAttributes,\n\t\t...getAttributesFromPreview(\n\t\t\tpreview,\n\t\t\ttitle,\n\t\t\tclassName,\n\t\t\tisResponsive,\n\t\t\tallowResponsive\n\t\t),\n\t};\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,OAAO,MAAM,QAAQ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AI,EAAG;IAC/BF,UAAU,CAACE,IAAI,GAAGA,IAAI;IACtBF,UAAU,CAACO,gBAAgB,GAAGA,gBAAgB;EAC/C;;EAEA;EACA;EACA;EACA,IAAK4C,mBAAmB,CAAE8B,iBAAkB,CAAC,EAAG;IAC/C,OAAOjF,UAAU;EAClB;EAEAA,UAAU,CAACqD,SAAS,GAAGK,aAAa,CACnC3B,IAAI,EACJkD,iBAAiB,EACjBC,YAAY,IAAI1E,eACjB,CAAC;EAED,OAAOR,UAAU;AAClB,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMuF,8BAA8B,GAAGA,CAC7CC,iBAAiB,EACjB3C,OAAO,EACPjD,KAAK,EACLsF,YAAY,KACR;EACJ,MAAM;IAAE1E,eAAe;IAAE6C;EAAU,CAAC,GAAGmC,iBAAiB;EAExD,OAAO;IACN,GAAGA,iBAAiB;IACpB,GAAGR,wBAAwB,CAC1BnC,OAAO,EACPjD,KAAK,EACLyD,SAAS,EACT6B,YAAY,EACZ1E,eACD;EACD,CAAC;AACF,CAAC"}
|
|
@@ -53,7 +53,6 @@ function FileEdit({
|
|
|
53
53
|
}) {
|
|
54
54
|
const {
|
|
55
55
|
id,
|
|
56
|
-
fileId,
|
|
57
56
|
fileName,
|
|
58
57
|
href,
|
|
59
58
|
textLinkHref,
|
|
@@ -64,57 +63,50 @@ function FileEdit({
|
|
|
64
63
|
previewHeight
|
|
65
64
|
} = attributes;
|
|
66
65
|
const {
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
getSettings
|
|
67
|
+
} = useSelect(blockEditorStore);
|
|
68
|
+
const {
|
|
69
|
+
media
|
|
69
70
|
} = useSelect(select => ({
|
|
70
|
-
media: id === undefined ? undefined : select(coreStore).getMedia(id)
|
|
71
|
-
mediaUpload: select(blockEditorStore).getSettings().mediaUpload
|
|
71
|
+
media: id === undefined ? undefined : select(coreStore).getMedia(id)
|
|
72
72
|
}), [id]);
|
|
73
73
|
const {
|
|
74
74
|
createErrorNotice
|
|
75
75
|
} = useDispatch(noticesStore);
|
|
76
76
|
const {
|
|
77
|
-
toggleSelection
|
|
78
|
-
__unstableMarkNextChangeAsNotPersistent
|
|
77
|
+
toggleSelection
|
|
79
78
|
} = useDispatch(blockEditorStore);
|
|
80
79
|
useEffect(() => {
|
|
81
80
|
// Upload a file drag-and-dropped into the editor.
|
|
82
81
|
if (isBlobURL(href)) {
|
|
83
82
|
const file = getBlobByURL(href);
|
|
84
|
-
mediaUpload({
|
|
83
|
+
getSettings().mediaUpload({
|
|
85
84
|
filesList: [file],
|
|
86
85
|
onFileChange: ([newMedia]) => onSelectFile(newMedia),
|
|
87
86
|
onError: onUploadError
|
|
88
87
|
});
|
|
89
88
|
revokeBlobURL(href);
|
|
90
89
|
}
|
|
91
|
-
if (downloadButtonText
|
|
90
|
+
if (RichText.isEmpty(downloadButtonText)) {
|
|
92
91
|
setAttributes({
|
|
93
92
|
downloadButtonText: _x('Download', 'button label')
|
|
94
93
|
});
|
|
95
94
|
}
|
|
96
95
|
}, []);
|
|
97
|
-
useEffect(() => {
|
|
98
|
-
if (!fileId && href) {
|
|
99
|
-
// Add a unique fileId to each file block.
|
|
100
|
-
__unstableMarkNextChangeAsNotPersistent();
|
|
101
|
-
setAttributes({
|
|
102
|
-
fileId: `wp-block-file--media-${clientId}`
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}, [href, fileId, clientId]);
|
|
106
96
|
function onSelectFile(newMedia) {
|
|
107
|
-
if (newMedia
|
|
108
|
-
|
|
109
|
-
setAttributes({
|
|
110
|
-
href: newMedia.url,
|
|
111
|
-
fileName: newMedia.title,
|
|
112
|
-
textLinkHref: newMedia.url,
|
|
113
|
-
id: newMedia.id,
|
|
114
|
-
displayPreview: isPdf ? true : undefined,
|
|
115
|
-
previewHeight: isPdf ? 600 : undefined
|
|
116
|
-
});
|
|
97
|
+
if (!newMedia || !newMedia.url) {
|
|
98
|
+
return;
|
|
117
99
|
}
|
|
100
|
+
const isPdf = newMedia.url.endsWith('.pdf');
|
|
101
|
+
setAttributes({
|
|
102
|
+
href: newMedia.url,
|
|
103
|
+
fileName: newMedia.title,
|
|
104
|
+
textLinkHref: newMedia.url,
|
|
105
|
+
id: newMedia.id,
|
|
106
|
+
displayPreview: isPdf ? true : undefined,
|
|
107
|
+
previewHeight: isPdf ? 600 : undefined,
|
|
108
|
+
fileId: `wp-block-file--media-${clientId}`
|
|
109
|
+
});
|
|
118
110
|
}
|
|
119
111
|
function onUploadError(message) {
|
|
120
112
|
setAttributes({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","getBlobByURL","isBlobURL","revokeBlobURL","__unstableGetAnimateClassName","getAnimateClassName","ResizableBox","ToolbarButton","useSelect","useDispatch","BlockControls","BlockIcon","MediaPlaceholder","MediaReplaceFlow","RichText","useBlockProps","store","blockEditorStore","__experimentalGetElementClassName","useEffect","useCopyToClipboard","__","_x","file","icon","coreStore","noticesStore","FileBlockInspector","browserSupportsPdfs","removeAnchorTag","MIN_PREVIEW_HEIGHT","MAX_PREVIEW_HEIGHT","ClipboardToolbarButton","text","disabled","createNotice","ref","isDismissible","type","createElement","className","FileEdit","attributes","isSelected","setAttributes","clientId","id","fileId","fileName","href","textLinkHref","textLinkTarget","showDownloadButton","downloadButtonText","displayPreview","previewHeight","media","mediaUpload","select","undefined","getMedia","getSettings","createErrorNotice","toggleSelection","__unstableMarkNextChangeAsNotPersistent","filesList","onFileChange","newMedia","onSelectFile","onError","onUploadError","url","isPdf","endsWith","title","message","changeLinkDestinationOption","newHref","changeOpenInNewWindow","newValue","changeShowDownloadButton","changeDisplayPreview","handleOnResizeStop","event","direction","elt","delta","newHeight","parseInt","height","changePreviewHeight","Math","max","attachmentPage","link","blockProps","displayPreviewInEditor","labels","instructions","onSelect","accept","Fragment","hrefs","openInNewWindow","group","mediaId","mediaURL","size","minHeight","maxHeight","minWidth","grid","enable","top","right","bottom","left","topRight","bottomRight","bottomLeft","topLeft","onResizeStart","onResizeStop","showHandle","data","tagName","value","placeholder","withoutInteractiveFormatting","onChange"],"sources":["@wordpress/block-library/src/file/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tResizableBox,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { __, _x } from '@wordpress/i18n';\nimport { file as icon } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport FileBlockInspector from './inspector';\nimport { browserSupportsPdfs } from './utils';\nimport removeAnchorTag from '../utils/remove-anchor-tag';\n\nexport const MIN_PREVIEW_HEIGHT = 200;\nexport const MAX_PREVIEW_HEIGHT = 2000;\n\nfunction ClipboardToolbarButton( { text, disabled } ) {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst ref = useCopyToClipboard( text, () => {\n\t\tcreateNotice( 'info', __( 'Copied URL to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tclassName=\"components-clipboard-toolbar-button\"\n\t\t\tref={ ref }\n\t\t\tdisabled={ disabled }\n\t\t>\n\t\t\t{ __( 'Copy URL' ) }\n\t\t</ToolbarButton>\n\t);\n}\n\nfunction FileEdit( { attributes, isSelected, setAttributes, clientId } ) {\n\tconst {\n\t\tid,\n\t\tfileId,\n\t\tfileName,\n\t\thref,\n\t\ttextLinkHref,\n\t\ttextLinkTarget,\n\t\tshowDownloadButton,\n\t\tdownloadButtonText,\n\t\tdisplayPreview,\n\t\tpreviewHeight,\n\t} = attributes;\n\tconst { media, mediaUpload } = useSelect(\n\t\t( select ) => ( {\n\t\t\tmedia:\n\t\t\t\tid === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: select( coreStore ).getMedia( id ),\n\t\t\tmediaUpload: select( blockEditorStore ).getSettings().mediaUpload,\n\t\t} ),\n\t\t[ id ]\n\t);\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { toggleSelection, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// Upload a file drag-and-dropped into the editor.\n\t\tif ( isBlobURL( href ) ) {\n\t\t\tconst file = getBlobByURL( href );\n\n\t\t\tmediaUpload( {\n\t\t\t\tfilesList: [ file ],\n\t\t\t\tonFileChange: ( [ newMedia ] ) => onSelectFile( newMedia ),\n\t\t\t\tonError: onUploadError,\n\t\t\t} );\n\n\t\t\trevokeBlobURL( href );\n\t\t}\n\n\t\tif ( downloadButtonText === undefined ) {\n\t\t\tsetAttributes( {\n\t\t\t\tdownloadButtonText: _x( 'Download', 'button label' ),\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( ! fileId && href ) {\n\t\t\t// Add a unique fileId to each file block.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { fileId: `wp-block-file--media-${ clientId }` } );\n\t\t}\n\t}, [ href, fileId, clientId ] );\n\n\tfunction onSelectFile( newMedia ) {\n\t\tif ( newMedia && newMedia.url ) {\n\t\t\tconst isPdf = newMedia.url.endsWith( '.pdf' );\n\t\t\tsetAttributes( {\n\t\t\t\thref: newMedia.url,\n\t\t\t\tfileName: newMedia.title,\n\t\t\t\ttextLinkHref: newMedia.url,\n\t\t\t\tid: newMedia.id,\n\t\t\t\tdisplayPreview: isPdf ? true : undefined,\n\t\t\t\tpreviewHeight: isPdf ? 600 : undefined,\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction onUploadError( message ) {\n\t\tsetAttributes( { href: undefined } );\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t}\n\n\tfunction changeLinkDestinationOption( newHref ) {\n\t\t// Choose Media File or Attachment Page (when file is in Media Library).\n\t\tsetAttributes( { textLinkHref: newHref } );\n\t}\n\n\tfunction changeOpenInNewWindow( newValue ) {\n\t\tsetAttributes( {\n\t\t\ttextLinkTarget: newValue ? '_blank' : false,\n\t\t} );\n\t}\n\n\tfunction changeShowDownloadButton( newValue ) {\n\t\tsetAttributes( { showDownloadButton: newValue } );\n\t}\n\n\tfunction changeDisplayPreview( newValue ) {\n\t\tsetAttributes( { displayPreview: newValue } );\n\t}\n\n\tfunction handleOnResizeStop( event, direction, elt, delta ) {\n\t\ttoggleSelection( true );\n\n\t\tconst newHeight = parseInt( previewHeight + delta.height, 10 );\n\t\tsetAttributes( { previewHeight: newHeight } );\n\t}\n\n\tfunction changePreviewHeight( newValue ) {\n\t\tconst newHeight = Math.max(\n\t\t\tparseInt( newValue, 10 ),\n\t\t\tMIN_PREVIEW_HEIGHT\n\t\t);\n\t\tsetAttributes( { previewHeight: newHeight } );\n\t}\n\n\tconst attachmentPage = media && media.link;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames(\n\t\t\tisBlobURL( href ) && getAnimateClassName( { type: 'loading' } ),\n\t\t\t{\n\t\t\t\t'is-transient': isBlobURL( href ),\n\t\t\t}\n\t\t),\n\t} );\n\n\tconst displayPreviewInEditor = browserSupportsPdfs() && displayPreview;\n\n\tif ( ! href ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabels={ {\n\t\t\t\t\t\ttitle: __( 'File' ),\n\t\t\t\t\t\tinstructions: __(\n\t\t\t\t\t\t\t'Upload a file or pick one from your media library.'\n\t\t\t\t\t\t),\n\t\t\t\t\t} }\n\t\t\t\t\tonSelect={ onSelectFile }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\taccept=\"*\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<FileBlockInspector\n\t\t\t\threfs={ { href, textLinkHref, attachmentPage } }\n\t\t\t\t{ ...{\n\t\t\t\t\topenInNewWindow: !! textLinkTarget,\n\t\t\t\t\tshowDownloadButton,\n\t\t\t\t\tchangeLinkDestinationOption,\n\t\t\t\t\tchangeOpenInNewWindow,\n\t\t\t\t\tchangeShowDownloadButton,\n\t\t\t\t\tdisplayPreview,\n\t\t\t\t\tchangeDisplayPreview,\n\t\t\t\t\tpreviewHeight,\n\t\t\t\t\tchangePreviewHeight,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ href }\n\t\t\t\t\taccept=\"*\"\n\t\t\t\t\tonSelect={ onSelectFile }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t/>\n\t\t\t\t<ClipboardToolbarButton\n\t\t\t\t\ttext={ href }\n\t\t\t\t\tdisabled={ isBlobURL( href ) }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ displayPreviewInEditor && (\n\t\t\t\t\t<ResizableBox\n\t\t\t\t\t\tsize={ { height: previewHeight } }\n\t\t\t\t\t\tminHeight={ MIN_PREVIEW_HEIGHT }\n\t\t\t\t\t\tmaxHeight={ MAX_PREVIEW_HEIGHT }\n\t\t\t\t\t\tminWidth=\"100%\"\n\t\t\t\t\t\tgrid={ [ 10, 10 ] }\n\t\t\t\t\t\tenable={ {\n\t\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\t\tright: false,\n\t\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonResizeStart={ () => toggleSelection( false ) }\n\t\t\t\t\t\tonResizeStop={ handleOnResizeStop }\n\t\t\t\t\t\tshowHandle={ isSelected }\n\t\t\t\t\t>\n\t\t\t\t\t\t<object\n\t\t\t\t\t\t\tclassName=\"wp-block-file__preview\"\n\t\t\t\t\t\t\tdata={ href }\n\t\t\t\t\t\t\ttype=\"application/pdf\"\n\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t'Embed of the selected PDF file.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! isSelected && (\n\t\t\t\t\t\t\t<div className=\"wp-block-file__preview-overlay\" />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ResizableBox>\n\t\t\t\t) }\n\t\t\t\t<div className={ 'wp-block-file__content-wrapper' }>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\t\tvalue={ fileName }\n\t\t\t\t\t\tplaceholder={ __( 'Write file name…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tonChange={ ( text ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tfileName: removeAnchorTag( text ),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thref={ textLinkHref }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showDownloadButton && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t'wp-block-file__button-richtext-wrapper'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ /* Using RichText here instead of PlainText so that it can be styled like a button. */ }\n\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\ttagName=\"div\" // Must be block-level or else cursor disappears.\n\t\t\t\t\t\t\t\taria-label={ __( 'Download button text' ) }\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'wp-block-file__button',\n\t\t\t\t\t\t\t\t\t__experimentalGetElementClassName(\n\t\t\t\t\t\t\t\t\t\t'button'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tvalue={ downloadButtonText }\n\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\tplaceholder={ __( 'Add text…' ) }\n\t\t\t\t\t\t\t\tonChange={ ( text ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tdownloadButtonText:\n\t\t\t\t\t\t\t\t\t\t\tremoveAnchorTag( text ),\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default FileEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,YAAY,EAAEC,SAAS,EAAEC,aAAa,QAAQ,iBAAiB;AACxE,SACCC,6BAA6B,IAAIC,mBAAmB,EACpDC,YAAY,EACZC,aAAa,QACP,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,aAAa,EACbC,SAAS,EACTC,gBAAgB,EAChBC,gBAAgB,EAChBC,QAAQ,EACRC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,EACzBC,iCAAiC,QAC3B,yBAAyB;AAChC,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,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M;IACbX,IAAI,EAAC,iBAAiB;IACtB,cAAajB,EAAE,CACd,iCACD;EAAG,CACH,CAAC,EACA,CAAEsB,UAAU,IACbJ,aAAA;IAAKC,SAAS,EAAC;EAAgC,CAAE,CAErC,CACd,EACDD,aAAA;IAAKC,SAAS,EAAG;EAAkC,GAClDD,aAAA,CAACzB,QAAQ;IACR+G,OAAO,EAAC,GAAG;IACXC,KAAK,EAAG9E,QAAU;IAClB+E,WAAW,EAAG1G,EAAE,CAAE,kBAAmB,CAAG;IACxC2G,4BAA4B;IAC5BC,QAAQ,EAAKhG,IAAI,IAChBW,aAAa,CAAE;MACdI,QAAQ,EAAEnB,eAAe,CAAEI,IAAK;IACjC,CAAE,CACF;IACDgB,IAAI,EAAGC;EAAc,CACrB,CAAC,EACAE,kBAAkB,IACnBb,aAAA;IACCC,SAAS,EACR;EACA,GAGDD,aAAA,CAACzB,QAAQ;IACR+G,OAAO,EAAC,KAAK,CAAC;IAAA;IACd,cAAaxG,EAAE,CAAE,sBAAuB,CAAG;IAC3CmB,SAAS,EAAGxC,UAAU,CACrB,uBAAuB,EACvBkB,iCAAiC,CAChC,QACD,CACD,CAAG;IACH4G,KAAK,EAAGzE,kBAAoB;IAC5B2E,4BAA4B;IAC5BD,WAAW,EAAG1G,EAAE,CAAE,WAAY,CAAG;IACjC4G,QAAQ,EAAKhG,IAAI,IAChBW,aAAa,CAAE;MACdS,kBAAkB,EACjBxB,eAAe,CAAEI,IAAK;IACxB,CAAE;EACF,CACD,CACG,CAEF,CACD,CACJ,CAAC;AAEL;AAEA,eAAeQ,QAAQ"}
|
|
1
|
+
{"version":3,"names":["classnames","getBlobByURL","isBlobURL","revokeBlobURL","__unstableGetAnimateClassName","getAnimateClassName","ResizableBox","ToolbarButton","useSelect","useDispatch","BlockControls","BlockIcon","MediaPlaceholder","MediaReplaceFlow","RichText","useBlockProps","store","blockEditorStore","__experimentalGetElementClassName","useEffect","useCopyToClipboard","__","_x","file","icon","coreStore","noticesStore","FileBlockInspector","browserSupportsPdfs","removeAnchorTag","MIN_PREVIEW_HEIGHT","MAX_PREVIEW_HEIGHT","ClipboardToolbarButton","text","disabled","createNotice","ref","isDismissible","type","createElement","className","FileEdit","attributes","isSelected","setAttributes","clientId","id","fileName","href","textLinkHref","textLinkTarget","showDownloadButton","downloadButtonText","displayPreview","previewHeight","getSettings","media","select","undefined","getMedia","createErrorNotice","toggleSelection","mediaUpload","filesList","onFileChange","newMedia","onSelectFile","onError","onUploadError","isEmpty","url","isPdf","endsWith","title","fileId","message","changeLinkDestinationOption","newHref","changeOpenInNewWindow","newValue","changeShowDownloadButton","changeDisplayPreview","handleOnResizeStop","event","direction","elt","delta","newHeight","parseInt","height","changePreviewHeight","Math","max","attachmentPage","link","blockProps","displayPreviewInEditor","labels","instructions","onSelect","accept","Fragment","hrefs","openInNewWindow","group","mediaId","mediaURL","size","minHeight","maxHeight","minWidth","grid","enable","top","right","bottom","left","topRight","bottomRight","bottomLeft","topLeft","onResizeStart","onResizeStop","showHandle","data","tagName","value","placeholder","withoutInteractiveFormatting","onChange"],"sources":["@wordpress/block-library/src/file/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tResizableBox,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { __, _x } from '@wordpress/i18n';\nimport { file as icon } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport FileBlockInspector from './inspector';\nimport { browserSupportsPdfs } from './utils';\nimport removeAnchorTag from '../utils/remove-anchor-tag';\n\nexport const MIN_PREVIEW_HEIGHT = 200;\nexport const MAX_PREVIEW_HEIGHT = 2000;\n\nfunction ClipboardToolbarButton( { text, disabled } ) {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst ref = useCopyToClipboard( text, () => {\n\t\tcreateNotice( 'info', __( 'Copied URL to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tclassName=\"components-clipboard-toolbar-button\"\n\t\t\tref={ ref }\n\t\t\tdisabled={ disabled }\n\t\t>\n\t\t\t{ __( 'Copy URL' ) }\n\t\t</ToolbarButton>\n\t);\n}\n\nfunction FileEdit( { attributes, isSelected, setAttributes, clientId } ) {\n\tconst {\n\t\tid,\n\t\tfileName,\n\t\thref,\n\t\ttextLinkHref,\n\t\ttextLinkTarget,\n\t\tshowDownloadButton,\n\t\tdownloadButtonText,\n\t\tdisplayPreview,\n\t\tpreviewHeight,\n\t} = attributes;\n\tconst { getSettings } = useSelect( blockEditorStore );\n\tconst { media } = useSelect(\n\t\t( select ) => ( {\n\t\t\tmedia:\n\t\t\t\tid === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: select( coreStore ).getMedia( id ),\n\t\t} ),\n\t\t[ id ]\n\t);\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { toggleSelection } = useDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// Upload a file drag-and-dropped into the editor.\n\t\tif ( isBlobURL( href ) ) {\n\t\t\tconst file = getBlobByURL( href );\n\n\t\t\tgetSettings().mediaUpload( {\n\t\t\t\tfilesList: [ file ],\n\t\t\t\tonFileChange: ( [ newMedia ] ) => onSelectFile( newMedia ),\n\t\t\t\tonError: onUploadError,\n\t\t\t} );\n\n\t\t\trevokeBlobURL( href );\n\t\t}\n\n\t\tif ( RichText.isEmpty( downloadButtonText ) ) {\n\t\t\tsetAttributes( {\n\t\t\t\tdownloadButtonText: _x( 'Download', 'button label' ),\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\tfunction onSelectFile( newMedia ) {\n\t\tif ( ! newMedia || ! newMedia.url ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPdf = newMedia.url.endsWith( '.pdf' );\n\t\tsetAttributes( {\n\t\t\thref: newMedia.url,\n\t\t\tfileName: newMedia.title,\n\t\t\ttextLinkHref: newMedia.url,\n\t\t\tid: newMedia.id,\n\t\t\tdisplayPreview: isPdf ? true : undefined,\n\t\t\tpreviewHeight: isPdf ? 600 : undefined,\n\t\t\tfileId: `wp-block-file--media-${ clientId }`,\n\t\t} );\n\t}\n\n\tfunction onUploadError( message ) {\n\t\tsetAttributes( { href: undefined } );\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t}\n\n\tfunction changeLinkDestinationOption( newHref ) {\n\t\t// Choose Media File or Attachment Page (when file is in Media Library).\n\t\tsetAttributes( { textLinkHref: newHref } );\n\t}\n\n\tfunction changeOpenInNewWindow( newValue ) {\n\t\tsetAttributes( {\n\t\t\ttextLinkTarget: newValue ? '_blank' : false,\n\t\t} );\n\t}\n\n\tfunction changeShowDownloadButton( newValue ) {\n\t\tsetAttributes( { showDownloadButton: newValue } );\n\t}\n\n\tfunction changeDisplayPreview( newValue ) {\n\t\tsetAttributes( { displayPreview: newValue } );\n\t}\n\n\tfunction handleOnResizeStop( event, direction, elt, delta ) {\n\t\ttoggleSelection( true );\n\n\t\tconst newHeight = parseInt( previewHeight + delta.height, 10 );\n\t\tsetAttributes( { previewHeight: newHeight } );\n\t}\n\n\tfunction changePreviewHeight( newValue ) {\n\t\tconst newHeight = Math.max(\n\t\t\tparseInt( newValue, 10 ),\n\t\t\tMIN_PREVIEW_HEIGHT\n\t\t);\n\t\tsetAttributes( { previewHeight: newHeight } );\n\t}\n\n\tconst attachmentPage = media && media.link;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames(\n\t\t\tisBlobURL( href ) && getAnimateClassName( { type: 'loading' } ),\n\t\t\t{\n\t\t\t\t'is-transient': isBlobURL( href ),\n\t\t\t}\n\t\t),\n\t} );\n\n\tconst displayPreviewInEditor = browserSupportsPdfs() && displayPreview;\n\n\tif ( ! href ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabels={ {\n\t\t\t\t\t\ttitle: __( 'File' ),\n\t\t\t\t\t\tinstructions: __(\n\t\t\t\t\t\t\t'Upload a file or pick one from your media library.'\n\t\t\t\t\t\t),\n\t\t\t\t\t} }\n\t\t\t\t\tonSelect={ onSelectFile }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\taccept=\"*\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<FileBlockInspector\n\t\t\t\threfs={ { href, textLinkHref, attachmentPage } }\n\t\t\t\t{ ...{\n\t\t\t\t\topenInNewWindow: !! textLinkTarget,\n\t\t\t\t\tshowDownloadButton,\n\t\t\t\t\tchangeLinkDestinationOption,\n\t\t\t\t\tchangeOpenInNewWindow,\n\t\t\t\t\tchangeShowDownloadButton,\n\t\t\t\t\tdisplayPreview,\n\t\t\t\t\tchangeDisplayPreview,\n\t\t\t\t\tpreviewHeight,\n\t\t\t\t\tchangePreviewHeight,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ href }\n\t\t\t\t\taccept=\"*\"\n\t\t\t\t\tonSelect={ onSelectFile }\n\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t/>\n\t\t\t\t<ClipboardToolbarButton\n\t\t\t\t\ttext={ href }\n\t\t\t\t\tdisabled={ isBlobURL( href ) }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ displayPreviewInEditor && (\n\t\t\t\t\t<ResizableBox\n\t\t\t\t\t\tsize={ { height: previewHeight } }\n\t\t\t\t\t\tminHeight={ MIN_PREVIEW_HEIGHT }\n\t\t\t\t\t\tmaxHeight={ MAX_PREVIEW_HEIGHT }\n\t\t\t\t\t\tminWidth=\"100%\"\n\t\t\t\t\t\tgrid={ [ 10, 10 ] }\n\t\t\t\t\t\tenable={ {\n\t\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\t\tright: false,\n\t\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonResizeStart={ () => toggleSelection( false ) }\n\t\t\t\t\t\tonResizeStop={ handleOnResizeStop }\n\t\t\t\t\t\tshowHandle={ isSelected }\n\t\t\t\t\t>\n\t\t\t\t\t\t<object\n\t\t\t\t\t\t\tclassName=\"wp-block-file__preview\"\n\t\t\t\t\t\t\tdata={ href }\n\t\t\t\t\t\t\ttype=\"application/pdf\"\n\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t'Embed of the selected PDF file.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! isSelected && (\n\t\t\t\t\t\t\t<div className=\"wp-block-file__preview-overlay\" />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ResizableBox>\n\t\t\t\t) }\n\t\t\t\t<div className={ 'wp-block-file__content-wrapper' }>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\t\tvalue={ fileName }\n\t\t\t\t\t\tplaceholder={ __( 'Write file name…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tonChange={ ( text ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tfileName: removeAnchorTag( text ),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thref={ textLinkHref }\n\t\t\t\t\t/>\n\t\t\t\t\t{ showDownloadButton && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t'wp-block-file__button-richtext-wrapper'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ /* Using RichText here instead of PlainText so that it can be styled like a button. */ }\n\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\ttagName=\"div\" // Must be block-level or else cursor disappears.\n\t\t\t\t\t\t\t\taria-label={ __( 'Download button text' ) }\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'wp-block-file__button',\n\t\t\t\t\t\t\t\t\t__experimentalGetElementClassName(\n\t\t\t\t\t\t\t\t\t\t'button'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tvalue={ downloadButtonText }\n\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\tplaceholder={ __( 'Add text…' ) }\n\t\t\t\t\t\t\t\tonChange={ ( text ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tdownloadButtonText:\n\t\t\t\t\t\t\t\t\t\t\tremoveAnchorTag( text ),\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default FileEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM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
60
|
downloadButtonText
|
|
61
61
|
} = attributes;
|
|
62
|
-
if (downloadButtonText
|
|
62
|
+
if (RichText.isEmpty(downloadButtonText)) {
|
|
63
63
|
setAttributes({
|
|
64
64
|
downloadButtonText: _x('Download', 'button label')
|
|
65
65
|
});
|