@wordpress/block-library 8.7.0 → 8.9.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/column/index.js +2 -1
- package/build/column/index.js.map +1 -1
- package/build/columns/edit.js +24 -6
- package/build/columns/edit.js.map +1 -1
- package/build/columns/index.js +2 -1
- package/build/columns/index.js.map +1 -1
- package/build/columns/utils.js +4 -9
- package/build/columns/utils.js.map +1 -1
- package/build/cover/edit/index.js +46 -50
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/{resizable-cover.js → resizable-cover-popover.js} +32 -6
- package/build/cover/edit/resizable-cover-popover.js.map +1 -0
- package/build/cover/index.js +12 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/transforms.js +10 -7
- package/build/cover/transforms.js.map +1 -1
- package/build/details/edit.js +67 -0
- package/build/details/edit.js.map +1 -0
- package/build/details/index.js +110 -0
- package/build/details/index.js.map +1 -0
- package/build/details/save.js +33 -0
- package/build/details/save.js.map +1 -0
- package/build/details-content/edit.js +34 -0
- package/build/details-content/edit.js.map +1 -0
- package/build/details-content/index.js +94 -0
- package/build/details-content/index.js.map +1 -0
- package/build/details-content/save.js +20 -0
- package/build/details-content/save.js.map +1 -0
- package/build/details-summary/edit.js +42 -0
- package/build/details-summary/edit.js.map +1 -0
- package/build/details-summary/index.js +97 -0
- package/build/details-summary/index.js.map +1 -0
- package/build/details-summary/save.js +24 -0
- package/build/details-summary/save.js.map +1 -0
- package/build/embed/deprecated.js +4 -1
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/embed-link-settings.native.js +1 -1
- package/build/embed/embed-link-settings.native.js.map +1 -1
- package/build/embed/embed-placeholder.js +1 -1
- package/build/embed/embed-placeholder.js.map +1 -1
- package/build/embed/index.js +4 -1
- package/build/embed/index.js.map +1 -1
- package/build/embed/transforms.js +4 -1
- package/build/embed/transforms.js.map +1 -1
- package/build/embed/util.js +4 -1
- package/build/embed/util.js.map +1 -1
- package/build/file/edit.native.js +0 -2
- package/build/file/edit.native.js.map +1 -1
- package/build/gallery/use-get-media.native.js +2 -1
- package/build/gallery/use-get-media.native.js.map +1 -1
- package/build/group/edit.js +3 -1
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +3 -0
- package/build/group/index.js.map +1 -1
- package/build/image/edit.js +16 -13
- package/build/image/edit.js.map +1 -1
- package/build/image/index.js +5 -3
- package/build/image/index.js.map +1 -1
- package/build/index.js +24 -6
- package/build/index.js.map +1 -1
- package/build/index.native.js +9 -5
- package/build/index.native.js.map +1 -1
- package/build/media-text/edit.js +4 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/index.js +3 -0
- package/build/media-text/index.js.map +1 -1
- package/build/media-text/media-container.js +2 -6
- package/build/media-text/media-container.js.map +1 -1
- package/build/media-text/media-container.native.js +3 -3
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/navigation/deprecated.js +8 -11
- package/build/navigation/deprecated.js.map +1 -1
- package/build/navigation/edit/index.js +32 -64
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +1 -14
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/post-author/index.js +0 -1
- package/build/post-author/index.js.map +1 -1
- package/build/post-date/edit.js +4 -2
- package/build/post-date/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +2 -2
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +2 -1
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js +16 -27
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-time-to-read/edit.js +1 -1
- package/build/post-time-to-read/edit.js.map +1 -1
- package/build/post-time-to-read/index.js +7 -0
- package/build/post-time-to-read/index.js.map +1 -1
- package/build/query/deprecated.js +8 -6
- package/build/query/deprecated.js.map +1 -1
- package/build/query/edit/inspector-controls/create-new-post-link.js +41 -0
- package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
- package/build/query/edit/inspector-controls/index.js +14 -6
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/pattern-selection-modal.js +2 -1
- package/build/query/edit/pattern-selection-modal.js.map +1 -1
- package/build/query/index.js +5 -12
- package/build/query/index.js.map +1 -1
- package/build/site-logo/edit.js +114 -16
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +1 -1
- package/build/social-link/icons/chain.js +1 -1
- package/build/social-link/icons/chain.js.map +1 -1
- package/build/social-link/icons/mail.js +1 -1
- package/build/social-link/icons/mail.js.map +1 -1
- package/build/spacer/controls.js +25 -6
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/edit.js +129 -13
- package/build/spacer/edit.js.map +1 -1
- package/build/spacer/save.js +2 -2
- package/build/spacer/save.js.map +1 -1
- package/build/table/state.js +35 -35
- package/build/table/state.js.map +1 -1
- package/build/template-part/edit/index.js +2 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +2 -2
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/term-description/index.js +1 -2
- package/build/term-description/index.js.map +1 -1
- package/build/utils/migrate-font-family.js +12 -5
- package/build/utils/migrate-font-family.js.map +1 -1
- package/build/video/edit.native.js +4 -3
- package/build/video/edit.native.js.map +1 -1
- package/build-module/column/index.js +2 -1
- package/build-module/column/index.js.map +1 -1
- package/build-module/columns/edit.js +24 -6
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/index.js +2 -1
- package/build-module/columns/index.js.map +1 -1
- package/build-module/columns/utils.js +4 -8
- package/build-module/columns/utils.js.map +1 -1
- package/build-module/cover/edit/index.js +48 -52
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/{resizable-cover.js → resizable-cover-popover.js} +31 -6
- package/build-module/cover/edit/resizable-cover-popover.js.map +1 -0
- package/build-module/cover/index.js +12 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/transforms.js +5 -1
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/details/edit.js +52 -0
- package/build-module/details/edit.js.map +1 -0
- package/build-module/details/index.js +91 -0
- package/build-module/details/index.js.map +1 -0
- package/build-module/details/save.js +20 -0
- package/build-module/details/save.js.map +1 -0
- package/build-module/details-content/edit.js +23 -0
- package/build-module/details-content/edit.js.map +1 -0
- package/build-module/details-content/index.js +76 -0
- package/build-module/details-content/index.js.map +1 -0
- package/build-module/details-content/save.js +11 -0
- package/build-module/details-content/save.js.map +1 -0
- package/build-module/details-summary/edit.js +30 -0
- package/build-module/details-summary/edit.js.map +1 -0
- package/build-module/details-summary/index.js +79 -0
- package/build-module/details-summary/index.js.map +1 -0
- package/build-module/details-summary/save.js +16 -0
- package/build-module/details-summary/save.js.map +1 -0
- package/build-module/embed/deprecated.js +4 -1
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/embed-link-settings.native.js +1 -1
- package/build-module/embed/embed-link-settings.native.js.map +1 -1
- package/build-module/embed/embed-placeholder.js +1 -1
- package/build-module/embed/embed-placeholder.js.map +1 -1
- package/build-module/embed/index.js +4 -1
- package/build-module/embed/index.js.map +1 -1
- package/build-module/embed/transforms.js +4 -1
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/embed/util.js +4 -1
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/edit.native.js +0 -2
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/gallery/use-get-media.native.js +2 -1
- package/build-module/gallery/use-get-media.native.js.map +1 -1
- package/build-module/group/edit.js +3 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +3 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/image/edit.js +16 -13
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/index.js +5 -3
- package/build-module/image/index.js.map +1 -1
- package/build-module/index.js +21 -6
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +9 -5
- package/build-module/index.native.js.map +1 -1
- package/build-module/media-text/edit.js +4 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/index.js +3 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/media-text/media-container.js +1 -5
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/media-text/media-container.native.js +1 -1
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/navigation/deprecated.js +8 -10
- package/build-module/navigation/deprecated.js.map +1 -1
- package/build-module/navigation/edit/index.js +31 -63
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +1 -14
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/post-author/index.js +0 -1
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-date/edit.js +4 -2
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +2 -2
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +2 -1
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +16 -27
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-time-to-read/edit.js +1 -1
- package/build-module/post-time-to-read/edit.js.map +1 -1
- package/build-module/post-time-to-read/index.js +7 -0
- package/build-module/post-time-to-read/index.js.map +1 -1
- package/build-module/query/deprecated.js +5 -2
- package/build-module/query/deprecated.js.map +1 -1
- package/build-module/query/edit/inspector-controls/create-new-post-link.js +33 -0
- package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
- package/build-module/query/edit/inspector-controls/index.js +12 -7
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/pattern-selection-modal.js +2 -1
- package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
- package/build-module/query/index.js +5 -10
- package/build-module/query/index.js.map +1 -1
- package/build-module/site-logo/edit.js +115 -18
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +1 -1
- package/build-module/social-link/icons/chain.js +1 -1
- package/build-module/social-link/icons/chain.js.map +1 -1
- package/build-module/social-link/icons/mail.js +1 -1
- package/build-module/social-link/icons/mail.js.map +1 -1
- package/build-module/spacer/controls.js +27 -9
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/edit.js +129 -14
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/spacer/save.js +3 -3
- package/build-module/spacer/save.js.map +1 -1
- package/build-module/table/state.js +35 -33
- package/build-module/table/state.js.map +1 -1
- package/build-module/template-part/edit/index.js +2 -1
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +2 -2
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/term-description/index.js +1 -2
- package/build-module/term-description/index.js.map +1 -1
- package/build-module/utils/migrate-font-family.js +9 -1
- package/build-module/utils/migrate-font-family.js.map +1 -1
- package/build-module/video/edit.native.js +4 -3
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/columns/style-rtl.css +4 -1
- package/build-style/columns/style.css +4 -1
- package/build-style/common-rtl.css +1 -1
- package/build-style/common.css +1 -1
- package/build-style/cover/editor-rtl.css +9 -10
- package/build-style/cover/editor.css +9 -10
- package/build-style/cover/style-rtl.css +1 -1
- package/build-style/cover/style.css +1 -1
- package/build-style/details/style-rtl.css +91 -0
- package/build-style/details/style.css +91 -0
- package/build-style/details-summary/editor-rtl.css +91 -0
- package/build-style/details-summary/editor.css +91 -0
- package/build-style/details-summary/style-rtl.css +91 -0
- package/build-style/details-summary/style.css +91 -0
- package/build-style/editor-rtl.css +97 -74
- package/build-style/editor.css +97 -74
- package/build-style/file/style-rtl.css +4 -3
- package/build-style/file/style.css +4 -3
- package/build-style/html/editor-rtl.css +2 -2
- package/build-style/html/editor.css +2 -2
- package/build-style/image/editor-rtl.css +1 -1
- package/build-style/image/editor.css +1 -1
- package/build-style/post-excerpt/style-rtl.css +1 -1
- package/build-style/post-excerpt/style.css +1 -1
- package/build-style/pullquote/style-rtl.css +4 -1
- package/build-style/pullquote/style.css +4 -1
- package/build-style/query/editor-rtl.css +8 -12
- package/build-style/query/editor.css +8 -12
- package/build-style/search/style-rtl.css +2 -0
- package/build-style/search/style.css +2 -0
- package/build-style/shortcode/editor-rtl.css +15 -35
- package/build-style/shortcode/editor.css +15 -35
- package/build-style/site-logo/editor-rtl.css +46 -0
- package/build-style/site-logo/editor.css +46 -0
- package/build-style/spacer/editor-rtl.css +4 -2
- package/build-style/spacer/editor.css +4 -2
- package/build-style/style-rtl.css +25 -8
- package/build-style/style.css +25 -8
- package/build-style/template-part/editor-rtl.css +8 -12
- package/build-style/template-part/editor.css +8 -12
- package/package.json +31 -31
- package/src/buttons/test/__snapshots__/edit.native.js.snap +18 -0
- package/src/buttons/test/edit.native.js +123 -2
- package/src/column/block.json +2 -1
- package/src/columns/block.json +2 -1
- package/src/columns/edit.js +33 -9
- package/src/columns/style.scss +5 -1
- package/src/columns/utils.js +8 -9
- package/src/common.scss +1 -1
- package/src/cover/block.json +12 -0
- package/src/cover/edit/index.js +44 -37
- package/src/cover/edit/resizable-cover-popover.js +82 -0
- package/src/cover/editor.scss +20 -13
- package/src/cover/index.php +9 -10
- package/src/cover/style.scss +1 -1
- package/src/cover/test/edit.js +1 -1
- package/src/cover/transforms.js +4 -1
- package/src/details/block.json +54 -0
- package/src/details/edit.js +59 -0
- package/src/details/index.js +35 -0
- package/src/details/save.js +15 -0
- package/src/details/style.scss +3 -0
- package/src/details-content/block.json +50 -0
- package/src/details-content/edit.js +29 -0
- package/src/details-content/index.js +23 -0
- package/src/details-content/save.js +12 -0
- package/src/details-summary/block.json +53 -0
- package/src/details-summary/edit.js +27 -0
- package/src/details-summary/editor.scss +3 -0
- package/src/details-summary/index.js +23 -0
- package/src/details-summary/save.js +13 -0
- package/src/details-summary/style.scss +3 -0
- package/src/editor.scss +1 -0
- package/src/embed/block.json +4 -1
- package/src/embed/embed-link-settings.native.js +1 -1
- package/src/embed/embed-placeholder.js +1 -1
- package/src/file/edit.native.js +0 -2
- package/src/file/style.scss +5 -2
- package/src/gallery/test/index.native.js +4 -4
- package/src/gallery/test/use-get-media.native.js +24 -0
- package/src/gallery/use-get-media.native.js +1 -1
- package/src/group/block.json +3 -0
- package/src/group/edit.js +8 -2
- package/src/heading/test/__snapshots__/index.native.js.snap +12 -0
- package/src/heading/test/index.native.js +71 -0
- package/src/html/editor.scss +2 -21
- package/src/image/block.json +5 -3
- package/src/image/edit.js +21 -17
- package/src/image/editor.scss +1 -1
- package/src/index.js +13 -3
- package/src/index.native.js +9 -5
- package/src/list/test/edit.native.js +7 -7
- package/src/media-text/block.json +3 -0
- package/src/media-text/edit.js +2 -1
- package/src/media-text/media-container.js +1 -5
- package/src/media-text/media-container.native.js +1 -1
- package/src/navigation/deprecated.js +15 -19
- package/src/navigation/edit/index.js +32 -106
- package/src/navigation/edit/unsaved-inner-blocks.js +34 -46
- package/src/navigation/index.php +15 -12
- package/src/paragraph/test/edit.native.js +616 -1
- package/src/post-author/block.json +0 -1
- package/src/post-date/edit.js +4 -0
- package/src/post-date/index.php +17 -8
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-excerpt/index.php +3 -3
- package/src/post-excerpt/style.scss +2 -1
- package/src/post-featured-image/dimension-controls.js +5 -1
- package/src/post-featured-image/edit.js +14 -34
- package/src/post-featured-image/index.php +1 -1
- package/src/post-time-to-read/block.json +7 -0
- package/src/post-time-to-read/edit.js +1 -1
- package/src/post-time-to-read/index.php +3 -3
- package/src/preformatted/test/__snapshots__/edit.native.js.snap +2 -2
- package/src/preformatted/test/edit.native.js +42 -2
- package/src/pullquote/style.scss +5 -1
- package/src/pullquote/test/edit.native.js +65 -0
- package/src/query/deprecated.js +4 -1
- package/src/query/edit/inspector-controls/create-new-post-link.js +26 -0
- package/src/query/edit/inspector-controls/index.js +13 -6
- package/src/query/edit/pattern-selection-modal.js +1 -0
- package/src/query/editor.scss +8 -11
- package/src/query/index.js +1 -7
- package/src/quote/test/edit.native.js +88 -0
- package/src/search/index.php +1 -1
- package/src/search/style.scss +3 -0
- package/src/shortcode/editor.scss +6 -5
- package/src/site-logo/block.json +1 -1
- package/src/site-logo/edit.js +123 -9
- package/src/site-logo/editor.scss +57 -0
- package/src/social-link/icons/chain.js +1 -1
- package/src/social-link/icons/mail.js +1 -1
- package/src/social-link/index.php +2 -2
- package/src/spacer/controls.js +42 -17
- package/src/spacer/edit.js +176 -18
- package/src/spacer/editor.scss +2 -1
- package/src/spacer/save.js +3 -3
- package/src/style.scss +2 -0
- package/src/table/state.js +83 -66
- package/src/template-part/edit/index.js +1 -0
- package/src/template-part/edit/utils/hooks.js +2 -2
- package/src/template-part/editor.scss +9 -11
- package/src/term-description/block.json +1 -2
- package/src/utils/migrate-font-family.js +8 -1
- package/src/verse/test/edit.native.js +28 -0
- package/src/video/edit.native.js +2 -2
- package/tsconfig.json +1 -0
- package/build/cover/edit/resizable-cover.js.map +0 -1
- package/build/media-text/media-container-icon.js +0 -27
- package/build/media-text/media-container-icon.js.map +0 -1
- package/build/query/hooks.js +0 -72
- package/build/query/hooks.js.map +0 -1
- package/build/utils/clean-empty-object.js +0 -34
- package/build/utils/clean-empty-object.js.map +0 -1
- package/build-module/cover/edit/resizable-cover.js.map +0 -1
- package/build-module/media-text/media-container-icon.js +0 -17
- package/build-module/media-text/media-container-icon.js.map +0 -1
- package/build-module/query/hooks.js +0 -59
- package/build-module/query/hooks.js.map +0 -1
- package/build-module/utils/clean-empty-object.js +0 -25
- package/build-module/utils/clean-empty-object.js.map +0 -1
- package/src/cover/edit/resizable-cover.js +0 -61
- package/src/media-text/media-container-icon.js +0 -12
- package/src/query/hooks.js +0 -53
- package/src/utils/clean-empty-object.js +0 -28
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { render } from 'test/helpers';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import useGetMedia from '../use-get-media';
|
|
10
|
+
|
|
11
|
+
describe( 'useGetMedia', () => {
|
|
12
|
+
// TODO: Explore why a Gallery block would ever be without inner blocks.
|
|
13
|
+
// This test and the associated default function parameter might be unnecessary.
|
|
14
|
+
it( 'should not error when receiving zero images', () => {
|
|
15
|
+
// Arrange
|
|
16
|
+
const TestSubject = () => {
|
|
17
|
+
useGetMedia( undefined );
|
|
18
|
+
return null;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Assert
|
|
22
|
+
expect( () => render( <TestSubject /> ) ).not.toThrow();
|
|
23
|
+
} );
|
|
24
|
+
} );
|
|
@@ -14,7 +14,7 @@ const EMPTY_IMAGE_MEDIA = [];
|
|
|
14
14
|
*
|
|
15
15
|
* @return {Array} An array of media info options for each gallery image.
|
|
16
16
|
*/
|
|
17
|
-
export default function useGetMedia( innerBlockImages ) {
|
|
17
|
+
export default function useGetMedia( innerBlockImages = [] ) {
|
|
18
18
|
return useSelect(
|
|
19
19
|
( select ) => {
|
|
20
20
|
const imagesUploading = innerBlockImages.some(
|
package/src/group/block.json
CHANGED
package/src/group/edit.js
CHANGED
|
@@ -90,7 +90,12 @@ function GroupEdit( {
|
|
|
90
90
|
[ clientId ]
|
|
91
91
|
);
|
|
92
92
|
|
|
93
|
-
const {
|
|
93
|
+
const {
|
|
94
|
+
tagName: TagName = 'div',
|
|
95
|
+
templateLock,
|
|
96
|
+
allowedBlocks,
|
|
97
|
+
layout = {},
|
|
98
|
+
} = attributes;
|
|
94
99
|
|
|
95
100
|
// Layout settings.
|
|
96
101
|
const defaultLayout = useSetting( 'layout' ) || {};
|
|
@@ -131,6 +136,7 @@ function GroupEdit( {
|
|
|
131
136
|
: { className: 'wp-block-group__inner-container' },
|
|
132
137
|
{
|
|
133
138
|
templateLock,
|
|
139
|
+
allowedBlocks,
|
|
134
140
|
renderAppender,
|
|
135
141
|
__unstableDisableLayoutClassNames: ! layoutSupportEnabled,
|
|
136
142
|
}
|
|
@@ -153,7 +159,7 @@ function GroupEdit( {
|
|
|
153
159
|
}
|
|
154
160
|
/>
|
|
155
161
|
{ showPlaceholder && (
|
|
156
|
-
<View
|
|
162
|
+
<View>
|
|
157
163
|
{ innerBlocksProps.children }
|
|
158
164
|
<GroupPlaceHolder
|
|
159
165
|
clientId={ clientId }
|
|
@@ -5,3 +5,15 @@ exports[`Heading block inserts block 1`] = `
|
|
|
5
5
|
<h2 class="wp-block-heading"></h2>
|
|
6
6
|
<!-- /wp:heading -->"
|
|
7
7
|
`;
|
|
8
|
+
|
|
9
|
+
exports[`Heading block should set a background color 1`] = `
|
|
10
|
+
"<!-- wp:heading {"backgroundColor":"luminous-vivid-orange"} -->
|
|
11
|
+
<h2 class="wp-block-heading has-luminous-vivid-orange-background-color has-background">A quick brown fox jumps over the lazy dog.</h2>
|
|
12
|
+
<!-- /wp:heading -->"
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`Heading block should set a text color 1`] = `
|
|
16
|
+
"<!-- wp:heading {"textColor":"pale-pink"} -->
|
|
17
|
+
<h2 class="wp-block-heading has-pale-pink-color has-text-color">A quick brown fox jumps over the lazy dog.</h2>
|
|
18
|
+
<!-- /wp:heading -->"
|
|
19
|
+
`;
|
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
initializeEditor,
|
|
8
8
|
addBlock,
|
|
9
9
|
getBlock,
|
|
10
|
+
typeInRichText,
|
|
11
|
+
waitFor,
|
|
12
|
+
within,
|
|
10
13
|
} from 'test/helpers';
|
|
11
14
|
|
|
12
15
|
/**
|
|
@@ -41,4 +44,72 @@ describe( 'Heading block', () => {
|
|
|
41
44
|
|
|
42
45
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
43
46
|
} );
|
|
47
|
+
|
|
48
|
+
it( 'should set a text color', async () => {
|
|
49
|
+
// Arrange
|
|
50
|
+
const screen = await initializeEditor();
|
|
51
|
+
await addBlock( screen, 'Heading' );
|
|
52
|
+
|
|
53
|
+
// Act
|
|
54
|
+
const headingBlock = getBlock( screen, 'Heading' );
|
|
55
|
+
fireEvent.press( headingBlock );
|
|
56
|
+
const headingTextInput =
|
|
57
|
+
within( headingBlock ).getByPlaceholderText( 'Heading' );
|
|
58
|
+
typeInRichText(
|
|
59
|
+
headingTextInput,
|
|
60
|
+
'A quick brown fox jumps over the lazy dog.'
|
|
61
|
+
);
|
|
62
|
+
// Open Block Settings.
|
|
63
|
+
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
64
|
+
|
|
65
|
+
// Wait for Block Settings to be visible.
|
|
66
|
+
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
67
|
+
await waitFor( () => blockSettingsModal.props.isVisible );
|
|
68
|
+
|
|
69
|
+
// Open Text color settings
|
|
70
|
+
fireEvent.press( screen.getByLabelText( 'Text, Default' ) );
|
|
71
|
+
|
|
72
|
+
// Tap one color
|
|
73
|
+
fireEvent.press( screen.getByLabelText( 'Pale pink' ) );
|
|
74
|
+
|
|
75
|
+
// Dismiss the Block Settings modal.
|
|
76
|
+
fireEvent( blockSettingsModal, 'backdropPress' );
|
|
77
|
+
|
|
78
|
+
// Assert
|
|
79
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
80
|
+
} );
|
|
81
|
+
|
|
82
|
+
it( 'should set a background color', async () => {
|
|
83
|
+
// Arrange
|
|
84
|
+
const screen = await initializeEditor();
|
|
85
|
+
await addBlock( screen, 'Heading' );
|
|
86
|
+
|
|
87
|
+
// Act
|
|
88
|
+
const headingBlock = getBlock( screen, 'Heading' );
|
|
89
|
+
fireEvent.press( headingBlock );
|
|
90
|
+
const headingTextInput =
|
|
91
|
+
within( headingBlock ).getByPlaceholderText( 'Heading' );
|
|
92
|
+
typeInRichText(
|
|
93
|
+
headingTextInput,
|
|
94
|
+
'A quick brown fox jumps over the lazy dog.'
|
|
95
|
+
);
|
|
96
|
+
// Open Block Settings.
|
|
97
|
+
fireEvent.press( screen.getByLabelText( 'Open Settings' ) );
|
|
98
|
+
|
|
99
|
+
// Wait for Block Settings to be visible.
|
|
100
|
+
const blockSettingsModal = screen.getByTestId( 'block-settings-modal' );
|
|
101
|
+
await waitFor( () => blockSettingsModal.props.isVisible );
|
|
102
|
+
|
|
103
|
+
// Open Background color settings
|
|
104
|
+
fireEvent.press( screen.getByLabelText( 'Background, Default' ) );
|
|
105
|
+
|
|
106
|
+
// Tap one color
|
|
107
|
+
fireEvent.press( screen.getByLabelText( 'Luminous vivid orange' ) );
|
|
108
|
+
|
|
109
|
+
// Dismiss the Block Settings modal.
|
|
110
|
+
fireEvent( blockSettingsModal, 'backdropPress' );
|
|
111
|
+
|
|
112
|
+
// Assert
|
|
113
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
114
|
+
} );
|
|
44
115
|
} );
|
package/src/html/editor.scss
CHANGED
|
@@ -10,27 +10,8 @@
|
|
|
10
10
|
// The editing view for the HTML block is equivalent to block UI.
|
|
11
11
|
// Therefore we increase specificity to avoid theme styles bleeding in.
|
|
12
12
|
.block-editor-plain-text {
|
|
13
|
-
|
|
14
|
-
color: $gray-900 !important;
|
|
15
|
-
background: $white !important;
|
|
16
|
-
padding: $grid-unit-15 !important;
|
|
17
|
-
border: $border-width solid $gray-900 !important;
|
|
18
|
-
box-shadow: none !important;
|
|
19
|
-
border-radius: $radius-block-ui !important;
|
|
13
|
+
box-sizing: border-box;
|
|
20
14
|
max-height: 250px;
|
|
21
|
-
|
|
22
|
-
/* Fonts smaller than 16px causes mobile safari to zoom. */
|
|
23
|
-
font-size: $mobile-text-min-font-size !important;
|
|
24
|
-
@include break-small {
|
|
25
|
-
font-size: $default-font-size !important;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&:focus {
|
|
29
|
-
border-color: var(--wp-admin-theme-color) !important;
|
|
30
|
-
box-shadow: 0 0 0 ($border-width-focus - $border-width) var(--wp-admin-theme-color) !important;
|
|
31
|
-
|
|
32
|
-
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
33
|
-
outline: 2px solid transparent !important;
|
|
34
|
-
}
|
|
15
|
+
@include editor-input-reset();
|
|
35
16
|
}
|
|
36
17
|
}
|
package/src/image/block.json
CHANGED
|
@@ -85,10 +85,12 @@
|
|
|
85
85
|
"supports": {
|
|
86
86
|
"anchor": true,
|
|
87
87
|
"color": {
|
|
88
|
-
"__experimentalDuotone": true,
|
|
89
88
|
"text": false,
|
|
90
89
|
"background": false
|
|
91
90
|
},
|
|
91
|
+
"filter": {
|
|
92
|
+
"duotone": true
|
|
93
|
+
},
|
|
92
94
|
"__experimentalBorder": {
|
|
93
95
|
"color": true,
|
|
94
96
|
"radius": true,
|
|
@@ -102,9 +104,9 @@
|
|
|
102
104
|
}
|
|
103
105
|
},
|
|
104
106
|
"selectors": {
|
|
105
|
-
"border": ".wp-block-image img, .wp-block-image .wp-block-image__crop-area",
|
|
107
|
+
"border": ".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",
|
|
106
108
|
"filter": {
|
|
107
|
-
"duotone": "img, .components-placeholder"
|
|
109
|
+
"duotone": ".wp-block-image img, .wp-block-image .components-placeholder"
|
|
108
110
|
}
|
|
109
111
|
},
|
|
110
112
|
"styles": [
|
package/src/image/edit.js
CHANGED
|
@@ -29,23 +29,6 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
29
29
|
*/
|
|
30
30
|
import Image from './image';
|
|
31
31
|
|
|
32
|
-
// Much of this description is duplicated from MediaPlaceholder.
|
|
33
|
-
const placeholder = ( content ) => {
|
|
34
|
-
return (
|
|
35
|
-
<Placeholder
|
|
36
|
-
className="block-editor-media-placeholder"
|
|
37
|
-
withIllustration={ true }
|
|
38
|
-
icon={ icon }
|
|
39
|
-
label={ __( 'Image' ) }
|
|
40
|
-
instructions={ __(
|
|
41
|
-
'Upload an image file, pick one from your media library, or add one with a URL.'
|
|
42
|
-
) }
|
|
43
|
-
>
|
|
44
|
-
{ content }
|
|
45
|
-
</Placeholder>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
32
|
/**
|
|
50
33
|
* Module constants
|
|
51
34
|
*/
|
|
@@ -345,6 +328,27 @@ export function ImageEdit( {
|
|
|
345
328
|
className: classes,
|
|
346
329
|
} );
|
|
347
330
|
|
|
331
|
+
// Much of this description is duplicated from MediaPlaceholder.
|
|
332
|
+
const placeholder = ( content ) => {
|
|
333
|
+
return (
|
|
334
|
+
<Placeholder
|
|
335
|
+
className={ classnames( 'block-editor-media-placeholder', {
|
|
336
|
+
[ borderProps.className ]:
|
|
337
|
+
!! borderProps.className && ! isSelected,
|
|
338
|
+
} ) }
|
|
339
|
+
withIllustration={ true }
|
|
340
|
+
icon={ icon }
|
|
341
|
+
label={ __( 'Image' ) }
|
|
342
|
+
instructions={ __(
|
|
343
|
+
'Upload an image file, pick one from your media library, or add one with a URL.'
|
|
344
|
+
) }
|
|
345
|
+
style={ isSelected ? undefined : borderProps.style }
|
|
346
|
+
>
|
|
347
|
+
{ content }
|
|
348
|
+
</Placeholder>
|
|
349
|
+
);
|
|
350
|
+
};
|
|
351
|
+
|
|
348
352
|
return (
|
|
349
353
|
<figure { ...blockProps }>
|
|
350
354
|
{ ( temporaryURL || url ) && (
|
package/src/image/editor.scss
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
border: none;
|
|
11
11
|
|
|
12
12
|
// Disable any duotone filter applied in the selected state.
|
|
13
|
-
filter: none;
|
|
13
|
+
filter: none !important;
|
|
14
14
|
|
|
15
15
|
// @todo: this should eventually be overridden by a custom border-radius set in the inspector.
|
|
16
16
|
border-radius: $radius-block-ui;
|
package/src/index.js
CHANGED
|
@@ -45,6 +45,9 @@ import * as commentsPaginationNext from './comments-pagination-next';
|
|
|
45
45
|
import * as commentsPaginationNumbers from './comments-pagination-numbers';
|
|
46
46
|
import * as commentsTitle from './comments-title';
|
|
47
47
|
import * as cover from './cover';
|
|
48
|
+
import * as details from './details';
|
|
49
|
+
import * as detailsContent from './details-content';
|
|
50
|
+
import * as detailsSummary from './details-summary';
|
|
48
51
|
import * as embed from './embed';
|
|
49
52
|
import * as file from './file';
|
|
50
53
|
import * as gallery from './gallery';
|
|
@@ -121,8 +124,8 @@ import isBlockMetadataExperimental from './utils/is-block-metadata-experimental'
|
|
|
121
124
|
/**
|
|
122
125
|
* Function to get all the block-library blocks in an array
|
|
123
126
|
*/
|
|
124
|
-
const getAllBlocks = () =>
|
|
125
|
-
[
|
|
127
|
+
const getAllBlocks = () => {
|
|
128
|
+
const blocks = [
|
|
126
129
|
// Common blocks are grouped at the top to prioritize their display
|
|
127
130
|
// in various contexts — like the inserter and auto-complete components.
|
|
128
131
|
paragraph,
|
|
@@ -224,7 +227,14 @@ const getAllBlocks = () =>
|
|
|
224
227
|
termDescription,
|
|
225
228
|
queryTitle,
|
|
226
229
|
postAuthorBiography,
|
|
227
|
-
]
|
|
230
|
+
];
|
|
231
|
+
if ( window?.__experimentalEnableDetailsBlocks ) {
|
|
232
|
+
blocks.push( details );
|
|
233
|
+
blocks.push( detailsContent );
|
|
234
|
+
blocks.push( detailsSummary );
|
|
235
|
+
}
|
|
236
|
+
return blocks.filter( Boolean );
|
|
237
|
+
};
|
|
228
238
|
|
|
229
239
|
/**
|
|
230
240
|
* Function to get all the core blocks in an array.
|
package/src/index.native.js
CHANGED
|
@@ -261,10 +261,14 @@ export const registerCoreBlocks = () => {
|
|
|
261
261
|
* than 0, a "new" badge is displayed on the block type within the block
|
|
262
262
|
* inserter.
|
|
263
263
|
*
|
|
264
|
+
* With the below example, the Audio block will be displayed as "new" until its
|
|
265
|
+
* impression count reaches 0, which occurs by various actions decrementing
|
|
266
|
+
* the impression count.
|
|
267
|
+
*
|
|
268
|
+
* {
|
|
269
|
+
* [ audio.name ]: 40
|
|
270
|
+
* }
|
|
271
|
+
*
|
|
264
272
|
* @constant {{ string, number }}
|
|
265
273
|
*/
|
|
266
|
-
export const NEW_BLOCK_TYPES = {
|
|
267
|
-
[ embed.name ]: 40,
|
|
268
|
-
[ search.name ]: 40,
|
|
269
|
-
[ audio.name ]: 40,
|
|
270
|
-
};
|
|
274
|
+
export const NEW_BLOCK_TYPES = {};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
selectRangeInRichText,
|
|
6
|
+
typeInRichText,
|
|
7
7
|
fireEvent,
|
|
8
8
|
getEditorHtml,
|
|
9
9
|
initializeEditor,
|
|
@@ -79,7 +79,7 @@ describe( 'List block', () => {
|
|
|
79
79
|
|
|
80
80
|
const listItemField =
|
|
81
81
|
within( listBlock ).getByPlaceholderText( 'List' );
|
|
82
|
-
|
|
82
|
+
typeInRichText( listItemField, 'First list item' );
|
|
83
83
|
|
|
84
84
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
85
85
|
} );
|
|
@@ -347,7 +347,7 @@ describe( 'List block', () => {
|
|
|
347
347
|
// backward delete
|
|
348
348
|
const listItemField =
|
|
349
349
|
within( listItemBlock ).getByLabelText( /Text input. .*Two.*/ );
|
|
350
|
-
|
|
350
|
+
selectRangeInRichText( listItemField, 0 );
|
|
351
351
|
fireEvent( listItemField, 'onKeyDown', {
|
|
352
352
|
nativeEvent: {},
|
|
353
353
|
preventDefault() {},
|
|
@@ -395,7 +395,7 @@ describe( 'List block', () => {
|
|
|
395
395
|
// backward delete
|
|
396
396
|
const listItemField =
|
|
397
397
|
within( listItemBlock ).getByLabelText( /Text input. .*One.*/ );
|
|
398
|
-
|
|
398
|
+
selectRangeInRichText( listItemField, 0 );
|
|
399
399
|
fireEvent( listItemField, 'onKeyDown', {
|
|
400
400
|
nativeEvent: {},
|
|
401
401
|
preventDefault() {},
|
|
@@ -406,11 +406,11 @@ describe( 'List block', () => {
|
|
|
406
406
|
"<!-- wp:paragraph -->
|
|
407
407
|
<p>A quick brown fox.</p>
|
|
408
408
|
<!-- /wp:paragraph -->
|
|
409
|
-
|
|
409
|
+
|
|
410
410
|
<!-- wp:paragraph -->
|
|
411
411
|
<p>One</p>
|
|
412
412
|
<!-- /wp:paragraph -->
|
|
413
|
-
|
|
413
|
+
|
|
414
414
|
<!-- wp:list -->
|
|
415
415
|
<ul><!-- wp:list-item -->
|
|
416
416
|
<li>Two</li>
|
package/src/media-text/edit.js
CHANGED
|
@@ -143,6 +143,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes, clientId } ) {
|
|
|
143
143
|
mediaWidth,
|
|
144
144
|
rel,
|
|
145
145
|
verticalAlignment,
|
|
146
|
+
allowedBlocks,
|
|
146
147
|
} = attributes;
|
|
147
148
|
const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
|
|
148
149
|
|
|
@@ -315,7 +316,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes, clientId } ) {
|
|
|
315
316
|
|
|
316
317
|
const innerBlocksProps = useInnerBlocksProps(
|
|
317
318
|
{ className: 'wp-block-media-text__content' },
|
|
318
|
-
{ template: TEMPLATE }
|
|
319
|
+
{ template: TEMPLATE, allowedBlocks }
|
|
319
320
|
);
|
|
320
321
|
|
|
321
322
|
return (
|
|
@@ -20,11 +20,7 @@ import { useDispatch } from '@wordpress/data';
|
|
|
20
20
|
import { forwardRef } from '@wordpress/element';
|
|
21
21
|
import { isBlobURL } from '@wordpress/blob';
|
|
22
22
|
import { store as noticesStore } from '@wordpress/notices';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Internal dependencies
|
|
26
|
-
*/
|
|
27
|
-
import icon from './media-container-icon';
|
|
23
|
+
import { media as icon } from '@wordpress/icons';
|
|
28
24
|
|
|
29
25
|
/**
|
|
30
26
|
* Constants
|
|
@@ -26,12 +26,12 @@ import { Component } from '@wordpress/element';
|
|
|
26
26
|
import { __ } from '@wordpress/i18n';
|
|
27
27
|
import { isURL, getProtocol } from '@wordpress/url';
|
|
28
28
|
import { compose, withPreferredColorScheme } from '@wordpress/compose';
|
|
29
|
+
import { media as icon } from '@wordpress/icons';
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Internal dependencies
|
|
32
33
|
*/
|
|
33
34
|
import styles from './style.scss';
|
|
34
|
-
import icon from './media-container-icon';
|
|
35
35
|
import SvgIconRetry from './icon-retry';
|
|
36
36
|
|
|
37
37
|
/**
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { mapValues } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -331,22 +326,23 @@ const migrateTypographyPresets = function ( attributes ) {
|
|
|
331
326
|
...attributes,
|
|
332
327
|
style: {
|
|
333
328
|
...attributes.style,
|
|
334
|
-
typography:
|
|
335
|
-
attributes.style.typography
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
329
|
+
typography: Object.fromEntries(
|
|
330
|
+
Object.entries( attributes.style.typography ?? {} ).map(
|
|
331
|
+
( [ key, value ] ) => {
|
|
332
|
+
const prefix = TYPOGRAPHY_PRESET_DEPRECATION_MAP[ key ];
|
|
333
|
+
if ( prefix && value.startsWith( prefix ) ) {
|
|
334
|
+
const newValue = value.slice( prefix.length );
|
|
335
|
+
if (
|
|
336
|
+
'textDecoration' === key &&
|
|
337
|
+
'strikethrough' === newValue
|
|
338
|
+
) {
|
|
339
|
+
return [ key, 'line-through' ];
|
|
340
|
+
}
|
|
341
|
+
return [ key, newValue ];
|
|
345
342
|
}
|
|
346
|
-
return
|
|
343
|
+
return [ key, value ];
|
|
347
344
|
}
|
|
348
|
-
|
|
349
|
-
}
|
|
345
|
+
)
|
|
350
346
|
),
|
|
351
347
|
},
|
|
352
348
|
};
|