@wordpress/block-library 8.6.0 → 8.8.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/buttons/index.js +1 -0
- package/build/buttons/index.js.map +1 -1
- package/build/buttons/transforms.js +1 -0
- package/build/buttons/transforms.js.map +1 -1
- package/build/column/index.js +2 -1
- package/build/column/index.js.map +1 -1
- package/build/columns/edit.js +28 -8
- package/build/columns/edit.js.map +1 -1
- package/build/columns/index.js +6 -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/inspector-controls.js +2 -2
- package/build/cover/edit/inspector-controls.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/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/edit.js +8 -5
- package/build/gallery/edit.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/gallery/use-image-sizes.js +1 -1
- package/build/gallery/use-image-sizes.js.map +1 -1
- package/build/group/deprecated.js +4 -2
- package/build/group/deprecated.js.map +1 -1
- package/build/group/edit.js +22 -5
- package/build/group/edit.js.map +1 -1
- package/build/group/placeholder.js +11 -1
- package/build/group/placeholder.js.map +1 -1
- package/build/group/variations.js +23 -3
- package/build/group/variations.js.map +1 -1
- package/build/image/edit.js +1 -1
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +8 -6
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +9 -2
- package/build/image/index.js.map +1 -1
- package/build/index.js +24 -6
- package/build/index.js.map +1 -1
- package/build/latest-posts/edit.js +1 -0
- package/build/latest-posts/edit.js.map +1 -1
- package/build/media-text/deprecated.js +228 -18
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.js +3 -3
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/index.js +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 +1 -12
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +1 -4
- package/build/navigation/edit/inner-blocks.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/navigation/index.js +0 -1
- package/build/navigation/index.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 +2 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/index.js +4 -1
- package/build/post-date/index.js.map +1 -1
- package/build/post-date/variations.js +28 -0
- package/build/post-date/variations.js.map +1 -0
- package/build/post-excerpt/edit.js +39 -10
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +4 -3
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js +8 -22
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-template/index.js +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 +24 -1
- package/build/post-time-to-read/index.js.map +1 -1
- package/build/quote/index.js +1 -0
- package/build/quote/index.js.map +1 -1
- package/build/spacer/controls.js +25 -6
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/edit.js +27 -7
- 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/term-description/index.js +1 -2
- package/build/term-description/index.js.map +1 -1
- package/build/utils/clean-empty-object.js +5 -2
- package/build/utils/clean-empty-object.js.map +1 -1
- package/build-module/buttons/index.js +1 -0
- package/build-module/buttons/index.js.map +1 -1
- package/build-module/buttons/transforms.js +1 -0
- package/build-module/buttons/transforms.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 +28 -8
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/index.js +6 -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/inspector-controls.js +2 -2
- package/build-module/cover/edit/inspector-controls.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/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/edit.js +8 -5
- package/build-module/gallery/edit.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/gallery/use-image-sizes.js +1 -1
- package/build-module/gallery/use-image-sizes.js.map +1 -1
- package/build-module/group/deprecated.js +4 -2
- package/build-module/group/deprecated.js.map +1 -1
- package/build-module/group/edit.js +21 -5
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/placeholder.js +11 -1
- package/build-module/group/placeholder.js.map +1 -1
- package/build-module/group/variations.js +24 -1
- package/build-module/group/variations.js.map +1 -1
- package/build-module/image/edit.js +1 -1
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +1 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +8 -6
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +9 -2
- 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/latest-posts/edit.js +1 -0
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/media-text/deprecated.js +227 -18
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.js +3 -3
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/index.js +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 +1 -12
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +1 -4
- package/build-module/navigation/edit/inner-blocks.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/navigation/index.js +0 -1
- package/build-module/navigation/index.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 +2 -1
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/index.js +3 -1
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-date/variations.js +18 -0
- package/build-module/post-date/variations.js.map +1 -0
- package/build-module/post-excerpt/edit.js +38 -11
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +4 -3
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +8 -22
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-template/index.js +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 +24 -1
- package/build-module/post-time-to-read/index.js.map +1 -1
- package/build-module/quote/index.js +1 -0
- package/build-module/quote/index.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 +27 -8
- 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/term-description/index.js +1 -2
- package/build-module/term-description/index.js.map +1 -1
- package/build-module/utils/clean-empty-object.js +6 -3
- package/build-module/utils/clean-empty-object.js.map +1 -1
- package/build-style/categories/editor-rtl.css +5 -0
- package/build-style/categories/editor.css +5 -0
- package/build-style/categories/style-rtl.css +4 -0
- package/build-style/categories/style.css +4 -0
- 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 +11 -12
- package/build-style/cover/editor.css +11 -12
- package/build-style/cover/style-rtl.css +3 -2
- package/build-style/cover/style.css +3 -2
- 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 +40 -48
- package/build-style/editor.css +40 -48
- package/build-style/file/style-rtl.css +4 -3
- package/build-style/file/style.css +4 -3
- package/build-style/navigation/style-rtl.css +2 -0
- package/build-style/navigation/style.css +2 -0
- package/build-style/post-excerpt/style-rtl.css +1 -1
- package/build-style/post-excerpt/style.css +1 -1
- package/build-style/post-featured-image/editor-rtl.css +1 -0
- package/build-style/post-featured-image/editor.css +1 -0
- package/build-style/post-template/style-rtl.css +1 -1
- package/build-style/post-template/style.css +1 -1
- package/build-style/post-time-to-read/style-rtl.css +91 -0
- package/build-style/post-time-to-read/style.css +91 -0
- package/build-style/pullquote/style-rtl.css +4 -1
- package/build-style/pullquote/style.css +4 -1
- package/build-style/search/style-rtl.css +8 -7
- package/build-style/search/style.css +8 -7
- package/build-style/shortcode/editor-rtl.css +15 -34
- package/build-style/shortcode/editor.css +15 -34
- package/build-style/spacer/editor-rtl.css +4 -2
- package/build-style/spacer/editor.css +4 -2
- package/build-style/style-rtl.css +44 -17
- package/build-style/style.css +44 -17
- package/package.json +31 -31
- package/src/buttons/block.json +1 -0
- package/src/categories/editor.scss +5 -0
- package/src/categories/style.scss +4 -0
- package/src/column/block.json +2 -1
- package/src/columns/block.json +6 -1
- package/src/columns/edit.js +35 -10
- package/src/columns/style.scss +5 -1
- package/src/columns/utils.js +8 -9
- package/src/comments/index.php +1 -0
- 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/inspector-controls.js +4 -5
- 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 +2 -1
- package/src/cover/test/__snapshots__/transforms.native.js.snap +2 -2
- package/src/cover/test/edit.js +324 -0
- 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/edit.js +5 -2
- package/src/gallery/test/use-get-media.native.js +24 -0
- package/src/gallery/use-get-media.native.js +1 -1
- package/src/gallery/use-image-sizes.js +1 -1
- package/src/group/deprecated.js +4 -2
- package/src/group/edit.js +27 -9
- package/src/group/placeholder.js +13 -1
- package/src/group/variations.js +14 -1
- package/src/home-link/index.php +2 -2
- package/src/image/block.json +9 -2
- package/src/image/edit.js +1 -1
- package/src/image/edit.native.js +1 -1
- package/src/image/image.js +15 -7
- package/src/image/index.php +7 -2
- package/src/image/test/__snapshots__/transforms.native.js.snap +1 -1
- package/src/index.js +13 -3
- package/src/latest-comments/style.scss +1 -1
- package/src/latest-posts/edit.js +3 -0
- package/src/media-text/block.json +1 -1
- package/src/media-text/deprecated.js +235 -3
- package/src/media-text/edit.js +7 -6
- package/src/media-text/media-container.js +1 -5
- package/src/media-text/media-container.native.js +1 -1
- package/src/media-text/test/__snapshots__/transforms.native.js.snap +4 -4
- package/src/navigation/block.json +0 -1
- package/src/navigation/deprecated.js +15 -19
- package/src/navigation/edit/index.js +0 -13
- package/src/navigation/edit/inner-blocks.js +0 -3
- package/src/navigation/edit/unsaved-inner-blocks.js +34 -46
- package/src/navigation/index.php +0 -4
- package/src/navigation/style.scss +6 -4
- package/src/navigation-link/index.php +2 -1
- package/src/navigation-submenu/index.php +30 -76
- package/src/paragraph/test/edit.native.js +356 -1
- package/src/post-author/block.json +0 -1
- package/src/post-author/index.php +1 -1
- package/src/post-date/edit.js +4 -1
- package/src/post-date/index.js +2 -0
- package/src/post-date/variations.js +20 -0
- package/src/post-excerpt/edit.js +48 -16
- package/src/post-excerpt/index.php +3 -3
- package/src/post-excerpt/style.scss +2 -1
- package/src/post-featured-image/dimension-controls.js +7 -3
- package/src/post-featured-image/edit.js +8 -29
- package/src/post-featured-image/editor.scss +1 -0
- package/src/post-template/block.json +1 -1
- package/src/post-template/style.scss +1 -1
- package/src/post-time-to-read/block.json +24 -1
- package/src/post-time-to-read/edit.js +1 -1
- package/src/post-time-to-read/index.php +3 -3
- package/src/post-time-to-read/style.scss +4 -0
- package/src/preformatted/test/__snapshots__/edit.native.js.snap +2 -2
- package/src/preformatted/test/edit.native.js +45 -2
- package/src/pullquote/style.scss +5 -1
- package/src/pullquote/test/edit.native.js +70 -0
- package/src/query-title/index.php +2 -5
- package/src/quote/block.json +1 -0
- package/src/quote/test/edit.native.js +92 -0
- package/src/search/index.php +1 -1
- package/src/search/style.scss +16 -12
- package/src/shortcode/editor.scss +26 -5
- package/src/spacer/controls.js +42 -17
- package/src/spacer/edit.js +41 -9
- package/src/spacer/editor.scss +2 -1
- package/src/spacer/save.js +3 -3
- package/src/style.scss +3 -0
- package/src/table/state.js +83 -66
- package/src/term-description/block.json +1 -2
- package/src/utils/clean-empty-object.js +4 -4
- package/src/verse/test/edit.native.js +33 -0
- package/src/video/test/__snapshots__/transforms.native.js.snap +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- 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-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/src/cover/edit/resizable-cover.js +0 -61
- package/src/cover/test/block-controls.js +0 -62
- package/src/media-text/media-container-icon.js +0 -12
package/src/post-date/edit.js
CHANGED
|
@@ -76,12 +76,15 @@ export default function PostDateEdit( {
|
|
|
76
76
|
[ postTypeSlug ]
|
|
77
77
|
);
|
|
78
78
|
|
|
79
|
+
const dateLabel =
|
|
80
|
+
displayType === 'date' ? __( 'Post Date' ) : __( 'Post Modified Date' );
|
|
81
|
+
|
|
79
82
|
let postDate = date ? (
|
|
80
83
|
<time dateTime={ dateI18n( 'c', date ) } ref={ setPopoverAnchor }>
|
|
81
84
|
{ dateI18n( format || siteFormat, date ) }
|
|
82
85
|
</time>
|
|
83
86
|
) : (
|
|
84
|
-
|
|
87
|
+
dateLabel
|
|
85
88
|
);
|
|
86
89
|
|
|
87
90
|
if ( isLink && date ) {
|
package/src/post-date/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import initBlock from '../utils/init-block';
|
|
|
10
10
|
import metadata from './block.json';
|
|
11
11
|
import edit from './edit';
|
|
12
12
|
import deprecated from './deprecated';
|
|
13
|
+
import variations from './variations';
|
|
13
14
|
|
|
14
15
|
const { name } = metadata;
|
|
15
16
|
export { metadata, name };
|
|
@@ -18,6 +19,7 @@ export const settings = {
|
|
|
18
19
|
icon,
|
|
19
20
|
edit,
|
|
20
21
|
deprecated,
|
|
22
|
+
variations,
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
export const init = () => initBlock( { name, metadata, settings } );
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { postDate } from '@wordpress/icons';
|
|
6
|
+
|
|
7
|
+
const variations = [
|
|
8
|
+
{
|
|
9
|
+
name: 'post-date-modified',
|
|
10
|
+
title: __( 'Post Modified Date' ),
|
|
11
|
+
description: __( "Display a post's last updated date." ),
|
|
12
|
+
attributes: { displayType: 'modified' },
|
|
13
|
+
scope: [ 'block', 'inserter' ],
|
|
14
|
+
isActive: ( blockAttributes ) =>
|
|
15
|
+
blockAttributes.displayType === 'modified',
|
|
16
|
+
icon: postDate,
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export default variations;
|
package/src/post-excerpt/edit.js
CHANGED
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useEntityProp } from '@wordpress/core-data';
|
|
9
|
+
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
10
10
|
import { useMemo } from '@wordpress/element';
|
|
11
11
|
import {
|
|
12
12
|
AlignmentToolbar,
|
|
@@ -18,12 +18,15 @@ import {
|
|
|
18
18
|
} from '@wordpress/block-editor';
|
|
19
19
|
import { PanelBody, ToggleControl, RangeControl } from '@wordpress/components';
|
|
20
20
|
import { __, _x } from '@wordpress/i18n';
|
|
21
|
+
import { useSelect } from '@wordpress/data';
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Internal dependencies
|
|
24
25
|
*/
|
|
25
26
|
import { useCanEditEntity } from '../utils/hooks';
|
|
26
27
|
|
|
28
|
+
const ELLIPSIS = '…';
|
|
29
|
+
|
|
27
30
|
export default function PostExcerptEditor( {
|
|
28
31
|
attributes: { textAlign, moreText, showMoreOnNewLine, excerptLength },
|
|
29
32
|
setAttributes,
|
|
@@ -32,13 +35,41 @@ export default function PostExcerptEditor( {
|
|
|
32
35
|
} ) {
|
|
33
36
|
const isDescendentOfQueryLoop = Number.isFinite( queryId );
|
|
34
37
|
const userCanEdit = useCanEditEntity( 'postType', postType, postId );
|
|
35
|
-
const isEditable = userCanEdit && ! isDescendentOfQueryLoop;
|
|
36
|
-
|
|
37
38
|
const [
|
|
38
39
|
rawExcerpt,
|
|
39
40
|
setExcerpt,
|
|
40
41
|
{ rendered: renderedExcerpt, protected: isProtected } = {},
|
|
41
42
|
] = useEntityProp( 'postType', postType, 'excerpt', postId );
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Check if the post type supports excerpts.
|
|
46
|
+
* Add an exception and return early for the "page" post type,
|
|
47
|
+
* which is registered without support for the excerpt UI,
|
|
48
|
+
* but supports saving the excerpt to the database.
|
|
49
|
+
* See: https://core.trac.wordpress.org/browser/branches/6.1/src/wp-includes/post.php#L65
|
|
50
|
+
* Without this exception, users that have excerpts saved to the database will
|
|
51
|
+
* not be able to edit the excerpts.
|
|
52
|
+
*/
|
|
53
|
+
const postTypeSupportsExcerpts = useSelect(
|
|
54
|
+
( select ) => {
|
|
55
|
+
if ( postType === 'page' ) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
return !! select( coreStore ).getPostType( postType )?.supports
|
|
59
|
+
.excerpt;
|
|
60
|
+
},
|
|
61
|
+
[ postType ]
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The excerpt is editable if:
|
|
66
|
+
* - The user can edit the post
|
|
67
|
+
* - It is not a descendent of a Query Loop block
|
|
68
|
+
* - The post type supports excerpts
|
|
69
|
+
*/
|
|
70
|
+
const isEditable =
|
|
71
|
+
userCanEdit && ! isDescendentOfQueryLoop && postTypeSupportsExcerpts;
|
|
72
|
+
|
|
42
73
|
const blockProps = useBlockProps( {
|
|
43
74
|
className: classnames( {
|
|
44
75
|
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
@@ -65,6 +96,7 @@ export default function PostExcerptEditor( {
|
|
|
65
96
|
);
|
|
66
97
|
return document.body.textContent || document.body.innerText || '';
|
|
67
98
|
}, [ renderedExcerpt ] );
|
|
99
|
+
|
|
68
100
|
if ( ! postType || ! postId ) {
|
|
69
101
|
return (
|
|
70
102
|
<>
|
|
@@ -123,14 +155,13 @@ export default function PostExcerptEditor( {
|
|
|
123
155
|
* The excerpt length setting needs to be applied to both
|
|
124
156
|
* the raw and the rendered excerpt depending on which is being used.
|
|
125
157
|
*/
|
|
126
|
-
const rawOrRenderedExcerpt =
|
|
127
|
-
|
|
128
|
-
|
|
158
|
+
const rawOrRenderedExcerpt = (
|
|
159
|
+
rawExcerpt || strippedRenderedExcerpt
|
|
160
|
+
).trim();
|
|
129
161
|
|
|
130
162
|
let trimmedExcerpt = '';
|
|
131
163
|
if ( wordCountType === 'words' ) {
|
|
132
164
|
trimmedExcerpt = rawOrRenderedExcerpt
|
|
133
|
-
.trim()
|
|
134
165
|
.split( ' ', excerptLength )
|
|
135
166
|
.join( ' ' );
|
|
136
167
|
} else if ( wordCountType === 'characters_excluding_spaces' ) {
|
|
@@ -143,7 +174,6 @@ export default function PostExcerptEditor( {
|
|
|
143
174
|
* so that the spaces are excluded from the word count.
|
|
144
175
|
*/
|
|
145
176
|
const excerptWithSpaces = rawOrRenderedExcerpt
|
|
146
|
-
.trim()
|
|
147
177
|
.split( '', excerptLength )
|
|
148
178
|
.join( '' );
|
|
149
179
|
|
|
@@ -152,14 +182,15 @@ export default function PostExcerptEditor( {
|
|
|
152
182
|
excerptWithSpaces.replaceAll( ' ', '' ).length;
|
|
153
183
|
|
|
154
184
|
trimmedExcerpt = rawOrRenderedExcerpt
|
|
155
|
-
.trim()
|
|
156
185
|
.split( '', excerptLength + numberOfSpaces )
|
|
157
186
|
.join( '' );
|
|
158
187
|
} else if ( wordCountType === 'characters_including_spaces' ) {
|
|
159
|
-
trimmedExcerpt = rawOrRenderedExcerpt
|
|
188
|
+
trimmedExcerpt = rawOrRenderedExcerpt
|
|
189
|
+
.split( '', excerptLength )
|
|
190
|
+
.join( '' );
|
|
160
191
|
}
|
|
161
192
|
|
|
162
|
-
|
|
193
|
+
const isTrimmed = trimmedExcerpt !== rawOrRenderedExcerpt;
|
|
163
194
|
|
|
164
195
|
const excerptContent = isEditable ? (
|
|
165
196
|
<RichText
|
|
@@ -168,7 +199,9 @@ export default function PostExcerptEditor( {
|
|
|
168
199
|
value={
|
|
169
200
|
isSelected
|
|
170
201
|
? rawOrRenderedExcerpt
|
|
171
|
-
: (
|
|
202
|
+
: ( ! isTrimmed
|
|
203
|
+
? rawOrRenderedExcerpt
|
|
204
|
+
: trimmedExcerpt + ELLIPSIS ) ||
|
|
172
205
|
__( 'No post excerpt found' )
|
|
173
206
|
}
|
|
174
207
|
onChange={ setExcerpt }
|
|
@@ -176,9 +209,9 @@ export default function PostExcerptEditor( {
|
|
|
176
209
|
/>
|
|
177
210
|
) : (
|
|
178
211
|
<p className={ excerptClassName }>
|
|
179
|
-
{
|
|
180
|
-
?
|
|
181
|
-
:
|
|
212
|
+
{ ! isTrimmed
|
|
213
|
+
? rawOrRenderedExcerpt || __( 'No post excerpt found' )
|
|
214
|
+
: trimmedExcerpt + ELLIPSIS }
|
|
182
215
|
</p>
|
|
183
216
|
);
|
|
184
217
|
return (
|
|
@@ -208,7 +241,6 @@ export default function PostExcerptEditor( {
|
|
|
208
241
|
value={ excerptLength }
|
|
209
242
|
onChange={ ( value ) => {
|
|
210
243
|
setAttributes( { excerptLength: value } );
|
|
211
|
-
setExcerpt();
|
|
212
244
|
} }
|
|
213
245
|
min="10"
|
|
214
246
|
max="100"
|
|
@@ -25,11 +25,11 @@ function render_block_core_post_excerpt( $attributes, $content, $block ) {
|
|
|
25
25
|
* wp_trim_words is used instead.
|
|
26
26
|
*/
|
|
27
27
|
$excerpt_length = $attributes['excerptLength'];
|
|
28
|
+
$excerpt = get_the_excerpt( $block->context['postId'] );
|
|
28
29
|
if ( isset( $excerpt_length ) ) {
|
|
29
|
-
$excerpt = wp_trim_words(
|
|
30
|
-
} else {
|
|
31
|
-
$excerpt = get_the_excerpt();
|
|
30
|
+
$excerpt = wp_trim_words( $excerpt, $excerpt_length );
|
|
32
31
|
}
|
|
32
|
+
|
|
33
33
|
$more_text = ! empty( $attributes['moreText'] ) ? '<a class="wp-block-post-excerpt__more-link" href="' . esc_url( get_the_permalink( $block->context['postId'] ) ) . '">' . wp_kses_post( $attributes['moreText'] ) . '</a>' : '';
|
|
34
34
|
$filter_excerpt_more = function( $more ) use ( $more_text ) {
|
|
35
35
|
return empty( $more_text ) ? $more : '';
|
|
@@ -70,6 +70,10 @@ const DimensionControls = ( {
|
|
|
70
70
|
} );
|
|
71
71
|
};
|
|
72
72
|
const scaleLabel = _x( 'Scale', 'Image scaling options' );
|
|
73
|
+
|
|
74
|
+
const showScaleControl =
|
|
75
|
+
height || ( aspectRatio && aspectRatio !== 'auto' );
|
|
76
|
+
|
|
73
77
|
return (
|
|
74
78
|
<InspectorControls group="dimensions">
|
|
75
79
|
<ToolsPanelItem
|
|
@@ -170,7 +174,7 @@ const DimensionControls = ( {
|
|
|
170
174
|
units={ units }
|
|
171
175
|
/>
|
|
172
176
|
</ToolsPanelItem>
|
|
173
|
-
{
|
|
177
|
+
{ showScaleControl && (
|
|
174
178
|
<ToolsPanelItem
|
|
175
179
|
hasValue={ () => !! scale && scale !== DEFAULT_SCALE }
|
|
176
180
|
label={ scaleLabel }
|
|
@@ -204,7 +208,7 @@ const DimensionControls = ( {
|
|
|
204
208
|
{ !! imageSizeOptions.length && (
|
|
205
209
|
<ToolsPanelItem
|
|
206
210
|
hasValue={ () => !! sizeSlug }
|
|
207
|
-
label={ __( '
|
|
211
|
+
label={ __( 'Resolution' ) }
|
|
208
212
|
onDeselect={ () =>
|
|
209
213
|
setAttributes( { sizeSlug: undefined } )
|
|
210
214
|
}
|
|
@@ -216,7 +220,7 @@ const DimensionControls = ( {
|
|
|
216
220
|
>
|
|
217
221
|
<SelectControl
|
|
218
222
|
__nextHasNoMarginBottom
|
|
219
|
-
label={ __( '
|
|
223
|
+
label={ __( 'Resolution' ) }
|
|
220
224
|
value={ sizeSlug || DEFAULT_SIZE }
|
|
221
225
|
options={ imageSizeOptions }
|
|
222
226
|
onChange={ ( nextSizeSlug ) =>
|
|
@@ -183,10 +183,15 @@ export default function PostFeaturedImageEdit( {
|
|
|
183
183
|
let image;
|
|
184
184
|
|
|
185
185
|
/**
|
|
186
|
-
* A
|
|
187
|
-
*
|
|
186
|
+
* A Post Featured Image block should not have image replacement
|
|
187
|
+
* or upload options in the following cases:
|
|
188
|
+
* - Is placed in a Query Loop. This is a consious decision to
|
|
189
|
+
* prevent content editing of different posts in Query Loop, and
|
|
190
|
+
* this could change in the future.
|
|
191
|
+
* - Is in a context where it does not have a postId (for example
|
|
192
|
+
* in a template or template part).
|
|
188
193
|
*/
|
|
189
|
-
if ( ! featuredImage && isDescendentOfQueryLoop ) {
|
|
194
|
+
if ( ! featuredImage && ( isDescendentOfQueryLoop || ! postId ) ) {
|
|
190
195
|
return (
|
|
191
196
|
<>
|
|
192
197
|
{ controls }
|
|
@@ -202,32 +207,6 @@ export default function PostFeaturedImageEdit( {
|
|
|
202
207
|
);
|
|
203
208
|
}
|
|
204
209
|
|
|
205
|
-
/**
|
|
206
|
-
* A post featured image placed in a block template, outside a query loop,
|
|
207
|
-
* does not have a postId and will always be a placeholder image.
|
|
208
|
-
* It does not have image replacement, upload, or link options.
|
|
209
|
-
*/
|
|
210
|
-
if ( ! featuredImage && ! postId ) {
|
|
211
|
-
return (
|
|
212
|
-
<>
|
|
213
|
-
<DimensionControls
|
|
214
|
-
clientId={ clientId }
|
|
215
|
-
attributes={ attributes }
|
|
216
|
-
setAttributes={ setAttributes }
|
|
217
|
-
imageSizeOptions={ imageSizeOptions }
|
|
218
|
-
/>
|
|
219
|
-
<div { ...blockProps }>
|
|
220
|
-
{ placeholder() }
|
|
221
|
-
<Overlay
|
|
222
|
-
attributes={ attributes }
|
|
223
|
-
setAttributes={ setAttributes }
|
|
224
|
-
clientId={ clientId }
|
|
225
|
-
/>
|
|
226
|
-
</div>
|
|
227
|
-
</>
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
210
|
const label = __( 'Add a featured image' );
|
|
232
211
|
const imageStyles = {
|
|
233
212
|
...borderProps.style,
|
|
@@ -14,7 +14,30 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"supports": {
|
|
17
|
+
"color": {
|
|
18
|
+
"gradients": true,
|
|
19
|
+
"__experimentalDefaultControls": {
|
|
20
|
+
"background": true,
|
|
21
|
+
"text": true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
17
24
|
"html": false,
|
|
18
|
-
"
|
|
25
|
+
"spacing": {
|
|
26
|
+
"margin": true,
|
|
27
|
+
"padding": true
|
|
28
|
+
},
|
|
29
|
+
"typography": {
|
|
30
|
+
"fontSize": true,
|
|
31
|
+
"lineHeight": true,
|
|
32
|
+
"__experimentalFontFamily": true,
|
|
33
|
+
"__experimentalFontWeight": true,
|
|
34
|
+
"__experimentalFontStyle": true,
|
|
35
|
+
"__experimentalTextTransform": true,
|
|
36
|
+
"__experimentalTextDecoration": true,
|
|
37
|
+
"__experimentalLetterSpacing": true,
|
|
38
|
+
"__experimentalDefaultControls": {
|
|
39
|
+
"fontSize": true
|
|
40
|
+
}
|
|
41
|
+
}
|
|
19
42
|
}
|
|
20
43
|
}
|
|
@@ -32,8 +32,8 @@ function render_block_core_post_time_to_read( $attributes, $content, $block ) {
|
|
|
32
32
|
$minutes_to_read = max( 1, (int) round( wp_word_count( $content, $word_count_type ) / $average_reading_rate ) );
|
|
33
33
|
|
|
34
34
|
$minutes_to_read_string = sprintf(
|
|
35
|
-
/* translators: %
|
|
36
|
-
_n( '%
|
|
35
|
+
/* translators: %s is the number of minutes the post will take to read. */
|
|
36
|
+
_n( '%s minute', '%s minutes', $minutes_to_read ),
|
|
37
37
|
$minutes_to_read
|
|
38
38
|
);
|
|
39
39
|
|
|
@@ -42,7 +42,7 @@ function render_block_core_post_time_to_read( $attributes, $content, $block ) {
|
|
|
42
42
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
|
|
43
43
|
|
|
44
44
|
return sprintf(
|
|
45
|
-
'<
|
|
45
|
+
'<div %1$s>%2$s</div>',
|
|
46
46
|
$wrapper_attributes,
|
|
47
47
|
$minutes_to_read_string
|
|
48
48
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Preformatted should match snapshot when content is empty 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
6
|
[
|
|
@@ -46,7 +46,7 @@ exports[`core/more/edit/native should match snapshot when content is empty 1`] =
|
|
|
46
46
|
</View>
|
|
47
47
|
`;
|
|
48
48
|
|
|
49
|
-
exports[`
|
|
49
|
+
exports[`Preformatted should match snapshot when content is not empty 1`] = `
|
|
50
50
|
<View
|
|
51
51
|
style={
|
|
52
52
|
[
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
changeAndSelectTextOfRichText,
|
|
7
|
+
fireEvent,
|
|
8
|
+
getEditorHtml,
|
|
9
|
+
initializeEditor,
|
|
10
|
+
render,
|
|
11
|
+
setupCoreBlocks,
|
|
12
|
+
} from 'test/helpers';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { ENTER } from '@wordpress/keycodes';
|
|
5
18
|
|
|
6
19
|
/**
|
|
7
20
|
* Internal dependencies
|
|
8
21
|
*/
|
|
9
22
|
import PreformattedEdit from '../edit';
|
|
10
23
|
|
|
11
|
-
|
|
24
|
+
setupCoreBlocks();
|
|
25
|
+
|
|
26
|
+
describe( 'Preformatted', () => {
|
|
12
27
|
it( 'renders without crashing', () => {
|
|
13
28
|
const screen = render(
|
|
14
29
|
<PreformattedEdit
|
|
@@ -42,4 +57,32 @@ describe( 'core/more/edit/native', () => {
|
|
|
42
57
|
);
|
|
43
58
|
expect( screen.toJSON() ).toMatchSnapshot();
|
|
44
59
|
} );
|
|
60
|
+
|
|
61
|
+
it( 'should produce expected markup for multiline text', async () => {
|
|
62
|
+
// Arrange
|
|
63
|
+
const screen = await initializeEditor();
|
|
64
|
+
|
|
65
|
+
// Act
|
|
66
|
+
await addBlock( screen, 'Preformatted' );
|
|
67
|
+
const verseTextInput = await screen.findByPlaceholderText(
|
|
68
|
+
'Write preformatted text…'
|
|
69
|
+
);
|
|
70
|
+
const string = 'A great statement.';
|
|
71
|
+
changeAndSelectTextOfRichText( verseTextInput, string, {
|
|
72
|
+
selectionStart: string.length,
|
|
73
|
+
selectionEnd: string.length,
|
|
74
|
+
} );
|
|
75
|
+
fireEvent( verseTextInput, 'onKeyDown', {
|
|
76
|
+
nativeEvent: {},
|
|
77
|
+
preventDefault() {},
|
|
78
|
+
keyCode: ENTER,
|
|
79
|
+
} );
|
|
80
|
+
|
|
81
|
+
// Assert
|
|
82
|
+
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
83
|
+
"<!-- wp:preformatted -->
|
|
84
|
+
<pre class="wp-block-preformatted">A great statement.<br></pre>
|
|
85
|
+
<!-- /wp:preformatted -->"
|
|
86
|
+
` );
|
|
87
|
+
} );
|
|
45
88
|
} );
|
package/src/pullquote/style.scss
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
.wp-block-pullquote {
|
|
2
|
-
margin: 0 0 1em 0;
|
|
3
2
|
padding: 3em 0;
|
|
4
3
|
text-align: center; // Default text-alignment where the `textAlign` attribute value isn't specified.
|
|
5
4
|
overflow-wrap: break-word; // Break long strings of text without spaces so they don't overflow the block.
|
|
@@ -25,6 +24,11 @@
|
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
|
|
27
|
+
// Lowest specificity to avoid overriding layout styles.
|
|
28
|
+
:where(.wp-block-pullquote) {
|
|
29
|
+
margin: 0 0 1em 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
28
32
|
// Ensure that we are reasonably specific to override theme defaults.
|
|
29
33
|
.wp-block-pullquote.has-text-align-left blockquote {
|
|
30
34
|
text-align: left;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
getBlock,
|
|
7
|
+
initializeEditor,
|
|
8
|
+
setupCoreBlocks,
|
|
9
|
+
getEditorHtml,
|
|
10
|
+
fireEvent,
|
|
11
|
+
within,
|
|
12
|
+
waitFor,
|
|
13
|
+
changeAndSelectTextOfRichText,
|
|
14
|
+
} from 'test/helpers';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* WordPress dependencies
|
|
18
|
+
*/
|
|
19
|
+
import { ENTER } from '@wordpress/keycodes';
|
|
20
|
+
|
|
21
|
+
setupCoreBlocks();
|
|
22
|
+
|
|
23
|
+
describe( 'Pullquote', () => {
|
|
24
|
+
it( 'should produce expected markup for multiline text', async () => {
|
|
25
|
+
// Arrange
|
|
26
|
+
const screen = await initializeEditor();
|
|
27
|
+
await addBlock( screen, 'Pullquote' );
|
|
28
|
+
// Await inner blocks to be rendered
|
|
29
|
+
const citationBlock = await waitFor( () =>
|
|
30
|
+
screen.getByPlaceholderText( 'Add citation' )
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
// Act
|
|
34
|
+
const pullquoteBlock = getBlock( screen, 'Pullquote' );
|
|
35
|
+
fireEvent.press( pullquoteBlock );
|
|
36
|
+
const pullquoteTextInput =
|
|
37
|
+
within( pullquoteBlock ).getByPlaceholderText( 'Add quote' );
|
|
38
|
+
const string = 'A great statement.';
|
|
39
|
+
changeAndSelectTextOfRichText( pullquoteTextInput, string, {
|
|
40
|
+
selectionStart: string.length,
|
|
41
|
+
selectionEnd: string.length,
|
|
42
|
+
} );
|
|
43
|
+
fireEvent( pullquoteTextInput, 'onKeyDown', {
|
|
44
|
+
nativeEvent: {},
|
|
45
|
+
preventDefault() {},
|
|
46
|
+
keyCode: ENTER,
|
|
47
|
+
} );
|
|
48
|
+
|
|
49
|
+
// TODO: Determine a way to type after pressing ENTER within the block.
|
|
50
|
+
|
|
51
|
+
const citationTextInput =
|
|
52
|
+
within( citationBlock ).getByPlaceholderText( 'Add citation' );
|
|
53
|
+
changeAndSelectTextOfRichText( citationTextInput, 'A person', {
|
|
54
|
+
selectionStart: 2,
|
|
55
|
+
selectionEnd: 2,
|
|
56
|
+
} );
|
|
57
|
+
fireEvent( citationTextInput, 'onKeyDown', {
|
|
58
|
+
nativeEvent: {},
|
|
59
|
+
preventDefault() {},
|
|
60
|
+
keyCode: ENTER,
|
|
61
|
+
} );
|
|
62
|
+
|
|
63
|
+
// Assert
|
|
64
|
+
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
65
|
+
"<!-- wp:pullquote -->
|
|
66
|
+
<figure class="wp-block-pullquote"><blockquote><p>A great statement.<br></p><cite>A <br>person</cite></blockquote></figure>
|
|
67
|
+
<!-- /wp:pullquote -->"
|
|
68
|
+
` );
|
|
69
|
+
} );
|
|
70
|
+
} );
|
|
@@ -28,12 +28,9 @@ function render_block_core_query_title( $attributes ) {
|
|
|
28
28
|
if ( $is_archive ) {
|
|
29
29
|
$show_prefix = isset( $attributes['showPrefix'] ) ? $attributes['showPrefix'] : true;
|
|
30
30
|
if ( ! $show_prefix ) {
|
|
31
|
-
|
|
32
|
-
return $original_title;
|
|
33
|
-
};
|
|
34
|
-
add_filter( 'get_the_archive_title', $filter_title, 10, 2 );
|
|
31
|
+
add_filter( 'get_the_archive_title_prefix', '__return_empty_string', 1 );
|
|
35
32
|
$title = get_the_archive_title();
|
|
36
|
-
remove_filter( '
|
|
33
|
+
remove_filter( 'get_the_archive_title_prefix', '__return_empty_string', 1 );
|
|
37
34
|
} else {
|
|
38
35
|
$title = get_the_archive_title();
|
|
39
36
|
}
|