@wordpress/block-library 8.13.0 → 8.15.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 +4 -0
- package/build/archives/index.js +5 -1
- package/build/archives/index.js.map +1 -1
- package/build/audio/index.js +5 -1
- package/build/audio/index.js.map +1 -1
- package/build/avatar/edit.js +1 -0
- package/build/avatar/edit.js.map +1 -1
- package/build/avatar/index.js +1 -1
- package/build/block/edit.js +1 -1
- package/build/block/edit.js.map +1 -1
- package/build/block/edit.native.js +6 -9
- package/build/block/edit.native.js.map +1 -1
- package/build/block/index.js +2 -1
- package/build/block/index.js.map +1 -1
- package/build/buttons/edit.js +7 -3
- package/build/buttons/edit.js.map +1 -1
- package/build/categories/index.js +5 -1
- package/build/categories/index.js.map +1 -1
- package/build/code/index.js +5 -1
- package/build/code/index.js.map +1 -1
- package/build/column/edit.native.js +1 -4
- package/build/column/edit.native.js.map +1 -1
- package/build/column/index.js +1 -0
- package/build/column/index.js.map +1 -1
- package/build/columns/edit.js +1 -0
- package/build/columns/edit.js.map +1 -1
- package/build/comment-author-avatar/edit.js +1 -0
- package/build/comment-author-avatar/edit.js.map +1 -1
- package/build/comments/index.js +1 -0
- package/build/comments/index.js.map +1 -1
- package/build/cover/deprecated.js +4 -2
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +2 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/index.js +1 -0
- package/build/cover/index.js.map +1 -1
- package/build/details/index.js +5 -1
- package/build/details/index.js.map +1 -1
- package/build/embed/embed-placeholder.native.js +37 -13
- package/build/embed/embed-placeholder.native.js.map +1 -1
- package/build/embed/util.js +9 -8
- package/build/embed/util.js.map +1 -1
- package/build/file/inspector.js +1 -0
- package/build/file/inspector.js.map +1 -1
- package/build/file/{interactivity.js → view-interactivity.js} +6 -2
- package/build/file/view-interactivity.js.map +1 -0
- package/build/footnotes/edit.js +20 -1
- package/build/footnotes/edit.js.map +1 -1
- package/build/footnotes/format.js +19 -16
- package/build/footnotes/format.js.map +1 -1
- package/build/footnotes/index.js +0 -1
- package/build/footnotes/index.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/index.js +3 -1
- package/build/gallery/index.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/index.js +5 -1
- package/build/heading/index.js.map +1 -1
- package/build/heading/transforms.js +5 -1
- package/build/heading/transforms.js.map +1 -1
- package/build/image/deprecated.js +453 -175
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.js +0 -4
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +96 -43
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +6 -0
- package/build/image/index.js.map +1 -1
- package/build/image/save.js +8 -1
- package/build/image/save.js.map +1 -1
- package/build/image/utils.js +18 -0
- package/build/image/utils.js.map +1 -1
- package/build/image/{interactivity.js → view-interactivity.js} +86 -44
- package/build/image/view-interactivity.js.map +1 -0
- package/build/index.js +12 -3
- package/build/index.js.map +1 -1
- package/build/latest-comments/edit.js +1 -0
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-posts/edit.js +2 -0
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list/edit.js +4 -4
- package/build/list/edit.js.map +1 -1
- package/build/list/index.js +5 -1
- package/build/list/index.js.map +1 -1
- package/build/list-item/utils.js +6 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/media-text/index.js +1 -0
- package/build/media-text/index.js.map +1 -1
- package/build/media-text/media-container.native.js +2 -1
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/missing/edit.js +22 -8
- package/build/missing/edit.js.map +1 -1
- package/build/missing/edit.native.js +7 -5
- package/build/missing/edit.native.js.map +1 -1
- package/build/navigation/constants.js +10 -4
- package/build/navigation/constants.js.map +1 -1
- package/build/navigation/edit/index.js +17 -3
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +2 -2
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +0 -1
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +2 -2
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +10 -15
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +33 -45
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation/view-interactivity.js +185 -0
- package/build/navigation/view-interactivity.js.map +1 -0
- package/build/navigation-link/edit.js +12 -18
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/link-ui.js +12 -2
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/navigation-submenu/edit.js +2 -2
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +3 -3
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +34 -39
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list/use-convert-to-navigation-links.js +2 -15
- package/build/page-list/use-convert-to-navigation-links.js.map +1 -1
- package/build/paragraph/index.js +1 -0
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +1 -0
- package/build/paragraph/transforms.js.map +1 -1
- package/build/post-comments-form/index.js +1 -0
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-navigation-link/index.js +1 -0
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-time-to-read/index.js +5 -1
- package/build/post-time-to-read/index.js.map +1 -1
- package/build/query-pagination/edit.js +1 -1
- package/build/query-pagination/edit.js.map +1 -1
- package/build/query-pagination-numbers/index.js +1 -1
- package/build/query-title/edit.js +43 -1
- package/build/query-title/edit.js.map +1 -1
- package/build/quote/index.js +1 -0
- package/build/quote/index.js.map +1 -1
- package/build/quote/transforms.js +8 -0
- package/build/quote/transforms.js.map +1 -1
- package/build/rss/edit.js +3 -0
- package/build/rss/edit.js.map +1 -1
- package/build/search/edit.js +4 -3
- package/build/search/edit.js.map +1 -1
- package/build/search/index.js +1 -0
- package/build/search/index.js.map +1 -1
- package/build/site-logo/edit.js +1 -0
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +5 -1
- package/build/site-logo/index.js.map +1 -1
- package/build/site-tagline/icon.js +1 -1
- package/build/site-tagline/icon.js.map +1 -1
- package/build/site-tagline/index.js +5 -1
- package/build/site-tagline/index.js.map +1 -1
- package/build/site-title/index.js +5 -1
- package/build/site-title/index.js.map +1 -1
- package/build/social-links/index.js +3 -1
- package/build/social-links/index.js.map +1 -1
- package/build/table/index.js +5 -1
- package/build/table/index.js.map +1 -1
- package/build/tag-cloud/edit.js +1 -0
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/template-part/edit/index.js +1 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/term-description/index.js +1 -0
- package/build/term-description/index.js.map +1 -1
- package/build/text-columns/edit.js +1 -0
- package/build/text-columns/edit.js.map +1 -1
- package/build/verse/index.js +5 -1
- package/build/verse/index.js.map +1 -1
- package/build/video/deprecated.js +5 -1
- package/build/video/deprecated.js.map +1 -1
- package/build/video/index.js +5 -1
- package/build/video/index.js.map +1 -1
- package/build-module/archives/index.js +5 -1
- package/build-module/archives/index.js.map +1 -1
- package/build-module/audio/index.js +5 -1
- package/build-module/audio/index.js.map +1 -1
- package/build-module/avatar/edit.js +1 -0
- package/build-module/avatar/edit.js.map +1 -1
- package/build-module/avatar/index.js +1 -1
- package/build-module/block/edit.js +1 -1
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/edit.native.js +7 -9
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/block/index.js +2 -1
- package/build-module/block/index.js.map +1 -1
- package/build-module/buttons/edit.js +7 -3
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/categories/index.js +5 -1
- package/build-module/categories/index.js.map +1 -1
- package/build-module/code/index.js +5 -1
- package/build-module/code/index.js.map +1 -1
- package/build-module/column/edit.native.js +1 -4
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/column/index.js +1 -0
- package/build-module/column/index.js.map +1 -1
- package/build-module/columns/edit.js +1 -0
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/comment-author-avatar/edit.js +1 -0
- package/build-module/comment-author-avatar/edit.js.map +1 -1
- package/build-module/comments/index.js +1 -0
- package/build-module/comments/index.js.map +1 -1
- package/build-module/cover/deprecated.js +4 -2
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +2 -1
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/index.js +1 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/details/index.js +5 -1
- package/build-module/details/index.js.map +1 -1
- package/build-module/embed/embed-placeholder.native.js +37 -14
- package/build-module/embed/embed-placeholder.native.js.map +1 -1
- package/build-module/embed/util.js +6 -6
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/inspector.js +1 -0
- package/build-module/file/inspector.js.map +1 -1
- package/build-module/file/{interactivity.js → view-interactivity.js} +6 -2
- package/build-module/file/view-interactivity.js.map +1 -0
- package/build-module/footnotes/edit.js +18 -2
- package/build-module/footnotes/edit.js.map +1 -1
- package/build-module/footnotes/format.js +19 -16
- package/build-module/footnotes/format.js.map +1 -1
- package/build-module/footnotes/index.js +0 -1
- package/build-module/footnotes/index.js.map +1 -1
- package/build-module/gallery/edit.js +1 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/index.js +3 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/index.js +5 -1
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/transforms.js +5 -1
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/image/deprecated.js +454 -176
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.js +0 -4
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +96 -46
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +6 -0
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/save.js +8 -1
- package/build-module/image/save.js.map +1 -1
- package/build-module/image/utils.js +16 -0
- package/build-module/image/utils.js.map +1 -1
- package/build-module/image/{interactivity.js → view-interactivity.js} +86 -44
- package/build-module/image/view-interactivity.js.map +1 -0
- package/build-module/index.js +12 -3
- package/build-module/index.js.map +1 -1
- package/build-module/latest-comments/edit.js +1 -0
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-posts/edit.js +2 -0
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list/edit.js +4 -4
- package/build-module/list/edit.js.map +1 -1
- package/build-module/list/index.js +5 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/list-item/utils.js +6 -1
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/media-text/index.js +1 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/media-text/media-container.native.js +2 -1
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/missing/edit.js +22 -8
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/missing/edit.native.js +8 -6
- package/build-module/missing/edit.native.js.map +1 -1
- package/build-module/navigation/constants.js +8 -3
- package/build-module/navigation/constants.js.map +1 -1
- package/build-module/navigation/edit/index.js +18 -4
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +2 -2
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +0 -1
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +2 -2
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +10 -14
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +35 -47
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation/view-interactivity.js +182 -0
- package/build-module/navigation/view-interactivity.js.map +1 -0
- package/build-module/navigation-link/edit.js +13 -19
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +13 -3
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +2 -2
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +3 -3
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +34 -39
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list/use-convert-to-navigation-links.js +3 -16
- package/build-module/page-list/use-convert-to-navigation-links.js.map +1 -1
- package/build-module/paragraph/index.js +1 -0
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +1 -0
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/post-comments-form/index.js +1 -0
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-navigation-link/index.js +1 -0
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-time-to-read/index.js +5 -1
- package/build-module/post-time-to-read/index.js.map +1 -1
- package/build-module/query-pagination/edit.js +1 -1
- package/build-module/query-pagination/edit.js.map +1 -1
- package/build-module/query-pagination-numbers/index.js +1 -1
- package/build-module/query-title/edit.js +44 -3
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/quote/index.js +1 -0
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/transforms.js +8 -0
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/rss/edit.js +3 -0
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/search/edit.js +4 -3
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/index.js +1 -0
- package/build-module/search/index.js.map +1 -1
- package/build-module/site-logo/edit.js +1 -0
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +5 -1
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-tagline/icon.js +1 -1
- package/build-module/site-tagline/icon.js.map +1 -1
- package/build-module/site-tagline/index.js +5 -1
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/site-title/index.js +5 -1
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-links/index.js +3 -1
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/table/index.js +5 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/tag-cloud/edit.js +1 -0
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/template-part/edit/index.js +1 -1
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/term-description/index.js +1 -0
- package/build-module/term-description/index.js.map +1 -1
- package/build-module/text-columns/edit.js +1 -0
- package/build-module/text-columns/edit.js.map +1 -1
- package/build-module/verse/index.js +5 -1
- package/build-module/verse/index.js.map +1 -1
- package/build-module/video/deprecated.js +5 -1
- package/build-module/video/deprecated.js.map +1 -1
- package/build-module/video/index.js +5 -1
- package/build-module/video/index.js.map +1 -1
- package/build-style/details/style-rtl.css +4 -2
- package/build-style/details/style.css +4 -2
- package/build-style/footnotes/style-rtl.css +4 -3
- package/build-style/footnotes/style.css +4 -3
- package/build-style/image/style-rtl.css +16 -2
- package/build-style/image/style.css +16 -2
- package/build-style/navigation/style-rtl.css +14 -2
- package/build-style/navigation/style.css +14 -2
- package/build-style/query-pagination/style-rtl.css +4 -2
- package/build-style/query-pagination/style.css +4 -2
- package/build-style/style-rtl.css +42 -11
- package/build-style/style.css +42 -11
- package/package.json +33 -37
- package/src/archives/block.json +5 -1
- package/src/audio/block.json +5 -1
- package/src/audio/test/__snapshots__/edit.native.js.snap +58 -33
- package/src/avatar/block.json +1 -1
- package/src/avatar/edit.js +1 -0
- package/src/block/block.json +2 -1
- package/src/block/edit.js +2 -2
- package/src/block/edit.native.js +8 -12
- package/src/block/editor.native.scss +2 -2
- package/src/block/test/edit.native.js +4 -4
- package/src/buttons/edit.js +4 -4
- package/src/categories/block.json +5 -1
- package/src/code/block.json +5 -1
- package/src/column/block.json +1 -0
- package/src/column/edit.native.js +4 -10
- package/src/column/editor.native.scss +0 -4
- package/src/columns/edit.js +1 -0
- package/src/comment-author-avatar/edit.js +1 -0
- package/src/comment-template/index.php +5 -2
- package/src/comments/block.json +1 -0
- package/src/cover/block.json +1 -0
- package/src/cover/deprecated.js +2 -0
- package/src/cover/edit/inspector-controls.js +1 -0
- package/src/details/block.json +5 -1
- package/src/embed/embed-placeholder.native.js +80 -47
- package/src/embed/styles.native.scss +54 -18
- package/src/embed/test/index.native.js +5 -5
- package/src/embed/util.js +4 -6
- package/src/file/index.php +4 -3
- package/src/file/inspector.js +1 -0
- package/src/file/test/__snapshots__/edit.native.js.snap +58 -33
- package/src/file/{interactivity.js → view-interactivity.js} +4 -1
- package/src/footnotes/block.json +0 -1
- package/src/footnotes/edit.js +21 -2
- package/src/footnotes/format.js +22 -20
- package/src/footnotes/index.php +11 -9
- package/src/footnotes/style.scss +6 -3
- package/src/gallery/block.json +3 -1
- package/src/gallery/edit.js +1 -1
- package/src/gallery/test/index.native.js +17 -16
- package/src/group/block.json +1 -0
- package/src/heading/block.json +5 -1
- package/src/heading/test/index.native.js +18 -0
- package/src/home-link/index.php +15 -2
- package/src/image/block.json +6 -0
- package/src/image/deprecated.js +597 -320
- package/src/image/edit.js +0 -4
- package/src/image/image.js +131 -62
- package/src/image/index.php +47 -8
- package/src/image/save.js +9 -1
- package/src/image/style.scss +15 -2
- package/src/image/test/edit.native.js +1 -1
- package/src/image/utils.js +16 -0
- package/src/image/{interactivity.js → view-interactivity.js} +99 -50
- package/src/index.js +18 -1
- package/src/latest-comments/edit.js +1 -0
- package/src/latest-posts/edit.js +2 -0
- package/src/latest-posts/index.php +1 -1
- package/src/list/block.json +5 -1
- package/src/list/edit.js +6 -4
- package/src/list/test/edit.native.js +129 -33
- package/src/media-text/block.json +1 -0
- package/src/media-text/media-container.native.js +1 -0
- package/src/missing/edit.js +31 -11
- package/src/missing/edit.native.js +12 -10
- package/src/missing/style.native.scss +19 -12
- package/src/missing/test/__snapshots__/edit.native.js.snap +21 -13
- package/src/navigation/constants.js +12 -6
- package/src/navigation/edit/index.js +30 -3
- package/src/navigation/edit/inner-blocks.js +2 -2
- package/src/navigation/edit/menu-inspector-controls.js +0 -1
- package/src/navigation/edit/unsaved-inner-blocks.js +2 -2
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +17 -21
- package/src/navigation/index.php +43 -16
- package/src/navigation/style.scss +27 -8
- package/src/navigation/use-navigation-menu.js +39 -63
- package/src/navigation/view-interactivity.js +196 -0
- package/src/navigation-link/edit.js +61 -61
- package/src/navigation-link/link-ui.js +14 -2
- package/src/navigation-submenu/edit.js +2 -2
- package/src/navigation-submenu/index.php +2 -12
- package/src/page-list/convert-to-links-modal.js +3 -3
- package/src/page-list/edit.js +65 -62
- package/src/page-list/use-convert-to-navigation-links.js +3 -20
- package/src/paragraph/block.json +1 -0
- package/src/paragraph/test/__snapshots__/edit.native.js.snap +1 -0
- package/src/paragraph/test/edit.native.js +26 -0
- package/src/post-comments-form/block.json +1 -0
- package/src/post-navigation-link/block.json +1 -0
- package/src/post-template/index.php +4 -2
- package/src/post-time-to-read/block.json +5 -1
- package/src/post-title/index.php +6 -3
- package/src/preformatted/test/__snapshots__/edit.native.js.snap +2 -0
- package/src/query-pagination/edit.js +17 -14
- package/src/query-pagination-numbers/block.json +1 -1
- package/src/query-title/edit.js +48 -6
- package/src/quote/block.json +1 -0
- package/src/quote/test/__snapshots__/transforms.native.js.snap +10 -0
- package/src/quote/test/transforms.native.js +5 -1
- package/src/quote/transforms.js +13 -0
- package/src/rss/edit.js +3 -0
- package/src/search/block.json +1 -0
- package/src/search/edit.js +4 -3
- package/src/search/index.php +22 -4
- package/src/search/test/__snapshots__/edit.native.js.snap +7 -0
- package/src/site-logo/block.json +5 -1
- package/src/site-logo/edit.js +1 -0
- package/src/site-tagline/block.json +5 -1
- package/src/site-tagline/icon.js +1 -1
- package/src/site-title/block.json +5 -1
- package/src/social-links/block.json +3 -1
- package/src/table/block.json +5 -1
- package/src/tag-cloud/edit.js +1 -0
- package/src/template-part/edit/index.js +1 -1
- package/src/template-part/index.php +9 -15
- package/src/term-description/block.json +1 -0
- package/src/text-columns/edit.js +1 -0
- package/src/verse/block.json +5 -1
- package/src/video/block.json +5 -1
- package/build/file/interactivity.js.map +0 -1
- package/build/gallery/shared-icon.native.js +0 -38
- package/build/gallery/shared-icon.native.js.map +0 -1
- package/build/heading/heading-level-icon.js +0 -61
- package/build/heading/heading-level-icon.js.map +0 -1
- package/build/image/interactivity.js.map +0 -1
- package/build/navigation/interactivity.js +0 -167
- package/build/navigation/interactivity.js.map +0 -1
- package/build/utils/interactivity/constants.js +0 -9
- package/build/utils/interactivity/constants.js.map +0 -1
- package/build/utils/interactivity/directives.js +0 -222
- package/build/utils/interactivity/directives.js.map +0 -1
- package/build/utils/interactivity/hooks.js +0 -159
- package/build/utils/interactivity/hooks.js.map +0 -1
- package/build/utils/interactivity/hydration.js +0 -34
- package/build/utils/interactivity/hydration.js.map +0 -1
- package/build/utils/interactivity/index.js +0 -32
- package/build/utils/interactivity/index.js.map +0 -1
- package/build/utils/interactivity/portals.js +0 -108
- package/build/utils/interactivity/portals.js.map +0 -1
- package/build/utils/interactivity/store.js +0 -66
- package/build/utils/interactivity/store.js.map +0 -1
- package/build/utils/interactivity/utils.js +0 -87
- package/build/utils/interactivity/utils.js.map +0 -1
- package/build/utils/interactivity/vdom.js +0 -119
- package/build/utils/interactivity/vdom.js.map +0 -1
- package/build-module/file/interactivity.js.map +0 -1
- package/build-module/gallery/shared-icon.native.js +0 -24
- package/build-module/gallery/shared-icon.native.js.map +0 -1
- package/build-module/heading/heading-level-icon.js +0 -53
- package/build-module/heading/heading-level-icon.js.map +0 -1
- package/build-module/image/interactivity.js.map +0 -1
- package/build-module/navigation/interactivity.js +0 -164
- package/build-module/navigation/interactivity.js.map +0 -1
- package/build-module/utils/interactivity/constants.js +0 -2
- package/build-module/utils/interactivity/constants.js.map +0 -1
- package/build-module/utils/interactivity/directives.js +0 -209
- package/build-module/utils/interactivity/directives.js.map +0 -1
- package/build-module/utils/interactivity/hooks.js +0 -145
- package/build-module/utils/interactivity/hooks.js.map +0 -1
- package/build-module/utils/interactivity/hydration.js +0 -21
- package/build-module/utils/interactivity/hydration.js.map +0 -1
- package/build-module/utils/interactivity/index.js +0 -15
- package/build-module/utils/interactivity/index.js.map +0 -1
- package/build-module/utils/interactivity/portals.js +0 -100
- package/build-module/utils/interactivity/portals.js.map +0 -1
- package/build-module/utils/interactivity/store.js +0 -55
- package/build-module/utils/interactivity/store.js.map +0 -1
- package/build-module/utils/interactivity/utils.js +0 -75
- package/build-module/utils/interactivity/utils.js.map +0 -1
- package/build-module/utils/interactivity/vdom.js +0 -107
- package/build-module/utils/interactivity/vdom.js.map +0 -1
- package/src/gallery/shared-icon.native.js +0 -23
- package/src/heading/heading-level-icon.js +0 -48
- package/src/navigation/interactivity.js +0 -169
- package/src/utils/interactivity/constants.js +0 -1
- package/src/utils/interactivity/directives.js +0 -200
- package/src/utils/interactivity/hooks.js +0 -145
- package/src/utils/interactivity/hydration.js +0 -22
- package/src/utils/interactivity/index.js +0 -15
- package/src/utils/interactivity/portals.js +0 -98
- package/src/utils/interactivity/store.js +0 -45
- package/src/utils/interactivity/utils.js +0 -66
- package/src/utils/interactivity/vdom.js +0 -111
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { store } from '
|
|
4
|
+
import { store } from '@wordpress/interactivity';
|
|
5
5
|
|
|
6
6
|
const focusableSelectors = [
|
|
7
7
|
'a[href]',
|
|
@@ -22,32 +22,43 @@ store( {
|
|
|
22
22
|
core: {
|
|
23
23
|
image: {
|
|
24
24
|
showLightbox: ( { context, event } ) => {
|
|
25
|
+
// We can't initialize the lightbox until the reference
|
|
26
|
+
// image is loaded, otherwise the UX is broken.
|
|
27
|
+
if ( ! context.core.image.imageLoaded ) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
25
30
|
context.core.image.initialized = true;
|
|
26
31
|
context.core.image.lastFocusedElement =
|
|
27
32
|
window.document.activeElement;
|
|
28
33
|
context.core.image.scrollDelta = 0;
|
|
29
34
|
|
|
35
|
+
context.core.image.lightboxEnabled = true;
|
|
36
|
+
if ( context.core.image.lightboxAnimation === 'zoom' ) {
|
|
37
|
+
setZoomStyles(
|
|
38
|
+
event.target.nextElementSibling,
|
|
39
|
+
context,
|
|
40
|
+
event
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
// Hide overflow only when the animation is in progress,
|
|
44
|
+
// otherwise the removal of the scrollbars will draw attention
|
|
45
|
+
// to itself and look like an error
|
|
46
|
+
document.documentElement.classList.add(
|
|
47
|
+
'has-lightbox-open'
|
|
48
|
+
);
|
|
49
|
+
|
|
30
50
|
// Since the img is hidden and its src not loaded until
|
|
31
51
|
// the lightbox is opened, let's create an img element on the fly
|
|
32
52
|
// so we can get the dimensions we need to calculate the styles
|
|
53
|
+
context.core.image.preloadInitialized = true;
|
|
33
54
|
const imgDom = document.createElement( 'img' );
|
|
34
|
-
|
|
35
55
|
imgDom.onload = function () {
|
|
36
|
-
|
|
37
|
-
// is loaded to prevent flashing of unstyled content
|
|
38
|
-
context.core.image.lightboxEnabled = true;
|
|
39
|
-
if ( context.core.image.lightboxAnimation === 'zoom' ) {
|
|
40
|
-
setZoomStyles( imgDom, context, event );
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Hide overflow only when the animation is in progress,
|
|
44
|
-
// otherwise the removal of the scrollbars will draw attention
|
|
45
|
-
// to itself and look like an error
|
|
46
|
-
document.documentElement.classList.add(
|
|
47
|
-
'has-lightbox-open'
|
|
48
|
-
);
|
|
56
|
+
context.core.image.activateLargeImage = true;
|
|
49
57
|
};
|
|
50
|
-
imgDom.setAttribute(
|
|
58
|
+
imgDom.setAttribute(
|
|
59
|
+
'src',
|
|
60
|
+
context.core.image.imageUploadedSrc
|
|
61
|
+
);
|
|
51
62
|
},
|
|
52
63
|
hideLightbox: async ( { context, event } ) => {
|
|
53
64
|
context.core.image.hideAnimationEnabled = true;
|
|
@@ -122,6 +133,16 @@ store( {
|
|
|
122
133
|
}
|
|
123
134
|
}
|
|
124
135
|
},
|
|
136
|
+
preloadLightboxImage: ( { context } ) => {
|
|
137
|
+
if ( ! context.core.image.preloadInitialized ) {
|
|
138
|
+
context.core.image.preloadInitialized = true;
|
|
139
|
+
const imgDom = document.createElement( 'img' );
|
|
140
|
+
imgDom.setAttribute(
|
|
141
|
+
'src',
|
|
142
|
+
context.core.image.imageUploadedSrc
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
},
|
|
125
146
|
},
|
|
126
147
|
},
|
|
127
148
|
},
|
|
@@ -131,9 +152,15 @@ store( {
|
|
|
131
152
|
roleAttribute: ( { context } ) => {
|
|
132
153
|
return context.core.image.lightboxEnabled ? 'dialog' : '';
|
|
133
154
|
},
|
|
134
|
-
|
|
155
|
+
responsiveImgSrc: ( { context } ) => {
|
|
156
|
+
return context.core.image.activateLargeImage &&
|
|
157
|
+
context.core.image.hideAnimationEnabled
|
|
158
|
+
? ''
|
|
159
|
+
: context.core.image.imageCurrentSrc;
|
|
160
|
+
},
|
|
161
|
+
enlargedImgSrc: ( { context } ) => {
|
|
135
162
|
return context.core.image.initialized
|
|
136
|
-
? context.core.image.
|
|
163
|
+
? context.core.image.imageUploadedSrc
|
|
137
164
|
: '';
|
|
138
165
|
},
|
|
139
166
|
},
|
|
@@ -142,6 +169,18 @@ store( {
|
|
|
142
169
|
effects: {
|
|
143
170
|
core: {
|
|
144
171
|
image: {
|
|
172
|
+
setCurrentSrc: ( { context, ref } ) => {
|
|
173
|
+
if ( ref.complete ) {
|
|
174
|
+
context.core.image.imageLoaded = true;
|
|
175
|
+
context.core.image.imageCurrentSrc = ref.currentSrc;
|
|
176
|
+
} else {
|
|
177
|
+
ref.addEventListener( 'load', function () {
|
|
178
|
+
context.core.image.imageLoaded = true;
|
|
179
|
+
context.core.image.imageCurrentSrc =
|
|
180
|
+
this.currentSrc;
|
|
181
|
+
} );
|
|
182
|
+
}
|
|
183
|
+
},
|
|
145
184
|
initLightbox: async ( { context, ref } ) => {
|
|
146
185
|
context.core.image.figureRef =
|
|
147
186
|
ref.querySelector( 'figure' );
|
|
@@ -163,51 +202,61 @@ store( {
|
|
|
163
202
|
} );
|
|
164
203
|
|
|
165
204
|
function setZoomStyles( imgDom, context, event ) {
|
|
166
|
-
|
|
167
|
-
|
|
205
|
+
// Typically, we use the image's full-sized dimensions. If those
|
|
206
|
+
// dimensions have not been set (i.e. an external image with only one size),
|
|
207
|
+
// the image's dimensions in the lightbox are the same
|
|
208
|
+
// as those of the image in the content.
|
|
209
|
+
let targetWidth =
|
|
210
|
+
context.core.image.targetWidth !== 'none'
|
|
211
|
+
? context.core.image.targetWidth
|
|
212
|
+
: event.target.nextElementSibling.naturalWidth;
|
|
213
|
+
let targetHeight =
|
|
214
|
+
context.core.image.targetHeight !== 'none'
|
|
215
|
+
? context.core.image.targetHeight
|
|
216
|
+
: event.target.nextElementSibling.naturalHeight;
|
|
168
217
|
|
|
169
|
-
|
|
218
|
+
// Since the lightbox image has `position:absolute`, it
|
|
219
|
+
// ignores its parent's padding, so we need to set padding here
|
|
220
|
+
// to calculate dimensions and positioning.
|
|
170
221
|
|
|
171
|
-
// As per the design, let's
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const
|
|
222
|
+
// As per the design, let's constrain the height with fixed padding
|
|
223
|
+
const containerOuterHeight = window.innerHeight;
|
|
224
|
+
const verticalPadding = 40;
|
|
225
|
+
const containerInnerHeight = containerOuterHeight - verticalPadding * 2;
|
|
175
226
|
|
|
176
|
-
//
|
|
177
|
-
|
|
178
|
-
// to be used when calculating the image width and positioning
|
|
227
|
+
// Let's set a variable horizontal padding based on the container width
|
|
228
|
+
const containerOuterWidth = window.innerWidth;
|
|
179
229
|
let horizontalPadding = 0;
|
|
180
|
-
if (
|
|
230
|
+
if ( containerOuterWidth > 480 ) {
|
|
181
231
|
horizontalPadding = 40;
|
|
182
|
-
} else if (
|
|
232
|
+
} else if ( containerOuterWidth > 1920 ) {
|
|
183
233
|
horizontalPadding = 80;
|
|
184
234
|
}
|
|
185
|
-
|
|
186
|
-
const containerHeight =
|
|
187
|
-
context.core.image.figureRef.clientHeight - verticalPadding * 2;
|
|
235
|
+
const containerInnerWidth = containerOuterWidth - horizontalPadding * 2;
|
|
188
236
|
|
|
189
237
|
// Check difference between the image and figure dimensions
|
|
190
238
|
const widthOverflow = Math.abs(
|
|
191
|
-
Math.min(
|
|
239
|
+
Math.min( containerInnerWidth - targetWidth, 0 )
|
|
192
240
|
);
|
|
193
241
|
const heightOverflow = Math.abs(
|
|
194
|
-
Math.min(
|
|
242
|
+
Math.min( containerInnerHeight - targetHeight, 0 )
|
|
195
243
|
);
|
|
196
244
|
|
|
197
|
-
// If image is larger than
|
|
198
|
-
//
|
|
245
|
+
// If the image is larger than the container, let's resize
|
|
246
|
+
// it along the greater axis relative to the container
|
|
199
247
|
if ( widthOverflow > 0 || heightOverflow > 0 ) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
248
|
+
const containerInnerAspectRatio =
|
|
249
|
+
containerInnerWidth / containerInnerHeight;
|
|
250
|
+
const imageAspectRatio = targetWidth / targetHeight;
|
|
251
|
+
|
|
252
|
+
if ( imageAspectRatio > containerInnerAspectRatio ) {
|
|
253
|
+
targetWidth = containerInnerWidth;
|
|
205
254
|
targetHeight =
|
|
206
|
-
imgDom.naturalHeight
|
|
255
|
+
( targetWidth * imgDom.naturalHeight ) / imgDom.naturalWidth;
|
|
207
256
|
} else {
|
|
208
|
-
targetHeight =
|
|
257
|
+
targetHeight = containerInnerHeight;
|
|
209
258
|
targetWidth =
|
|
210
|
-
imgDom.naturalWidth
|
|
259
|
+
( targetHeight * imgDom.naturalWidth ) / imgDom.naturalHeight;
|
|
211
260
|
}
|
|
212
261
|
}
|
|
213
262
|
|
|
@@ -221,16 +270,16 @@ function setZoomStyles( imgDom, context, event ) {
|
|
|
221
270
|
|
|
222
271
|
// Get values used to center the image
|
|
223
272
|
let targetLeft = 0;
|
|
224
|
-
if ( targetWidth >=
|
|
273
|
+
if ( targetWidth >= containerInnerWidth ) {
|
|
225
274
|
targetLeft = horizontalPadding;
|
|
226
275
|
} else {
|
|
227
|
-
targetLeft = (
|
|
276
|
+
targetLeft = ( containerOuterWidth - targetWidth ) / 2;
|
|
228
277
|
}
|
|
229
278
|
let targetTop = 0;
|
|
230
|
-
if ( targetHeight >=
|
|
279
|
+
if ( targetHeight >= containerInnerHeight ) {
|
|
231
280
|
targetTop = verticalPadding;
|
|
232
281
|
} else {
|
|
233
|
-
targetTop = (
|
|
282
|
+
targetTop = ( containerOuterHeight - targetHeight ) / 2;
|
|
234
283
|
}
|
|
235
284
|
|
|
236
285
|
const root = document.documentElement;
|
package/src/index.js
CHANGED
|
@@ -142,7 +142,6 @@ const getAllBlocks = () => {
|
|
|
142
142
|
buttons,
|
|
143
143
|
calendar,
|
|
144
144
|
categories,
|
|
145
|
-
...( window.wp && window.wp.oldEditor ? [ classic ] : [] ), // Only add the classic block in WP Context.
|
|
146
145
|
code,
|
|
147
146
|
column,
|
|
148
147
|
columns,
|
|
@@ -229,6 +228,24 @@ const getAllBlocks = () => {
|
|
|
229
228
|
queryTitle,
|
|
230
229
|
postAuthorBiography,
|
|
231
230
|
];
|
|
231
|
+
|
|
232
|
+
// When in a WordPress context, conditionally
|
|
233
|
+
// add the classic block and TinyMCE editor
|
|
234
|
+
// under any of the following conditions:
|
|
235
|
+
// - the current post contains a classic block
|
|
236
|
+
// - the experiment to disable TinyMCE isn't active.
|
|
237
|
+
// - a query argument specifies that TinyMCE should be loaded
|
|
238
|
+
if (
|
|
239
|
+
window?.wp?.oldEditor &&
|
|
240
|
+
( window?.wp?.needsClassicBlock ||
|
|
241
|
+
! window?.__experimentalDisableTinymce ||
|
|
242
|
+
!! new URLSearchParams( window?.location?.search ).get(
|
|
243
|
+
'requiresTinymce'
|
|
244
|
+
) )
|
|
245
|
+
) {
|
|
246
|
+
blocks.push( classic );
|
|
247
|
+
}
|
|
248
|
+
|
|
232
249
|
return blocks.filter( Boolean );
|
|
233
250
|
};
|
|
234
251
|
|
package/src/latest-posts/edit.js
CHANGED
|
@@ -230,6 +230,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
230
230
|
displayPostContentRadio === 'excerpt' && (
|
|
231
231
|
<RangeControl
|
|
232
232
|
__nextHasNoMarginBottom
|
|
233
|
+
__next40pxDefaultSize
|
|
233
234
|
label={ __( 'Max number of words' ) }
|
|
234
235
|
value={ excerptLength }
|
|
235
236
|
onChange={ ( value ) =>
|
|
@@ -359,6 +360,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
359
360
|
{ postLayout === 'grid' && (
|
|
360
361
|
<RangeControl
|
|
361
362
|
__nextHasNoMarginBottom
|
|
363
|
+
__next40pxDefaultSize
|
|
362
364
|
label={ __( 'Columns' ) }
|
|
363
365
|
value={ columns }
|
|
364
366
|
onChange={ ( value ) =>
|
|
@@ -51,7 +51,7 @@ function render_block_core_latest_posts( $attributes ) {
|
|
|
51
51
|
$filter_latest_posts_excerpt_more = static function( $more ) use ( $attributes ) {
|
|
52
52
|
$use_excerpt = 'excerpt' === $attributes['displayPostContentRadio'];
|
|
53
53
|
/* translators: %1$s is a URL to a post, excerpt truncation character, default … */
|
|
54
|
-
return $use_excerpt ? sprintf( __( ' … <a href="%1$s" rel="noopener noreferrer">Read more</a>'
|
|
54
|
+
return $use_excerpt ? sprintf( __( ' … <a href="%1$s" rel="noopener noreferrer">Read more</a>' ), esc_url( get_permalink() ) ) : $more;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
add_filter( 'excerpt_more', $filter_latest_posts_excerpt_more );
|
package/src/list/block.json
CHANGED
package/src/list/edit.js
CHANGED
|
@@ -177,10 +177,12 @@ export default function Edit( { attributes, setAttributes, clientId, style } ) {
|
|
|
177
177
|
{ controls }
|
|
178
178
|
{ ordered && (
|
|
179
179
|
<OrderedListSettings
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
{ ...{
|
|
181
|
+
setAttributes,
|
|
182
|
+
reversed,
|
|
183
|
+
start,
|
|
184
|
+
type,
|
|
185
|
+
} }
|
|
184
186
|
/>
|
|
185
187
|
) }
|
|
186
188
|
</>
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
*/
|
|
20
20
|
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
|
|
21
21
|
import { registerCoreBlocks } from '@wordpress/block-library';
|
|
22
|
-
import { BACKSPACE } from '@wordpress/keycodes';
|
|
22
|
+
import { BACKSPACE, ENTER } from '@wordpress/keycodes';
|
|
23
23
|
|
|
24
24
|
describe( 'List block', () => {
|
|
25
25
|
beforeAll( () => {
|
|
@@ -338,34 +338,125 @@ describe( 'List block', () => {
|
|
|
338
338
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
339
339
|
} );
|
|
340
340
|
|
|
341
|
-
it( '
|
|
341
|
+
it( 'splits empty list items into paragraphs', async () => {
|
|
342
|
+
// Arrange
|
|
342
343
|
const initialHtml = `<!-- wp:list -->
|
|
343
344
|
<ul><!-- wp:list-item -->
|
|
344
|
-
<li>One</li><!-- /wp:list-item
|
|
345
|
-
<!--
|
|
346
|
-
<ul><!-- wp:list-item -->
|
|
345
|
+
<li>One</li><!-- /wp:list-item -->
|
|
346
|
+
<!-- wp:list-item -->
|
|
347
347
|
<li>Two</li><!-- /wp:list-item --></ul>
|
|
348
348
|
<!-- /wp:list -->`;
|
|
349
|
+
const screen = await initializeEditor( { initialHtml } );
|
|
349
350
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
} );
|
|
353
|
-
|
|
354
|
-
// Select List block
|
|
355
|
-
const [ listBlock ] = screen.getAllByLabelText( /List Block\. Row 2/ );
|
|
351
|
+
// Act
|
|
352
|
+
const listBlock = screen.getByLabelText( /List Block\. Row 1/ );
|
|
356
353
|
fireEvent.press( listBlock );
|
|
357
354
|
await triggerBlockListLayout( listBlock );
|
|
355
|
+
const listItemField = screen.getByLabelText( /Text input. .*One.*/ );
|
|
356
|
+
selectRangeInRichText( listItemField, 3 );
|
|
357
|
+
fireEvent( listItemField, 'onKeyDown', {
|
|
358
|
+
nativeEvent: {},
|
|
359
|
+
preventDefault() {},
|
|
360
|
+
keyCode: ENTER,
|
|
361
|
+
} );
|
|
362
|
+
const listItemField2 = screen.getByLabelText( /Text input. Empty/ );
|
|
363
|
+
fireEvent( listItemField2, 'onKeyDown', {
|
|
364
|
+
nativeEvent: {},
|
|
365
|
+
preventDefault() {},
|
|
366
|
+
keyCode: ENTER,
|
|
367
|
+
} );
|
|
358
368
|
|
|
359
|
-
//
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
369
|
+
// Assert
|
|
370
|
+
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
371
|
+
"<!-- wp:list -->
|
|
372
|
+
<ul><!-- wp:list-item -->
|
|
373
|
+
<li>One</li>
|
|
374
|
+
<!-- /wp:list-item --></ul>
|
|
375
|
+
<!-- /wp:list -->
|
|
364
376
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
377
|
+
<!-- wp:paragraph -->
|
|
378
|
+
<p></p>
|
|
379
|
+
<!-- /wp:paragraph -->
|
|
380
|
+
|
|
381
|
+
<!-- wp:list -->
|
|
382
|
+
<ul><!-- wp:list-item -->
|
|
383
|
+
<li>Two</li>
|
|
384
|
+
<!-- /wp:list-item --></ul>
|
|
385
|
+
<!-- /wp:list -->"
|
|
386
|
+
` );
|
|
387
|
+
} );
|
|
388
|
+
|
|
389
|
+
it( 'merges paragraphs into list items', async () => {
|
|
390
|
+
const initialHtml = `<!-- wp:list -->
|
|
391
|
+
<ul><!-- wp:list-item -->
|
|
392
|
+
<li>One</li>
|
|
393
|
+
<!-- /wp:list-item --></ul>
|
|
394
|
+
<!-- /wp:list -->
|
|
395
|
+
|
|
396
|
+
<!-- wp:paragraph -->
|
|
397
|
+
<p>Two</p>
|
|
398
|
+
<!-- /wp:paragraph -->
|
|
399
|
+
|
|
400
|
+
<!-- wp:list -->
|
|
401
|
+
<ul><!-- wp:list-item -->
|
|
402
|
+
<li>Three</li>
|
|
403
|
+
<!-- /wp:list-item --></ul>
|
|
404
|
+
<!-- /wp:list -->`;
|
|
405
|
+
const screen = await initializeEditor( { initialHtml } );
|
|
406
|
+
|
|
407
|
+
// Act
|
|
408
|
+
const paragraphField = screen.getByLabelText( /Text input. .*Two.*/ );
|
|
409
|
+
selectRangeInRichText( paragraphField, 0 );
|
|
410
|
+
fireEvent( paragraphField, 'onKeyDown', {
|
|
411
|
+
nativeEvent: {},
|
|
412
|
+
preventDefault() {},
|
|
413
|
+
keyCode: BACKSPACE,
|
|
414
|
+
} );
|
|
415
|
+
|
|
416
|
+
// Assert
|
|
417
|
+
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
418
|
+
"<!-- wp:list -->
|
|
419
|
+
<ul><!-- wp:list-item -->
|
|
420
|
+
<li>One</li>
|
|
421
|
+
<!-- /wp:list-item -->
|
|
422
|
+
|
|
423
|
+
<!-- wp:list-item -->
|
|
424
|
+
<li>Two</li>
|
|
425
|
+
<!-- /wp:list-item --></ul>
|
|
426
|
+
<!-- /wp:list -->
|
|
427
|
+
|
|
428
|
+
<!-- wp:list -->
|
|
429
|
+
<ul><!-- wp:list-item -->
|
|
430
|
+
<li>Three</li>
|
|
431
|
+
<!-- /wp:list-item --></ul>
|
|
432
|
+
<!-- /wp:list -->"
|
|
433
|
+
` );
|
|
434
|
+
} );
|
|
435
|
+
|
|
436
|
+
it( 'merges lists into lists', async () => {
|
|
437
|
+
// Arrange
|
|
438
|
+
const initialHtml = `<!-- wp:list -->
|
|
439
|
+
<ul><!-- wp:list-item -->
|
|
440
|
+
<li>One</li>
|
|
441
|
+
<!-- /wp:list-item -->
|
|
442
|
+
|
|
443
|
+
<!-- wp:list-item -->
|
|
444
|
+
<li>Two</li>
|
|
445
|
+
<!-- /wp:list-item --></ul>
|
|
446
|
+
<!-- /wp:list -->
|
|
447
|
+
|
|
448
|
+
<!-- wp:list -->
|
|
449
|
+
<ul><!-- wp:list-item -->
|
|
450
|
+
<li>Three</li>
|
|
451
|
+
<!-- /wp:list-item --></ul>
|
|
452
|
+
<!-- /wp:list -->`;
|
|
453
|
+
const screen = await initializeEditor( { initialHtml } );
|
|
454
|
+
|
|
455
|
+
// Act
|
|
456
|
+
const listBlock = screen.getByLabelText( /List Block\. Row 2/ );
|
|
457
|
+
fireEvent.press( listBlock );
|
|
458
|
+
await triggerBlockListLayout( listBlock );
|
|
459
|
+
const listItemField = screen.getByLabelText( /Text input\..*Three/ );
|
|
369
460
|
selectRangeInRichText( listItemField, 0 );
|
|
370
461
|
fireEvent( listItemField, 'onKeyDown', {
|
|
371
462
|
nativeEvent: {},
|
|
@@ -373,17 +464,22 @@ describe( 'List block', () => {
|
|
|
373
464
|
keyCode: BACKSPACE,
|
|
374
465
|
} );
|
|
375
466
|
|
|
467
|
+
// Assert
|
|
376
468
|
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
469
|
+
"<!-- wp:list -->
|
|
470
|
+
<ul><!-- wp:list-item -->
|
|
471
|
+
<li>One</li>
|
|
472
|
+
<!-- /wp:list-item -->
|
|
473
|
+
|
|
474
|
+
<!-- wp:list-item -->
|
|
475
|
+
<li>Two</li>
|
|
476
|
+
<!-- /wp:list-item -->
|
|
477
|
+
|
|
478
|
+
<!-- wp:list-item -->
|
|
479
|
+
<li>Three</li>
|
|
480
|
+
<!-- /wp:list-item --></ul>
|
|
481
|
+
<!-- /wp:list -->"
|
|
482
|
+
` );
|
|
387
483
|
} );
|
|
388
484
|
|
|
389
485
|
it( 'unwraps first item when attempting to merge with non-list block', async () => {
|
|
@@ -486,16 +582,16 @@ describe( 'List block', () => {
|
|
|
486
582
|
"<!-- wp:paragraph -->
|
|
487
583
|
<p>A quick brown fox.</p>
|
|
488
584
|
<!-- /wp:paragraph -->
|
|
489
|
-
|
|
585
|
+
|
|
490
586
|
<!-- wp:paragraph -->
|
|
491
587
|
<p>One</p>
|
|
492
588
|
<!-- /wp:paragraph -->
|
|
493
|
-
|
|
589
|
+
|
|
494
590
|
<!-- wp:list -->
|
|
495
591
|
<ul><!-- wp:list-item -->
|
|
496
592
|
<li>Two</li>
|
|
497
593
|
<!-- /wp:list-item -->
|
|
498
|
-
|
|
594
|
+
|
|
499
595
|
<!-- wp:list-item -->
|
|
500
596
|
<li>Three</li>
|
|
501
597
|
<!-- /wp:list-item --></ul>
|
package/src/missing/edit.js
CHANGED
|
@@ -16,22 +16,46 @@ import { safeHTML } from '@wordpress/dom';
|
|
|
16
16
|
function MissingBlockWarning( { attributes, convertToHTML, clientId } ) {
|
|
17
17
|
const { originalName, originalUndelimitedContent } = attributes;
|
|
18
18
|
const hasContent = !! originalUndelimitedContent;
|
|
19
|
-
const hasHTMLBlock = useSelect(
|
|
19
|
+
const { hasFreeformBlock, hasHTMLBlock } = useSelect(
|
|
20
20
|
( select ) => {
|
|
21
21
|
const { canInsertBlockType, getBlockRootClientId } =
|
|
22
22
|
select( blockEditorStore );
|
|
23
23
|
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
return {
|
|
25
|
+
hasFreeformBlock: canInsertBlockType(
|
|
26
|
+
'core/freeform',
|
|
27
|
+
getBlockRootClientId( clientId )
|
|
28
|
+
),
|
|
29
|
+
hasHTMLBlock: canInsertBlockType(
|
|
30
|
+
'core/html',
|
|
31
|
+
getBlockRootClientId( clientId )
|
|
32
|
+
),
|
|
33
|
+
};
|
|
28
34
|
},
|
|
29
35
|
[ clientId ]
|
|
30
36
|
);
|
|
31
37
|
|
|
32
38
|
const actions = [];
|
|
33
39
|
let messageHTML;
|
|
34
|
-
|
|
40
|
+
|
|
41
|
+
const convertToHtmlButton = (
|
|
42
|
+
<Button key="convert" onClick={ convertToHTML } variant="primary">
|
|
43
|
+
{ __( 'Keep as HTML' ) }
|
|
44
|
+
</Button>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
if ( hasContent && ! hasFreeformBlock && ! originalName ) {
|
|
48
|
+
if ( hasHTMLBlock ) {
|
|
49
|
+
messageHTML = __(
|
|
50
|
+
'It appears you are trying to use the deprecated Classic block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely. Alternatively, you can refresh the page to use the Classic block.'
|
|
51
|
+
);
|
|
52
|
+
actions.push( convertToHtmlButton );
|
|
53
|
+
} else {
|
|
54
|
+
messageHTML = __(
|
|
55
|
+
'It appears you are trying to use the deprecated Classic block. You can leave this block intact, or remove it entirely. Alternatively, you can refresh the page to use the Classic block.'
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
} else if ( hasContent && hasHTMLBlock ) {
|
|
35
59
|
messageHTML = sprintf(
|
|
36
60
|
/* translators: %s: block name */
|
|
37
61
|
__(
|
|
@@ -39,11 +63,7 @@ function MissingBlockWarning( { attributes, convertToHTML, clientId } ) {
|
|
|
39
63
|
),
|
|
40
64
|
originalName
|
|
41
65
|
);
|
|
42
|
-
actions.push(
|
|
43
|
-
<Button key="convert" onClick={ convertToHTML } variant="primary">
|
|
44
|
-
{ __( 'Keep as HTML' ) }
|
|
45
|
-
</Button>
|
|
46
|
-
);
|
|
66
|
+
actions.push( convertToHtmlButton );
|
|
47
67
|
} else {
|
|
48
68
|
messageHTML = sprintf(
|
|
49
69
|
/* translators: %s: block name */
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
View,
|
|
6
6
|
Text,
|
|
7
7
|
TouchableWithoutFeedback,
|
|
8
|
-
|
|
8
|
+
TouchableOpacity,
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -83,7 +83,7 @@ export class UnsupportedBlockEdit extends Component {
|
|
|
83
83
|
);
|
|
84
84
|
|
|
85
85
|
return (
|
|
86
|
-
<
|
|
86
|
+
<TouchableOpacity
|
|
87
87
|
onPress={ this.onHelpButtonPressed }
|
|
88
88
|
style={ styles.helpIconContainer }
|
|
89
89
|
accessibilityLabel={ __( 'Help button' ) }
|
|
@@ -94,9 +94,9 @@ export class UnsupportedBlockEdit extends Component {
|
|
|
94
94
|
className="unsupported-icon-help"
|
|
95
95
|
label={ __( 'Help icon' ) }
|
|
96
96
|
icon={ help }
|
|
97
|
-
|
|
97
|
+
fill={ infoIconStyle.color }
|
|
98
98
|
/>
|
|
99
|
-
</
|
|
99
|
+
</TouchableOpacity>
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -282,12 +282,14 @@ export class UnsupportedBlockEdit extends Component {
|
|
|
282
282
|
) }
|
|
283
283
|
>
|
|
284
284
|
{ this.renderHelpIcon() }
|
|
285
|
-
<
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
285
|
+
<View style={ styles.unsupportedBlockHeader }>
|
|
286
|
+
<Icon
|
|
287
|
+
className={ iconClassName }
|
|
288
|
+
icon={ icon && icon.src ? icon.src : icon }
|
|
289
|
+
fill={ iconStyle.color }
|
|
290
|
+
/>
|
|
291
|
+
<Text style={ titleStyle }>{ title }</Text>
|
|
292
|
+
</View>
|
|
291
293
|
{ subtitle }
|
|
292
294
|
{ this.renderSheet( title, originalName ) }
|
|
293
295
|
</View>
|