@wordpress/block-library 8.11.0 → 8.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/archives/edit.js +6 -6
- package/build/archives/edit.js.map +1 -1
- package/build/archives/index.js +1 -2
- package/build/archives/index.js.map +1 -1
- package/build/audio/deprecated.js +3 -4
- package/build/audio/deprecated.js.map +1 -1
- package/build/audio/edit.js +13 -15
- package/build/audio/edit.js.map +1 -1
- package/build/audio/edit.native.js +22 -26
- package/build/audio/edit.native.js.map +1 -1
- package/build/audio/index.js +1 -1
- package/build/audio/save.js +5 -5
- package/build/audio/save.js.map +1 -1
- package/build/audio/transforms.js +25 -29
- package/build/audio/transforms.js.map +1 -1
- package/build/avatar/edit.js +68 -73
- package/build/avatar/edit.js.map +1 -1
- package/build/avatar/hooks.js +12 -16
- package/build/avatar/hooks.js.map +1 -1
- package/build/avatar/index.js +1 -2
- package/build/avatar/index.js.map +1 -1
- package/build/avatar/user-control.js +4 -5
- package/build/avatar/user-control.js.map +1 -1
- package/build/block/edit-title.native.js +4 -5
- package/build/block/edit-title.native.js.map +1 -1
- package/build/block/edit.js +15 -12
- package/build/block/edit.js.map +1 -1
- package/build/block/edit.native.js +7 -8
- package/build/block/edit.native.js.map +1 -1
- package/build/block/index.js +2 -2
- package/build/button/color-background.native.js +5 -6
- package/build/button/color-background.native.js.map +1 -1
- package/build/button/deprecated.js +75 -95
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.js +14 -27
- package/build/button/edit.js.map +1 -1
- package/build/button/edit.native.js +38 -41
- package/build/button/edit.native.js.map +1 -1
- package/build/button/index.js +6 -9
- package/build/button/index.js.map +1 -1
- package/build/button/save.js +10 -12
- package/build/button/save.js.map +1 -1
- package/build/buttons/deprecated.js +19 -23
- package/build/buttons/deprecated.js.map +1 -1
- package/build/buttons/edit.js +8 -12
- package/build/buttons/edit.js.map +1 -1
- package/build/buttons/edit.native.js +19 -22
- package/build/buttons/edit.native.js.map +1 -1
- package/build/buttons/index.js +2 -2
- package/build/buttons/save.js +7 -9
- package/build/buttons/save.js.map +1 -1
- package/build/buttons/transforms.js +3 -3
- package/build/buttons/transforms.js.map +1 -1
- package/build/calendar/edit.js +8 -7
- package/build/calendar/edit.js.map +1 -1
- package/build/calendar/index.js +1 -2
- package/build/calendar/index.js.map +1 -1
- package/build/categories/edit.js +21 -24
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +1 -2
- package/build/categories/index.js.map +1 -1
- package/build/code/edit.js +7 -7
- package/build/code/edit.js.map +1 -1
- package/build/code/edit.native.js +1 -1
- package/build/code/edit.native.js.map +1 -1
- package/build/code/index.js +1 -1
- package/build/code/save.js +5 -5
- package/build/code/save.js.map +1 -1
- package/build/code/transforms.js +6 -8
- package/build/code/transforms.js.map +1 -1
- package/build/column/column-preview.native.js +9 -11
- package/build/column/column-preview.native.js.map +1 -1
- package/build/column/deprecated.js +6 -8
- package/build/column/deprecated.js.map +1 -1
- package/build/column/edit.js +12 -12
- package/build/column/edit.js.map +1 -1
- package/build/column/edit.native.js +20 -24
- package/build/column/edit.native.js.map +1 -1
- package/build/column/index.js +2 -2
- package/build/column/save.js +6 -6
- package/build/column/save.js.map +1 -1
- package/build/columns/columnCalculations.native.js +13 -8
- package/build/columns/columnCalculations.native.js.map +1 -1
- package/build/columns/deprecated.js +9 -12
- package/build/columns/deprecated.js.map +1 -1
- package/build/columns/edit.js +21 -24
- package/build/columns/edit.js.map +1 -1
- package/build/columns/edit.native.js +16 -20
- package/build/columns/edit.native.js.map +1 -1
- package/build/columns/index.js +2 -2
- package/build/columns/save.js +5 -5
- package/build/columns/save.js.map +1 -1
- package/build/columns/transforms.js +11 -16
- package/build/columns/transforms.js.map +1 -1
- package/build/columns/utils.js +6 -13
- package/build/columns/utils.js.map +1 -1
- package/build/comment-author-avatar/edit.js +14 -17
- package/build/comment-author-avatar/edit.js.map +1 -1
- package/build/comment-author-avatar/index.js +1 -2
- package/build/comment-author-avatar/index.js.map +1 -1
- package/build/comment-author-name/deprecated.js +4 -7
- package/build/comment-author-name/deprecated.js.map +1 -1
- package/build/comment-author-name/edit.js +15 -15
- package/build/comment-author-name/edit.js.map +1 -1
- package/build/comment-author-name/index.js +1 -2
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-content/edit.js +13 -12
- package/build/comment-content/edit.js.map +1 -1
- package/build/comment-content/index.js +1 -2
- package/build/comment-content/index.js.map +1 -1
- package/build/comment-date/deprecated.js +4 -7
- package/build/comment-date/deprecated.js.map +1 -1
- package/build/comment-date/edit.js +12 -12
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-date/index.js +1 -2
- package/build/comment-date/index.js.map +1 -1
- package/build/comment-edit-link/edit.js +9 -9
- package/build/comment-edit-link/edit.js.map +1 -1
- package/build/comment-edit-link/index.js +1 -2
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/edit.js +8 -8
- package/build/comment-reply-link/edit.js.map +1 -1
- package/build/comment-reply-link/index.js +1 -2
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comment-template/edit.js +67 -81
- package/build/comment-template/edit.js.map +1 -1
- package/build/comment-template/hooks.js +14 -17
- package/build/comment-template/hooks.js.map +1 -1
- package/build/comment-template/index.js +1 -2
- package/build/comment-template/index.js.map +1 -1
- package/build/comment-template/util.js +1 -3
- package/build/comment-template/util.js.map +1 -1
- package/build/comments/deprecated.js +10 -11
- package/build/comments/deprecated.js.map +1 -1
- package/build/comments/edit/comments-inspector-controls.js +6 -7
- package/build/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments/edit/comments-legacy.js +10 -10
- package/build/comments/edit/comments-legacy.js.map +1 -1
- package/build/comments/edit/index.js +4 -2
- package/build/comments/edit/index.js.map +1 -1
- package/build/comments/edit/placeholder.js +4 -5
- package/build/comments/edit/placeholder.js.map +1 -1
- package/build/comments/index.js +1 -2
- package/build/comments/index.js.map +1 -1
- package/build/comments/save.js +8 -9
- package/build/comments/save.js.map +1 -1
- package/build/comments-pagination/comments-pagination-arrow-controls.js +4 -5
- package/build/comments-pagination/comments-pagination-arrow-controls.js.map +1 -1
- package/build/comments-pagination/edit.js +11 -11
- package/build/comments-pagination/edit.js.map +1 -1
- package/build/comments-pagination/index.js +2 -3
- package/build/comments-pagination/index.js.map +1 -1
- package/build/comments-pagination-next/edit.js +13 -17
- package/build/comments-pagination-next/edit.js.map +1 -1
- package/build/comments-pagination-next/index.js +1 -2
- package/build/comments-pagination-next/index.js.map +1 -1
- package/build/comments-pagination-numbers/edit.js +13 -15
- package/build/comments-pagination-numbers/edit.js.map +1 -1
- package/build/comments-pagination-numbers/index.js +1 -2
- package/build/comments-pagination-numbers/index.js.map +1 -1
- package/build/comments-pagination-previous/edit.js +13 -17
- package/build/comments-pagination-previous/edit.js.map +1 -1
- package/build/comments-pagination-previous/index.js +1 -2
- package/build/comments-pagination-previous/index.js.map +1 -1
- package/build/comments-title/deprecated.js +5 -8
- package/build/comments-title/deprecated.js.map +1 -1
- package/build/comments-title/edit.js +17 -23
- package/build/comments-title/edit.js.map +1 -1
- package/build/comments-title/index.js +1 -1
- package/build/cover/controls.native.js +92 -101
- package/build/cover/controls.native.js.map +1 -1
- package/build/cover/deprecated.js +79 -80
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/block-controls.js +7 -8
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/cover-placeholder.js +8 -9
- package/build/cover/edit/cover-placeholder.js.map +1 -1
- package/build/cover/edit/index.js +24 -26
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +18 -23
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/edit/resizable-cover-popover.js +18 -20
- package/build/cover/edit/resizable-cover-popover.js.map +1 -1
- package/build/cover/edit/use-cover-is-dark.js +1 -3
- package/build/cover/edit/use-cover-is-dark.js.map +1 -1
- package/build/cover/edit.native.js +134 -156
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/focal-point-settings-button.native.js +6 -7
- package/build/cover/focal-point-settings-button.native.js.map +1 -1
- package/build/cover/index.js +2 -2
- package/build/cover/overlay-color-settings.native.js +8 -9
- package/build/cover/overlay-color-settings.native.js.map +1 -1
- package/build/cover/save.js +12 -11
- package/build/cover/save.js.map +1 -1
- package/build/cover/shared.js +5 -6
- package/build/cover/shared.js.map +1 -1
- package/build/cover/transforms.js +117 -147
- package/build/cover/transforms.js.map +1 -1
- package/build/cover/use-cover-is-dark.native.js +1 -5
- package/build/cover/use-cover-is-dark.native.js.map +1 -1
- package/build/details/edit.js +8 -13
- package/build/details/edit.js.map +1 -1
- package/build/details/index.js +2 -3
- package/build/details/index.js.map +1 -1
- package/build/details/init.js +16 -0
- package/build/details/init.js.map +1 -0
- package/build/details/save.js +5 -10
- package/build/details/save.js.map +1 -1
- package/build/embed/deprecated.js +16 -18
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/edit.js +10 -9
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +10 -7
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/embed-controls.js +22 -25
- package/build/embed/embed-controls.js.map +1 -1
- package/build/embed/embed-controls.native.js +9 -10
- package/build/embed/embed-controls.native.js.map +1 -1
- package/build/embed/embed-link-settings.native.js +9 -10
- package/build/embed/embed-link-settings.native.js.map +1 -1
- package/build/embed/embed-no-preview.native.js +8 -9
- package/build/embed/embed-no-preview.native.js.map +1 -1
- package/build/embed/embed-placeholder.js +10 -11
- package/build/embed/embed-placeholder.js.map +1 -1
- package/build/embed/embed-placeholder.native.js +11 -14
- package/build/embed/embed-placeholder.native.js.map +1 -1
- package/build/embed/embed-preview.native.js +16 -17
- package/build/embed/embed-preview.native.js.map +1 -1
- package/build/embed/index.js +1 -1
- package/build/embed/save.js +7 -7
- package/build/embed/save.js.map +1 -1
- package/build/embed/transforms.js +10 -18
- package/build/embed/transforms.js.map +1 -1
- package/build/embed/util.js +20 -51
- package/build/embed/util.js.map +1 -1
- package/build/embed/wp-embed-preview.js +18 -25
- package/build/embed/wp-embed-preview.js.map +1 -1
- package/build/embed/wp-embed-preview.native.js +8 -12
- package/build/embed/wp-embed-preview.native.js.map +1 -1
- package/build/file/deprecated.js +15 -15
- package/build/file/deprecated.js.map +1 -1
- package/build/file/edit.js +15 -18
- package/build/file/edit.js.map +1 -1
- package/build/file/edit.native.js +20 -25
- package/build/file/edit.native.js.map +1 -1
- package/build/file/index.js +1 -1
- package/build/file/inspector.js +12 -13
- package/build/file/inspector.js.map +1 -1
- package/build/file/save.js +5 -5
- package/build/file/save.js.map +1 -1
- package/build/file/transforms.js +9 -15
- package/build/file/transforms.js.map +1 -1
- package/build/footnotes/edit.js +57 -0
- package/build/footnotes/edit.js.map +1 -0
- package/build/footnotes/format.js +142 -0
- package/build/footnotes/format.js.map +1 -0
- package/build/footnotes/index.js +67 -0
- package/build/footnotes/index.js.map +1 -0
- package/build/freeform/convert-to-blocks-button.js +3 -4
- package/build/freeform/convert-to-blocks-button.js.map +1 -1
- package/build/freeform/edit.js +16 -16
- package/build/freeform/edit.js.map +1 -1
- package/build/freeform/edit.native.js +2 -4
- package/build/freeform/edit.native.js.map +1 -1
- package/build/freeform/index.js +2 -2
- package/build/freeform/modal.js +5 -5
- package/build/freeform/modal.js.map +1 -1
- package/build/freeform/save.js +3 -4
- package/build/freeform/save.js.map +1 -1
- package/build/gallery/deprecated.js +46 -58
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/edit-wrapper.js +4 -2
- package/build/gallery/edit-wrapper.js.map +1 -1
- package/build/gallery/edit.js +39 -64
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +2 -4
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gallery.native.js +3 -2
- package/build/gallery/gallery.native.js.map +1 -1
- package/build/gallery/gap-styles.js +6 -7
- package/build/gallery/gap-styles.js.map +1 -1
- package/build/gallery/index.js +2 -2
- package/build/gallery/save.js +5 -6
- package/build/gallery/save.js.map +1 -1
- package/build/gallery/shared-icon.native.js +7 -9
- package/build/gallery/shared-icon.native.js.map +1 -1
- package/build/gallery/shared.js +4 -10
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/transforms.js +103 -142
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/use-get-media.native.js +8 -15
- package/build/gallery/use-get-media.native.js.map +1 -1
- package/build/gallery/use-get-new-images.js +2 -2
- package/build/gallery/use-get-new-images.js.map +1 -1
- package/build/gallery/use-image-sizes.js +11 -19
- package/build/gallery/use-image-sizes.js.map +1 -1
- package/build/gallery/utils.js +2 -2
- package/build/gallery/utils.js.map +1 -1
- package/build/gallery/v1/edit.js +38 -69
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/gallery/v1/gallery.js +10 -11
- package/build/gallery/v1/gallery.js.map +1 -1
- package/build/gallery/v1/save.js +8 -8
- package/build/gallery/v1/save.js.map +1 -1
- package/build/gallery/v1/shared.js +4 -10
- package/build/gallery/v1/shared.js.map +1 -1
- package/build/group/deprecated.js +25 -31
- package/build/group/deprecated.js.map +1 -1
- package/build/group/edit.js +18 -19
- package/build/group/edit.js.map +1 -1
- package/build/group/edit.native.js +14 -18
- package/build/group/edit.native.js.map +1 -1
- package/build/group/index.js +2 -2
- package/build/group/placeholder.js +18 -20
- package/build/group/placeholder.js.map +1 -1
- package/build/group/save.js +7 -7
- package/build/group/save.js.map +1 -1
- package/build/group/variations.js +8 -23
- package/build/group/variations.js.map +1 -1
- package/build/heading/deprecated.js +26 -32
- package/build/heading/deprecated.js.map +1 -1
- package/build/heading/edit.js +17 -20
- package/build/heading/edit.js.map +1 -1
- package/build/heading/heading-level-icon.js +4 -5
- package/build/heading/heading-level-icon.js.map +1 -1
- package/build/heading/index.js +4 -5
- package/build/heading/index.js.map +1 -1
- package/build/heading/save.js +7 -7
- package/build/heading/save.js.map +1 -1
- package/build/heading/transforms.js +21 -28
- package/build/heading/transforms.js.map +1 -1
- package/build/home-link/edit.js +12 -16
- package/build/home-link/edit.js.map +1 -1
- package/build/home-link/index.js +1 -2
- package/build/home-link/index.js.map +1 -1
- package/build/html/edit.js +9 -9
- package/build/html/edit.js.map +1 -1
- package/build/html/index.js +1 -1
- package/build/html/preview.js +5 -8
- package/build/html/preview.js.map +1 -1
- package/build/html/save.js +3 -4
- package/build/html/save.js.map +1 -1
- package/build/html/transforms.js +3 -4
- package/build/html/transforms.js.map +1 -1
- package/build/image/deprecated.js +29 -32
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.js +20 -28
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +48 -63
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +48 -59
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +7 -9
- package/build/image/index.js.map +1 -1
- package/build/image/interactivity.js +140 -30
- package/build/image/interactivity.js.map +1 -1
- package/build/image/save.js +7 -7
- package/build/image/save.js.map +1 -1
- package/build/image/transforms.js +36 -46
- package/build/image/transforms.js.map +1 -1
- package/build/image/use-client-width.js +1 -3
- package/build/image/use-client-width.js.map +1 -1
- package/build/image/utils.js +4 -7
- package/build/image/utils.js.map +1 -1
- package/build/index.js +22 -44
- package/build/index.js.map +1 -1
- package/build/index.native.js +3 -6
- package/build/index.native.js.map +1 -1
- package/build/latest-comments/edit.js +7 -7
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-comments/index.js +1 -2
- package/build/latest-comments/index.js.map +1 -1
- package/build/latest-posts/deprecated.js +4 -8
- package/build/latest-posts/deprecated.js.map +1 -1
- package/build/latest-posts/edit.js +38 -41
- package/build/latest-posts/edit.js.map +1 -1
- package/build/latest-posts/edit.native.js +8 -10
- package/build/latest-posts/edit.native.js.map +1 -1
- package/build/latest-posts/index.js +1 -2
- package/build/latest-posts/index.js.map +1 -1
- package/build/list/deprecated.js +22 -25
- package/build/list/deprecated.js.map +1 -1
- package/build/list/edit.js +13 -16
- package/build/list/edit.js.map +1 -1
- package/build/list/index.js +1 -1
- package/build/list/ordered-list-settings.js +55 -34
- package/build/list/ordered-list-settings.js.map +1 -1
- package/build/list/save.js +9 -9
- package/build/list/save.js.map +1 -1
- package/build/list/tag-name.js +4 -7
- package/build/list/tag-name.js.map +1 -1
- package/build/list/tag-name.native.js +4 -7
- package/build/list/tag-name.native.js.map +1 -1
- package/build/list/transforms.js +11 -15
- package/build/list/transforms.js.map +1 -1
- package/build/list/utils.js +1 -1
- package/build/list/utils.js.map +1 -1
- package/build/list-item/edit.js +13 -18
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/edit.native.js +17 -24
- package/build/list-item/edit.native.js.map +1 -1
- package/build/list-item/hooks/use-enter.js +1 -3
- package/build/list-item/hooks/use-enter.js.map +1 -1
- package/build/list-item/hooks/use-enter.native.js +1 -3
- package/build/list-item/hooks/use-enter.native.js.map +1 -1
- package/build/list-item/hooks/use-indent-list-item.js +1 -3
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +2 -4
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/list-item/index.js +1 -1
- package/build/list-item/list-style-type.native.js +29 -34
- package/build/list-item/list-style-type.native.js.map +1 -1
- package/build/list-item/save.js +5 -5
- package/build/list-item/save.js.map +1 -1
- package/build/list-item/transforms.js +1 -4
- package/build/list-item/transforms.js.map +1 -1
- package/build/list-item/utils.js +4 -4
- package/build/list-item/utils.js.map +1 -1
- package/build/{private-apis.js → lock-unlock.js} +1 -1
- package/build/lock-unlock.js.map +1 -0
- package/build/loginout/edit.js +8 -8
- package/build/loginout/edit.js.map +1 -1
- package/build/loginout/index.js +1 -2
- package/build/loginout/index.js.map +1 -1
- package/build/media-text/deprecated.js +65 -64
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.js +32 -43
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/edit.native.js +9 -13
- package/build/media-text/edit.native.js.map +1 -1
- package/build/media-text/index.js +1 -1
- package/build/media-text/media-container.js +23 -25
- package/build/media-text/media-container.js.map +1 -1
- package/build/media-text/media-container.native.js +12 -13
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/media-text/save.js +20 -17
- package/build/media-text/save.js.map +1 -1
- package/build/media-text/transforms.js +73 -91
- package/build/media-text/transforms.js.map +1 -1
- package/build/missing/edit.js +13 -14
- package/build/missing/edit.js.map +1 -1
- package/build/missing/edit.native.js +7 -8
- package/build/missing/edit.native.js.map +1 -1
- package/build/missing/index.js +4 -6
- package/build/missing/index.js.map +1 -1
- package/build/missing/save.js +3 -4
- package/build/missing/save.js.map +1 -1
- package/build/more/edit.js +13 -16
- package/build/more/edit.js.map +1 -1
- package/build/more/edit.native.js +4 -10
- package/build/more/edit.native.js.map +1 -1
- package/build/more/index.js +4 -6
- package/build/more/index.js.map +1 -1
- package/build/more/save.js +6 -7
- package/build/more/save.js.map +1 -1
- package/build/navigation/constants.js +8 -1
- package/build/navigation/constants.js.map +1 -1
- package/build/navigation/deprecated.js +17 -28
- package/build/navigation/deprecated.js.map +1 -1
- package/build/navigation/edit/are-blocks-dirty.js +1 -1
- package/build/navigation/edit/are-blocks-dirty.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +3 -4
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation/edit/index.js +68 -61
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +12 -15
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/leaf-more-menu.js +38 -46
- package/build/navigation/edit/leaf-more-menu.js.map +1 -1
- package/build/navigation/edit/manage-menus-button.js +5 -6
- package/build/navigation/edit/manage-menus-button.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +52 -52
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js +3 -4
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +63 -61
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/overlay-menu-icon.js +3 -5
- package/build/navigation/edit/overlay-menu-icon.js.map +1 -1
- package/build/navigation/edit/overlay-menu-preview.js +5 -6
- package/build/navigation/edit/overlay-menu-preview.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +10 -11
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/edit/placeholder/placeholder-preview.js +3 -4
- package/build/navigation/edit/placeholder/placeholder-preview.js.map +1 -1
- package/build/navigation/edit/responsive-wrapper.js +20 -21
- package/build/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +13 -19
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +2 -3
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/edit/use-create-navigation-menu.js +3 -7
- package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build/navigation/edit/use-generate-default-navigation-title.js +1 -5
- package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build/navigation/edit/use-inner-blocks.js +1 -1
- package/build/navigation/edit/use-inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-navigation-notice.js +4 -5
- package/build/navigation/edit/use-navigation-notice.js.map +1 -1
- package/build/navigation/edit/utils.js +2 -4
- package/build/navigation/edit/utils.js.map +1 -1
- package/build/navigation/index.js +2 -3
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/interactivity.js +97 -87
- package/build/navigation/interactivity.js.map +1 -1
- package/build/navigation/menu-items-to-blocks.js +25 -34
- package/build/navigation/menu-items-to-blocks.js.map +1 -1
- package/build/navigation/save.js +3 -5
- package/build/navigation/save.js.map +1 -1
- package/build/navigation/use-navigation-entities.js +2 -2
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +10 -8
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation/use-template-part-area-label.js +3 -5
- package/build/navigation/use-template-part-area-label.js.map +1 -1
- package/build/navigation/view-modal.js +2 -4
- package/build/navigation/view-modal.js.map +1 -1
- package/build/navigation/view.js +1 -1
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +18 -23
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/hooks.js +1 -1
- package/build/navigation-link/hooks.js.map +1 -1
- package/build/navigation-link/index.js +11 -16
- package/build/navigation-link/index.js.map +1 -1
- package/build/navigation-link/link-ui.js +9 -8
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/navigation-link/update-attributes.js +1 -4
- package/build/navigation-link/update-attributes.js.map +1 -1
- package/build/navigation-submenu/edit.js +17 -18
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/index.js +7 -12
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/navigation-submenu/transforms.js +6 -30
- package/build/navigation-submenu/transforms.js.map +1 -1
- package/build/nextpage/edit.js +2 -1
- package/build/nextpage/edit.js.map +1 -1
- package/build/nextpage/edit.native.js +9 -10
- package/build/nextpage/edit.native.js.map +1 -1
- package/build/nextpage/index.js +1 -1
- package/build/page-list/convert-to-links-modal.js +5 -6
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +35 -41
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list/index.js +1 -2
- package/build/page-list/index.js.map +1 -1
- package/build/page-list/use-convert-to-navigation-links.js +16 -21
- package/build/page-list/use-convert-to-navigation-links.js.map +1 -1
- package/build/page-list-item/edit.js +7 -7
- package/build/page-list-item/edit.js.map +1 -1
- package/build/page-list-item/index.js +4 -7
- package/build/page-list-item/index.js.map +1 -1
- package/build/paragraph/deprecated.js +23 -28
- package/build/paragraph/deprecated.js.map +1 -1
- package/build/paragraph/edit.js +16 -20
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/edit.native.js +13 -16
- package/build/paragraph/edit.native.js.map +1 -1
- package/build/paragraph/index.js +4 -6
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/save.js +8 -8
- package/build/paragraph/save.js.map +1 -1
- package/build/paragraph/transforms.js +10 -13
- package/build/paragraph/transforms.js.map +1 -1
- package/build/pattern/edit.js +11 -39
- package/build/pattern/edit.js.map +1 -1
- package/build/pattern/index.js +7 -14
- package/build/pattern/index.js.map +1 -1
- package/build/post-author/edit.js +22 -24
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author/index.js +1 -2
- package/build/post-author/index.js.map +1 -1
- package/build/post-author-biography/edit.js +14 -19
- package/build/post-author-biography/edit.js.map +1 -1
- package/build/post-author-biography/index.js +1 -2
- package/build/post-author-biography/index.js.map +1 -1
- package/build/post-author-name/edit.js +16 -18
- package/build/post-author-name/edit.js.map +1 -1
- package/build/post-author-name/index.js +1 -2
- package/build/post-author-name/index.js.map +1 -1
- package/build/post-author-name/transforms.js +10 -16
- package/build/post-author-name/transforms.js.map +1 -1
- package/build/post-comment/edit.js +10 -9
- package/build/post-comment/edit.js.map +1 -1
- package/build/post-comment/index.js +1 -1
- package/build/post-comment/save.js +2 -1
- package/build/post-comment/save.js.map +1 -1
- package/build/post-comments-count/edit.js +8 -13
- package/build/post-comments-count/edit.js.map +1 -1
- package/build/post-comments-count/index.js +1 -2
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-form/edit.js +7 -7
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +5 -10
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-comments-form/index.js +1 -2
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-comments-link/edit.js +7 -7
- package/build/post-comments-link/edit.js.map +1 -1
- package/build/post-comments-link/index.js +1 -2
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-content/edit.js +37 -32
- package/build/post-content/edit.js.map +1 -1
- package/build/post-content/index.js +2 -3
- package/build/post-content/index.js.map +1 -1
- package/build/post-date/deprecated.js +4 -7
- package/build/post-date/deprecated.js.map +1 -1
- package/build/post-date/edit.js +29 -34
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/index.js +1 -2
- package/build/post-date/index.js.map +1 -1
- package/build/post-excerpt/edit.js +25 -25
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-excerpt/index.js +3 -4
- package/build/post-excerpt/index.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +12 -13
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js +31 -39
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +1 -2
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-featured-image/overlay.js +11 -13
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/post-navigation-link/edit.js +13 -13
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/post-navigation-link/index.js +1 -2
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-template/edit.js +107 -88
- package/build/post-template/edit.js.map +1 -1
- package/build/post-template/index.js +10 -5
- package/build/post-template/index.js.map +1 -1
- package/build/post-terms/edit.js +13 -22
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/hooks.js +9 -5
- package/build/post-terms/hooks.js.map +1 -1
- package/build/post-terms/index.js +1 -2
- package/build/post-terms/index.js.map +1 -1
- package/build/post-terms/use-post-terms.js +7 -12
- package/build/post-terms/use-post-terms.js.map +1 -1
- package/build/post-time-to-read/edit.js +7 -7
- package/build/post-time-to-read/edit.js.map +1 -1
- package/build/post-time-to-read/index.js +1 -1
- package/build/post-time-to-read/init.js +16 -0
- package/build/post-time-to-read/init.js.map +1 -0
- package/build/post-title/deprecated.js +4 -7
- package/build/post-title/deprecated.js.map +1 -1
- package/build/post-title/edit.js +40 -34
- package/build/post-title/edit.js.map +1 -1
- package/build/post-title/index.js +2 -3
- package/build/post-title/index.js.map +1 -1
- package/build/preformatted/edit.js +11 -16
- package/build/preformatted/edit.js.map +1 -1
- package/build/preformatted/edit.native.js +7 -8
- package/build/preformatted/edit.native.js.map +1 -1
- package/build/preformatted/index.js +1 -1
- package/build/preformatted/save.js +5 -5
- package/build/preformatted/save.js.map +1 -1
- package/build/preformatted/transforms.js +14 -20
- package/build/preformatted/transforms.js.map +1 -1
- package/build/pullquote/deprecated.js +71 -81
- package/build/pullquote/deprecated.js.map +1 -1
- package/build/pullquote/edit.js +8 -8
- package/build/pullquote/edit.js.map +1 -1
- package/build/pullquote/edit.native.js +15 -22
- package/build/pullquote/edit.native.js.map +1 -1
- package/build/pullquote/figure.native.js +5 -6
- package/build/pullquote/figure.native.js.map +1 -1
- package/build/pullquote/index.js +1 -1
- package/build/pullquote/save.js +8 -8
- package/build/pullquote/save.js.map +1 -1
- package/build/pullquote/transforms.js +17 -24
- package/build/pullquote/transforms.js.map +1 -1
- package/build/query/deprecated.js +211 -87
- package/build/query/deprecated.js.map +1 -1
- package/build/query/edit/index.js +2 -4
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +5 -8
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/create-new-post-link.js +6 -7
- package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +8 -9
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/order-control.js +5 -6
- package/build/query/edit/inspector-controls/order-control.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +10 -13
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/sticky-control.js +4 -5
- package/build/query/edit/inspector-controls/sticky-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +15 -19
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/edit/pattern-selection-modal.js +5 -6
- package/build/query/edit/pattern-selection-modal.js.map +1 -1
- package/build/query/edit/query-content.js +27 -15
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/edit/query-placeholder.js +20 -22
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/edit/query-toolbar.js +17 -41
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/query/index.js +2 -9
- package/build/query/index.js.map +1 -1
- package/build/query/save.js +7 -8
- package/build/query/save.js.map +1 -1
- package/build/query/utils.js +25 -62
- package/build/query/utils.js.map +1 -1
- package/build/query-no-results/edit.js +2 -1
- package/build/query-no-results/edit.js.map +1 -1
- package/build/query-no-results/index.js +1 -2
- package/build/query-no-results/index.js.map +1 -1
- package/build/query-pagination/deprecated.js +2 -1
- package/build/query-pagination/deprecated.js.map +1 -1
- package/build/query-pagination/edit.js +30 -12
- package/build/query-pagination/edit.js.map +1 -1
- package/build/query-pagination/index.js +8 -4
- package/build/query-pagination/index.js.map +1 -1
- package/build/query-pagination/query-pagination-arrow-controls.js +4 -5
- package/build/query-pagination/query-pagination-arrow-controls.js.map +1 -1
- package/build/query-pagination/query-pagination-label-control.js +29 -0
- package/build/query-pagination/query-pagination-label-control.js.map +1 -0
- package/build/query-pagination-next/edit.js +14 -17
- package/build/query-pagination-next/edit.js.map +1 -1
- package/build/query-pagination-next/index.js +2 -3
- package/build/query-pagination-next/index.js.map +1 -1
- package/build/query-pagination-numbers/edit.js +5 -8
- package/build/query-pagination-numbers/edit.js.map +1 -1
- package/build/query-pagination-numbers/index.js +1 -2
- package/build/query-pagination-numbers/index.js.map +1 -1
- package/build/query-pagination-previous/edit.js +15 -18
- package/build/query-pagination-previous/edit.js.map +1 -1
- package/build/query-pagination-previous/index.js +2 -3
- package/build/query-pagination-previous/index.js.map +1 -1
- package/build/query-title/deprecated.js +4 -7
- package/build/query-title/deprecated.js.map +1 -1
- package/build/query-title/edit.js +18 -22
- package/build/query-title/edit.js.map +1 -1
- package/build/query-title/index.js +1 -2
- package/build/query-title/index.js.map +1 -1
- package/build/quote/deprecated.js +21 -27
- package/build/quote/deprecated.js.map +1 -1
- package/build/quote/edit.js +15 -16
- package/build/quote/edit.js.map +1 -1
- package/build/quote/index.js +1 -1
- package/build/quote/save.js +7 -7
- package/build/quote/save.js.map +1 -1
- package/build/quote/transforms.js +37 -57
- package/build/quote/transforms.js.map +1 -1
- package/build/read-more/edit.js +12 -16
- package/build/read-more/edit.js.map +1 -1
- package/build/read-more/index.js +1 -2
- package/build/read-more/index.js.map +1 -1
- package/build/rss/edit.js +8 -7
- package/build/rss/edit.js.map +1 -1
- package/build/rss/index.js +1 -2
- package/build/rss/index.js.map +1 -1
- package/build/search/edit.js +77 -34
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js +45 -43
- package/build/search/edit.native.js.map +1 -1
- package/build/search/index.js +9 -2
- package/build/search/index.js.map +1 -1
- package/build/search/view.js +67 -0
- package/build/search/view.js.map +1 -0
- package/build/separator/deprecated.js +8 -8
- package/build/separator/deprecated.js.map +1 -1
- package/build/separator/edit.js +11 -13
- package/build/separator/edit.js.map +1 -1
- package/build/separator/index.js +1 -1
- package/build/separator/save.js +10 -12
- package/build/separator/save.js.map +1 -1
- package/build/shortcode/edit.js +8 -8
- package/build/shortcode/edit.js.map +1 -1
- package/build/shortcode/index.js +2 -2
- package/build/shortcode/save.js +3 -4
- package/build/shortcode/save.js.map +1 -1
- package/build/shortcode/transforms.js +3 -4
- package/build/shortcode/transforms.js.map +1 -1
- package/build/site-logo/edit.js +68 -84
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +1 -2
- package/build/site-logo/index.js.map +1 -1
- package/build/site-logo/transforms.js +4 -5
- package/build/site-logo/transforms.js.map +1 -1
- package/build/site-tagline/deprecated.js +4 -7
- package/build/site-tagline/deprecated.js.map +1 -1
- package/build/site-tagline/edit.js +11 -12
- package/build/site-tagline/edit.js.map +1 -1
- package/build/site-tagline/icon.js +0 -3
- package/build/site-tagline/icon.js.map +1 -1
- package/build/site-tagline/index.js +1 -2
- package/build/site-tagline/index.js.map +1 -1
- package/build/site-title/deprecated.js +4 -7
- package/build/site-title/deprecated.js.map +1 -1
- package/build/site-title/edit/index.js +14 -16
- package/build/site-title/edit/index.js.map +1 -1
- package/build/site-title/index.js +1 -2
- package/build/site-title/index.js.map +1 -1
- package/build/site-title/transforms.js +4 -5
- package/build/site-title/transforms.js.map +1 -1
- package/build/social-link/edit.js +21 -18
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/edit.native.js +11 -13
- package/build/social-link/edit.native.js.map +1 -1
- package/build/social-link/index.js +2 -3
- package/build/social-link/index.js.map +1 -1
- package/build/social-links/deprecated.js +7 -8
- package/build/social-links/deprecated.js.map +1 -1
- package/build/social-links/edit.js +39 -45
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/edit.native.js +18 -25
- package/build/social-links/edit.native.js.map +1 -1
- package/build/social-links/index.js +4 -2
- package/build/social-links/index.js.map +1 -1
- package/build/social-links/save.js +2 -1
- package/build/social-links/save.js.map +1 -1
- package/build/spacer/controls.js +18 -21
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +7 -8
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/deprecated.js +11 -11
- package/build/spacer/deprecated.js.map +1 -1
- package/build/spacer/edit.js +30 -33
- package/build/spacer/edit.js.map +1 -1
- package/build/spacer/edit.native.js +11 -13
- package/build/spacer/edit.native.js.map +1 -1
- package/build/spacer/index.js +1 -1
- package/build/spacer/save.js +23 -14
- package/build/spacer/save.js.map +1 -1
- package/build/spacer/save.native.js +14 -14
- package/build/spacer/save.native.js.map +1 -1
- package/build/table/deprecated.js +83 -104
- package/build/table/deprecated.js.map +1 -1
- package/build/table/edit.js +51 -63
- package/build/table/edit.js.map +1 -1
- package/build/table/index.js +1 -1
- package/build/table/save.js +35 -41
- package/build/table/save.js.map +1 -1
- package/build/table/state.js +32 -59
- package/build/table/state.js.map +1 -1
- package/build/table/transforms.js +17 -20
- package/build/table/transforms.js.map +1 -1
- package/build/table-of-contents/edit.js +13 -12
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/index.js +1 -1
- package/build/table-of-contents/list.js +3 -4
- package/build/table-of-contents/list.js.map +1 -1
- package/build/table-of-contents/save.js +7 -8
- package/build/table-of-contents/save.js.map +1 -1
- package/build/table-of-contents/utils.js +1 -3
- package/build/table-of-contents/utils.js.map +1 -1
- package/build/tag-cloud/edit.js +8 -9
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/tag-cloud/index.js +1 -2
- package/build/tag-cloud/index.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +15 -19
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/import-controls.js +7 -11
- package/build/template-part/edit/import-controls.js.map +1 -1
- package/build/template-part/edit/index.js +15 -12
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/inner-blocks.js +11 -13
- package/build/template-part/edit/inner-blocks.js.map +1 -1
- package/build/template-part/edit/placeholder.js +7 -8
- package/build/template-part/edit/placeholder.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +8 -11
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/template-part/edit/title-modal.js +5 -6
- package/build/template-part/edit/title-modal.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +4 -6
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/template-part/edit/utils/transformers.js +3 -6
- package/build/template-part/edit/utils/transformers.js.map +1 -1
- package/build/template-part/index.js +11 -20
- package/build/template-part/index.js.map +1 -1
- package/build/template-part/variations.js +2 -2
- package/build/template-part/variations.js.map +1 -1
- package/build/term-description/edit.js +7 -7
- package/build/term-description/edit.js.map +1 -1
- package/build/term-description/index.js +1 -2
- package/build/term-description/index.js.map +1 -1
- package/build/text-columns/edit.js +9 -11
- package/build/text-columns/edit.js.map +1 -1
- package/build/text-columns/index.js +1 -1
- package/build/text-columns/save.js +14 -18
- package/build/text-columns/save.js.map +1 -1
- package/build/text-columns/transforms.js +14 -20
- package/build/text-columns/transforms.js.map +1 -1
- package/build/utils/init-block.native.js +1 -3
- package/build/utils/init-block.native.js.map +1 -1
- package/build/utils/interactivity/constants.js +1 -1
- package/build/utils/interactivity/constants.js.map +1 -1
- package/build/utils/interactivity/directives.js +79 -93
- package/build/utils/interactivity/directives.js.map +1 -1
- package/build/utils/interactivity/hooks.js +29 -46
- package/build/utils/interactivity/hooks.js.map +1 -1
- package/build/utils/interactivity/hydration.js +1 -1
- package/build/utils/interactivity/hydration.js.map +1 -1
- package/build/utils/interactivity/index.js +1 -3
- package/build/utils/interactivity/index.js.map +1 -1
- package/build/utils/interactivity/store.js +4 -5
- package/build/utils/interactivity/store.js.map +1 -1
- package/build/utils/interactivity/vdom.js +14 -4
- package/build/utils/interactivity/vdom.js.map +1 -1
- package/build/utils/migrate-font-family.js +3 -5
- package/build/utils/migrate-font-family.js.map +1 -1
- package/build/utils/search-patterns.js +5 -19
- package/build/utils/search-patterns.js.map +1 -1
- package/build/utils/transformation-categories.native.js +1 -4
- package/build/utils/transformation-categories.native.js.map +1 -1
- package/build/verse/deprecated.js +14 -18
- package/build/verse/deprecated.js.map +1 -1
- package/build/verse/edit.js +11 -14
- package/build/verse/edit.js.map +1 -1
- package/build/verse/index.js +1 -1
- package/build/verse/save.js +7 -7
- package/build/verse/save.js.map +1 -1
- package/build/video/deprecated.js +6 -6
- package/build/video/deprecated.js.map +1 -1
- package/build/video/edit-common-settings.js +4 -5
- package/build/video/edit-common-settings.js.map +1 -1
- package/build/video/edit.js +22 -29
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +26 -32
- package/build/video/edit.native.js.map +1 -1
- package/build/video/index.js +1 -1
- package/build/video/save.js +5 -5
- package/build/video/save.js.map +1 -1
- package/build/video/tracks-editor.js +39 -51
- package/build/video/tracks-editor.js.map +1 -1
- package/build/video/tracks.js +7 -11
- package/build/video/tracks.js.map +1 -1
- package/build/video/transforms.js +30 -35
- package/build/video/transforms.js.map +1 -1
- package/build-module/archives/edit.js +6 -6
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/archives/index.js +1 -2
- package/build-module/archives/index.js.map +1 -1
- package/build-module/audio/deprecated.js +3 -4
- package/build-module/audio/deprecated.js.map +1 -1
- package/build-module/audio/edit.js +13 -15
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js +22 -26
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/audio/index.js +1 -1
- package/build-module/audio/save.js +5 -5
- package/build-module/audio/save.js.map +1 -1
- package/build-module/audio/transforms.js +25 -29
- package/build-module/audio/transforms.js.map +1 -1
- package/build-module/avatar/edit.js +67 -72
- package/build-module/avatar/edit.js.map +1 -1
- package/build-module/avatar/hooks.js +12 -16
- package/build-module/avatar/hooks.js.map +1 -1
- package/build-module/avatar/index.js +1 -2
- package/build-module/avatar/index.js.map +1 -1
- package/build-module/avatar/user-control.js +4 -5
- package/build-module/avatar/user-control.js.map +1 -1
- package/build-module/block/edit-title.native.js +4 -5
- package/build-module/block/edit-title.native.js.map +1 -1
- package/build-module/block/edit.js +15 -12
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/edit.native.js +7 -8
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/block/index.js +2 -2
- package/build-module/button/color-background.native.js +5 -6
- package/build-module/button/color-background.native.js.map +1 -1
- package/build-module/button/deprecated.js +75 -95
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/edit.js +14 -26
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/edit.native.js +26 -41
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/button/index.js +6 -9
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/save.js +10 -12
- package/build-module/button/save.js.map +1 -1
- package/build-module/buttons/deprecated.js +19 -23
- package/build-module/buttons/deprecated.js.map +1 -1
- package/build-module/buttons/edit.js +8 -12
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/buttons/edit.native.js +19 -22
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/buttons/index.js +2 -2
- package/build-module/buttons/save.js +7 -9
- package/build-module/buttons/save.js.map +1 -1
- package/build-module/buttons/transforms.js +3 -3
- package/build-module/buttons/transforms.js.map +1 -1
- package/build-module/calendar/edit.js +8 -7
- package/build-module/calendar/edit.js.map +1 -1
- package/build-module/calendar/index.js +1 -2
- package/build-module/calendar/index.js.map +1 -1
- package/build-module/categories/edit.js +21 -24
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +1 -2
- package/build-module/categories/index.js.map +1 -1
- package/build-module/code/edit.js +7 -7
- package/build-module/code/edit.js.map +1 -1
- package/build-module/code/edit.native.js +1 -1
- package/build-module/code/edit.native.js.map +1 -1
- package/build-module/code/index.js +1 -1
- package/build-module/code/save.js +5 -5
- package/build-module/code/save.js.map +1 -1
- package/build-module/code/transforms.js +6 -8
- package/build-module/code/transforms.js.map +1 -1
- package/build-module/column/column-preview.native.js +9 -11
- package/build-module/column/column-preview.native.js.map +1 -1
- package/build-module/column/deprecated.js +6 -8
- package/build-module/column/deprecated.js.map +1 -1
- package/build-module/column/edit.js +12 -12
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/edit.native.js +20 -24
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/column/index.js +2 -2
- package/build-module/column/save.js +6 -6
- package/build-module/column/save.js.map +1 -1
- package/build-module/columns/columnCalculations.native.js +6 -9
- package/build-module/columns/columnCalculations.native.js.map +1 -1
- package/build-module/columns/deprecated.js +9 -12
- package/build-module/columns/deprecated.js.map +1 -1
- package/build-module/columns/edit.js +21 -24
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +16 -19
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/columns/index.js +2 -2
- package/build-module/columns/save.js +5 -5
- package/build-module/columns/save.js.map +1 -1
- package/build-module/columns/transforms.js +11 -16
- package/build-module/columns/transforms.js.map +1 -1
- package/build-module/columns/utils.js +6 -13
- package/build-module/columns/utils.js.map +1 -1
- package/build-module/comment-author-avatar/edit.js +14 -14
- package/build-module/comment-author-avatar/edit.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +1 -2
- package/build-module/comment-author-avatar/index.js.map +1 -1
- package/build-module/comment-author-name/deprecated.js +4 -7
- package/build-module/comment-author-name/deprecated.js.map +1 -1
- package/build-module/comment-author-name/edit.js +15 -15
- package/build-module/comment-author-name/edit.js.map +1 -1
- package/build-module/comment-author-name/index.js +1 -2
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-content/edit.js +13 -12
- package/build-module/comment-content/edit.js.map +1 -1
- package/build-module/comment-content/index.js +1 -2
- package/build-module/comment-content/index.js.map +1 -1
- package/build-module/comment-date/deprecated.js +4 -7
- package/build-module/comment-date/deprecated.js.map +1 -1
- package/build-module/comment-date/edit.js +12 -12
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-date/index.js +1 -2
- package/build-module/comment-date/index.js.map +1 -1
- package/build-module/comment-edit-link/edit.js +9 -9
- package/build-module/comment-edit-link/edit.js.map +1 -1
- package/build-module/comment-edit-link/index.js +1 -2
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/edit.js +8 -8
- package/build-module/comment-reply-link/edit.js.map +1 -1
- package/build-module/comment-reply-link/index.js +1 -2
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comment-template/edit.js +66 -77
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js +14 -17
- package/build-module/comment-template/hooks.js.map +1 -1
- package/build-module/comment-template/index.js +1 -2
- package/build-module/comment-template/index.js.map +1 -1
- package/build-module/comment-template/util.js +1 -3
- package/build-module/comment-template/util.js.map +1 -1
- package/build-module/comments/deprecated.js +10 -10
- package/build-module/comments/deprecated.js.map +1 -1
- package/build-module/comments/edit/comments-inspector-controls.js +6 -7
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments/edit/comments-legacy.js +10 -10
- package/build-module/comments/edit/comments-legacy.js.map +1 -1
- package/build-module/comments/edit/index.js +4 -2
- package/build-module/comments/edit/index.js.map +1 -1
- package/build-module/comments/edit/placeholder.js +4 -5
- package/build-module/comments/edit/placeholder.js.map +1 -1
- package/build-module/comments/index.js +1 -2
- package/build-module/comments/index.js.map +1 -1
- package/build-module/comments/save.js +8 -8
- package/build-module/comments/save.js.map +1 -1
- package/build-module/comments-pagination/comments-pagination-arrow-controls.js +4 -5
- package/build-module/comments-pagination/comments-pagination-arrow-controls.js.map +1 -1
- package/build-module/comments-pagination/edit.js +11 -11
- package/build-module/comments-pagination/edit.js.map +1 -1
- package/build-module/comments-pagination/index.js +2 -3
- package/build-module/comments-pagination/index.js.map +1 -1
- package/build-module/comments-pagination-next/edit.js +13 -14
- package/build-module/comments-pagination-next/edit.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +1 -2
- package/build-module/comments-pagination-next/index.js.map +1 -1
- package/build-module/comments-pagination-numbers/edit.js +13 -15
- package/build-module/comments-pagination-numbers/edit.js.map +1 -1
- package/build-module/comments-pagination-numbers/index.js +1 -2
- package/build-module/comments-pagination-numbers/index.js.map +1 -1
- package/build-module/comments-pagination-previous/edit.js +13 -14
- package/build-module/comments-pagination-previous/edit.js.map +1 -1
- package/build-module/comments-pagination-previous/index.js +1 -2
- package/build-module/comments-pagination-previous/index.js.map +1 -1
- package/build-module/comments-title/deprecated.js +5 -8
- package/build-module/comments-title/deprecated.js.map +1 -1
- package/build-module/comments-title/edit.js +17 -22
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/comments-title/index.js +1 -1
- package/build-module/cover/controls.native.js +92 -101
- package/build-module/cover/controls.native.js.map +1 -1
- package/build-module/cover/deprecated.js +79 -80
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +7 -8
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/cover-placeholder.js +8 -9
- package/build-module/cover/edit/cover-placeholder.js.map +1 -1
- package/build-module/cover/edit/index.js +24 -25
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +18 -20
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/edit/resizable-cover-popover.js +17 -18
- package/build-module/cover/edit/resizable-cover-popover.js.map +1 -1
- package/build-module/cover/edit/use-cover-is-dark.js +1 -3
- package/build-module/cover/edit/use-cover-is-dark.js.map +1 -1
- package/build-module/cover/edit.native.js +134 -155
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/focal-point-settings-button.native.js +6 -7
- package/build-module/cover/focal-point-settings-button.native.js.map +1 -1
- package/build-module/cover/index.js +2 -2
- package/build-module/cover/overlay-color-settings.native.js +8 -9
- package/build-module/cover/overlay-color-settings.native.js.map +1 -1
- package/build-module/cover/save.js +12 -11
- package/build-module/cover/save.js.map +1 -1
- package/build-module/cover/shared.js +5 -6
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/cover/transforms.js +116 -146
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/cover/use-cover-is-dark.native.js +1 -5
- package/build-module/cover/use-cover-is-dark.native.js.map +1 -1
- package/build-module/details/edit.js +8 -10
- package/build-module/details/edit.js.map +1 -1
- package/build-module/details/index.js +2 -3
- package/build-module/details/index.js.map +1 -1
- package/build-module/details/init.js +6 -0
- package/build-module/details/init.js.map +1 -0
- package/build-module/details/save.js +5 -7
- package/build-module/details/save.js.map +1 -1
- package/build-module/embed/deprecated.js +16 -18
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/edit.js +10 -9
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +10 -7
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/embed-controls.js +22 -25
- package/build-module/embed/embed-controls.js.map +1 -1
- package/build-module/embed/embed-controls.native.js +9 -10
- package/build-module/embed/embed-controls.native.js.map +1 -1
- package/build-module/embed/embed-link-settings.native.js +9 -10
- package/build-module/embed/embed-link-settings.native.js.map +1 -1
- package/build-module/embed/embed-no-preview.native.js +8 -9
- package/build-module/embed/embed-no-preview.native.js.map +1 -1
- package/build-module/embed/embed-placeholder.js +10 -11
- package/build-module/embed/embed-placeholder.js.map +1 -1
- package/build-module/embed/embed-placeholder.native.js +11 -14
- package/build-module/embed/embed-placeholder.native.js.map +1 -1
- package/build-module/embed/embed-preview.native.js +16 -17
- package/build-module/embed/embed-preview.native.js.map +1 -1
- package/build-module/embed/index.js +1 -1
- package/build-module/embed/save.js +7 -7
- package/build-module/embed/save.js.map +1 -1
- package/build-module/embed/transforms.js +10 -18
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/embed/util.js +20 -51
- package/build-module/embed/util.js.map +1 -1
- package/build-module/embed/wp-embed-preview.js +18 -22
- package/build-module/embed/wp-embed-preview.js.map +1 -1
- package/build-module/embed/wp-embed-preview.native.js +8 -9
- package/build-module/embed/wp-embed-preview.native.js.map +1 -1
- package/build-module/file/deprecated.js +15 -15
- package/build-module/file/deprecated.js.map +1 -1
- package/build-module/file/edit.js +15 -18
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js +20 -25
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/index.js +1 -1
- package/build-module/file/inspector.js +12 -13
- package/build-module/file/inspector.js.map +1 -1
- package/build-module/file/save.js +5 -5
- package/build-module/file/save.js.map +1 -1
- package/build-module/file/transforms.js +9 -15
- package/build-module/file/transforms.js.map +1 -1
- package/build-module/footnotes/edit.js +48 -0
- package/build-module/footnotes/edit.js.map +1 -0
- package/build-module/footnotes/format.js +126 -0
- package/build-module/footnotes/format.js.map +1 -0
- package/build-module/footnotes/index.js +48 -0
- package/build-module/footnotes/index.js.map +1 -0
- package/build-module/freeform/convert-to-blocks-button.js +3 -4
- package/build-module/freeform/convert-to-blocks-button.js.map +1 -1
- package/build-module/freeform/edit.js +16 -16
- package/build-module/freeform/edit.js.map +1 -1
- package/build-module/freeform/edit.native.js +2 -3
- package/build-module/freeform/edit.native.js.map +1 -1
- package/build-module/freeform/index.js +2 -2
- package/build-module/freeform/modal.js +5 -5
- package/build-module/freeform/modal.js.map +1 -1
- package/build-module/freeform/save.js +3 -4
- package/build-module/freeform/save.js.map +1 -1
- package/build-module/gallery/deprecated.js +46 -58
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/edit-wrapper.js +4 -2
- package/build-module/gallery/edit-wrapper.js.map +1 -1
- package/build-module/gallery/edit.js +39 -63
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +2 -3
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gallery.native.js +3 -2
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/gap-styles.js +6 -7
- package/build-module/gallery/gap-styles.js.map +1 -1
- package/build-module/gallery/index.js +2 -2
- package/build-module/gallery/save.js +5 -6
- package/build-module/gallery/save.js.map +1 -1
- package/build-module/gallery/shared-icon.native.js +7 -8
- package/build-module/gallery/shared-icon.native.js.map +1 -1
- package/build-module/gallery/shared.js +4 -10
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/transforms.js +103 -142
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/use-get-media.native.js +8 -15
- package/build-module/gallery/use-get-media.native.js.map +1 -1
- package/build-module/gallery/use-get-new-images.js +2 -2
- package/build-module/gallery/use-get-new-images.js.map +1 -1
- package/build-module/gallery/use-image-sizes.js +11 -19
- package/build-module/gallery/use-image-sizes.js.map +1 -1
- package/build-module/gallery/utils.js +2 -2
- package/build-module/gallery/utils.js.map +1 -1
- package/build-module/gallery/v1/edit.js +38 -68
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/gallery/v1/gallery.js +10 -10
- package/build-module/gallery/v1/gallery.js.map +1 -1
- package/build-module/gallery/v1/save.js +8 -8
- package/build-module/gallery/v1/save.js.map +1 -1
- package/build-module/gallery/v1/shared.js +4 -10
- package/build-module/gallery/v1/shared.js.map +1 -1
- package/build-module/group/deprecated.js +25 -31
- package/build-module/group/deprecated.js.map +1 -1
- package/build-module/group/edit.js +18 -19
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/edit.native.js +14 -18
- package/build-module/group/edit.native.js.map +1 -1
- package/build-module/group/index.js +2 -2
- package/build-module/group/placeholder.js +18 -20
- package/build-module/group/placeholder.js.map +1 -1
- package/build-module/group/save.js +7 -7
- package/build-module/group/save.js.map +1 -1
- package/build-module/group/variations.js +5 -23
- package/build-module/group/variations.js.map +1 -1
- package/build-module/heading/deprecated.js +26 -32
- package/build-module/heading/deprecated.js.map +1 -1
- package/build-module/heading/edit.js +17 -18
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/heading/heading-level-icon.js +4 -5
- package/build-module/heading/heading-level-icon.js.map +1 -1
- package/build-module/heading/index.js +4 -5
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/save.js +7 -7
- package/build-module/heading/save.js.map +1 -1
- package/build-module/heading/transforms.js +21 -28
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/home-link/edit.js +12 -16
- package/build-module/home-link/edit.js.map +1 -1
- package/build-module/home-link/index.js +1 -2
- package/build-module/home-link/index.js.map +1 -1
- package/build-module/html/edit.js +9 -9
- package/build-module/html/edit.js.map +1 -1
- package/build-module/html/index.js +1 -1
- package/build-module/html/preview.js +5 -8
- package/build-module/html/preview.js.map +1 -1
- package/build-module/html/save.js +3 -4
- package/build-module/html/save.js.map +1 -1
- package/build-module/html/transforms.js +3 -4
- package/build-module/html/transforms.js.map +1 -1
- package/build-module/image/deprecated.js +29 -31
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.js +19 -27
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +48 -62
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +49 -60
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +7 -9
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/interactivity.js +140 -30
- package/build-module/image/interactivity.js.map +1 -1
- package/build-module/image/save.js +7 -7
- package/build-module/image/save.js.map +1 -1
- package/build-module/image/transforms.js +36 -46
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/image/use-client-width.js +1 -3
- package/build-module/image/use-client-width.js.map +1 -1
- package/build-module/image/utils.js +4 -7
- package/build-module/image/utils.js.map +1 -1
- package/build-module/index.js +21 -44
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +3 -6
- package/build-module/index.native.js.map +1 -1
- package/build-module/latest-comments/edit.js +7 -7
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-comments/index.js +1 -2
- package/build-module/latest-comments/index.js.map +1 -1
- package/build-module/latest-posts/deprecated.js +4 -8
- package/build-module/latest-posts/deprecated.js.map +1 -1
- package/build-module/latest-posts/edit.js +39 -41
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/latest-posts/edit.native.js +8 -9
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/latest-posts/index.js +1 -2
- package/build-module/latest-posts/index.js.map +1 -1
- package/build-module/list/deprecated.js +22 -25
- package/build-module/list/deprecated.js.map +1 -1
- package/build-module/list/edit.js +13 -15
- package/build-module/list/edit.js.map +1 -1
- package/build-module/list/index.js +1 -1
- package/build-module/list/ordered-list-settings.js +56 -35
- package/build-module/list/ordered-list-settings.js.map +1 -1
- package/build-module/list/save.js +9 -9
- package/build-module/list/save.js.map +1 -1
- package/build-module/list/tag-name.js +4 -4
- package/build-module/list/tag-name.js.map +1 -1
- package/build-module/list/tag-name.native.js +4 -4
- package/build-module/list/tag-name.native.js.map +1 -1
- package/build-module/list/transforms.js +11 -15
- package/build-module/list/transforms.js.map +1 -1
- package/build-module/list/utils.js +1 -1
- package/build-module/list/utils.js.map +1 -1
- package/build-module/list-item/edit.js +13 -18
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/edit.native.js +17 -24
- package/build-module/list-item/edit.native.js.map +1 -1
- package/build-module/list-item/hooks/use-enter.js +1 -3
- package/build-module/list-item/hooks/use-enter.js.map +1 -1
- package/build-module/list-item/hooks/use-enter.native.js +1 -3
- package/build-module/list-item/hooks/use-enter.native.js.map +1 -1
- package/build-module/list-item/hooks/use-indent-list-item.js +1 -3
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +2 -4
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/list-item/index.js +1 -1
- package/build-module/list-item/list-style-type.native.js +29 -34
- package/build-module/list-item/list-style-type.native.js.map +1 -1
- package/build-module/list-item/save.js +5 -5
- package/build-module/list-item/save.js.map +1 -1
- package/build-module/list-item/transforms.js +1 -4
- package/build-module/list-item/transforms.js.map +1 -1
- package/build-module/list-item/utils.js +4 -4
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/{private-apis.js → lock-unlock.js} +1 -1
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/loginout/edit.js +8 -8
- package/build-module/loginout/edit.js.map +1 -1
- package/build-module/loginout/index.js +1 -2
- package/build-module/loginout/index.js.map +1 -1
- package/build-module/media-text/deprecated.js +65 -64
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.js +31 -42
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/edit.native.js +9 -13
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/media-text/index.js +1 -1
- package/build-module/media-text/media-container.js +23 -24
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/media-text/media-container.native.js +12 -12
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/media-text/save.js +20 -17
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/media-text/transforms.js +73 -91
- package/build-module/media-text/transforms.js.map +1 -1
- package/build-module/missing/edit.js +13 -14
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/missing/edit.native.js +7 -8
- package/build-module/missing/edit.native.js.map +1 -1
- package/build-module/missing/index.js +4 -6
- package/build-module/missing/index.js.map +1 -1
- package/build-module/missing/save.js +3 -4
- package/build-module/missing/save.js.map +1 -1
- package/build-module/more/edit.js +13 -16
- package/build-module/more/edit.js.map +1 -1
- package/build-module/more/edit.native.js +3 -8
- package/build-module/more/edit.native.js.map +1 -1
- package/build-module/more/index.js +4 -6
- package/build-module/more/index.js.map +1 -1
- package/build-module/more/save.js +6 -7
- package/build-module/more/save.js.map +1 -1
- package/build-module/navigation/constants.js +6 -0
- package/build-module/navigation/constants.js.map +1 -1
- package/build-module/navigation/deprecated.js +17 -28
- package/build-module/navigation/deprecated.js.map +1 -1
- package/build-module/navigation/edit/are-blocks-dirty.js +1 -1
- package/build-module/navigation/edit/are-blocks-dirty.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +3 -4
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation/edit/index.js +68 -62
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +12 -15
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/leaf-more-menu.js +38 -43
- package/build-module/navigation/edit/leaf-more-menu.js.map +1 -1
- package/build-module/navigation/edit/manage-menus-button.js +5 -6
- package/build-module/navigation/edit/manage-menus-button.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +52 -52
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +3 -4
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +63 -61
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/overlay-menu-icon.js +3 -5
- package/build-module/navigation/edit/overlay-menu-icon.js.map +1 -1
- package/build-module/navigation/edit/overlay-menu-preview.js +5 -6
- package/build-module/navigation/edit/overlay-menu-preview.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +10 -11
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/edit/placeholder/placeholder-preview.js +3 -4
- package/build-module/navigation/edit/placeholder/placeholder-preview.js.map +1 -1
- package/build-module/navigation/edit/responsive-wrapper.js +20 -21
- package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +14 -20
- 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 +2 -3
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/edit/use-create-navigation-menu.js +3 -7
- package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build-module/navigation/edit/use-generate-default-navigation-title.js +1 -5
- package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build-module/navigation/edit/use-inner-blocks.js +1 -1
- package/build-module/navigation/edit/use-inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/use-navigation-notice.js +4 -5
- package/build-module/navigation/edit/use-navigation-notice.js.map +1 -1
- package/build-module/navigation/edit/utils.js +2 -4
- package/build-module/navigation/edit/utils.js.map +1 -1
- package/build-module/navigation/index.js +2 -3
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/interactivity.js +97 -87
- package/build-module/navigation/interactivity.js.map +1 -1
- package/build-module/navigation/menu-items-to-blocks.js +25 -34
- package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
- package/build-module/navigation/save.js +3 -5
- package/build-module/navigation/save.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js +2 -2
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +9 -8
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation/use-template-part-area-label.js +3 -5
- package/build-module/navigation/use-template-part-area-label.js.map +1 -1
- package/build-module/navigation/view-modal.js +2 -4
- package/build-module/navigation/view-modal.js.map +1 -1
- package/build-module/navigation/view.js +1 -1
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +19 -24
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/hooks.js +2 -2
- package/build-module/navigation-link/hooks.js.map +1 -1
- package/build-module/navigation-link/index.js +11 -16
- package/build-module/navigation-link/index.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +10 -9
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/navigation-link/update-attributes.js +1 -4
- package/build-module/navigation-link/update-attributes.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +17 -18
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/index.js +7 -12
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/navigation-submenu/transforms.js +6 -30
- package/build-module/navigation-submenu/transforms.js.map +1 -1
- package/build-module/nextpage/edit.js +2 -1
- package/build-module/nextpage/edit.js.map +1 -1
- package/build-module/nextpage/edit.native.js +8 -9
- package/build-module/nextpage/edit.native.js.map +1 -1
- package/build-module/nextpage/index.js +1 -1
- package/build-module/page-list/convert-to-links-modal.js +5 -6
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +35 -41
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list/index.js +1 -2
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/page-list/use-convert-to-navigation-links.js +16 -21
- package/build-module/page-list/use-convert-to-navigation-links.js.map +1 -1
- package/build-module/page-list-item/edit.js +7 -7
- package/build-module/page-list-item/edit.js.map +1 -1
- package/build-module/page-list-item/index.js +4 -7
- package/build-module/page-list-item/index.js.map +1 -1
- package/build-module/paragraph/deprecated.js +23 -28
- package/build-module/paragraph/deprecated.js.map +1 -1
- package/build-module/paragraph/edit.js +16 -19
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/edit.native.js +13 -16
- package/build-module/paragraph/edit.native.js.map +1 -1
- package/build-module/paragraph/index.js +4 -6
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/save.js +8 -8
- package/build-module/paragraph/save.js.map +1 -1
- package/build-module/paragraph/transforms.js +10 -13
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/pattern/edit.js +12 -40
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/pattern/index.js +5 -14
- package/build-module/pattern/index.js.map +1 -1
- package/build-module/post-author/edit.js +22 -24
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author/index.js +1 -2
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-author-biography/edit.js +14 -18
- package/build-module/post-author-biography/edit.js.map +1 -1
- package/build-module/post-author-biography/index.js +1 -2
- package/build-module/post-author-biography/index.js.map +1 -1
- package/build-module/post-author-name/edit.js +16 -18
- package/build-module/post-author-name/edit.js.map +1 -1
- package/build-module/post-author-name/index.js +1 -2
- package/build-module/post-author-name/index.js.map +1 -1
- package/build-module/post-author-name/transforms.js +10 -16
- package/build-module/post-author-name/transforms.js.map +1 -1
- package/build-module/post-comment/edit.js +10 -9
- package/build-module/post-comment/edit.js.map +1 -1
- package/build-module/post-comment/index.js +1 -1
- package/build-module/post-comment/save.js +2 -1
- package/build-module/post-comment/save.js.map +1 -1
- package/build-module/post-comments-count/edit.js +8 -12
- package/build-module/post-comments-count/edit.js.map +1 -1
- package/build-module/post-comments-count/index.js +1 -2
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-form/edit.js +7 -7
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +5 -10
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-comments-form/index.js +1 -2
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-comments-link/edit.js +7 -7
- package/build-module/post-comments-link/edit.js.map +1 -1
- package/build-module/post-comments-link/index.js +1 -2
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-content/edit.js +37 -30
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-content/index.js +2 -3
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-date/deprecated.js +4 -7
- package/build-module/post-date/deprecated.js.map +1 -1
- package/build-module/post-date/edit.js +29 -34
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/index.js +1 -2
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-excerpt/edit.js +25 -25
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-excerpt/index.js +3 -4
- package/build-module/post-excerpt/index.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +12 -13
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +31 -39
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +1 -2
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-featured-image/overlay.js +11 -12
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/post-navigation-link/edit.js +13 -13
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/post-navigation-link/index.js +1 -2
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-template/edit.js +109 -90
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-template/index.js +10 -5
- package/build-module/post-template/index.js.map +1 -1
- package/build-module/post-terms/edit.js +13 -22
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/hooks.js +9 -5
- package/build-module/post-terms/hooks.js.map +1 -1
- package/build-module/post-terms/index.js +1 -2
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-terms/use-post-terms.js +7 -12
- package/build-module/post-terms/use-post-terms.js.map +1 -1
- package/build-module/post-time-to-read/edit.js +7 -7
- package/build-module/post-time-to-read/edit.js.map +1 -1
- package/build-module/post-time-to-read/index.js +1 -1
- package/build-module/post-time-to-read/init.js +6 -0
- package/build-module/post-time-to-read/init.js.map +1 -0
- package/build-module/post-title/deprecated.js +4 -7
- package/build-module/post-title/deprecated.js.map +1 -1
- package/build-module/post-title/edit.js +38 -32
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/post-title/index.js +2 -3
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/preformatted/edit.js +11 -13
- package/build-module/preformatted/edit.js.map +1 -1
- package/build-module/preformatted/edit.native.js +7 -8
- package/build-module/preformatted/edit.native.js.map +1 -1
- package/build-module/preformatted/index.js +1 -1
- package/build-module/preformatted/save.js +5 -5
- package/build-module/preformatted/save.js.map +1 -1
- package/build-module/preformatted/transforms.js +14 -20
- package/build-module/preformatted/transforms.js.map +1 -1
- package/build-module/pullquote/deprecated.js +71 -81
- package/build-module/pullquote/deprecated.js.map +1 -1
- package/build-module/pullquote/edit.js +8 -8
- package/build-module/pullquote/edit.js.map +1 -1
- package/build-module/pullquote/edit.native.js +15 -22
- package/build-module/pullquote/edit.native.js.map +1 -1
- package/build-module/pullquote/figure.native.js +5 -6
- package/build-module/pullquote/figure.native.js.map +1 -1
- package/build-module/pullquote/index.js +1 -1
- package/build-module/pullquote/save.js +8 -8
- package/build-module/pullquote/save.js.map +1 -1
- package/build-module/pullquote/transforms.js +17 -24
- package/build-module/pullquote/transforms.js.map +1 -1
- package/build-module/query/deprecated.js +208 -83
- package/build-module/query/deprecated.js.map +1 -1
- package/build-module/query/edit/index.js +2 -3
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +5 -8
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/create-new-post-link.js +6 -7
- package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +7 -8
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/order-control.js +5 -6
- package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +10 -13
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/sticky-control.js +4 -5
- package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +15 -19
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/edit/pattern-selection-modal.js +5 -6
- package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
- package/build-module/query/edit/query-content.js +26 -15
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +20 -22
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +18 -42
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/query/index.js +2 -9
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/save.js +7 -7
- package/build-module/query/save.js.map +1 -1
- package/build-module/query/utils.js +25 -62
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-no-results/edit.js +2 -1
- package/build-module/query-no-results/edit.js.map +1 -1
- package/build-module/query-no-results/index.js +1 -2
- package/build-module/query-no-results/index.js.map +1 -1
- package/build-module/query-pagination/deprecated.js +2 -1
- package/build-module/query-pagination/deprecated.js.map +1 -1
- package/build-module/query-pagination/edit.js +30 -12
- package/build-module/query-pagination/edit.js.map +1 -1
- package/build-module/query-pagination/index.js +8 -4
- package/build-module/query-pagination/index.js.map +1 -1
- package/build-module/query-pagination/query-pagination-arrow-controls.js +4 -5
- package/build-module/query-pagination/query-pagination-arrow-controls.js.map +1 -1
- package/build-module/query-pagination/query-pagination-label-control.js +20 -0
- package/build-module/query-pagination/query-pagination-label-control.js.map +1 -0
- package/build-module/query-pagination-next/edit.js +14 -14
- package/build-module/query-pagination-next/edit.js.map +1 -1
- package/build-module/query-pagination-next/index.js +2 -3
- package/build-module/query-pagination-next/index.js.map +1 -1
- package/build-module/query-pagination-numbers/edit.js +5 -8
- package/build-module/query-pagination-numbers/edit.js.map +1 -1
- package/build-module/query-pagination-numbers/index.js +1 -2
- package/build-module/query-pagination-numbers/index.js.map +1 -1
- package/build-module/query-pagination-previous/edit.js +15 -15
- package/build-module/query-pagination-previous/edit.js.map +1 -1
- package/build-module/query-pagination-previous/index.js +2 -3
- package/build-module/query-pagination-previous/index.js.map +1 -1
- package/build-module/query-title/deprecated.js +4 -7
- package/build-module/query-title/deprecated.js.map +1 -1
- package/build-module/query-title/edit.js +18 -21
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/query-title/index.js +1 -2
- package/build-module/query-title/index.js.map +1 -1
- package/build-module/quote/deprecated.js +21 -27
- package/build-module/quote/deprecated.js.map +1 -1
- package/build-module/quote/edit.js +15 -15
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/quote/index.js +1 -1
- package/build-module/quote/save.js +7 -7
- package/build-module/quote/save.js.map +1 -1
- package/build-module/quote/transforms.js +37 -57
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/read-more/edit.js +12 -13
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/read-more/index.js +1 -2
- package/build-module/read-more/index.js.map +1 -1
- package/build-module/rss/edit.js +8 -7
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/rss/index.js +1 -2
- package/build-module/rss/index.js.map +1 -1
- package/build-module/search/edit.js +77 -34
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js +34 -44
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/search/index.js +9 -2
- package/build-module/search/index.js.map +1 -1
- package/build-module/search/view.js +65 -0
- package/build-module/search/view.js.map +1 -0
- package/build-module/separator/deprecated.js +8 -8
- package/build-module/separator/deprecated.js.map +1 -1
- package/build-module/separator/edit.js +11 -13
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/separator/index.js +1 -1
- package/build-module/separator/save.js +10 -12
- package/build-module/separator/save.js.map +1 -1
- package/build-module/shortcode/edit.js +8 -8
- package/build-module/shortcode/edit.js.map +1 -1
- package/build-module/shortcode/index.js +2 -2
- package/build-module/shortcode/save.js +3 -4
- package/build-module/shortcode/save.js.map +1 -1
- package/build-module/shortcode/transforms.js +3 -4
- package/build-module/shortcode/transforms.js.map +1 -1
- package/build-module/site-logo/edit.js +68 -83
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +1 -2
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-logo/transforms.js +4 -5
- package/build-module/site-logo/transforms.js.map +1 -1
- package/build-module/site-tagline/deprecated.js +4 -7
- package/build-module/site-tagline/deprecated.js.map +1 -1
- package/build-module/site-tagline/edit.js +11 -11
- package/build-module/site-tagline/edit.js.map +1 -1
- package/build-module/site-tagline/icon.js +0 -3
- package/build-module/site-tagline/icon.js.map +1 -1
- package/build-module/site-tagline/index.js +1 -2
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/site-title/deprecated.js +4 -7
- package/build-module/site-title/deprecated.js.map +1 -1
- package/build-module/site-title/edit/index.js +15 -17
- package/build-module/site-title/edit/index.js.map +1 -1
- package/build-module/site-title/index.js +1 -2
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/site-title/transforms.js +4 -5
- package/build-module/site-title/transforms.js.map +1 -1
- package/build-module/social-link/edit.js +21 -18
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/edit.native.js +11 -13
- package/build-module/social-link/edit.native.js.map +1 -1
- package/build-module/social-link/index.js +2 -3
- package/build-module/social-link/index.js.map +1 -1
- package/build-module/social-links/deprecated.js +7 -8
- package/build-module/social-links/deprecated.js.map +1 -1
- package/build-module/social-links/edit.js +39 -44
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/social-links/edit.native.js +18 -25
- package/build-module/social-links/edit.native.js.map +1 -1
- package/build-module/social-links/index.js +4 -2
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/social-links/save.js +2 -1
- package/build-module/social-links/save.js.map +1 -1
- package/build-module/spacer/controls.js +18 -21
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +7 -8
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/deprecated.js +11 -11
- package/build-module/spacer/deprecated.js.map +1 -1
- package/build-module/spacer/edit.js +30 -32
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/spacer/edit.native.js +11 -12
- package/build-module/spacer/edit.native.js.map +1 -1
- package/build-module/spacer/index.js +1 -1
- package/build-module/spacer/save.js +23 -14
- package/build-module/spacer/save.js.map +1 -1
- package/build-module/spacer/save.native.js +14 -14
- package/build-module/spacer/save.native.js.map +1 -1
- package/build-module/table/deprecated.js +83 -104
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/table/edit.js +51 -63
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/index.js +1 -1
- package/build-module/table/save.js +35 -41
- package/build-module/table/save.js.map +1 -1
- package/build-module/table/state.js +32 -59
- package/build-module/table/state.js.map +1 -1
- package/build-module/table/transforms.js +17 -20
- package/build-module/table/transforms.js.map +1 -1
- package/build-module/table-of-contents/edit.js +13 -12
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/index.js +1 -1
- package/build-module/table-of-contents/list.js +3 -4
- package/build-module/table-of-contents/list.js.map +1 -1
- package/build-module/table-of-contents/save.js +7 -8
- package/build-module/table-of-contents/save.js.map +1 -1
- package/build-module/table-of-contents/utils.js +1 -3
- package/build-module/table-of-contents/utils.js.map +1 -1
- package/build-module/tag-cloud/edit.js +8 -9
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/tag-cloud/index.js +1 -2
- package/build-module/tag-cloud/index.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +15 -19
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/import-controls.js +7 -11
- package/build-module/template-part/edit/import-controls.js.map +1 -1
- package/build-module/template-part/edit/index.js +15 -12
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/inner-blocks.js +11 -13
- package/build-module/template-part/edit/inner-blocks.js.map +1 -1
- package/build-module/template-part/edit/placeholder.js +7 -8
- package/build-module/template-part/edit/placeholder.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +8 -11
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/template-part/edit/title-modal.js +5 -6
- package/build-module/template-part/edit/title-modal.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +4 -6
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/template-part/edit/utils/transformers.js +3 -6
- package/build-module/template-part/edit/utils/transformers.js.map +1 -1
- package/build-module/template-part/index.js +11 -20
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/template-part/variations.js +2 -2
- package/build-module/template-part/variations.js.map +1 -1
- package/build-module/term-description/edit.js +7 -7
- package/build-module/term-description/edit.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/text-columns/edit.js +9 -11
- package/build-module/text-columns/edit.js.map +1 -1
- package/build-module/text-columns/index.js +1 -1
- package/build-module/text-columns/save.js +14 -18
- package/build-module/text-columns/save.js.map +1 -1
- package/build-module/text-columns/transforms.js +14 -20
- package/build-module/text-columns/transforms.js.map +1 -1
- package/build-module/utils/init-block.native.js +1 -3
- package/build-module/utils/init-block.native.js.map +1 -1
- package/build-module/utils/interactivity/constants.js +1 -1
- package/build-module/utils/interactivity/constants.js.map +1 -1
- package/build-module/utils/interactivity/directives.js +74 -85
- package/build-module/utils/interactivity/directives.js.map +1 -1
- package/build-module/utils/interactivity/hooks.js +29 -46
- package/build-module/utils/interactivity/hooks.js.map +1 -1
- package/build-module/utils/interactivity/hydration.js +1 -1
- package/build-module/utils/interactivity/hydration.js.map +1 -1
- package/build-module/utils/interactivity/index.js +1 -3
- package/build-module/utils/interactivity/index.js.map +1 -1
- package/build-module/utils/interactivity/store.js +4 -5
- package/build-module/utils/interactivity/store.js.map +1 -1
- package/build-module/utils/interactivity/vdom.js +14 -4
- package/build-module/utils/interactivity/vdom.js.map +1 -1
- package/build-module/utils/migrate-font-family.js +2 -4
- package/build-module/utils/migrate-font-family.js.map +1 -1
- package/build-module/utils/search-patterns.js +5 -19
- package/build-module/utils/search-patterns.js.map +1 -1
- package/build-module/utils/transformation-categories.native.js +1 -4
- package/build-module/utils/transformation-categories.native.js.map +1 -1
- package/build-module/verse/deprecated.js +14 -18
- package/build-module/verse/deprecated.js.map +1 -1
- package/build-module/verse/edit.js +11 -13
- package/build-module/verse/edit.js.map +1 -1
- package/build-module/verse/index.js +1 -1
- package/build-module/verse/save.js +7 -7
- package/build-module/verse/save.js.map +1 -1
- package/build-module/video/deprecated.js +6 -6
- package/build-module/video/deprecated.js.map +1 -1
- package/build-module/video/edit-common-settings.js +4 -5
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-module/video/edit.js +22 -29
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +26 -31
- package/build-module/video/edit.native.js.map +1 -1
- package/build-module/video/index.js +1 -1
- package/build-module/video/save.js +5 -5
- package/build-module/video/save.js.map +1 -1
- package/build-module/video/tracks-editor.js +39 -51
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-module/video/tracks.js +7 -8
- package/build-module/video/tracks.js.map +1 -1
- package/build-module/video/transforms.js +30 -35
- package/build-module/video/transforms.js.map +1 -1
- package/build-style/avatar/style-rtl.css +1 -0
- package/build-style/avatar/style.css +1 -0
- package/build-style/editor-rtl.css +0 -17
- package/build-style/editor.css +0 -17
- package/build-style/footnotes/style-rtl.css +106 -0
- package/build-style/footnotes/style.css +106 -0
- package/build-style/image/style-rtl.css +87 -17
- package/build-style/image/style.css +87 -17
- package/build-style/navigation/editor-rtl.css +0 -17
- package/build-style/navigation/editor.css +0 -17
- package/build-style/post-template/style-rtl.css +6 -0
- package/build-style/post-template/style.css +6 -0
- package/build-style/search/style-rtl.css +30 -0
- package/build-style/search/style.css +30 -0
- package/build-style/social-links/style-rtl.css +4 -0
- package/build-style/social-links/style.css +4 -0
- package/build-style/style-rtl.css +156 -18
- package/build-style/style.css +156 -18
- package/build-style/term-description/style-rtl.css +97 -0
- package/build-style/term-description/style.css +97 -0
- package/package.json +33 -32
- package/src/archives/block.json +1 -2
- package/src/audio/block.json +1 -1
- package/src/avatar/block.json +1 -2
- package/src/avatar/style.scss +1 -0
- package/src/block/block.json +2 -2
- package/src/block/edit.js +1 -0
- package/src/block/test/__snapshots__/transforms.native.js.snap +2 -2
- package/src/block/test/edit.native.js +5 -7
- package/src/block/test/transforms.native.js +1 -1
- package/src/button/block.json +1 -1
- package/src/buttons/block.json +2 -2
- package/src/buttons/edit.native.js +7 -6
- package/src/buttons/test/__snapshots__/edit.native.js.snap +6 -0
- package/src/buttons/test/edit.native.js +30 -2
- package/src/calendar/block.json +1 -2
- package/src/categories/block.json +1 -2
- package/src/code/block.json +1 -1
- package/src/column/block.json +2 -2
- package/src/columns/block.json +2 -2
- package/src/columns/test/__snapshots__/edit.native.js.snap +72 -0
- package/src/columns/test/edit.native.js +61 -32
- package/src/comment-author-avatar/block.json +1 -2
- package/src/comment-author-name/block.json +1 -2
- package/src/comment-content/block.json +1 -2
- package/src/comment-date/block.json +1 -2
- package/src/comment-edit-link/block.json +1 -2
- package/src/comment-reply-link/block.json +1 -2
- package/src/comment-template/block.json +1 -2
- package/src/comment-template/index.php +13 -1
- package/src/comments/block.json +1 -2
- package/src/comments/deprecated.js +1 -1
- package/src/comments-pagination/block.json +2 -3
- package/src/comments-pagination-next/block.json +1 -2
- package/src/comments-pagination-next/index.php +1 -1
- package/src/comments-pagination-numbers/block.json +1 -2
- package/src/comments-pagination-previous/block.json +1 -2
- package/src/comments-pagination-previous/index.php +1 -1
- package/src/comments-title/block.json +1 -1
- package/src/comments-title/edit.js +2 -6
- package/src/cover/block.json +2 -2
- package/src/cover/edit/resizable-cover-popover.js +1 -1
- package/src/cover/test/edit.native.js +45 -31
- package/src/cover/transforms.js +1 -1
- package/src/details/block.json +2 -3
- package/src/details/edit.js +12 -9
- package/src/details/init.js +6 -0
- package/src/embed/block.json +1 -1
- package/src/embed/test/index.native.js +38 -44
- package/src/file/block.json +1 -1
- package/src/file/index.php +47 -7
- package/src/footnotes/block.json +18 -0
- package/src/footnotes/edit.js +52 -0
- package/src/footnotes/format.js +112 -0
- package/src/footnotes/index.js +29 -0
- package/src/footnotes/index.php +78 -0
- package/src/footnotes/style.scss +18 -0
- package/src/freeform/block.json +2 -2
- package/src/gallery/block.json +2 -2
- package/src/gallery/edit.js +4 -1
- package/src/gallery/gallery.native.js +1 -1
- package/src/gallery/test/__snapshots__/index.native.js.snap +6 -0
- package/src/gallery/test/index.native.js +23 -1
- package/src/gallery/v1/save.js +1 -1
- package/src/group/block.json +2 -2
- package/src/group/deprecated.js +1 -1
- package/src/group/test/edit.native.js +2 -4
- package/src/heading/block.json +1 -1
- package/src/heading/edit.js +2 -2
- package/src/home-link/block.json +1 -2
- package/src/html/block.json +1 -1
- package/src/image/block.json +4 -4
- package/src/image/edit.js +1 -1
- package/src/image/image.js +23 -11
- package/src/image/index.php +0 -72
- package/src/image/interactivity.js +160 -13
- package/src/image/style.scss +97 -15
- package/src/image/test/edit.native.js +3 -13
- package/src/index.js +3 -3
- package/src/latest-comments/block.json +1 -2
- package/src/latest-posts/block.json +1 -2
- package/src/latest-posts/edit.js +17 -9
- package/src/latest-posts/index.php +8 -0
- package/src/list/block.json +1 -1
- package/src/list/ordered-list-settings.js +20 -2
- package/src/list/test/edit.native.js +5 -0
- package/src/list-item/block.json +1 -1
- package/src/loginout/block.json +1 -2
- package/src/media-text/block.json +1 -1
- package/src/media-text/edit.js +1 -1
- package/src/missing/block.json +1 -1
- package/src/more/block.json +1 -1
- package/src/more/edit.native.js +8 -15
- package/src/navigation/block.json +2 -3
- package/src/navigation/constants.js +11 -0
- package/src/navigation/deprecated.js +1 -1
- package/src/navigation/edit/index.js +15 -6
- package/src/navigation/edit/leaf-more-menu.js +1 -2
- package/src/navigation/edit/menu-inspector-controls.js +67 -76
- package/src/navigation/edit/navigation-menu-selector.js +17 -7
- package/src/navigation/edit/unsaved-inner-blocks.js +6 -6
- package/src/navigation/editor.scss +0 -22
- package/src/navigation/index.php +183 -32
- package/src/navigation/interactivity.js +75 -57
- package/src/navigation/test/use-navigation-menu.js +15 -3
- package/src/navigation/use-navigation-menu.js +11 -8
- package/src/navigation-link/block.json +1 -1
- package/src/navigation-link/edit.js +1 -9
- package/src/navigation-link/hooks.js +2 -2
- package/src/navigation-link/link-ui.js +12 -6
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +2 -2
- package/src/navigation-submenu/block.json +1 -1
- package/src/nextpage/block.json +1 -1
- package/src/nextpage/edit.native.js +2 -2
- package/src/page-list/block.json +1 -2
- package/src/page-list-item/block.json +1 -1
- package/src/page-list-item/index.php +14 -0
- package/src/paragraph/block.json +1 -1
- package/src/paragraph/test/__snapshots__/edit.native.js.snap +39 -0
- package/src/paragraph/test/edit.native.js +3 -3
- package/src/pattern/block.json +2 -6
- package/src/pattern/edit.js +14 -40
- package/src/pattern/index.js +4 -5
- package/src/pattern/index.php +1 -13
- package/src/post-author/block.json +1 -2
- package/src/post-author/edit.js +3 -3
- package/src/post-author-biography/block.json +1 -2
- package/src/post-author-name/block.json +1 -2
- package/src/post-comment/block.json +1 -1
- package/src/post-comments-count/block.json +1 -2
- package/src/post-comments-form/block.json +1 -2
- package/src/post-comments-link/block.json +1 -2
- package/src/post-content/block.json +2 -3
- package/src/post-content/edit.js +22 -2
- package/src/post-date/block.json +1 -2
- package/src/post-excerpt/block.json +3 -4
- package/src/post-excerpt/edit.js +5 -14
- package/src/post-excerpt/index.php +2 -2
- package/src/post-featured-image/block.json +1 -2
- package/src/post-navigation-link/block.json +1 -2
- package/src/post-template/block.json +10 -5
- package/src/post-template/edit.js +67 -30
- package/src/post-template/index.php +15 -9
- package/src/post-template/style.scss +8 -1
- package/src/post-terms/block.json +1 -2
- package/src/post-terms/edit.js +8 -7
- package/src/post-terms/hooks.js +3 -3
- package/src/post-time-to-read/block.json +1 -1
- package/src/post-time-to-read/init.js +6 -0
- package/src/post-title/block.json +2 -3
- package/src/post-title/edit.js +24 -19
- package/src/post-title/index.php +1 -1
- package/src/preformatted/block.json +1 -1
- package/src/preformatted/test/edit.native.js +1 -13
- package/src/pullquote/block.json +1 -1
- package/src/query/block.json +2 -9
- package/src/query/deprecated.js +173 -26
- package/src/query/edit/inspector-controls/index.js +5 -3
- package/src/query/edit/query-content.js +13 -5
- package/src/query/edit/query-toolbar.js +3 -22
- package/src/query-no-results/block.json +1 -2
- package/src/query-pagination/block.json +8 -4
- package/src/query-pagination/edit.js +18 -2
- package/src/query-pagination/query-pagination-label-control.js +19 -0
- package/src/query-pagination-next/block.json +2 -3
- package/src/query-pagination-next/edit.js +13 -11
- package/src/query-pagination-next/index.php +7 -2
- package/src/query-pagination-numbers/block.json +1 -2
- package/src/query-pagination-previous/block.json +2 -3
- package/src/query-pagination-previous/edit.js +13 -11
- package/src/query-pagination-previous/index.php +7 -2
- package/src/query-title/block.json +1 -2
- package/src/query-title/edit.js +2 -6
- package/src/quote/block.json +1 -1
- package/src/read-more/block.json +1 -2
- package/src/rss/block.json +1 -2
- package/src/search/block.json +9 -2
- package/src/search/edit.js +63 -5
- package/src/search/index.php +50 -51
- package/src/search/style.scss +39 -0
- package/src/search/view.js +68 -0
- package/src/separator/block.json +1 -1
- package/src/shortcode/block.json +2 -2
- package/src/site-logo/block.json +1 -2
- package/src/site-logo/index.php +1 -1
- package/src/site-tagline/block.json +1 -2
- package/src/site-tagline/icon.js +0 -1
- package/src/site-title/block.json +1 -2
- package/src/site-title/edit/index.js +5 -6
- package/src/social-link/block.json +3 -2
- package/src/social-link/edit.js +10 -1
- package/src/social-link/index.php +22 -1
- package/src/social-links/block.json +4 -2
- package/src/social-links/style.scss +10 -0
- package/src/spacer/block.json +1 -1
- package/src/spacer/controls.js +1 -0
- package/src/spacer/save.js +7 -2
- package/src/spacer/test/index.native.js +33 -29
- package/src/style.scss +2 -0
- package/src/table/block.json +1 -1
- package/src/table-of-contents/block.json +1 -1
- package/src/tag-cloud/block.json +1 -2
- package/src/template-part/block.json +1 -2
- package/src/template-part/edit/inner-blocks.js +1 -1
- package/src/template-part/index.php +18 -11
- package/src/term-description/block.json +1 -2
- package/src/term-description/style.scss +11 -0
- package/src/text-columns/block.json +1 -1
- package/src/utils/interactivity/constants.js +1 -1
- package/src/utils/interactivity/directives.js +5 -5
- package/src/utils/interactivity/hydration.js +1 -1
- package/src/utils/interactivity/index.js +0 -2
- package/src/utils/interactivity/vdom.js +21 -4
- package/src/utils/migrate-font-family.js +1 -1
- package/src/verse/block.json +1 -1
- package/src/video/block.json +1 -1
- package/build/heading/heading-level-dropdown.js +0 -82
- package/build/heading/heading-level-dropdown.js.map +0 -1
- package/build/heading/heading-level-dropdown.native.js +0 -74
- package/build/heading/heading-level-dropdown.native.js.map +0 -1
- package/build/pattern/v1/edit.js +0 -57
- package/build/pattern/v1/edit.js.map +0 -1
- package/build/private-apis.js.map +0 -1
- package/build/site-title/edit/level-icon.js +0 -41
- package/build/site-title/edit/level-icon.js.map +0 -1
- package/build/site-title/edit/level-toolbar.js +0 -52
- package/build/site-title/edit/level-toolbar.js.map +0 -1
- package/build-module/heading/heading-level-dropdown.js +0 -70
- package/build-module/heading/heading-level-dropdown.js.map +0 -1
- package/build-module/heading/heading-level-dropdown.native.js +0 -62
- package/build-module/heading/heading-level-dropdown.native.js.map +0 -1
- package/build-module/pattern/v1/edit.js +0 -48
- package/build-module/pattern/v1/edit.js.map +0 -1
- package/build-module/private-apis.js.map +0 -1
- package/build-module/site-title/edit/level-icon.js +0 -32
- package/build-module/site-title/edit/level-icon.js.map +0 -1
- package/build-module/site-title/edit/level-toolbar.js +0 -40
- package/build-module/site-title/edit/level-toolbar.js.map +0 -1
- package/src/heading/heading-level-dropdown.js +0 -69
- package/src/heading/heading-level-dropdown.native.js +0 -63
- package/src/pattern/v1/edit.js +0 -57
- package/src/site-title/edit/level-icon.js +0 -28
- package/src/site-title/edit/level-toolbar.js +0 -34
- /package/src/{private-apis.js → lock-unlock.js} +0 -0
package/build/table/state.js
CHANGED
|
@@ -26,11 +26,10 @@ const INHERITED_COLUMN_ATTRIBUTES = ['align'];
|
|
|
26
26
|
* @return {Object} New table state.
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
function createTable(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} = _ref;
|
|
29
|
+
function createTable({
|
|
30
|
+
rowCount,
|
|
31
|
+
columnCount
|
|
32
|
+
}) {
|
|
34
33
|
return {
|
|
35
34
|
body: Array.from({
|
|
36
35
|
length: rowCount
|
|
@@ -78,14 +77,12 @@ function getFirstRow(state) {
|
|
|
78
77
|
|
|
79
78
|
|
|
80
79
|
function getCellAttribute(state, cellLocation, attributeName) {
|
|
81
|
-
var _state$sectionName, _state$sectionName$ro, _state$sectionName$ro2, _state$sectionName$ro3;
|
|
82
|
-
|
|
83
80
|
const {
|
|
84
81
|
sectionName,
|
|
85
82
|
rowIndex,
|
|
86
83
|
columnIndex
|
|
87
84
|
} = cellLocation;
|
|
88
|
-
return
|
|
85
|
+
return state[sectionName]?.[rowIndex]?.cells?.[columnIndex]?.[attributeName];
|
|
89
86
|
}
|
|
90
87
|
/**
|
|
91
88
|
* Returns updated cell attributes after applying the `updateCell` function to the selection.
|
|
@@ -103,17 +100,12 @@ function updateSelectedCell(state, selection, updateCell) {
|
|
|
103
100
|
return state;
|
|
104
101
|
}
|
|
105
102
|
|
|
106
|
-
const tableSections = Object.fromEntries(Object.entries(state).filter(
|
|
107
|
-
let [key] = _ref2;
|
|
108
|
-
return ['head', 'body', 'foot'].includes(key);
|
|
109
|
-
}));
|
|
103
|
+
const tableSections = Object.fromEntries(Object.entries(state).filter(([key]) => ['head', 'body', 'foot'].includes(key)));
|
|
110
104
|
const {
|
|
111
105
|
sectionName: selectionSectionName,
|
|
112
106
|
rowIndex: selectionRowIndex
|
|
113
107
|
} = selection;
|
|
114
|
-
return Object.fromEntries(Object.entries(tableSections).map(
|
|
115
|
-
let [sectionName, section] = _ref3;
|
|
116
|
-
|
|
108
|
+
return Object.fromEntries(Object.entries(tableSections).map(([sectionName, section]) => {
|
|
117
109
|
if (selectionSectionName && selectionSectionName !== sectionName) {
|
|
118
110
|
return [sectionName, section];
|
|
119
111
|
}
|
|
@@ -177,16 +169,13 @@ function isCellSelected(cellLocation, selection) {
|
|
|
177
169
|
*/
|
|
178
170
|
|
|
179
171
|
|
|
180
|
-
function insertRow(state,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
rowIndex,
|
|
186
|
-
columnCount
|
|
187
|
-
} = _ref4;
|
|
172
|
+
function insertRow(state, {
|
|
173
|
+
sectionName,
|
|
174
|
+
rowIndex,
|
|
175
|
+
columnCount
|
|
176
|
+
}) {
|
|
188
177
|
const firstRow = getFirstRow(state);
|
|
189
|
-
const cellCount = columnCount === undefined ? firstRow
|
|
178
|
+
const cellCount = columnCount === undefined ? firstRow?.cells?.length : columnCount; // Bail early if the function cannot determine how many cells to add.
|
|
190
179
|
|
|
191
180
|
if (!cellCount) {
|
|
192
181
|
return state;
|
|
@@ -197,13 +186,10 @@ function insertRow(state, _ref4) {
|
|
|
197
186
|
cells: Array.from({
|
|
198
187
|
length: cellCount
|
|
199
188
|
}).map((_, index) => {
|
|
200
|
-
var _firstRow$cells$index
|
|
189
|
+
var _firstRow$cells$index;
|
|
201
190
|
|
|
202
|
-
const firstCellInColumn = (_firstRow$cells$index = firstRow
|
|
203
|
-
const inheritedAttributes = Object.fromEntries(Object.entries(firstCellInColumn).filter(
|
|
204
|
-
let [key] = _ref5;
|
|
205
|
-
return INHERITED_COLUMN_ATTRIBUTES.includes(key);
|
|
206
|
-
}));
|
|
191
|
+
const firstCellInColumn = (_firstRow$cells$index = firstRow?.cells?.[index]) !== null && _firstRow$cells$index !== void 0 ? _firstRow$cells$index : {};
|
|
192
|
+
const inheritedAttributes = Object.fromEntries(Object.entries(firstCellInColumn).filter(([key]) => INHERITED_COLUMN_ATTRIBUTES.includes(key)));
|
|
207
193
|
return { ...inheritedAttributes,
|
|
208
194
|
content: '',
|
|
209
195
|
tag: sectionName === 'head' ? 'th' : 'td'
|
|
@@ -224,11 +210,10 @@ function insertRow(state, _ref4) {
|
|
|
224
210
|
*/
|
|
225
211
|
|
|
226
212
|
|
|
227
|
-
function deleteRow(state,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
} = _ref6;
|
|
213
|
+
function deleteRow(state, {
|
|
214
|
+
sectionName,
|
|
215
|
+
rowIndex
|
|
216
|
+
}) {
|
|
232
217
|
return {
|
|
233
218
|
[sectionName]: state[sectionName].filter((row, index) => index !== rowIndex)
|
|
234
219
|
};
|
|
@@ -244,17 +229,11 @@ function deleteRow(state, _ref6) {
|
|
|
244
229
|
*/
|
|
245
230
|
|
|
246
231
|
|
|
247
|
-
function insertColumn(state,
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
let [key] = _ref8;
|
|
253
|
-
return ['head', 'body', 'foot'].includes(key);
|
|
254
|
-
}));
|
|
255
|
-
return Object.fromEntries(Object.entries(tableSections).map(_ref9 => {
|
|
256
|
-
let [sectionName, section] = _ref9;
|
|
257
|
-
|
|
232
|
+
function insertColumn(state, {
|
|
233
|
+
columnIndex
|
|
234
|
+
}) {
|
|
235
|
+
const tableSections = Object.fromEntries(Object.entries(state).filter(([key]) => ['head', 'body', 'foot'].includes(key)));
|
|
236
|
+
return Object.fromEntries(Object.entries(tableSections).map(([sectionName, section]) => {
|
|
258
237
|
// Bail early if the table section is empty.
|
|
259
238
|
if (isEmptyTableSection(section)) {
|
|
260
239
|
return [sectionName, section];
|
|
@@ -287,17 +266,11 @@ function insertColumn(state, _ref7) {
|
|
|
287
266
|
*/
|
|
288
267
|
|
|
289
268
|
|
|
290
|
-
function deleteColumn(state,
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
let [key] = _ref11;
|
|
296
|
-
return ['head', 'body', 'foot'].includes(key);
|
|
297
|
-
}));
|
|
298
|
-
return Object.fromEntries(Object.entries(tableSections).map(_ref12 => {
|
|
299
|
-
let [sectionName, section] = _ref12;
|
|
300
|
-
|
|
269
|
+
function deleteColumn(state, {
|
|
270
|
+
columnIndex
|
|
271
|
+
}) {
|
|
272
|
+
const tableSections = Object.fromEntries(Object.entries(state).filter(([key]) => ['head', 'body', 'foot'].includes(key)));
|
|
273
|
+
return Object.fromEntries(Object.entries(tableSections).map(([sectionName, section]) => {
|
|
301
274
|
// Bail early if the table section is empty.
|
|
302
275
|
if (isEmptyTableSection(section)) {
|
|
303
276
|
return [sectionName, section];
|
|
@@ -319,7 +292,7 @@ function deleteColumn(state, _ref10) {
|
|
|
319
292
|
|
|
320
293
|
|
|
321
294
|
function toggleSection(state, sectionName) {
|
|
322
|
-
var _state$body$0$cells$l
|
|
295
|
+
var _state$body$0$cells$l;
|
|
323
296
|
|
|
324
297
|
// Section exists, replace it with an empty row to remove it.
|
|
325
298
|
if (!isEmptyTableSection(state[sectionName])) {
|
|
@@ -329,7 +302,7 @@ function toggleSection(state, sectionName) {
|
|
|
329
302
|
} // Get the length of the first row of the body to use when creating the header.
|
|
330
303
|
|
|
331
304
|
|
|
332
|
-
const columnCount = (_state$body$0$cells$l =
|
|
305
|
+
const columnCount = (_state$body$0$cells$l = state.body?.[0]?.cells?.length) !== null && _state$body$0$cells$l !== void 0 ? _state$body$0$cells$l : 1; // Section doesn't exist, insert an empty row to create the section.
|
|
333
306
|
|
|
334
307
|
return insertRow(state, {
|
|
335
308
|
sectionName,
|
package/build/table/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/table/state.js"],"names":["INHERITED_COLUMN_ATTRIBUTES","createTable","rowCount","columnCount","body","Array","from","length","map","cells","content","tag","getFirstRow","state","isEmptyTableSection","head","foot","getCellAttribute","cellLocation","attributeName","sectionName","rowIndex","columnIndex","updateSelectedCell","selection","updateCell","tableSections","Object","fromEntries","entries","filter","key","includes","selectionSectionName","selectionRowIndex","section","row","cellAttributes","isCellSelected","type","insertRow","firstRow","cellCount","undefined","slice","_","index","firstCellInColumn","inheritedAttributes","deleteRow","insertColumn","isEmptyRow","deleteColumn","cell","toggleSection","every"],"mappings":";;;;;;;;;;;;;;;;;AAAA,MAAMA,2BAA2B,GAAG,CAAE,OAAF,CAApC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,WAAT,OAAkD;AAAA,MAA5B;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAA4B;AACxD,SAAO;AACNC,IAAAA,IAAI,EAAEC,KAAK,CAACC,IAAN,CAAY;AAAEC,MAAAA,MAAM,EAAEL;AAAV,KAAZ,EAAmCM,GAAnC,CAAwC,OAAQ;AACrDC,MAAAA,KAAK,EAAEJ,KAAK,CAACC,IAAN,CAAY;AAAEC,QAAAA,MAAM,EAAEJ;AAAV,OAAZ,EAAsCK,GAAtC,CAA2C,OAAQ;AACzDE,QAAAA,OAAO,EAAE,EADgD;AAEzDC,QAAAA,GAAG,EAAE;AAFoD,OAAR,CAA3C;AAD8C,KAAR,CAAxC;AADA,GAAP;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,WAAT,CAAsBC,KAAtB,EAA8B;AACpC,MAAK,CAAEC,mBAAmB,CAAED,KAAK,CAACE,IAAR,CAA1B,EAA2C;AAC1C,WAAOF,KAAK,CAACE,IAAN,CAAY,CAAZ,CAAP;AACA;;AACD,MAAK,CAAED,mBAAmB,CAAED,KAAK,CAACT,IAAR,CAA1B,EAA2C;AAC1C,WAAOS,KAAK,CAACT,IAAN,CAAY,CAAZ,CAAP;AACA;;AACD,MAAK,CAAEU,mBAAmB,CAAED,KAAK,CAACG,IAAR,CAA1B,EAA2C;AAC1C,WAAOH,KAAK,CAACG,IAAN,CAAY,CAAZ,CAAP;AACA;AACD;AAED;AACA;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F,CASYM,GAAF,IAAWA,GAAG,CAAC3B,KAAJ,CAAUF,MAT/B,CAFM,CAAP;AAaA,GAnBD,CADM,CAAP;AAsBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAAS+C,aAAT,CAAwBzC,KAAxB,EAA+BO,WAA/B,EAA6C;AAAA;;AACnD;AACA,MAAK,CAAEN,mBAAmB,CAAED,KAAK,CAAEO,WAAF,CAAP,CAA1B,EAAqD;AACpD,WAAO;AAAE,OAAEA,WAAF,GAAiB;AAAnB,KAAP;AACA,GAJkD,CAMnD;;;AACA,QAAMjB,WAAW,2CAAGU,KAAK,CAACT,IAAT,gEAAG,YAAc,CAAd,CAAH,uEAAG,aAAmBK,KAAtB,uDAAG,mBAA0BF,MAA7B,yEAAuC,CAAxD,CAPmD,CASnD;;AACA,SAAOiC,SAAS,CAAE3B,KAAF,EAAS;AAAEO,IAAAA,WAAF;AAAeC,IAAAA,QAAQ,EAAE,CAAzB;AAA4BlB,IAAAA;AAA5B,GAAT,CAAhB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASW,mBAAT,CAA8BqB,OAA9B,EAAwC;AAC9C,SAAO,CAAEA,OAAF,IAAa,CAAEA,OAAO,CAAC5B,MAAvB,IAAiC4B,OAAO,CAACoB,KAAR,CAAeJ,UAAf,CAAxC;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASA,UAAT,CAAqBf,GAArB,EAA2B;AACjC,SAAO,EAAIA,GAAG,CAAC3B,KAAJ,IAAa2B,GAAG,CAAC3B,KAAJ,CAAUF,MAA3B,CAAP;AACA","sourcesContent":["const INHERITED_COLUMN_ATTRIBUTES = [ 'align' ];\n\n/**\n * Creates a table state.\n *\n * @param {Object} options\n * @param {number} options.rowCount Row count for the table to create.\n * @param {number} options.columnCount Column count for the table to create.\n *\n * @return {Object} New table state.\n */\nexport function createTable( { rowCount, columnCount } ) {\n\treturn {\n\t\tbody: Array.from( { length: rowCount } ).map( () => ( {\n\t\t\tcells: Array.from( { length: columnCount } ).map( () => ( {\n\t\t\t\tcontent: '',\n\t\t\t\ttag: 'td',\n\t\t\t} ) ),\n\t\t} ) ),\n\t};\n}\n\n/**\n * Returns the first row in the table.\n *\n * @param {Object} state Current table state.\n *\n * @return {Object | undefined} The first table row.\n */\nexport function getFirstRow( state ) {\n\tif ( ! isEmptyTableSection( state.head ) ) {\n\t\treturn state.head[ 0 ];\n\t}\n\tif ( ! isEmptyTableSection( state.body ) ) {\n\t\treturn state.body[ 0 ];\n\t}\n\tif ( ! isEmptyTableSection( state.foot ) ) {\n\t\treturn state.foot[ 0 ];\n\t}\n}\n\n/**\n * Gets an attribute for a cell.\n *\n * @param {Object} state Current table state.\n * @param {Object} cellLocation The location of the cell\n * @param {string} attributeName The name of the attribute to get the value of.\n *\n * @return {*} The attribute value.\n */\nexport function getCellAttribute( state, cellLocation, attributeName ) {\n\tconst { sectionName, rowIndex, columnIndex } = cellLocation;\n\treturn state[ sectionName ]?.[ rowIndex ]?.cells?.[ columnIndex ]?.[\n\t\tattributeName\n\t];\n}\n\n/**\n * Returns updated cell attributes after applying the `updateCell` function to the selection.\n *\n * @param {Object} state The block attributes.\n * @param {Object} selection The selection of cells to update.\n * @param {Function} updateCell A function to update the selected cell attributes.\n *\n * @return {Object} New table state including the updated cells.\n */\nexport function updateSelectedCell( state, selection, updateCell ) {\n\tif ( ! selection ) {\n\t\treturn state;\n\t}\n\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\tconst { sectionName: selectionSectionName, rowIndex: selectionRowIndex } =\n\t\tselection;\n\n\treturn Object.fromEntries(\n\t\tObject.entries( tableSections ).map( ( [ sectionName, section ] ) => {\n\t\t\tif (\n\t\t\t\tselectionSectionName &&\n\t\t\t\tselectionSectionName !== sectionName\n\t\t\t) {\n\t\t\t\treturn [ sectionName, section ];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tsectionName,\n\t\t\t\tsection.map( ( row, rowIndex ) => {\n\t\t\t\t\tif ( selectionRowIndex && selectionRowIndex !== rowIndex ) {\n\t\t\t\t\t\treturn row;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcells: row.cells.map(\n\t\t\t\t\t\t\t( cellAttributes, columnIndex ) => {\n\t\t\t\t\t\t\t\tconst cellLocation = {\n\t\t\t\t\t\t\t\t\tsectionName,\n\t\t\t\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\t\t\t\trowIndex,\n\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t! isCellSelected( cellLocation, selection )\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn cellAttributes;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn updateCell( cellAttributes );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t\t];\n\t\t} )\n\t);\n}\n\n/**\n * Returns whether the cell at `cellLocation` is included in the selection `selection`.\n *\n * @param {Object} cellLocation An object containing cell location properties.\n * @param {Object} selection An object containing selection properties.\n *\n * @return {boolean} True if the cell is selected, false otherwise.\n */\nexport function isCellSelected( cellLocation, selection ) {\n\tif ( ! cellLocation || ! selection ) {\n\t\treturn false;\n\t}\n\n\tswitch ( selection.type ) {\n\t\tcase 'column':\n\t\t\treturn (\n\t\t\t\tselection.type === 'column' &&\n\t\t\t\tcellLocation.columnIndex === selection.columnIndex\n\t\t\t);\n\t\tcase 'cell':\n\t\t\treturn (\n\t\t\t\tselection.type === 'cell' &&\n\t\t\t\tcellLocation.sectionName === selection.sectionName &&\n\t\t\t\tcellLocation.columnIndex === selection.columnIndex &&\n\t\t\t\tcellLocation.rowIndex === selection.rowIndex\n\t\t\t);\n\t}\n}\n\n/**\n * Inserts a row in the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {string} options.sectionName Section in which to insert the row.\n * @param {number} options.rowIndex Row index at which to insert the row.\n * @param {number} options.columnCount Column count for the table to create.\n *\n * @return {Object} New table state.\n */\nexport function insertRow( state, { sectionName, rowIndex, columnCount } ) {\n\tconst firstRow = getFirstRow( state );\n\tconst cellCount =\n\t\tcolumnCount === undefined ? firstRow?.cells?.length : columnCount;\n\n\t// Bail early if the function cannot determine how many cells to add.\n\tif ( ! cellCount ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\t[ sectionName ]: [\n\t\t\t...state[ sectionName ].slice( 0, rowIndex ),\n\t\t\t{\n\t\t\t\tcells: Array.from( { length: cellCount } ).map(\n\t\t\t\t\t( _, index ) => {\n\t\t\t\t\t\tconst firstCellInColumn =\n\t\t\t\t\t\t\tfirstRow?.cells?.[ index ] ?? {};\n\n\t\t\t\t\t\tconst inheritedAttributes = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( firstCellInColumn ).filter(\n\t\t\t\t\t\t\t\t( [ key ] ) =>\n\t\t\t\t\t\t\t\t\tINHERITED_COLUMN_ATTRIBUTES.includes( key )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...inheritedAttributes,\n\t\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t},\n\t\t\t...state[ sectionName ].slice( rowIndex ),\n\t\t],\n\t};\n}\n\n/**\n * Deletes a row from the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {string} options.sectionName Section in which to delete the row.\n * @param {number} options.rowIndex Row index to delete.\n *\n * @return {Object} New table state.\n */\nexport function deleteRow( state, { sectionName, rowIndex } ) {\n\treturn {\n\t\t[ sectionName ]: state[ sectionName ].filter(\n\t\t\t( row, index ) => index !== rowIndex\n\t\t),\n\t};\n}\n\n/**\n * Inserts a column in the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {number} options.columnIndex Column index at which to insert the column.\n *\n * @return {Object} New table state.\n */\nexport function insertColumn( state, { columnIndex } ) {\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\n\treturn Object.fromEntries(\n\t\tObject.entries( tableSections ).map( ( [ sectionName, section ] ) => {\n\t\t\t// Bail early if the table section is empty.\n\t\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\t\treturn [ sectionName, section ];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tsectionName,\n\t\t\t\tsection.map( ( row ) => {\n\t\t\t\t\t// Bail early if the row is empty or it's an attempt to insert past\n\t\t\t\t\t// the last possible index of the array.\n\t\t\t\t\tif ( isEmptyRow( row ) || row.cells.length < columnIndex ) {\n\t\t\t\t\t\treturn row;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcells: [\n\t\t\t\t\t\t\t...row.cells.slice( 0, columnIndex ),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...row.cells.slice( columnIndex ),\n\t\t\t\t\t\t],\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t\t];\n\t\t} )\n\t);\n}\n\n/**\n * Deletes a column from the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {number} options.columnIndex Column index to delete.\n *\n * @return {Object} New table state.\n */\nexport function deleteColumn( state, { columnIndex } ) {\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\n\treturn Object.fromEntries(\n\t\tObject.entries( tableSections ).map( ( [ sectionName, section ] ) => {\n\t\t\t// Bail early if the table section is empty.\n\t\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\t\treturn [ sectionName, section ];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tsectionName,\n\t\t\t\tsection\n\t\t\t\t\t.map( ( row ) => ( {\n\t\t\t\t\t\tcells:\n\t\t\t\t\t\t\trow.cells.length >= columnIndex\n\t\t\t\t\t\t\t\t? row.cells.filter(\n\t\t\t\t\t\t\t\t\t\t( cell, index ) => index !== columnIndex\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: row.cells,\n\t\t\t\t\t} ) )\n\t\t\t\t\t.filter( ( row ) => row.cells.length ),\n\t\t\t];\n\t\t} )\n\t);\n}\n\n/**\n * Toggles the existence of a section.\n *\n * @param {Object} state Current table state.\n * @param {string} sectionName Name of the section to toggle.\n *\n * @return {Object} New table state.\n */\nexport function toggleSection( state, sectionName ) {\n\t// Section exists, replace it with an empty row to remove it.\n\tif ( ! isEmptyTableSection( state[ sectionName ] ) ) {\n\t\treturn { [ sectionName ]: [] };\n\t}\n\n\t// Get the length of the first row of the body to use when creating the header.\n\tconst columnCount = state.body?.[ 0 ]?.cells?.length ?? 1;\n\n\t// Section doesn't exist, insert an empty row to create the section.\n\treturn insertRow( state, { sectionName, rowIndex: 0, columnCount } );\n}\n\n/**\n * Determines whether a table section is empty.\n *\n * @param {Object} section Table section state.\n *\n * @return {boolean} True if the table section is empty, false otherwise.\n */\nexport function isEmptyTableSection( section ) {\n\treturn ! section || ! section.length || section.every( isEmptyRow );\n}\n\n/**\n * Determines whether a table row is empty.\n *\n * @param {Object} row Table row state.\n *\n * @return {boolean} True if the table section is empty, false otherwise.\n */\nexport function isEmptyRow( row ) {\n\treturn ! ( row.cells && row.cells.length );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table/state.js"],"names":["INHERITED_COLUMN_ATTRIBUTES","createTable","rowCount","columnCount","body","Array","from","length","map","cells","content","tag","getFirstRow","state","isEmptyTableSection","head","foot","getCellAttribute","cellLocation","attributeName","sectionName","rowIndex","columnIndex","updateSelectedCell","selection","updateCell","tableSections","Object","fromEntries","entries","filter","key","includes","selectionSectionName","selectionRowIndex","section","row","cellAttributes","isCellSelected","type","insertRow","firstRow","cellCount","undefined","slice","_","index","firstCellInColumn","inheritedAttributes","deleteRow","insertColumn","isEmptyRow","deleteColumn","cell","toggleSection","every"],"mappings":";;;;;;;;;;;;;;;;;AAAA,MAAMA,2BAA2B,GAAG,CAAE,OAAF,CAApC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,WAAT,CAAsB;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAAtB,EAAkD;AACxD,SAAO;AACNC,IAAAA,IAAI,EAAEC,KAAK,CAACC,IAAN,CAAY;AAAEC,MAAAA,MAAM,EAAEL;AAAV,KAAZ,EAAmCM,GAAnC,CAAwC,OAAQ;AACrDC,MAAAA,KAAK,EAAEJ,KAAK,CAACC,IAAN,CAAY;AAAEC,QAAAA,MAAM,EAAEJ;AAAV,OAAZ,EAAsCK,GAAtC,CAA2C,OAAQ;AACzDE,QAAAA,OAAO,EAAE,EADgD;AAEzDC,QAAAA,GAAG,EAAE;AAFoD,OAAR,CAA3C;AAD8C,KAAR,CAAxC;AADA,GAAP;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,WAAT,CAAsBC,KAAtB,EAA8B;AACpC,MAAK,CAAEC,mBAAmB,CAAED,KAAK,CAACE,IAAR,CAA1B,EAA2C;AAC1C,WAAOF,KAAK,CAACE,IAAN,CAAY,CAAZ,CAAP;AACA;;AACD,MAAK,CAAED,mBAAmB,CAAED,KAAK,CAACT,IAAR,CAA1B,EAA2C;AAC1C,WAAOS,KAAK,CAACT,IAAN,CAAY,CAAZ,CAAP;AACA;;AACD,MAAK,CAAEU,mBAAmB,CAAED,KAAK,C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A;;AACnD;AACA,MAAK,CAAEN,mBAAmB,CAAED,KAAK,CAAEO,WAAF,CAAP,CAA1B,EAAqD;AACpD,WAAO;AAAE,OAAEA,WAAF,GAAiB;AAAnB,KAAP;AACA,GAJkD,CAMnD;;;AACA,QAAMjB,WAAW,4BAAGU,KAAK,CAACT,IAAN,GAAc,CAAd,GAAmBK,KAAnB,EAA0BF,MAA7B,yEAAuC,CAAxD,CAPmD,CASnD;;AACA,SAAOiC,SAAS,CAAE3B,KAAF,EAAS;AAAEO,IAAAA,WAAF;AAAeC,IAAAA,QAAQ,EAAE,CAAzB;AAA4BlB,IAAAA;AAA5B,GAAT,CAAhB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASW,mBAAT,CAA8BqB,OAA9B,EAAwC;AAC9C,SAAO,CAAEA,OAAF,IAAa,CAAEA,OAAO,CAAC5B,MAAvB,IAAiC4B,OAAO,CAACoB,KAAR,CAAeJ,UAAf,CAAxC;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASA,UAAT,CAAqBf,GAArB,EAA2B;AACjC,SAAO,EAAIA,GAAG,CAAC3B,KAAJ,IAAa2B,GAAG,CAAC3B,KAAJ,CAAUF,MAA3B,CAAP;AACA","sourcesContent":["const INHERITED_COLUMN_ATTRIBUTES = [ 'align' ];\n\n/**\n * Creates a table state.\n *\n * @param {Object} options\n * @param {number} options.rowCount Row count for the table to create.\n * @param {number} options.columnCount Column count for the table to create.\n *\n * @return {Object} New table state.\n */\nexport function createTable( { rowCount, columnCount } ) {\n\treturn {\n\t\tbody: Array.from( { length: rowCount } ).map( () => ( {\n\t\t\tcells: Array.from( { length: columnCount } ).map( () => ( {\n\t\t\t\tcontent: '',\n\t\t\t\ttag: 'td',\n\t\t\t} ) ),\n\t\t} ) ),\n\t};\n}\n\n/**\n * Returns the first row in the table.\n *\n * @param {Object} state Current table state.\n *\n * @return {Object | undefined} The first table row.\n */\nexport function getFirstRow( state ) {\n\tif ( ! isEmptyTableSection( state.head ) ) {\n\t\treturn state.head[ 0 ];\n\t}\n\tif ( ! isEmptyTableSection( state.body ) ) {\n\t\treturn state.body[ 0 ];\n\t}\n\tif ( ! isEmptyTableSection( state.foot ) ) {\n\t\treturn state.foot[ 0 ];\n\t}\n}\n\n/**\n * Gets an attribute for a cell.\n *\n * @param {Object} state Current table state.\n * @param {Object} cellLocation The location of the cell\n * @param {string} attributeName The name of the attribute to get the value of.\n *\n * @return {*} The attribute value.\n */\nexport function getCellAttribute( state, cellLocation, attributeName ) {\n\tconst { sectionName, rowIndex, columnIndex } = cellLocation;\n\treturn state[ sectionName ]?.[ rowIndex ]?.cells?.[ columnIndex ]?.[\n\t\tattributeName\n\t];\n}\n\n/**\n * Returns updated cell attributes after applying the `updateCell` function to the selection.\n *\n * @param {Object} state The block attributes.\n * @param {Object} selection The selection of cells to update.\n * @param {Function} updateCell A function to update the selected cell attributes.\n *\n * @return {Object} New table state including the updated cells.\n */\nexport function updateSelectedCell( state, selection, updateCell ) {\n\tif ( ! selection ) {\n\t\treturn state;\n\t}\n\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\tconst { sectionName: selectionSectionName, rowIndex: selectionRowIndex } =\n\t\tselection;\n\n\treturn Object.fromEntries(\n\t\tObject.entries( tableSections ).map( ( [ sectionName, section ] ) => {\n\t\t\tif (\n\t\t\t\tselectionSectionName &&\n\t\t\t\tselectionSectionName !== sectionName\n\t\t\t) {\n\t\t\t\treturn [ sectionName, section ];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tsectionName,\n\t\t\t\tsection.map( ( row, rowIndex ) => {\n\t\t\t\t\tif ( selectionRowIndex && selectionRowIndex !== rowIndex ) {\n\t\t\t\t\t\treturn row;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcells: row.cells.map(\n\t\t\t\t\t\t\t( cellAttributes, columnIndex ) => {\n\t\t\t\t\t\t\t\tconst cellLocation = {\n\t\t\t\t\t\t\t\t\tsectionName,\n\t\t\t\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\t\t\t\trowIndex,\n\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t! isCellSelected( cellLocation, selection )\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn cellAttributes;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn updateCell( cellAttributes );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t\t];\n\t\t} )\n\t);\n}\n\n/**\n * Returns whether the cell at `cellLocation` is included in the selection `selection`.\n *\n * @param {Object} cellLocation An object containing cell location properties.\n * @param {Object} selection An object containing selection properties.\n *\n * @return {boolean} True if the cell is selected, false otherwise.\n */\nexport function isCellSelected( cellLocation, selection ) {\n\tif ( ! cellLocation || ! selection ) {\n\t\treturn false;\n\t}\n\n\tswitch ( selection.type ) {\n\t\tcase 'column':\n\t\t\treturn (\n\t\t\t\tselection.type === 'column' &&\n\t\t\t\tcellLocation.columnIndex === selection.columnIndex\n\t\t\t);\n\t\tcase 'cell':\n\t\t\treturn (\n\t\t\t\tselection.type === 'cell' &&\n\t\t\t\tcellLocation.sectionName === selection.sectionName &&\n\t\t\t\tcellLocation.columnIndex === selection.columnIndex &&\n\t\t\t\tcellLocation.rowIndex === selection.rowIndex\n\t\t\t);\n\t}\n}\n\n/**\n * Inserts a row in the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {string} options.sectionName Section in which to insert the row.\n * @param {number} options.rowIndex Row index at which to insert the row.\n * @param {number} options.columnCount Column count for the table to create.\n *\n * @return {Object} New table state.\n */\nexport function insertRow( state, { sectionName, rowIndex, columnCount } ) {\n\tconst firstRow = getFirstRow( state );\n\tconst cellCount =\n\t\tcolumnCount === undefined ? firstRow?.cells?.length : columnCount;\n\n\t// Bail early if the function cannot determine how many cells to add.\n\tif ( ! cellCount ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\t[ sectionName ]: [\n\t\t\t...state[ sectionName ].slice( 0, rowIndex ),\n\t\t\t{\n\t\t\t\tcells: Array.from( { length: cellCount } ).map(\n\t\t\t\t\t( _, index ) => {\n\t\t\t\t\t\tconst firstCellInColumn =\n\t\t\t\t\t\t\tfirstRow?.cells?.[ index ] ?? {};\n\n\t\t\t\t\t\tconst inheritedAttributes = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( firstCellInColumn ).filter(\n\t\t\t\t\t\t\t\t( [ key ] ) =>\n\t\t\t\t\t\t\t\t\tINHERITED_COLUMN_ATTRIBUTES.includes( key )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...inheritedAttributes,\n\t\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t},\n\t\t\t...state[ sectionName ].slice( rowIndex ),\n\t\t],\n\t};\n}\n\n/**\n * Deletes a row from the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {string} options.sectionName Section in which to delete the row.\n * @param {number} options.rowIndex Row index to delete.\n *\n * @return {Object} New table state.\n */\nexport function deleteRow( state, { sectionName, rowIndex } ) {\n\treturn {\n\t\t[ sectionName ]: state[ sectionName ].filter(\n\t\t\t( row, index ) => index !== rowIndex\n\t\t),\n\t};\n}\n\n/**\n * Inserts a column in the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {number} options.columnIndex Column index at which to insert the column.\n *\n * @return {Object} New table state.\n */\nexport function insertColumn( state, { columnIndex } ) {\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\n\treturn Object.fromEntries(\n\t\tObject.entries( tableSections ).map( ( [ sectionName, section ] ) => {\n\t\t\t// Bail early if the table section is empty.\n\t\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\t\treturn [ sectionName, section ];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tsectionName,\n\t\t\t\tsection.map( ( row ) => {\n\t\t\t\t\t// Bail early if the row is empty or it's an attempt to insert past\n\t\t\t\t\t// the last possible index of the array.\n\t\t\t\t\tif ( isEmptyRow( row ) || row.cells.length < columnIndex ) {\n\t\t\t\t\t\treturn row;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcells: [\n\t\t\t\t\t\t\t...row.cells.slice( 0, columnIndex ),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...row.cells.slice( columnIndex ),\n\t\t\t\t\t\t],\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t\t];\n\t\t} )\n\t);\n}\n\n/**\n * Deletes a column from the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {number} options.columnIndex Column index to delete.\n *\n * @return {Object} New table state.\n */\nexport function deleteColumn( state, { columnIndex } ) {\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\n\treturn Object.fromEntries(\n\t\tObject.entries( tableSections ).map( ( [ sectionName, section ] ) => {\n\t\t\t// Bail early if the table section is empty.\n\t\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\t\treturn [ sectionName, section ];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tsectionName,\n\t\t\t\tsection\n\t\t\t\t\t.map( ( row ) => ( {\n\t\t\t\t\t\tcells:\n\t\t\t\t\t\t\trow.cells.length >= columnIndex\n\t\t\t\t\t\t\t\t? row.cells.filter(\n\t\t\t\t\t\t\t\t\t\t( cell, index ) => index !== columnIndex\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: row.cells,\n\t\t\t\t\t} ) )\n\t\t\t\t\t.filter( ( row ) => row.cells.length ),\n\t\t\t];\n\t\t} )\n\t);\n}\n\n/**\n * Toggles the existence of a section.\n *\n * @param {Object} state Current table state.\n * @param {string} sectionName Name of the section to toggle.\n *\n * @return {Object} New table state.\n */\nexport function toggleSection( state, sectionName ) {\n\t// Section exists, replace it with an empty row to remove it.\n\tif ( ! isEmptyTableSection( state[ sectionName ] ) ) {\n\t\treturn { [ sectionName ]: [] };\n\t}\n\n\t// Get the length of the first row of the body to use when creating the header.\n\tconst columnCount = state.body?.[ 0 ]?.cells?.length ?? 1;\n\n\t// Section doesn't exist, insert an empty row to create the section.\n\treturn insertRow( state, { sectionName, rowIndex: 0, columnCount } );\n}\n\n/**\n * Determines whether a table section is empty.\n *\n * @param {Object} section Table section state.\n *\n * @return {boolean} True if the table section is empty, false otherwise.\n */\nexport function isEmptyTableSection( section ) {\n\treturn ! section || ! section.length || section.every( isEmptyRow );\n}\n\n/**\n * Determines whether a table row is empty.\n *\n * @param {Object} row Table row state.\n *\n * @return {boolean} True if the table section is empty, false otherwise.\n */\nexport function isEmptyRow( row ) {\n\treturn ! ( row.cells && row.cells.length );\n}\n"]}
|
|
@@ -16,28 +16,25 @@ var _utils = require("./utils");
|
|
|
16
16
|
/**
|
|
17
17
|
* Internal dependencies
|
|
18
18
|
*/
|
|
19
|
-
const tableContentPasteSchema =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
children: phrasingContentSchema,
|
|
35
|
-
attributes: ['colspan', 'rowspan']
|
|
36
|
-
}
|
|
19
|
+
const tableContentPasteSchema = ({
|
|
20
|
+
phrasingContentSchema
|
|
21
|
+
}) => ({
|
|
22
|
+
tr: {
|
|
23
|
+
allowEmpty: true,
|
|
24
|
+
children: {
|
|
25
|
+
th: {
|
|
26
|
+
allowEmpty: true,
|
|
27
|
+
children: phrasingContentSchema,
|
|
28
|
+
attributes: ['scope', 'colspan', 'rowspan']
|
|
29
|
+
},
|
|
30
|
+
td: {
|
|
31
|
+
allowEmpty: true,
|
|
32
|
+
children: phrasingContentSchema,
|
|
33
|
+
attributes: ['colspan', 'rowspan']
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
36
|
+
}
|
|
37
|
+
});
|
|
41
38
|
|
|
42
39
|
const tablePasteSchema = args => ({
|
|
43
40
|
table: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/table/transforms.js"],"names":["tableContentPasteSchema","phrasingContentSchema","tr","allowEmpty","children","th","attributes","td","tablePasteSchema","args","table","thead","tfoot","tbody","transforms","from","type","selector","schema","transform","node","Array","reduce","sectionAcc","section","length","sectionName","nodeName","toLowerCase","slice","sectionAttributes","rowAcc","row","rowAttributes","colAcc","col","rowspan","getAttribute","colspan","push","tag","content","innerHTML","cells"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,uBAAuB,GAAG
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table/transforms.js"],"names":["tableContentPasteSchema","phrasingContentSchema","tr","allowEmpty","children","th","attributes","td","tablePasteSchema","args","table","thead","tfoot","tbody","transforms","from","type","selector","schema","transform","node","Array","reduce","sectionAcc","section","length","sectionName","nodeName","toLowerCase","slice","sectionAttributes","rowAcc","row","rowAttributes","colAcc","col","rowspan","getAttribute","colspan","push","tag","content","innerHTML","cells"],"mappings":";;;;;;;AAGA;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BI,iBAA5B;AACA,eAAOP,UAAP;AACA,OA9CiB,EA+ClB,EA/CkB,CAAnB;AAkDA,aAAO,yBAAa,YAAb,EAA2BjB,UAA3B,CAAP;AACA;AAxDF,GADK;AADY,CAAnB;eA+DeQ,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { normalizeRowColSpan } from './utils';\n\nconst tableContentPasteSchema = ( { phrasingContentSchema } ) => ( {\n\ttr: {\n\t\tallowEmpty: true,\n\t\tchildren: {\n\t\t\tth: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'scope', 'colspan', 'rowspan' ],\n\t\t\t},\n\t\t\ttd: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'colspan', 'rowspan' ],\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst tablePasteSchema = ( args ) => ( {\n\ttable: {\n\t\tchildren: {\n\t\t\tthead: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttfoot: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttbody: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tselector: 'table',\n\t\t\tschema: tablePasteSchema,\n\t\t\ttransform: ( node ) => {\n\t\t\t\tconst attributes = Array.from( node.children ).reduce(\n\t\t\t\t\t( sectionAcc, section ) => {\n\t\t\t\t\t\tif ( ! section.children.length ) {\n\t\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst sectionName = section.nodeName\n\t\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t\t.slice( 1 );\n\n\t\t\t\t\t\tconst sectionAttributes = Array.from(\n\t\t\t\t\t\t\tsection.children\n\t\t\t\t\t\t).reduce( ( rowAcc, row ) => {\n\t\t\t\t\t\t\tif ( ! row.children.length ) {\n\t\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst rowAttributes = Array.from(\n\t\t\t\t\t\t\t\trow.children\n\t\t\t\t\t\t\t).reduce( ( colAcc, col ) => {\n\t\t\t\t\t\t\t\tconst rowspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'rowspan' )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst colspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'colspan' )\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tcolAcc.push( {\n\t\t\t\t\t\t\t\t\ttag: col.nodeName.toLowerCase(),\n\t\t\t\t\t\t\t\t\tcontent: col.innerHTML,\n\t\t\t\t\t\t\t\t\trowspan,\n\t\t\t\t\t\t\t\t\tcolspan,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\treturn colAcc;\n\t\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\t\trowAcc.push( {\n\t\t\t\t\t\t\t\tcells: rowAttributes,\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\tsectionAcc[ sectionName ] = sectionAttributes;\n\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\n\t\t\t\treturn createBlock( 'core/table', attributes );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"]}
|
|
@@ -57,15 +57,14 @@ var _utils = require("./utils");
|
|
|
57
57
|
*
|
|
58
58
|
* @return {WPComponent} The component.
|
|
59
59
|
*/
|
|
60
|
-
function TableOfContentsEdit(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} = _ref;
|
|
60
|
+
function TableOfContentsEdit({
|
|
61
|
+
attributes: {
|
|
62
|
+
headings = [],
|
|
63
|
+
onlyIncludeCurrentPage
|
|
64
|
+
},
|
|
65
|
+
clientId,
|
|
66
|
+
setAttributes
|
|
67
|
+
}) {
|
|
69
68
|
const blockProps = (0, _blockEditor.useBlockProps)();
|
|
70
69
|
const canInsertList = (0, _data.useSelect)(select => {
|
|
71
70
|
const {
|
|
@@ -145,7 +144,7 @@ function TableOfContentsEdit(_ref) {
|
|
|
145
144
|
* unavailable, this variable will be null.
|
|
146
145
|
*/
|
|
147
146
|
|
|
148
|
-
const permalink = (_editorSelectors$getP = editorSelectors
|
|
147
|
+
const permalink = (_editorSelectors$getP = editorSelectors?.getPermalink()) !== null && _editorSelectors$getP !== void 0 ? _editorSelectors$getP : null;
|
|
149
148
|
let headingPageLink = null; // If the core/editor store is available, we can add permalinks to the
|
|
150
149
|
// generated table of contents.
|
|
151
150
|
|
|
@@ -231,7 +230,8 @@ function TableOfContentsEdit(_ref) {
|
|
|
231
230
|
// "Convert to static list" option is useless to the placeholder state.
|
|
232
231
|
|
|
233
232
|
if (headings.length === 0) {
|
|
234
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", blockProps
|
|
233
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", { ...blockProps
|
|
234
|
+
}, (0, _element.createElement)(_components.Placeholder, {
|
|
235
235
|
icon: (0, _element.createElement)(_blockEditor.BlockIcon, {
|
|
236
236
|
icon: _icon.default
|
|
237
237
|
}),
|
|
@@ -240,7 +240,8 @@ function TableOfContentsEdit(_ref) {
|
|
|
240
240
|
})), inspectorControls);
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("nav", blockProps
|
|
243
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("nav", { ...blockProps
|
|
244
|
+
}, (0, _element.createElement)("ol", {
|
|
244
245
|
inert: "true"
|
|
245
246
|
}, (0, _element.createElement)(_list.default, {
|
|
246
247
|
nestedHeadingList: headingTree
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"names":["TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","blockProps","canInsertList","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","__unstableMarkNextChangeAsNotPersistent","replaceBlocks","latestHeadings","getBlockAttributes","getBlockName","getClientIdsWithDescendants","__experimentalGetGlobalBlocksByName","getGlobalBlocksByName","editorSelectors","pageBreakClientIds","isPaginated","length","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","_latestHeadings","headingPage","permalink","getPermalink","headingPageLink","page","blockName","headingAttributes","canBeLinked","anchor","push","content","replace","level","link","headingTree","toolbarControls","ordered","values","inspectorControls","value","icon"],"mappings":";;;;;;;;;AAyBA;;AAtBA;;AAKA;;AAOA;;AACA;;AAOA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AAlCA;AACA;AACA;;AAGA;AACA;AACA;;AAsBA;AACA;AACA;;AAKA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,mBAAT,OAIX;AAAA,MAJyC;AAC5CC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,QAAQ,GAAG,EAAb;AAAiBC,MAAAA;AAAjB,KADgC;AAE5CC,IAAAA,QAF4C;AAG5CC,IAAAA;AAH4C,GAIzC;AACH,QAAMC,UAAU,GAAG,iCAAnB;AAEA,QAAMC,aAAa,GAAG,qBACnBC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,oBAA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,4BAAC,yBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,2BAAJ,CAFT;AAGC,IAAA,OAAO,EAAGhD,sBAHX;AAIC,IAAA,QAAQ,EAAKiD,KAAF,IACV/C,aAAa,CAAE;AAAEF,MAAAA,sBAAsB,EAAEiD;AAA1B,KAAF,CALf;AAOC,IAAA,IAAI,EACHjD,sBAAsB,GACnB,cACA,2EADA,CADmB,GAInB,cACA,mFADA;AAZL,IADD,CADD,CADD,CAnMG,CA2NH;AACA;AACA;;AACA,MAAKD,QAAQ,CAACsB,MAAT,KAAoB,CAAzB,EAA6B;AAC5B,WACC,qDACC,mCAAUlB,UAAV,EACC,4BAAC,uBAAD;AACC,MAAA,IAAI,EAAG,4BAAC,sBAAD;AAAW,QAAA,IAAI,EAAG+C;AAAlB,QADR;AAEC,MAAA,KAAK,EAAG,cAAI,mBAAJ,CAFT;AAGC,MAAA,YAAY,EAAG,cACd,4GADc;AAHhB,MADD,CADD,EAUGF,iBAVH,CADD;AAcA;;AAED,SACC,qDACC,mCAAU7C,UAAV,EACC;AAAI,IAAA,KAAK,EAAC;AAAV,KACC,4BAAC,aAAD;AAAqB,IAAA,iBAAiB,EAAGyC;AAAzC,IADD,CADD,CADD,EAMGC,eANH,EAOGG,iBAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { renderToString, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport icon from './icon';\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {WPComponent} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\t/**\n\t * The latest heading data, or null if the new data deeply equals the saved\n\t * headings attribute.\n\t *\n\t * Since useSelect forces a re-render when its return value is shallowly\n\t * inequal to its prior call, we would be re-rendering this block every time\n\t * the stores change, even if the latest headings were deeply equal to the\n\t * ones saved in the block attributes.\n\t *\n\t * By returning null when they're equal, we reduce that to 2 renders: one\n\t * when there are new latest headings (and so it returns them), and one when\n\t * they haven't changed (so it returns null). As long as the latest heading\n\t * data remains the same, further calls of the useSelect callback will\n\t * continue to return null, thus preventing any forced re-renders.\n\t */\n\tconst latestHeadings = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t\t__experimentalGetGlobalBlocksByName: getGlobalBlocksByName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t\t\t// declaring @wordpress/editor as a dependency, we must access its\n\t\t\t// store by string. When the store is not available, editorSelectors\n\t\t\t// will be null, and the block's saved markup will lack permalinks.\n\t\t\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\t\t\tconst editorSelectors = select( 'core/editor' );\n\n\t\t\tconst pageBreakClientIds = getGlobalBlocksByName( 'core/nextpage' );\n\n\t\t\tconst isPaginated = pageBreakClientIds.length !== 0;\n\n\t\t\t// Get the client ids of all blocks in the editor.\n\t\t\tconst allBlockClientIds = getClientIdsWithDescendants();\n\n\t\t\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\t\t\tlet tocPage = 1;\n\n\t\t\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t\t\t// We can't use getBlockIndex because it only returns the index\n\t\t\t\t// relative to sibling blocks.\n\t\t\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\t\t\tfor ( const [\n\t\t\t\t\tblockIndex,\n\t\t\t\t\tblockClientId,\n\t\t\t\t] of allBlockClientIds.entries() ) {\n\t\t\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t\t\t// finished calculating which page the block is on.\n\t\t\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\t\t\ttocPage++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst _latestHeadings = [];\n\n\t\t\t/** The page (of a paginated post) a heading will be part of. */\n\t\t\tlet headingPage = 1;\n\n\t\t\t/**\n\t\t\t * A permalink to the current post. If the core/editor store is\n\t\t\t * unavailable, this variable will be null.\n\t\t\t */\n\t\t\tconst permalink = editorSelectors?.getPermalink() ?? null;\n\n\t\t\tlet headingPageLink = null;\n\n\t\t\t// If the core/editor store is available, we can add permalinks to the\n\t\t\t// generated table of contents.\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = isPaginated\n\t\t\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t\t\t: permalink;\n\t\t\t}\n\n\t\t\tfor ( const blockClientId of allBlockClientIds ) {\n\t\t\t\tconst blockName = getBlockName( blockClientId );\n\t\t\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\t\t\theadingPage++;\n\n\t\t\t\t\t// If we're only including headings from the current page (of\n\t\t\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t\t\t// pages after the one with the Table of Contents block.\n\t\t\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t\t\t{ page: headingPage }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If we're including all headings or we've reached headings on\n\t\t\t\t// the same page as the Table of Contents block, add them to the\n\t\t\t\t// list.\n\t\t\t\telse if (\n\t\t\t\t\t! onlyIncludeCurrentPage ||\n\t\t\t\t\theadingPage === tocPage\n\t\t\t\t) {\n\t\t\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\t\t\tconst headingAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( blockClientId );\n\n\t\t\t\t\t\tconst canBeLinked =\n\t\t\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\t\t\t_latestHeadings.push( {\n\t\t\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\n\t\t\t\t\t\t\t\t\t' '\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tlevel: headingAttributes.level,\n\t\t\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( fastDeepEqual( headings, _latestHeadings ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn _latestHeadings;\n\t\t},\n\t\t[ clientId, onlyIncludeCurrentPage, headings ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( latestHeadings !== null ) {\n\t\t\t// This is required to keep undo working and not create 2 undo steps\n\t\t\t// for each heading change.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { headings: latestHeadings } );\n\t\t}\n\t}, [ latestHeadings ] );\n\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={\n\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Toggle to only include headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel={ __( 'Table of Contents' ) }\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol inert=\"true\">\n\t\t\t\t\t<TableOfContentsList nestedHeadingList={ headingTree } />\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"names":["TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","blockProps","canInsertList","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","__unstableMarkNextChangeAsNotPersistent","replaceBlocks","latestHeadings","getBlockAttributes","getBlockName","getClientIdsWithDescendants","__experimentalGetGlobalBlocksByName","getGlobalBlocksByName","editorSelectors","pageBreakClientIds","isPaginated","length","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","_latestHeadings","headingPage","permalink","getPermalink","headingPageLink","page","blockName","headingAttributes","canBeLinked","anchor","push","content","replace","level","link","headingTree","toolbarControls","ordered","values","inspectorControls","value","icon"],"mappings":";;;;;;;;;AAyBA;;AAtBA;;AAKA;;AAOA;;AACA;;AAOA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AAlCA;AACA;AACA;;AAGA;AACA;AACA;;AAsBA;AACA;AACA;;AAKA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,mBAAT,CAA8B;AAC5CC,EAAAA,UAAU,EAAE;AAAEC,IAAAA,QAAQ,GAAG,EAAb;AAAiBC,IAAAA;AAAjB,GADgC;AAE5CC,EAAAA,QAF4C;AAG5CC,EAAAA;AAH4C,CAA9B,EAIX;AACH,QAAMC,UAAU,GAAG,iCAAnB;AAEA,QAAMC,aAAa,GAAG,qBACnBC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,oBAAF;AAAwBC,MAAAA;AAAxB,QACLF,MAAM,CAAEG,kBAAF,CADP;AAEA,UAAMC,Y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AAO,EAAGhD,sBAHX;AAIC,IAAA,QAAQ,EAAKiD,KAAF,IACV/C,aAAa,CAAE;AAAEF,MAAAA,sBAAsB,EAAEiD;AAA1B,KAAF,CALf;AAOC,IAAA,IAAI,EACHjD,sBAAsB,GACnB,cACA,2EADA,CADmB,GAInB,cACA,mFADA;AAZL,IADD,CADD,CADD,CAnMG,CA2NH;AACA;AACA;;AACA,MAAKD,QAAQ,CAACsB,MAAT,KAAoB,CAAzB,EAA6B;AAC5B,WACC,qDACC,wCAAUlB;AAAV,OACC,4BAAC,uBAAD;AACC,MAAA,IAAI,EAAG,4BAAC,sBAAD;AAAW,QAAA,IAAI,EAAG+C;AAAlB,QADR;AAEC,MAAA,KAAK,EAAG,cAAI,mBAAJ,CAFT;AAGC,MAAA,YAAY,EAAG,cACd,4GADc;AAHhB,MADD,CADD,EAUGF,iBAVH,CADD;AAcA;;AAED,SACC,qDACC,wCAAU7C;AAAV,KACC;AAAI,IAAA,KAAK,EAAC;AAAV,KACC,4BAAC,aAAD;AAAqB,IAAA,iBAAiB,EAAGyC;AAAzC,IADD,CADD,CADD,EAMGC,eANH,EAOGG,iBAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { renderToString, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport icon from './icon';\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {WPComponent} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\t/**\n\t * The latest heading data, or null if the new data deeply equals the saved\n\t * headings attribute.\n\t *\n\t * Since useSelect forces a re-render when its return value is shallowly\n\t * inequal to its prior call, we would be re-rendering this block every time\n\t * the stores change, even if the latest headings were deeply equal to the\n\t * ones saved in the block attributes.\n\t *\n\t * By returning null when they're equal, we reduce that to 2 renders: one\n\t * when there are new latest headings (and so it returns them), and one when\n\t * they haven't changed (so it returns null). As long as the latest heading\n\t * data remains the same, further calls of the useSelect callback will\n\t * continue to return null, thus preventing any forced re-renders.\n\t */\n\tconst latestHeadings = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t\t__experimentalGetGlobalBlocksByName: getGlobalBlocksByName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t\t\t// declaring @wordpress/editor as a dependency, we must access its\n\t\t\t// store by string. When the store is not available, editorSelectors\n\t\t\t// will be null, and the block's saved markup will lack permalinks.\n\t\t\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\t\t\tconst editorSelectors = select( 'core/editor' );\n\n\t\t\tconst pageBreakClientIds = getGlobalBlocksByName( 'core/nextpage' );\n\n\t\t\tconst isPaginated = pageBreakClientIds.length !== 0;\n\n\t\t\t// Get the client ids of all blocks in the editor.\n\t\t\tconst allBlockClientIds = getClientIdsWithDescendants();\n\n\t\t\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\t\t\tlet tocPage = 1;\n\n\t\t\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t\t\t// We can't use getBlockIndex because it only returns the index\n\t\t\t\t// relative to sibling blocks.\n\t\t\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\t\t\tfor ( const [\n\t\t\t\t\tblockIndex,\n\t\t\t\t\tblockClientId,\n\t\t\t\t] of allBlockClientIds.entries() ) {\n\t\t\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t\t\t// finished calculating which page the block is on.\n\t\t\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\t\t\ttocPage++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst _latestHeadings = [];\n\n\t\t\t/** The page (of a paginated post) a heading will be part of. */\n\t\t\tlet headingPage = 1;\n\n\t\t\t/**\n\t\t\t * A permalink to the current post. If the core/editor store is\n\t\t\t * unavailable, this variable will be null.\n\t\t\t */\n\t\t\tconst permalink = editorSelectors?.getPermalink() ?? null;\n\n\t\t\tlet headingPageLink = null;\n\n\t\t\t// If the core/editor store is available, we can add permalinks to the\n\t\t\t// generated table of contents.\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = isPaginated\n\t\t\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t\t\t: permalink;\n\t\t\t}\n\n\t\t\tfor ( const blockClientId of allBlockClientIds ) {\n\t\t\t\tconst blockName = getBlockName( blockClientId );\n\t\t\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\t\t\theadingPage++;\n\n\t\t\t\t\t// If we're only including headings from the current page (of\n\t\t\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t\t\t// pages after the one with the Table of Contents block.\n\t\t\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t\t\t{ page: headingPage }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If we're including all headings or we've reached headings on\n\t\t\t\t// the same page as the Table of Contents block, add them to the\n\t\t\t\t// list.\n\t\t\t\telse if (\n\t\t\t\t\t! onlyIncludeCurrentPage ||\n\t\t\t\t\theadingPage === tocPage\n\t\t\t\t) {\n\t\t\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\t\t\tconst headingAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( blockClientId );\n\n\t\t\t\t\t\tconst canBeLinked =\n\t\t\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\t\t\t_latestHeadings.push( {\n\t\t\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\n\t\t\t\t\t\t\t\t\t' '\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tlevel: headingAttributes.level,\n\t\t\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( fastDeepEqual( headings, _latestHeadings ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn _latestHeadings;\n\t\t},\n\t\t[ clientId, onlyIncludeCurrentPage, headings ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( latestHeadings !== null ) {\n\t\t\t// This is required to keep undo working and not create 2 undo steps\n\t\t\t// for each heading change.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { headings: latestHeadings } );\n\t\t}\n\t}, [ latestHeadings ] );\n\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={\n\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Toggle to only include headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel={ __( 'Table of Contents' ) }\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol inert=\"true\">\n\t\t\t\t\t<TableOfContentsList nestedHeadingList={ headingTree } />\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -20,7 +20,7 @@ var _save = _interopRequireDefault(require("./save"));
|
|
|
20
20
|
*/
|
|
21
21
|
const metadata = {
|
|
22
22
|
$schema: "https://schemas.wp.org/trunk/block.json",
|
|
23
|
-
apiVersion:
|
|
23
|
+
apiVersion: 3,
|
|
24
24
|
__experimental: true,
|
|
25
25
|
name: "core/table-of-contents",
|
|
26
26
|
title: "Table of Contents",
|
|
@@ -16,10 +16,9 @@ var _element = require("@wordpress/element");
|
|
|
16
16
|
*/
|
|
17
17
|
const ENTRY_CLASS_NAME = 'wp-block-table-of-contents__entry';
|
|
18
18
|
|
|
19
|
-
function TableOfContentsList(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = _ref;
|
|
19
|
+
function TableOfContentsList({
|
|
20
|
+
nestedHeadingList
|
|
21
|
+
}) {
|
|
23
22
|
return (0, _element.createElement)(_element.Fragment, null, nestedHeadingList.map((node, index) => {
|
|
24
23
|
const {
|
|
25
24
|
content,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/list.tsx"],"names":["ENTRY_CLASS_NAME","TableOfContentsList","nestedHeadingList","map","node","index","content","link","heading","entry","children"],"mappings":";;;;;;;;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,gBAAgB,GAAG,mCAAzB;;AAEe,SAASC,mBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/list.tsx"],"names":["ENTRY_CLASS_NAME","TableOfContentsList","nestedHeadingList","map","node","index","content","link","heading","entry","children"],"mappings":";;;;;;;;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,gBAAgB,GAAG,mCAAzB;;AAEe,SAASC,mBAAT,CAA8B;AAC5CC,EAAAA;AAD4C,CAA9B,EAIA;AACd,SACC,qDACGA,iBAAiB,CAACC,GAAlB,CAAuB,CAAEC,IAAF,EAAQC,KAAR,KAAmB;AAC3C,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA;AAAX,QAAoBH,IAAI,CAACI,OAA/B;AAEA,UAAMC,KAAK,GAAGF,IAAI,GACjB;AAAG,MAAA,SAAS,EAAGP,gBAAf;AAAkC,MAAA,IAAI,EAAGO;AAAzC,OACGD,OADH,CADiB,GAKjB;AAAM,MAAA,SAAS,EAAGN;AAAlB,OAAuCM,OAAvC,CALD;AAQA,WACC;AAAI,MAAA,GAAG,EAAGD;AAAV,OACGI,KADH,EAEGL,IAAI,CAACM,QAAL,GACD,wCACC,4BAAC,mBAAD;AACC,MAAA,iBAAiB,EAAGN,IAAI,CAACM;AAD1B,MADD,CADC,GAME,IARL,CADD;AAYA,GAvBC,CADH,CADD;AA4BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport type { WPElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { NestedHeadingData } from './utils';\n\nconst ENTRY_CLASS_NAME = 'wp-block-table-of-contents__entry';\n\nexport default function TableOfContentsList( {\n\tnestedHeadingList,\n}: {\n\tnestedHeadingList: NestedHeadingData[];\n} ): WPElement {\n\treturn (\n\t\t<>\n\t\t\t{ nestedHeadingList.map( ( node, index ) => {\n\t\t\t\tconst { content, link } = node.heading;\n\n\t\t\t\tconst entry = link ? (\n\t\t\t\t\t<a className={ ENTRY_CLASS_NAME } href={ link }>\n\t\t\t\t\t\t{ content }\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<span className={ ENTRY_CLASS_NAME }>{ content }</span>\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<li key={ index }>\n\t\t\t\t\t\t{ entry }\n\t\t\t\t\t\t{ node.children ? (\n\t\t\t\t\t\t\t<ol>\n\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\tnestedHeadingList={ node.children }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ol>\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t</li>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -22,18 +22,17 @@ var _utils = require("./utils");
|
|
|
22
22
|
/**
|
|
23
23
|
* Internal dependencies
|
|
24
24
|
*/
|
|
25
|
-
function save(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = _ref;
|
|
31
|
-
|
|
25
|
+
function save({
|
|
26
|
+
attributes: {
|
|
27
|
+
headings = []
|
|
28
|
+
}
|
|
29
|
+
}) {
|
|
32
30
|
if (headings.length === 0) {
|
|
33
31
|
return null;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
|
-
return (0, _element.createElement)("nav", _blockEditor.useBlockProps.save()
|
|
34
|
+
return (0, _element.createElement)("nav", { ..._blockEditor.useBlockProps.save()
|
|
35
|
+
}, (0, _element.createElement)("ol", null, (0, _element.createElement)(_list.default, {
|
|
37
36
|
nestedHeadingList: (0, _utils.linearToNestedHeadingList)(headings)
|
|
38
37
|
})));
|
|
39
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/save.js"],"names":["save","attributes","headings","length","useBlockProps"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,IAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/save.js"],"names":["save","attributes","headings","length","useBlockProps"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,IAAT,CAAe;AAAEC,EAAAA,UAAU,EAAE;AAAEC,IAAAA,QAAQ,GAAG;AAAb;AAAd,CAAf,EAAmD;AACjE,MAAKA,QAAQ,CAACC,MAAT,KAAoB,CAAzB,EAA6B;AAC5B,WAAO,IAAP;AACA;;AACD,SACC,wCAAUC,2BAAcJ,IAAd;AAAV,KACC,wCACC,4BAAC,aAAD;AACC,IAAA,iBAAiB,EAAG,sCAA2BE,QAA3B;AADrB,IADD,CADD,CADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\n\nexport default function save( { attributes: { headings = [] } } ) {\n\tif ( headings.length === 0 ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<nav { ...useBlockProps.save() }>\n\t\t\t<ol>\n\t\t\t\t<TableOfContentsList\n\t\t\t\t\tnestedHeadingList={ linearToNestedHeadingList( headings ) }\n\t\t\t\t/>\n\t\t\t</ol>\n\t\t</nav>\n\t);\n}\n"]}
|
|
@@ -22,12 +22,10 @@ function linearToNestedHeadingList(headingList) {
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
if (heading.level === headingList[0].level) {
|
|
25
|
-
var _headingList;
|
|
26
|
-
|
|
27
25
|
// Check that the next iteration will return a value.
|
|
28
26
|
// If it does and the next level is greater than the current level,
|
|
29
27
|
// the next iteration becomes a child of the current iteration.
|
|
30
|
-
if (
|
|
28
|
+
if (headingList[key + 1]?.level > heading.level) {
|
|
31
29
|
// We must calculate the last index before the next iteration that
|
|
32
30
|
// has the same level (siblings). We then use this index to slice
|
|
33
31
|
// the array for use in recursion. This prevents duplicate nodes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/utils.ts"],"names":["linearToNestedHeadingList","headingList","nestedHeadingList","forEach","heading","key","content","level","endOfSlice","length","i","push","children","slice"],"mappings":";;;;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,yBAAT,CACNC,WADM,EAEgB;AACtB,QAAMC,iBAAsC,GAAG,EAA/C;AAEAD,EAAAA,WAAW,CAACE,OAAZ,CAAqB,CAAEC,OAAF,EAAWC,GAAX,KAAoB;AACxC,QAAKD,OAAO,CAACE,OAAR,KAAoB,EAAzB,EAA8B;AAC7B;AACA,KAHuC,CAKxC;;;AACA,QAAKF,OAAO,CAACG,KAAR,KAAkBN,WAAW,CAAE,CAAF,CAAX,CAAiBM,KAAxC,EAAgD;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table-of-contents/utils.ts"],"names":["linearToNestedHeadingList","headingList","nestedHeadingList","forEach","heading","key","content","level","endOfSlice","length","i","push","children","slice"],"mappings":";;;;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,yBAAT,CACNC,WADM,EAEgB;AACtB,QAAMC,iBAAsC,GAAG,EAA/C;AAEAD,EAAAA,WAAW,CAACE,OAAZ,CAAqB,CAAEC,OAAF,EAAWC,GAAX,KAAoB;AACxC,QAAKD,OAAO,CAACE,OAAR,KAAoB,EAAzB,EAA8B;AAC7B;AACA,KAHuC,CAKxC;;;AACA,QAAKF,OAAO,CAACG,KAAR,KAAkBN,WAAW,CAAE,CAAF,CAAX,CAAiBM,KAAxC,EAAgD;AAC/C;AACA;AACA;AACA,UAAKN,WAAW,CAAEI,GAAG,GAAG,CAAR,CAAX,EAAwBE,KAAxB,GAAgCH,OAAO,CAACG,KAA7C,EAAqD;AACpD;AACA;AACA;AACA,YAAIC,UAAU,GAAGP,WAAW,CAACQ,MAA7B;;AACA,aAAM,IAAIC,CAAC,GAAGL,GAAG,GAAG,CAApB,EAAuBK,CAAC,GAAGT,WAAW,CAACQ,MAAvC,EAA+CC,CAAC,EAAhD,EAAqD;AACpD,cAAKT,WAAW,CAAES,CAAF,CAAX,CAAiBH,KAAjB,KAA2BH,OAAO,CAACG,KAAxC,EAAgD;AAC/CC,YAAAA,UAAU,GAAGE,CAAb;AACA;AACA;AACD,SAVmD,CAYpD;AACA;;;AACAR,QAAAA,iBAAiB,CAACS,IAAlB,CAAwB;AACvBP,UAAAA,OADuB;AAEvBQ,UAAAA,QAAQ,EAAEZ,yBAAyB,CAClCC,WAAW,CAACY,KAAZ,CAAmBR,GAAG,GAAG,CAAzB,EAA4BG,UAA5B,CADkC;AAFZ,SAAxB;AAMA,OApBD,MAoBO;AACN;AACAN,QAAAA,iBAAiB,CAACS,IAAlB,CAAwB;AACvBP,UAAAA,OADuB;AAEvBQ,UAAAA,QAAQ,EAAE;AAFa,SAAxB;AAIA;AACD;AACD,GAtCD;AAwCA,SAAOV,iBAAP;AACA","sourcesContent":["export interface HeadingData {\n\t/** The plain text content of the heading. */\n\tcontent: string;\n\t/** The heading level. */\n\tlevel: number;\n\t/** Link to the heading. */\n\tlink: string;\n}\n\nexport interface NestedHeadingData {\n\t/** The heading content, level, and link. */\n\theading: HeadingData;\n\t/** The sub-headings of this heading, if any. */\n\tchildren: NestedHeadingData[] | null;\n}\n\n/**\n * Takes a flat list of heading parameters and nests them based on each header's\n * immediate parent's level.\n *\n * @param headingList The flat list of headings to nest.\n *\n * @return The nested list of headings.\n */\nexport function linearToNestedHeadingList(\n\theadingList: HeadingData[]\n): NestedHeadingData[] {\n\tconst nestedHeadingList: NestedHeadingData[] = [];\n\n\theadingList.forEach( ( heading, key ) => {\n\t\tif ( heading.content === '' ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure we are only working with the same level as the first iteration in our set.\n\t\tif ( heading.level === headingList[ 0 ].level ) {\n\t\t\t// Check that the next iteration will return a value.\n\t\t\t// If it does and the next level is greater than the current level,\n\t\t\t// the next iteration becomes a child of the current iteration.\n\t\t\tif ( headingList[ key + 1 ]?.level > heading.level ) {\n\t\t\t\t// We must calculate the last index before the next iteration that\n\t\t\t\t// has the same level (siblings). We then use this index to slice\n\t\t\t\t// the array for use in recursion. This prevents duplicate nodes.\n\t\t\t\tlet endOfSlice = headingList.length;\n\t\t\t\tfor ( let i = key + 1; i < headingList.length; i++ ) {\n\t\t\t\t\tif ( headingList[ i ].level === heading.level ) {\n\t\t\t\t\t\tendOfSlice = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// We found a child node: Push a new node onto the return array\n\t\t\t\t// with children.\n\t\t\t\tnestedHeadingList.push( {\n\t\t\t\t\theading,\n\t\t\t\t\tchildren: linearToNestedHeadingList(\n\t\t\t\t\t\theadingList.slice( key + 1, endOfSlice )\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\t// No child node: Push a new node onto the return array.\n\t\t\t\tnestedHeadingList.push( {\n\t\t\t\t\theading,\n\t\t\t\t\tchildren: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t} );\n\n\treturn nestedHeadingList;\n}\n"]}
|
package/build/tag-cloud/edit.js
CHANGED
|
@@ -41,12 +41,11 @@ const MAX_TAGS = 100;
|
|
|
41
41
|
const MIN_FONT_SIZE = 0.1;
|
|
42
42
|
const MAX_FONT_SIZE = 100;
|
|
43
43
|
|
|
44
|
-
function TagCloudEdit(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} = _ref;
|
|
44
|
+
function TagCloudEdit({
|
|
45
|
+
attributes,
|
|
46
|
+
setAttributes,
|
|
47
|
+
taxonomies
|
|
48
|
+
}) {
|
|
50
49
|
const {
|
|
51
50
|
taxonomy,
|
|
52
51
|
showTagCounts,
|
|
@@ -89,8 +88,7 @@ function TagCloudEdit(_ref) {
|
|
|
89
88
|
Object.entries({
|
|
90
89
|
smallestFontSize,
|
|
91
90
|
largestFontSize
|
|
92
|
-
}).forEach(
|
|
93
|
-
let [attribute, currentValue] = _ref2;
|
|
91
|
+
}).forEach(([attribute, currentValue]) => {
|
|
94
92
|
const [currentQuantity, currentUnit] = (0, _components.__experimentalParseQuantityAndUnitFromRawValue)(currentValue); // Only add an update if the other font size attribute has a different unit.
|
|
95
93
|
|
|
96
94
|
if (attribute !== fontSizeLabel && currentUnit !== newUnit) {
|
|
@@ -150,7 +148,8 @@ function TagCloudEdit(_ref) {
|
|
|
150
148
|
min: MIN_FONT_SIZE,
|
|
151
149
|
max: MAX_FONT_SIZE
|
|
152
150
|
})))));
|
|
153
|
-
return (0, _element.createElement)(_element.Fragment, null, inspectorControls, (0, _element.createElement)("div", (0, _blockEditor.useBlockProps)()
|
|
151
|
+
return (0, _element.createElement)(_element.Fragment, null, inspectorControls, (0, _element.createElement)("div", { ...(0, _blockEditor.useBlockProps)()
|
|
152
|
+
}, (0, _element.createElement)(_components.Disabled, null, (0, _element.createElement)(_serverSideRender.default, {
|
|
154
153
|
skipBlockSupportAttributes: true,
|
|
155
154
|
block: "core/tag-cloud",
|
|
156
155
|
attributes: attributes
|