@wordpress/block-library 8.2.0 → 8.3.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/babel-plugin.js +1 -1
- package/build/archives/index.js +1 -0
- package/build/archives/index.js.map +1 -1
- package/build/avatar/index.js +1 -0
- package/build/avatar/index.js.map +1 -1
- package/build/block/edit.js +1 -0
- package/build/block/edit.js.map +1 -1
- package/build/button/edit.js +2 -1
- package/build/button/edit.js.map +1 -1
- package/build/button/index.js +1 -0
- package/build/button/index.js.map +1 -1
- package/build/buttons/edit.js +0 -2
- package/build/buttons/edit.js.map +1 -1
- package/build/calendar/index.js +1 -0
- package/build/calendar/index.js.map +1 -1
- package/build/categories/edit.js +3 -3
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +1 -0
- package/build/categories/index.js.map +1 -1
- package/build/column/edit.native.js +2 -1
- package/build/column/edit.native.js.map +1 -1
- package/build/columns/deprecated.js +1 -1
- package/build/columns/deprecated.js.map +1 -1
- package/build/comment-author-avatar/index.js +1 -0
- package/build/comment-author-avatar/index.js.map +1 -1
- package/build/comment-author-name/index.js +1 -0
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-content/index.js +1 -0
- package/build/comment-content/index.js.map +1 -1
- package/build/comment-date/index.js +1 -0
- package/build/comment-date/index.js.map +1 -1
- package/build/comment-edit-link/index.js +1 -0
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +1 -0
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comment-template/index.js +1 -0
- package/build/comment-template/index.js.map +1 -1
- package/build/comments/edit/comments-inspector-controls.js +1 -1
- package/build/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments/index.js +2 -1
- package/build/comments/index.js.map +1 -1
- package/build/comments-pagination/comments-pagination-arrow-controls.js +1 -0
- package/build/comments-pagination/comments-pagination-arrow-controls.js.map +1 -1
- package/build/comments-pagination/edit.js +3 -14
- package/build/comments-pagination/edit.js.map +1 -1
- package/build/comments-pagination/index.js +1 -0
- package/build/comments-pagination/index.js.map +1 -1
- package/build/comments-pagination-next/index.js +1 -0
- package/build/comments-pagination-next/index.js.map +1 -1
- package/build/comments-pagination-numbers/index.js +1 -0
- package/build/comments-pagination-numbers/index.js.map +1 -1
- package/build/comments-pagination-previous/index.js +1 -0
- package/build/comments-pagination-previous/index.js.map +1 -1
- package/build/cover/deprecated.js +153 -30
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/index.js +4 -3
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +45 -4
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/edit.native.js +0 -4
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/index.js +4 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js +3 -2
- package/build/cover/save.js.map +1 -1
- package/build/embed/variations.js +1 -1
- package/build/embed/variations.js.map +1 -1
- package/build/experiments.js +19 -0
- package/build/experiments.js.map +1 -0
- package/build/gallery/deprecated.js +6 -4
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/edit.js +48 -7
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +8 -34
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/v1/edit.js +5 -5
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/group/deprecated.js +1 -1
- package/build/group/deprecated.js.map +1 -1
- package/build/group/edit.js +1 -2
- package/build/group/edit.js.map +1 -1
- package/build/heading/index.js +1 -7
- package/build/heading/index.js.map +1 -1
- package/build/home-link/index.js +1 -0
- package/build/home-link/index.js.map +1 -1
- package/build/image/edit.native.js +2 -2
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +12 -15
- package/build/image/image.js.map +1 -1
- package/build/latest-comments/index.js +1 -0
- package/build/latest-comments/index.js.map +1 -1
- package/build/latest-posts/deprecated.js +1 -0
- package/build/latest-posts/deprecated.js.map +1 -1
- package/build/latest-posts/index.js +1 -0
- package/build/latest-posts/index.js.map +1 -1
- package/build/list/ordered-list-settings.js +1 -0
- package/build/list/ordered-list-settings.js.map +1 -1
- package/build/loginout/index.js +1 -0
- package/build/loginout/index.js.map +1 -1
- package/build/media-text/edit.js +2 -4
- package/build/media-text/edit.js.map +1 -1
- package/build/missing/edit.native.js +4 -4
- package/build/missing/edit.native.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +31 -0
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -0
- package/build/navigation/edit/index.js +19 -11
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +0 -5
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/manage-menus-button.js +9 -2
- package/build/navigation/edit/manage-menus-button.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +39 -48
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/edit/navigation-menu-delete-control.js +0 -1
- package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build/navigation/edit/navigation-menu-name-control.js +1 -0
- package/build/navigation/edit/navigation-menu-name-control.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +11 -52
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/overlay-menu-preview.js +1 -0
- package/build/navigation/edit/overlay-menu-preview.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +1 -6
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/index.js +5 -0
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/menu-items-to-blocks.js +0 -2
- package/build/navigation/menu-items-to-blocks.js.map +1 -1
- package/build/navigation-link/edit.js +17 -8
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +4 -0
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/index.js +13 -3
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/page-list/edit.js +153 -132
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list/index.js +2 -11
- package/build/page-list/index.js.map +1 -1
- package/build/page-list/{convert-to-navigation-links.js → use-convert-to-navigation-links.js} +41 -9
- package/build/page-list/use-convert-to-navigation-links.js.map +1 -0
- package/build/page-list-item/edit.js +4 -2
- package/build/page-list-item/edit.js.map +1 -1
- package/build/page-list-item/index.js +1 -1
- package/build/page-list-item/index.js.map +1 -1
- package/build/paragraph/edit.js +1 -1
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/index.js +1 -7
- package/build/paragraph/index.js.map +1 -1
- package/build/post-author/index.js +1 -0
- package/build/post-author/index.js.map +1 -1
- package/build/post-author-biography/index.js +1 -0
- package/build/post-author-biography/index.js.map +1 -1
- package/build/post-author-name/index.js +1 -1
- package/build/post-comment/edit.js +1 -0
- package/build/post-comment/edit.js.map +1 -1
- package/build/post-comments-count/index.js +1 -0
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-form/index.js +1 -0
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-comments-link/index.js +1 -0
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-content/edit.js +1 -20
- package/build/post-content/edit.js.map +1 -1
- package/build/post-content/index.js +1 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-date/index.js +1 -0
- package/build/post-date/index.js.map +1 -1
- package/build/post-excerpt/edit.js +6 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-excerpt/index.js +1 -0
- package/build/post-excerpt/index.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +2 -1
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js +39 -22
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +1 -0
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-featured-image/overlay.js +1 -1
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/post-navigation-link/edit.js +1 -0
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/post-navigation-link/index.js +1 -0
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-template/edit.js +6 -4
- package/build/post-template/edit.js.map +1 -1
- package/build/post-template/index.js +1 -0
- package/build/post-template/index.js.map +1 -1
- package/build/post-terms/edit.js +5 -4
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/index.js +1 -0
- package/build/post-terms/index.js.map +1 -1
- package/build/post-title/edit.js +1 -0
- package/build/post-title/edit.js.map +1 -1
- package/build/post-title/index.js +1 -0
- package/build/post-title/index.js.map +1 -1
- package/build/query/deprecated.js +90 -1
- package/build/query/deprecated.js.map +1 -1
- package/build/query/edit/index.js +2 -50
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +1 -0
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -2
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/edit/pattern-selection-modal.js +88 -0
- package/build/query/edit/pattern-selection-modal.js.map +1 -0
- package/build/query/edit/query-content.js +3 -24
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/edit/query-placeholder.js +2 -2
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/edit/query-toolbar.js +6 -11
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/query/index.js +1 -0
- package/build/query/index.js.map +1 -1
- package/build/query/utils.js +25 -3
- package/build/query/utils.js.map +1 -1
- package/build/query-no-results/index.js +1 -0
- package/build/query-no-results/index.js.map +1 -1
- package/build/query-pagination/edit.js +3 -14
- package/build/query-pagination/edit.js.map +1 -1
- package/build/query-pagination/index.js +1 -0
- package/build/query-pagination/index.js.map +1 -1
- package/build/query-pagination/query-pagination-arrow-controls.js +1 -0
- package/build/query-pagination/query-pagination-arrow-controls.js.map +1 -1
- package/build/query-pagination-next/index.js +1 -0
- package/build/query-pagination-next/index.js.map +1 -1
- package/build/query-pagination-numbers/index.js +1 -0
- package/build/query-pagination-numbers/index.js.map +1 -1
- package/build/query-pagination-previous/index.js +1 -0
- package/build/query-pagination-previous/index.js.map +1 -1
- package/build/query-title/index.js +1 -0
- package/build/query-title/index.js.map +1 -1
- package/build/read-more/index.js +1 -0
- package/build/read-more/index.js.map +1 -1
- package/build/rss/edit.js +5 -2
- package/build/rss/edit.js.map +1 -1
- package/build/rss/index.js +1 -0
- package/build/rss/index.js.map +1 -1
- package/build/search/index.js +1 -0
- package/build/search/index.js.map +1 -1
- package/build/site-logo/edit.js +9 -13
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +1 -0
- package/build/site-logo/index.js.map +1 -1
- package/build/site-tagline/index.js +1 -0
- package/build/site-tagline/index.js.map +1 -1
- package/build/site-title/index.js +1 -0
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/edit.js +3 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/index.js +1 -0
- package/build/social-link/index.js.map +1 -1
- package/build/social-links/edit.js +3 -14
- package/build/social-links/edit.js.map +1 -1
- package/build/table/edit.js +9 -5
- package/build/table/edit.js.map +1 -1
- package/build/table/index.js +15 -0
- package/build/table/index.js.map +1 -1
- package/build/table/save.js +4 -2
- package/build/table/save.js.map +1 -1
- package/build/table/state.js +1 -1
- package/build/table/state.js.map +1 -1
- package/build/table/transforms.js +47 -3
- package/build/table/transforms.js.map +1 -1
- package/build/table/utils.js +26 -0
- package/build/table/utils.js.map +1 -0
- package/build/tag-cloud/edit.js +3 -9
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/tag-cloud/index.js +1 -0
- package/build/tag-cloud/index.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +2 -1
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/index.js +0 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +3 -3
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/template-part/edit/title-modal.js +6 -5
- package/build/template-part/edit/title-modal.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +2 -2
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/template-part/index.js +1 -0
- package/build/template-part/index.js.map +1 -1
- package/build/term-description/index.js +1 -0
- package/build/term-description/index.js.map +1 -1
- package/build/utils/init-block.js +1 -1
- package/build/utils/init-block.js.map +1 -1
- package/build/utils/init-block.native.js +1 -1
- package/build/utils/init-block.native.js.map +1 -1
- package/build/{template-part/edit/utils/search.js → utils/search-patterns.js} +3 -1
- package/build/utils/search-patterns.js.map +1 -0
- package/build/video/tracks-editor.js +17 -11
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/archives/index.js +1 -0
- package/build-module/archives/index.js.map +1 -1
- package/build-module/avatar/index.js +1 -0
- package/build-module/avatar/index.js.map +1 -1
- package/build-module/block/edit.js +1 -0
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/edit.js +2 -1
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/index.js +1 -0
- package/build-module/button/index.js.map +1 -1
- package/build-module/buttons/edit.js +0 -2
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/calendar/index.js +1 -0
- package/build-module/calendar/index.js.map +1 -1
- package/build-module/categories/edit.js +2 -2
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +1 -0
- package/build-module/categories/index.js.map +1 -1
- package/build-module/column/edit.native.js +2 -1
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/columns/deprecated.js +1 -1
- package/build-module/columns/deprecated.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +1 -0
- package/build-module/comment-author-avatar/index.js.map +1 -1
- package/build-module/comment-author-name/index.js +1 -0
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-content/index.js +1 -0
- package/build-module/comment-content/index.js.map +1 -1
- package/build-module/comment-date/index.js +1 -0
- package/build-module/comment-date/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +1 -0
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +1 -0
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comment-template/index.js +1 -0
- package/build-module/comment-template/index.js.map +1 -1
- package/build-module/comments/edit/comments-inspector-controls.js +1 -1
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments/index.js +2 -1
- package/build-module/comments/index.js.map +1 -1
- package/build-module/comments-pagination/comments-pagination-arrow-controls.js +1 -0
- package/build-module/comments-pagination/comments-pagination-arrow-controls.js.map +1 -1
- package/build-module/comments-pagination/edit.js +3 -14
- package/build-module/comments-pagination/edit.js.map +1 -1
- package/build-module/comments-pagination/index.js +1 -0
- package/build-module/comments-pagination/index.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +1 -0
- package/build-module/comments-pagination-next/index.js.map +1 -1
- package/build-module/comments-pagination-numbers/index.js +1 -0
- package/build-module/comments-pagination-numbers/index.js.map +1 -1
- package/build-module/comments-pagination-previous/index.js +1 -0
- package/build-module/comments-pagination-previous/index.js.map +1 -1
- package/build-module/cover/deprecated.js +155 -31
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/index.js +4 -3
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +46 -5
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/edit.native.js +0 -4
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/index.js +4 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js +3 -2
- package/build-module/cover/save.js.map +1 -1
- package/build-module/embed/variations.js +1 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/experiments.js +9 -0
- package/build-module/experiments.js.map +1 -0
- package/build-module/gallery/deprecated.js +6 -3
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/edit.js +50 -10
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +9 -35
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/v1/edit.js +6 -6
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/group/deprecated.js +1 -1
- package/build-module/group/deprecated.js.map +1 -1
- package/build-module/group/edit.js +1 -2
- package/build-module/group/edit.js.map +1 -1
- package/build-module/heading/index.js +1 -6
- package/build-module/heading/index.js.map +1 -1
- package/build-module/home-link/index.js +1 -0
- package/build-module/home-link/index.js.map +1 -1
- package/build-module/image/edit.native.js +2 -2
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +14 -17
- package/build-module/image/image.js.map +1 -1
- package/build-module/latest-comments/index.js +1 -0
- package/build-module/latest-comments/index.js.map +1 -1
- package/build-module/latest-posts/deprecated.js +1 -0
- package/build-module/latest-posts/deprecated.js.map +1 -1
- package/build-module/latest-posts/index.js +1 -0
- package/build-module/latest-posts/index.js.map +1 -1
- package/build-module/list/ordered-list-settings.js +1 -0
- package/build-module/list/ordered-list-settings.js.map +1 -1
- package/build-module/loginout/index.js +1 -0
- package/build-module/loginout/index.js.map +1 -1
- package/build-module/media-text/edit.js +2 -3
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/missing/edit.native.js +4 -4
- package/build-module/missing/edit.native.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +21 -0
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -0
- package/build-module/navigation/edit/index.js +18 -11
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +0 -5
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/manage-menus-button.js +10 -3
- package/build-module/navigation/edit/manage-menus-button.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +38 -49
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js +0 -1
- package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-name-control.js +1 -0
- package/build-module/navigation/edit/navigation-menu-name-control.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +13 -54
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/overlay-menu-preview.js +1 -0
- package/build-module/navigation/edit/overlay-menu-preview.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +1 -6
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/index.js +5 -0
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/menu-items-to-blocks.js +0 -2
- package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
- package/build-module/navigation-link/edit.js +16 -7
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +4 -0
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/index.js +14 -4
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/page-list/edit.js +155 -132
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list/index.js +3 -12
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/page-list/{convert-to-navigation-links.js → use-convert-to-navigation-links.js} +37 -7
- package/build-module/page-list/use-convert-to-navigation-links.js.map +1 -0
- package/build-module/page-list-item/edit.js +3 -2
- package/build-module/page-list-item/edit.js.map +1 -1
- package/build-module/page-list-item/index.js +1 -1
- package/build-module/page-list-item/index.js.map +1 -1
- package/build-module/paragraph/edit.js +1 -1
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/index.js +1 -6
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/post-author/index.js +1 -0
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-author-biography/index.js +1 -0
- package/build-module/post-author-biography/index.js.map +1 -1
- package/build-module/post-author-name/index.js +1 -1
- package/build-module/post-comment/edit.js +1 -0
- package/build-module/post-comment/edit.js.map +1 -1
- package/build-module/post-comments-count/index.js +1 -0
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-form/index.js +1 -0
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +1 -0
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-content/edit.js +2 -20
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-content/index.js +1 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-date/index.js +1 -0
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-excerpt/edit.js +6 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-excerpt/index.js +1 -0
- package/build-module/post-excerpt/index.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +2 -1
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +39 -22
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +1 -0
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-featured-image/overlay.js +1 -1
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/post-navigation-link/edit.js +1 -0
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/post-navigation-link/index.js +1 -0
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-template/edit.js +6 -4
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-template/index.js +1 -0
- package/build-module/post-template/index.js.map +1 -1
- package/build-module/post-terms/edit.js +4 -3
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/index.js +1 -0
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-title/edit.js +1 -0
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/post-title/index.js +1 -0
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/deprecated.js +87 -1
- package/build-module/query/deprecated.js.map +1 -1
- package/build-module/query/edit/index.js +4 -50
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +1 -0
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -2
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/edit/pattern-selection-modal.js +75 -0
- package/build-module/query/edit/pattern-selection-modal.js.map +1 -0
- package/build-module/query/edit/query-content.js +4 -25
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +2 -2
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +6 -10
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/query/index.js +1 -0
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/utils.js +21 -2
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-no-results/index.js +1 -0
- package/build-module/query-no-results/index.js.map +1 -1
- package/build-module/query-pagination/edit.js +3 -14
- package/build-module/query-pagination/edit.js.map +1 -1
- package/build-module/query-pagination/index.js +1 -0
- package/build-module/query-pagination/index.js.map +1 -1
- package/build-module/query-pagination/query-pagination-arrow-controls.js +1 -0
- package/build-module/query-pagination/query-pagination-arrow-controls.js.map +1 -1
- package/build-module/query-pagination-next/index.js +1 -0
- package/build-module/query-pagination-next/index.js.map +1 -1
- package/build-module/query-pagination-numbers/index.js +1 -0
- package/build-module/query-pagination-numbers/index.js.map +1 -1
- package/build-module/query-pagination-previous/index.js +1 -0
- package/build-module/query-pagination-previous/index.js.map +1 -1
- package/build-module/query-title/index.js +1 -0
- package/build-module/query-title/index.js.map +1 -1
- package/build-module/read-more/index.js +1 -0
- package/build-module/read-more/index.js.map +1 -1
- package/build-module/rss/edit.js +6 -3
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/rss/index.js +1 -0
- package/build-module/rss/index.js.map +1 -1
- package/build-module/search/index.js +1 -0
- package/build-module/search/index.js.map +1 -1
- package/build-module/site-logo/edit.js +10 -14
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +1 -0
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-tagline/index.js +1 -0
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/site-title/index.js +1 -0
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/edit.js +3 -1
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/index.js +1 -0
- package/build-module/social-link/index.js.map +1 -1
- package/build-module/social-links/edit.js +3 -14
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/table/edit.js +9 -5
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/index.js +15 -0
- package/build-module/table/index.js.map +1 -1
- package/build-module/table/save.js +4 -2
- package/build-module/table/save.js.map +1 -1
- package/build-module/table/state.js +1 -1
- package/build-module/table/state.js.map +1 -1
- package/build-module/table/transforms.js +46 -3
- package/build-module/table/transforms.js.map +1 -1
- package/build-module/table/utils.js +19 -0
- package/build-module/table/utils.js.map +1 -0
- package/build-module/tag-cloud/edit.js +4 -9
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/tag-cloud/index.js +1 -0
- package/build-module/tag-cloud/index.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +2 -1
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/index.js +0 -1
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +1 -1
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/template-part/edit/title-modal.js +7 -6
- package/build-module/template-part/edit/title-modal.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +2 -2
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/template-part/index.js +1 -0
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/term-description/index.js +1 -0
- package/build-module/term-description/index.js.map +1 -1
- package/build-module/utils/init-block.js +1 -1
- package/build-module/utils/init-block.js.map +1 -1
- package/build-module/utils/init-block.native.js +1 -1
- package/build-module/utils/init-block.native.js.map +1 -1
- package/build-module/{template-part/edit/utils/search.js → utils/search-patterns.js} +3 -5
- package/build-module/utils/search-patterns.js.map +1 -0
- package/build-module/video/tracks-editor.js +18 -12
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/common-rtl.css +14 -0
- package/build-style/common.css +14 -0
- package/build-style/editor-rtl.css +14 -67
- package/build-style/editor.css +14 -67
- package/build-style/post-excerpt/style-rtl.css +15 -0
- package/build-style/post-excerpt/style.css +15 -0
- package/build-style/query/editor-rtl.css +11 -14
- package/build-style/query/editor.css +11 -14
- package/build-style/rss/editor-rtl.css +3 -16
- package/build-style/rss/editor.css +3 -16
- package/build-style/style-rtl.css +29 -0
- package/build-style/style.css +29 -0
- package/build-style/table/editor-rtl.css +0 -3
- package/build-style/table/editor.css +0 -3
- package/build-style/video/editor-rtl.css +0 -34
- package/build-style/video/editor.css +0 -34
- package/package.json +30 -29
- package/src/archives/block.json +1 -0
- package/src/avatar/block.json +1 -0
- package/src/block/edit.js +1 -0
- package/src/button/block.json +1 -0
- package/src/button/edit.js +2 -1
- package/src/buttons/edit.js +2 -2
- package/src/calendar/block.json +1 -0
- package/src/calendar/index.php +4 -2
- package/src/categories/block.json +1 -0
- package/src/categories/edit.js +2 -2
- package/src/column/edit.native.js +6 -1
- package/src/columns/deprecated.js +1 -1
- package/src/comment-author-avatar/block.json +1 -0
- package/src/comment-author-name/block.json +1 -0
- package/src/comment-author-name/index.php +6 -3
- package/src/comment-content/block.json +1 -0
- package/src/comment-content/index.php +6 -3
- package/src/comment-date/block.json +1 -0
- package/src/comment-date/index.php +1 -1
- package/src/comment-edit-link/block.json +1 -0
- package/src/comment-edit-link/index.php +6 -3
- package/src/comment-reply-link/block.json +1 -0
- package/src/comment-reply-link/index.php +6 -3
- package/src/comment-template/block.json +1 -0
- package/src/comments/block.json +2 -1
- package/src/comments/edit/comments-inspector-controls.js +1 -1
- package/src/comments-pagination/block.json +1 -0
- package/src/comments-pagination/comments-pagination-arrow-controls.js +1 -0
- package/src/comments-pagination/edit.js +1 -13
- package/src/comments-pagination/index.php +4 -1
- package/src/comments-pagination-next/block.json +1 -0
- package/src/comments-pagination-numbers/block.json +1 -0
- package/src/comments-pagination-previous/block.json +1 -0
- package/src/common.scss +19 -0
- package/src/cover/block.json +4 -0
- package/src/cover/deprecated.js +173 -6
- package/src/cover/edit/index.js +5 -4
- package/src/cover/edit/inspector-controls.js +45 -2
- package/src/cover/edit.native.js +0 -3
- package/src/cover/save.js +3 -2
- package/src/embed/variations.js +1 -1
- package/src/experiments.js +10 -0
- package/src/gallery/deprecated.js +2 -3
- package/src/gallery/edit.js +66 -5
- package/src/gallery/gallery.js +27 -44
- package/src/gallery/index.php +1 -1
- package/src/gallery/v1/edit.js +8 -9
- package/src/group/deprecated.js +3 -1
- package/src/group/edit.js +1 -2
- package/src/heading/index.js +1 -6
- package/src/home-link/block.json +1 -0
- package/src/image/edit.native.js +2 -3
- package/src/image/image.js +17 -22
- package/src/latest-comments/block.json +1 -0
- package/src/latest-posts/block.json +1 -0
- package/src/latest-posts/index.php +9 -10
- package/src/list/ordered-list-settings.js +1 -0
- package/src/loginout/block.json +1 -0
- package/src/media-text/edit.js +3 -7
- package/src/missing/edit.native.js +3 -4
- package/src/missing/test/edit.native.js +2 -2
- package/src/navigation/block.json +2 -0
- package/src/navigation/edit/deleted-navigation-warning.js +19 -0
- package/src/navigation/edit/index.js +22 -24
- package/src/navigation/edit/inner-blocks.js +0 -6
- package/src/navigation/edit/manage-menus-button.js +24 -13
- package/src/navigation/edit/menu-inspector-controls.js +51 -74
- package/src/navigation/edit/navigation-menu-delete-control.js +0 -1
- package/src/navigation/edit/navigation-menu-name-control.js +1 -0
- package/src/navigation/edit/navigation-menu-selector.js +12 -77
- package/src/navigation/edit/overlay-menu-preview.js +1 -0
- package/src/navigation/edit/placeholder/index.js +0 -6
- package/src/navigation/index.js +3 -0
- package/src/navigation/index.php +27 -9
- package/src/navigation/menu-items-to-blocks.js +0 -2
- package/src/navigation-link/edit.js +16 -7
- package/src/navigation-link/index.php +2 -34
- package/src/navigation-submenu/edit.js +4 -0
- package/src/navigation-submenu/index.js +8 -2
- package/src/navigation-submenu/index.php +2 -34
- package/src/page-list/block.json +1 -0
- package/src/page-list/edit.js +196 -161
- package/src/page-list/index.js +2 -8
- package/src/page-list/test/convert-to-links-modal.js +1 -1
- package/src/page-list/{convert-to-navigation-links.js → use-convert-to-navigation-links.js} +36 -6
- package/src/page-list-item/edit.js +3 -2
- package/src/page-list-item/index.js +1 -1
- package/src/paragraph/edit.js +1 -1
- package/src/paragraph/index.js +1 -6
- package/src/post-author/block.json +1 -0
- package/src/post-author/index.php +10 -4
- package/src/post-author-biography/block.json +1 -0
- package/src/post-author-name/block.json +1 -1
- package/src/post-author-name/index.php +9 -4
- package/src/post-comment/edit.js +1 -0
- package/src/post-comments-count/block.json +1 -0
- package/src/post-comments-form/block.json +1 -0
- package/src/post-comments-form/index.php +6 -4
- package/src/post-comments-link/block.json +1 -0
- package/src/post-comments-link/index.php +8 -2
- package/src/post-content/block.json +1 -0
- package/src/post-content/edit.js +2 -13
- package/src/post-date/block.json +1 -0
- package/src/post-date/index.php +10 -3
- package/src/post-excerpt/block.json +1 -0
- package/src/post-excerpt/edit.js +22 -12
- package/src/post-excerpt/index.php +6 -3
- package/src/post-excerpt/style.scss +18 -0
- package/src/post-featured-image/block.json +1 -0
- package/src/post-featured-image/dimension-controls.js +2 -1
- package/src/post-featured-image/edit.js +46 -27
- package/src/post-featured-image/index.php +19 -6
- package/src/post-featured-image/overlay.js +1 -1
- package/src/post-navigation-link/block.json +1 -0
- package/src/post-navigation-link/edit.js +1 -0
- package/src/post-template/block.json +1 -0
- package/src/post-template/edit.js +4 -3
- package/src/post-template/index.php +4 -1
- package/src/post-terms/block.json +1 -0
- package/src/post-terms/edit.js +4 -3
- package/src/post-terms/index.php +6 -3
- package/src/post-title/block.json +1 -0
- package/src/post-title/edit.js +1 -0
- package/src/post-title/index.php +10 -4
- package/src/preformatted/test/__snapshots__/edit.native.js.snap +0 -2
- package/src/query/block.json +1 -0
- package/src/query/deprecated.js +77 -1
- package/src/query/edit/index.js +4 -60
- package/src/query/edit/inspector-controls/index.js +1 -0
- package/src/query/edit/inspector-controls/taxonomy-controls.js +2 -2
- package/src/query/edit/pattern-selection-modal.js +86 -0
- package/src/query/edit/query-content.js +1 -12
- package/src/query/edit/query-placeholder.js +4 -8
- package/src/query/edit/query-toolbar.js +6 -16
- package/src/query/editor.scss +21 -19
- package/src/query/utils.js +22 -8
- package/src/query-no-results/block.json +1 -0
- package/src/query-no-results/index.php +3 -1
- package/src/query-pagination/block.json +1 -0
- package/src/query-pagination/edit.js +1 -13
- package/src/query-pagination/index.php +2 -0
- package/src/query-pagination/query-pagination-arrow-controls.js +1 -0
- package/src/query-pagination-next/block.json +1 -0
- package/src/query-pagination-numbers/block.json +1 -0
- package/src/query-pagination-previous/block.json +1 -0
- package/src/query-title/block.json +1 -0
- package/src/read-more/block.json +1 -0
- package/src/rss/block.json +1 -0
- package/src/rss/edit.js +16 -12
- package/src/rss/editor.scss +4 -15
- package/src/search/block.json +1 -0
- package/src/search/index.php +2 -2
- package/src/site-logo/block.json +1 -0
- package/src/site-logo/edit.js +9 -16
- package/src/site-tagline/block.json +1 -0
- package/src/site-title/block.json +1 -0
- package/src/site-title/index.php +6 -3
- package/src/social-link/block.json +1 -0
- package/src/social-link/edit.js +3 -1
- package/src/social-links/edit.js +1 -14
- package/src/table/block.json +15 -0
- package/src/table/edit.js +38 -26
- package/src/table/editor.scss +0 -6
- package/src/table/save.js +9 -1
- package/src/table/state.js +1 -1
- package/src/table/test/utils.js +20 -0
- package/src/table/transforms.js +65 -2
- package/src/table/utils.js +18 -0
- package/src/tag-cloud/block.json +1 -0
- package/src/tag-cloud/edit.js +12 -15
- package/src/template-part/block.json +1 -0
- package/src/template-part/edit/advanced-controls.js +2 -1
- package/src/template-part/edit/index.js +0 -1
- package/src/template-part/edit/selection-modal.js +1 -1
- package/src/template-part/edit/title-modal.js +12 -15
- package/src/template-part/edit/utils/hooks.js +3 -8
- package/src/template-part/index.php +19 -7
- package/src/term-description/block.json +1 -0
- package/src/term-description/index.php +8 -4
- package/src/utils/init-block.js +1 -1
- package/src/utils/init-block.native.js +1 -1
- package/src/{template-part/edit/utils/search.js → utils/search-patterns.js} +2 -2
- package/src/utils/test/search-patterns.js +58 -0
- package/src/video/editor.scss +0 -35
- package/src/video/tracks-editor.js +65 -51
- package/tsconfig.tsbuildinfo +1 -1
- package/build/page-list/constants.js +0 -15
- package/build/page-list/constants.js.map +0 -1
- package/build/page-list/convert-to-links-modal.js +0 -83
- package/build/page-list/convert-to-links-modal.js.map +0 -1
- package/build/page-list/convert-to-navigation-links.js.map +0 -1
- package/build/template-part/edit/utils/search.js.map +0 -1
- package/build-module/page-list/constants.js +0 -6
- package/build-module/page-list/constants.js.map +0 -1
- package/build-module/page-list/convert-to-links-modal.js +0 -68
- package/build-module/page-list/convert-to-links-modal.js.map +0 -1
- package/build-module/page-list/convert-to-navigation-links.js.map +0 -1
- package/build-module/template-part/edit/utils/search.js.map +0 -1
- package/src/page-list/constants.js +0 -8
- package/src/page-list/convert-to-links-modal.js +0 -70
package/build/table/edit.js
CHANGED
|
@@ -174,7 +174,7 @@ function TableEdit(_ref2) {
|
|
|
174
174
|
/**
|
|
175
175
|
* Get the alignment of the currently selected cell.
|
|
176
176
|
*
|
|
177
|
-
* @return {string} The new alignment to apply to the column.
|
|
177
|
+
* @return {string | undefined} The new alignment to apply to the column.
|
|
178
178
|
*/
|
|
179
179
|
|
|
180
180
|
|
|
@@ -391,7 +391,8 @@ function TableEdit(_ref2) {
|
|
|
391
391
|
tag: CellTag,
|
|
392
392
|
scope,
|
|
393
393
|
align,
|
|
394
|
-
colspan
|
|
394
|
+
colspan,
|
|
395
|
+
rowspan
|
|
395
396
|
} = _ref4;
|
|
396
397
|
return (0, _element.createElement)(_blockEditor.RichText, {
|
|
397
398
|
tagName: CellTag,
|
|
@@ -401,6 +402,7 @@ function TableEdit(_ref2) {
|
|
|
401
402
|
}, 'wp-block-table__cell-content'),
|
|
402
403
|
scope: CellTag === 'th' ? scope : undefined,
|
|
403
404
|
colSpan: colspan,
|
|
405
|
+
rowSpan: rowspan,
|
|
404
406
|
value: content,
|
|
405
407
|
onChange: onChange,
|
|
406
408
|
unstableOnFocus: () => {
|
|
@@ -433,14 +435,14 @@ function TableEdit(_ref2) {
|
|
|
433
435
|
icon: _icons.table,
|
|
434
436
|
label: (0, _i18n.__)('Edit table'),
|
|
435
437
|
controls: tableControls
|
|
436
|
-
}))),
|
|
438
|
+
}))), (0, _element.createElement)(_blockEditor.InspectorControls, null, (0, _element.createElement)(_components.PanelBody, {
|
|
437
439
|
title: (0, _i18n.__)('Settings'),
|
|
438
440
|
className: "blocks-table-settings"
|
|
439
441
|
}, (0, _element.createElement)(_components.ToggleControl, {
|
|
440
442
|
label: (0, _i18n.__)('Fixed width table cells'),
|
|
441
443
|
checked: !!hasFixedLayout,
|
|
442
444
|
onChange: onChangeFixedLayout
|
|
443
|
-
}), (0, _element.createElement)(_components.ToggleControl, {
|
|
445
|
+
}), !isEmpty && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.ToggleControl, {
|
|
444
446
|
label: (0, _i18n.__)('Header section'),
|
|
445
447
|
checked: !!(head && head.length),
|
|
446
448
|
onChange: onToggleHeaderSection
|
|
@@ -448,7 +450,7 @@ function TableEdit(_ref2) {
|
|
|
448
450
|
label: (0, _i18n.__)('Footer section'),
|
|
449
451
|
checked: !!(foot && foot.length),
|
|
450
452
|
onChange: onToggleFooterSection
|
|
451
|
-
}))), !isEmpty && (0, _element.createElement)("table", {
|
|
453
|
+
})))), !isEmpty && (0, _element.createElement)("table", {
|
|
452
454
|
className: (0, _classnames.default)(colorProps.className, borderProps.className, {
|
|
453
455
|
'has-fixed-layout': hasFixedLayout,
|
|
454
456
|
// This is required in the editor only to overcome
|
|
@@ -483,6 +485,7 @@ function TableEdit(_ref2) {
|
|
|
483
485
|
className: "blocks-table__placeholder-form",
|
|
484
486
|
onSubmit: onCreateTable
|
|
485
487
|
}, (0, _element.createElement)(_components.TextControl, {
|
|
488
|
+
__nextHasNoMarginBottom: true,
|
|
486
489
|
type: "number",
|
|
487
490
|
label: (0, _i18n.__)('Column count'),
|
|
488
491
|
value: initialColumnCount,
|
|
@@ -490,6 +493,7 @@ function TableEdit(_ref2) {
|
|
|
490
493
|
min: "1",
|
|
491
494
|
className: "blocks-table__placeholder-input"
|
|
492
495
|
}), (0, _element.createElement)(_components.TextControl, {
|
|
496
|
+
__nextHasNoMarginBottom: true,
|
|
493
497
|
type: "number",
|
|
494
498
|
label: (0, _i18n.__)('Row count'),
|
|
495
499
|
value: initialRowCount,
|
package/build/table/edit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/table/edit.js"],"names":["ALIGNMENT_CONTROLS","icon","alignLeft","title","align","alignCenter","alignRight","cellAriaLabel","head","body","foot","placeholder","TSection","name","props","TagName","TableEdit","attributes","setAttributes","insertBlocksAfter","isSelected","hasFixedLayout","caption","initialRowCount","setInitialRowCount","initialColumnCount","setInitialColumnCount","selectedCell","setSelectedCell","colorProps","borderProps","tableRef","hasTableCreated","setHasTableCreated","onChangeInitialColumnCount","count","onChangeInitialRowCount","onCreateTable","event","preventDefault","rowCount","parseInt","columnCount","onChangeFixedLayout","onChange","content","cellAttributes","onChangeColumnAlignment","columnSelection","type","columnIndex","newAttributes","getCellAlignment","onToggleHeaderSection","onToggleFooterSection","onInsertRow","delta","sectionName","rowIndex","newRowIndex","onInsertRowBefore","onInsertRowAfter","onDeleteRow","onInsertColumn","newColumnIndex","onInsertColumnBefore","onInsertColumnAfter","onDeleteColumn","current","querySelector","focus","sections","filter","tableControls","tableRowBefore","isDisabled","onClick","tableRowAfter","tableRowDelete","tableColumnBefore","tableColumnAfter","tableColumnDelete","renderedSections","map","cells","tag","CellTag","scope","colspan","undefined","isEmpty","length","ref","nextAlign","table","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eAHT;AAIC,IAAA,QAAQ,EAAGa,uBAJZ;AAKC,IAAA,GAAG,EAAC,GALL;AAMC,IAAA,SAAS,EAAC;AANX,IAZD,EAoBC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,kCADX;AAEC,IAAA,OAAO,EAAC,SAFT;AAGC,IAAA,IAAI,EAAC;AAHN,KAKG,cAAI,cAAJ,CALH,CApBD,CALD,CAxFF,CADD;AA8HA;;eAEcpB,S","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tRichText,\n\tBlockIcon,\n\tAlignmentControl,\n\tuseBlockProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tPanelBody,\n\tPlaceholder,\n\tTextControl,\n\tToggleControl,\n\tToolbarDropdownMenu,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport {\n\talignLeft,\n\talignRight,\n\talignCenter,\n\tblockTable as icon,\n\ttableColumnAfter,\n\ttableColumnBefore,\n\ttableColumnDelete,\n\ttableRowAfter,\n\ttableRowBefore,\n\ttableRowDelete,\n\ttable,\n} from '@wordpress/icons';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcreateTable,\n\tupdateSelectedCell,\n\tgetCellAttribute,\n\tinsertRow,\n\tdeleteRow,\n\tinsertColumn,\n\tdeleteColumn,\n\ttoggleSection,\n\tisEmptyTableSection,\n} from './state';\n\nconst ALIGNMENT_CONTROLS = [\n\t{\n\t\ticon: alignLeft,\n\t\ttitle: __( 'Align column left' ),\n\t\talign: 'left',\n\t},\n\t{\n\t\ticon: alignCenter,\n\t\ttitle: __( 'Align column center' ),\n\t\talign: 'center',\n\t},\n\t{\n\t\ticon: alignRight,\n\t\ttitle: __( 'Align column right' ),\n\t\talign: 'right',\n\t},\n];\n\nconst cellAriaLabel = {\n\thead: __( 'Header cell text' ),\n\tbody: __( 'Body cell text' ),\n\tfoot: __( 'Footer cell text' ),\n};\n\nconst placeholder = {\n\thead: __( 'Header label' ),\n\tfoot: __( 'Footer label' ),\n};\n\nfunction TSection( { name, ...props } ) {\n\tconst TagName = `t${ name }`;\n\treturn <TagName { ...props } />;\n}\n\nfunction TableEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tisSelected,\n} ) {\n\tconst { hasFixedLayout, caption, head, foot } = attributes;\n\tconst [ initialRowCount, setInitialRowCount ] = useState( 2 );\n\tconst [ initialColumnCount, setInitialColumnCount ] = useState( 2 );\n\tconst [ selectedCell, setSelectedCell ] = useState();\n\n\tconst colorProps = useColorProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\n\tconst tableRef = useRef();\n\tconst [ hasTableCreated, setHasTableCreated ] = useState( false );\n\n\t/**\n\t * Updates the initial column count used for table creation.\n\t *\n\t * @param {number} count New initial column count.\n\t */\n\tfunction onChangeInitialColumnCount( count ) {\n\t\tsetInitialColumnCount( count );\n\t}\n\n\t/**\n\t * Updates the initial row count used for table creation.\n\t *\n\t * @param {number} count New initial row count.\n\t */\n\tfunction onChangeInitialRowCount( count ) {\n\t\tsetInitialRowCount( count );\n\t}\n\n\t/**\n\t * Creates a table based on dimensions in local state.\n\t *\n\t * @param {Object} event Form submit event.\n\t */\n\tfunction onCreateTable( event ) {\n\t\tevent.preventDefault();\n\n\t\tsetAttributes(\n\t\t\tcreateTable( {\n\t\t\t\trowCount: parseInt( initialRowCount, 10 ) || 2,\n\t\t\t\tcolumnCount: parseInt( initialColumnCount, 10 ) || 2,\n\t\t\t} )\n\t\t);\n\t\tsetHasTableCreated( true );\n\t}\n\n\t/**\n\t * Toggles whether the table has a fixed layout or not.\n\t */\n\tfunction onChangeFixedLayout() {\n\t\tsetAttributes( { hasFixedLayout: ! hasFixedLayout } );\n\t}\n\n\t/**\n\t * Changes the content of the currently selected cell.\n\t *\n\t * @param {Array} content A RichText content value.\n\t */\n\tfunction onChange( content ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes(\n\t\t\tupdateSelectedCell(\n\t\t\t\tattributes,\n\t\t\t\tselectedCell,\n\t\t\t\t( cellAttributes ) => ( {\n\t\t\t\t\t...cellAttributes,\n\t\t\t\t\tcontent,\n\t\t\t\t} )\n\t\t\t)\n\t\t);\n\t}\n\n\t/**\n\t * Align text within the a column.\n\t *\n\t * @param {string} align The new alignment to apply to the column.\n\t */\n\tfunction onChangeColumnAlignment( align ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Convert the cell selection to a column selection so that alignment\n\t\t// is applied to the entire column.\n\t\tconst columnSelection = {\n\t\t\ttype: 'column',\n\t\t\tcolumnIndex: selectedCell.columnIndex,\n\t\t};\n\n\t\tconst newAttributes = updateSelectedCell(\n\t\t\tattributes,\n\t\t\tcolumnSelection,\n\t\t\t( cellAttributes ) => ( {\n\t\t\t\t...cellAttributes,\n\t\t\t\talign,\n\t\t\t} )\n\t\t);\n\t\tsetAttributes( newAttributes );\n\t}\n\n\t/**\n\t * Get the alignment of the currently selected cell.\n\t *\n\t * @return {string} The new alignment to apply to the column.\n\t */\n\tfunction getCellAlignment() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn getCellAttribute( attributes, selectedCell, 'align' );\n\t}\n\n\t/**\n\t * Add or remove a `head` table section.\n\t */\n\tfunction onToggleHeaderSection() {\n\t\tsetAttributes( toggleSection( attributes, 'head' ) );\n\t}\n\n\t/**\n\t * Add or remove a `foot` table section.\n\t */\n\tfunction onToggleFooterSection() {\n\t\tsetAttributes( toggleSection( attributes, 'foot' ) );\n\t}\n\n\t/**\n\t * Inserts a row at the currently selected row index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected row index at which to insert.\n\t */\n\tfunction onInsertRow( delta ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\t\tconst newRowIndex = rowIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertRow( attributes, {\n\t\t\t\tsectionName,\n\t\t\t\trowIndex: newRowIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new row.\n\t\tsetSelectedCell( {\n\t\t\tsectionName,\n\t\t\trowIndex: newRowIndex,\n\t\t\tcolumnIndex: 0,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a row before the currently selected row.\n\t */\n\tfunction onInsertRowBefore() {\n\t\tonInsertRow( 0 );\n\t}\n\n\t/**\n\t * Inserts a row after the currently selected row.\n\t */\n\tfunction onInsertRowAfter() {\n\t\tonInsertRow( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected row.\n\t */\n\tfunction onDeleteRow() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes( deleteRow( attributes, { sectionName, rowIndex } ) );\n\t}\n\n\t/**\n\t * Inserts a column at the currently selected column index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected column index at which to insert.\n\t */\n\tfunction onInsertColumn( delta = 0 ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { columnIndex } = selectedCell;\n\t\tconst newColumnIndex = columnIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertColumn( attributes, {\n\t\t\t\tcolumnIndex: newColumnIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new column.\n\t\tsetSelectedCell( {\n\t\t\trowIndex: 0,\n\t\t\tcolumnIndex: newColumnIndex,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a column before the currently selected column.\n\t */\n\tfunction onInsertColumnBefore() {\n\t\tonInsertColumn( 0 );\n\t}\n\n\t/**\n\t * Inserts a column after the currently selected column.\n\t */\n\tfunction onInsertColumnAfter() {\n\t\tonInsertColumn( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected column.\n\t */\n\tfunction onDeleteColumn() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, columnIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes(\n\t\t\tdeleteColumn( attributes, { sectionName, columnIndex } )\n\t\t);\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetSelectedCell();\n\t\t}\n\t}, [ isSelected ] );\n\n\tuseEffect( () => {\n\t\tif ( hasTableCreated ) {\n\t\t\ttableRef?.current\n\t\t\t\t?.querySelector( 'td[contentEditable=\"true\"]' )\n\t\t\t\t?.focus();\n\t\t\tsetHasTableCreated( false );\n\t\t}\n\t}, [ hasTableCreated ] );\n\n\tconst sections = [ 'head', 'body', 'foot' ].filter(\n\t\t( name ) => ! isEmptyTableSection( attributes[ name ] )\n\t);\n\n\tconst tableControls = [\n\t\t{\n\t\t\ticon: tableRowBefore,\n\t\t\ttitle: __( 'Insert row before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowAfter,\n\t\t\ttitle: __( 'Insert row after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowDelete,\n\t\t\ttitle: __( 'Delete row' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteRow,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnBefore,\n\t\t\ttitle: __( 'Insert column before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnAfter,\n\t\t\ttitle: __( 'Insert column after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnDelete,\n\t\t\ttitle: __( 'Delete column' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteColumn,\n\t\t},\n\t];\n\n\tconst renderedSections = [ 'head', 'body', 'foot' ].map( ( name ) => (\n\t\t<TSection name={ name } key={ name }>\n\t\t\t{ attributes[ name ].map( ( { cells }, rowIndex ) => (\n\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t{ cells.map(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t{ content, tag: CellTag, scope, align, colspan },\n\t\t\t\t\t\t\tcolumnIndex\n\t\t\t\t\t\t) => (\n\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\ttagName={ CellTag }\n\t\t\t\t\t\t\t\tkey={ columnIndex }\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t'wp-block-table__cell-content'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tscope={ CellTag === 'th' ? scope : undefined }\n\t\t\t\t\t\t\t\tcolSpan={ colspan }\n\t\t\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tunstableOnFocus={ () => {\n\t\t\t\t\t\t\t\t\tsetSelectedCell( {\n\t\t\t\t\t\t\t\t\t\tsectionName: name,\n\t\t\t\t\t\t\t\t\t\trowIndex,\n\t\t\t\t\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\t\t\t\t\ttype: 'cell',\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\taria-label={ cellAriaLabel[ name ] }\n\t\t\t\t\t\t\t\tplaceholder={ placeholder[ name ] }\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</tr>\n\t\t\t) ) }\n\t\t</TSection>\n\t) );\n\n\tconst isEmpty = ! sections.length;\n\n\treturn (\n\t\t<figure { ...useBlockProps( { ref: tableRef } ) }>\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<AlignmentControl\n\t\t\t\t\t\t\tlabel={ __( 'Change column alignment' ) }\n\t\t\t\t\t\t\talignmentControls={ ALIGNMENT_CONTROLS }\n\t\t\t\t\t\t\tvalue={ getCellAlignment() }\n\t\t\t\t\t\t\tonChange={ ( nextAlign ) =>\n\t\t\t\t\t\t\t\tonChangeColumnAlignment( nextAlign )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\t\thasArrowIndicator\n\t\t\t\t\t\t\ticon={ table }\n\t\t\t\t\t\t\tlabel={ __( 'Edit table' ) }\n\t\t\t\t\t\t\tcontrols={ tableControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\t\t\tclassName=\"blocks-table-settings\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\t\tchecked={ !! hasFixedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeFixedLayout }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\tchecked={ !! ( head && head.length ) }\n\t\t\t\t\t\t\tonChange={ onToggleHeaderSection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\tchecked={ !! ( foot && foot.length ) }\n\t\t\t\t\t\t\tonChange={ onToggleFooterSection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<table\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-fixed-layout': hasFixedLayout,\n\t\t\t\t\t\t\t// This is required in the editor only to overcome\n\t\t\t\t\t\t\t// the fact the editor rewrites individual border\n\t\t\t\t\t\t\t// widths into a shorthand format.\n\t\t\t\t\t\t\t'has-individual-borders': hasSplitBorders(\n\t\t\t\t\t\t\t\tattributes?.style?.border\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\tstyle={ { ...colorProps.style, ...borderProps.style } }\n\t\t\t\t>\n\t\t\t\t\t{ renderedSections }\n\t\t\t\t</table>\n\t\t\t) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<RichText\n\t\t\t\t\tidentifier=\"caption\"\n\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\tclassName={ __experimentalGetElementClassName( 'caption' ) }\n\t\t\t\t\taria-label={ __( 'Table caption text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\tvalue={ caption }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t}\n\t\t\t\t\t// Deselect the selected table cell when the caption is focused.\n\t\t\t\t\tunstableOnFocus={ () => setSelectedCell() }\n\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\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{ isEmpty && (\n\t\t\t\t<Placeholder\n\t\t\t\t\tlabel={ __( 'Table' ) }\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\tinstructions={ __( 'Insert a table for sharing data.' ) }\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tclassName=\"blocks-table__placeholder-form\"\n\t\t\t\t\t\tonSubmit={ onCreateTable }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Column count' ) }\n\t\t\t\t\t\t\tvalue={ initialColumnCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialColumnCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Row count' ) }\n\t\t\t\t\t\t\tvalue={ initialRowCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialRowCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-button\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create Table' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</form>\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n\nexport default TableEdit;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table/edit.js"],"names":["ALIGNMENT_CONTROLS","icon","alignLeft","title","align","alignCenter","alignRight","cellAriaLabel","head","body","foot","placeholder","TSection","name","props","TagName","TableEdit","attributes","setAttributes","insertBlocksAfter","isSelected","hasFixedLayout","caption","initialRowCount","setInitialRowCount","initialColumnCount","setInitialColumnCount","selectedCell","setSelectedCell","colorProps","borderProps","tableRef","hasTableCreated","setHasTableCreated","onChangeInitialColumnCount","count","onChangeInitialRowCount","onCreateTable","event","preventDefault","rowCount","parseInt","columnCount","onChangeFixedLayout","onChange","content","cellAttributes","onChangeColumnAlignment","columnSelection","type","columnIndex","newAttributes","getCellAlignment","onToggleHeaderSection","onToggleFooterSection","onInsertRow","delta","sectionName","rowIndex","newRowIndex","onInsertRowBefore","onInsertRowAfter","onDeleteRow","onInsertColumn","newColumnIndex","onInsertColumnBefore","onInsertColumnAfter","onDeleteColumn","current","querySelector","focus","sections","filter","tableControls","tableRowBefore","isDisabled","onClick","tableRowAfter","tableRowDelete","tableColumnBefore","tableColumnAfter","tableColumnDelete","renderedSections","map","cells","tag","CellTag","scope","colspan","rowspan","undefined","isEmpty","length","ref","nextAlign","table","className","style","border","value"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAWA;;AACA;;AASA;;AAaA;;AAKA;;AAhDA;AACA;AACA;;AAGA;AACA;AACA;;AAsCA;AACA;AACA;AAaA,MAAMA,kBAAkB,GAAG,CAC1B;AACCC,EAAAA,IAAI,EAAEC,gBADP;AAECC,EAAAA,KAAK,EAAE,cAAI,mBAAJ,CAFR;AAGCC,EAAAA,KAAK,EAAE;AAHR,CAD0B,EAM1B;AACCH,EAAAA,IAAI,EAAEI,kBADP;AAECF,EAAAA,KAAK,EAAE,cAAI,qBAAJ,CAFR;AAGCC,EAAAA,KAAK,EAAE;A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* External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tRichText,\n\tBlockIcon,\n\tAlignmentControl,\n\tuseBlockProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tPanelBody,\n\tPlaceholder,\n\tTextControl,\n\tToggleControl,\n\tToolbarDropdownMenu,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport {\n\talignLeft,\n\talignRight,\n\talignCenter,\n\tblockTable as icon,\n\ttableColumnAfter,\n\ttableColumnBefore,\n\ttableColumnDelete,\n\ttableRowAfter,\n\ttableRowBefore,\n\ttableRowDelete,\n\ttable,\n} from '@wordpress/icons';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcreateTable,\n\tupdateSelectedCell,\n\tgetCellAttribute,\n\tinsertRow,\n\tdeleteRow,\n\tinsertColumn,\n\tdeleteColumn,\n\ttoggleSection,\n\tisEmptyTableSection,\n} from './state';\n\nconst ALIGNMENT_CONTROLS = [\n\t{\n\t\ticon: alignLeft,\n\t\ttitle: __( 'Align column left' ),\n\t\talign: 'left',\n\t},\n\t{\n\t\ticon: alignCenter,\n\t\ttitle: __( 'Align column center' ),\n\t\talign: 'center',\n\t},\n\t{\n\t\ticon: alignRight,\n\t\ttitle: __( 'Align column right' ),\n\t\talign: 'right',\n\t},\n];\n\nconst cellAriaLabel = {\n\thead: __( 'Header cell text' ),\n\tbody: __( 'Body cell text' ),\n\tfoot: __( 'Footer cell text' ),\n};\n\nconst placeholder = {\n\thead: __( 'Header label' ),\n\tfoot: __( 'Footer label' ),\n};\n\nfunction TSection( { name, ...props } ) {\n\tconst TagName = `t${ name }`;\n\treturn <TagName { ...props } />;\n}\n\nfunction TableEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tisSelected,\n} ) {\n\tconst { hasFixedLayout, caption, head, foot } = attributes;\n\tconst [ initialRowCount, setInitialRowCount ] = useState( 2 );\n\tconst [ initialColumnCount, setInitialColumnCount ] = useState( 2 );\n\tconst [ selectedCell, setSelectedCell ] = useState();\n\n\tconst colorProps = useColorProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\n\tconst tableRef = useRef();\n\tconst [ hasTableCreated, setHasTableCreated ] = useState( false );\n\n\t/**\n\t * Updates the initial column count used for table creation.\n\t *\n\t * @param {number} count New initial column count.\n\t */\n\tfunction onChangeInitialColumnCount( count ) {\n\t\tsetInitialColumnCount( count );\n\t}\n\n\t/**\n\t * Updates the initial row count used for table creation.\n\t *\n\t * @param {number} count New initial row count.\n\t */\n\tfunction onChangeInitialRowCount( count ) {\n\t\tsetInitialRowCount( count );\n\t}\n\n\t/**\n\t * Creates a table based on dimensions in local state.\n\t *\n\t * @param {Object} event Form submit event.\n\t */\n\tfunction onCreateTable( event ) {\n\t\tevent.preventDefault();\n\n\t\tsetAttributes(\n\t\t\tcreateTable( {\n\t\t\t\trowCount: parseInt( initialRowCount, 10 ) || 2,\n\t\t\t\tcolumnCount: parseInt( initialColumnCount, 10 ) || 2,\n\t\t\t} )\n\t\t);\n\t\tsetHasTableCreated( true );\n\t}\n\n\t/**\n\t * Toggles whether the table has a fixed layout or not.\n\t */\n\tfunction onChangeFixedLayout() {\n\t\tsetAttributes( { hasFixedLayout: ! hasFixedLayout } );\n\t}\n\n\t/**\n\t * Changes the content of the currently selected cell.\n\t *\n\t * @param {Array} content A RichText content value.\n\t */\n\tfunction onChange( content ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes(\n\t\t\tupdateSelectedCell(\n\t\t\t\tattributes,\n\t\t\t\tselectedCell,\n\t\t\t\t( cellAttributes ) => ( {\n\t\t\t\t\t...cellAttributes,\n\t\t\t\t\tcontent,\n\t\t\t\t} )\n\t\t\t)\n\t\t);\n\t}\n\n\t/**\n\t * Align text within the a column.\n\t *\n\t * @param {string} align The new alignment to apply to the column.\n\t */\n\tfunction onChangeColumnAlignment( align ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Convert the cell selection to a column selection so that alignment\n\t\t// is applied to the entire column.\n\t\tconst columnSelection = {\n\t\t\ttype: 'column',\n\t\t\tcolumnIndex: selectedCell.columnIndex,\n\t\t};\n\n\t\tconst newAttributes = updateSelectedCell(\n\t\t\tattributes,\n\t\t\tcolumnSelection,\n\t\t\t( cellAttributes ) => ( {\n\t\t\t\t...cellAttributes,\n\t\t\t\talign,\n\t\t\t} )\n\t\t);\n\t\tsetAttributes( newAttributes );\n\t}\n\n\t/**\n\t * Get the alignment of the currently selected cell.\n\t *\n\t * @return {string | undefined} The new alignment to apply to the column.\n\t */\n\tfunction getCellAlignment() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn getCellAttribute( attributes, selectedCell, 'align' );\n\t}\n\n\t/**\n\t * Add or remove a `head` table section.\n\t */\n\tfunction onToggleHeaderSection() {\n\t\tsetAttributes( toggleSection( attributes, 'head' ) );\n\t}\n\n\t/**\n\t * Add or remove a `foot` table section.\n\t */\n\tfunction onToggleFooterSection() {\n\t\tsetAttributes( toggleSection( attributes, 'foot' ) );\n\t}\n\n\t/**\n\t * Inserts a row at the currently selected row index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected row index at which to insert.\n\t */\n\tfunction onInsertRow( delta ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\t\tconst newRowIndex = rowIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertRow( attributes, {\n\t\t\t\tsectionName,\n\t\t\t\trowIndex: newRowIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new row.\n\t\tsetSelectedCell( {\n\t\t\tsectionName,\n\t\t\trowIndex: newRowIndex,\n\t\t\tcolumnIndex: 0,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a row before the currently selected row.\n\t */\n\tfunction onInsertRowBefore() {\n\t\tonInsertRow( 0 );\n\t}\n\n\t/**\n\t * Inserts a row after the currently selected row.\n\t */\n\tfunction onInsertRowAfter() {\n\t\tonInsertRow( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected row.\n\t */\n\tfunction onDeleteRow() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes( deleteRow( attributes, { sectionName, rowIndex } ) );\n\t}\n\n\t/**\n\t * Inserts a column at the currently selected column index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected column index at which to insert.\n\t */\n\tfunction onInsertColumn( delta = 0 ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { columnIndex } = selectedCell;\n\t\tconst newColumnIndex = columnIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertColumn( attributes, {\n\t\t\t\tcolumnIndex: newColumnIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new column.\n\t\tsetSelectedCell( {\n\t\t\trowIndex: 0,\n\t\t\tcolumnIndex: newColumnIndex,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a column before the currently selected column.\n\t */\n\tfunction onInsertColumnBefore() {\n\t\tonInsertColumn( 0 );\n\t}\n\n\t/**\n\t * Inserts a column after the currently selected column.\n\t */\n\tfunction onInsertColumnAfter() {\n\t\tonInsertColumn( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected column.\n\t */\n\tfunction onDeleteColumn() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, columnIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes(\n\t\t\tdeleteColumn( attributes, { sectionName, columnIndex } )\n\t\t);\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetSelectedCell();\n\t\t}\n\t}, [ isSelected ] );\n\n\tuseEffect( () => {\n\t\tif ( hasTableCreated ) {\n\t\t\ttableRef?.current\n\t\t\t\t?.querySelector( 'td[contentEditable=\"true\"]' )\n\t\t\t\t?.focus();\n\t\t\tsetHasTableCreated( false );\n\t\t}\n\t}, [ hasTableCreated ] );\n\n\tconst sections = [ 'head', 'body', 'foot' ].filter(\n\t\t( name ) => ! isEmptyTableSection( attributes[ name ] )\n\t);\n\n\tconst tableControls = [\n\t\t{\n\t\t\ticon: tableRowBefore,\n\t\t\ttitle: __( 'Insert row before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowAfter,\n\t\t\ttitle: __( 'Insert row after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowDelete,\n\t\t\ttitle: __( 'Delete row' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteRow,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnBefore,\n\t\t\ttitle: __( 'Insert column before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnAfter,\n\t\t\ttitle: __( 'Insert column after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnDelete,\n\t\t\ttitle: __( 'Delete column' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteColumn,\n\t\t},\n\t];\n\n\tconst renderedSections = [ 'head', 'body', 'foot' ].map( ( name ) => (\n\t\t<TSection name={ name } key={ name }>\n\t\t\t{ attributes[ name ].map( ( { cells }, rowIndex ) => (\n\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t{ cells.map(\n\t\t\t\t\t\t(\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: CellTag,\n\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\t\tcolspan,\n\t\t\t\t\t\t\t\trowspan,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tcolumnIndex\n\t\t\t\t\t\t) => (\n\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\ttagName={ CellTag }\n\t\t\t\t\t\t\t\tkey={ columnIndex }\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t'wp-block-table__cell-content'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tscope={ CellTag === 'th' ? scope : undefined }\n\t\t\t\t\t\t\t\tcolSpan={ colspan }\n\t\t\t\t\t\t\t\trowSpan={ rowspan }\n\t\t\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\tunstableOnFocus={ () => {\n\t\t\t\t\t\t\t\t\tsetSelectedCell( {\n\t\t\t\t\t\t\t\t\t\tsectionName: name,\n\t\t\t\t\t\t\t\t\t\trowIndex,\n\t\t\t\t\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\t\t\t\t\ttype: 'cell',\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\taria-label={ cellAriaLabel[ name ] }\n\t\t\t\t\t\t\t\tplaceholder={ placeholder[ name ] }\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</tr>\n\t\t\t) ) }\n\t\t</TSection>\n\t) );\n\n\tconst isEmpty = ! sections.length;\n\n\treturn (\n\t\t<figure { ...useBlockProps( { ref: tableRef } ) }>\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<AlignmentControl\n\t\t\t\t\t\t\tlabel={ __( 'Change column alignment' ) }\n\t\t\t\t\t\t\talignmentControls={ ALIGNMENT_CONTROLS }\n\t\t\t\t\t\t\tvalue={ getCellAlignment() }\n\t\t\t\t\t\t\tonChange={ ( nextAlign ) =>\n\t\t\t\t\t\t\t\tonChangeColumnAlignment( nextAlign )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\t\thasArrowIndicator\n\t\t\t\t\t\t\ticon={ table }\n\t\t\t\t\t\t\tlabel={ __( 'Edit table' ) }\n\t\t\t\t\t\t\tcontrols={ tableControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody\n\t\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\t\tclassName=\"blocks-table-settings\"\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\tchecked={ !! hasFixedLayout }\n\t\t\t\t\t\tonChange={ onChangeFixedLayout }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\t\tchecked={ !! ( head && head.length ) }\n\t\t\t\t\t\t\t\tonChange={ onToggleHeaderSection }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\t\tchecked={ !! ( foot && foot.length ) }\n\t\t\t\t\t\t\t\tonChange={ onToggleFooterSection }\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</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<table\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-fixed-layout': hasFixedLayout,\n\t\t\t\t\t\t\t// This is required in the editor only to overcome\n\t\t\t\t\t\t\t// the fact the editor rewrites individual border\n\t\t\t\t\t\t\t// widths into a shorthand format.\n\t\t\t\t\t\t\t'has-individual-borders': hasSplitBorders(\n\t\t\t\t\t\t\t\tattributes?.style?.border\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\tstyle={ { ...colorProps.style, ...borderProps.style } }\n\t\t\t\t>\n\t\t\t\t\t{ renderedSections }\n\t\t\t\t</table>\n\t\t\t) }\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<RichText\n\t\t\t\t\tidentifier=\"caption\"\n\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\tclassName={ __experimentalGetElementClassName( 'caption' ) }\n\t\t\t\t\taria-label={ __( 'Table caption text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\tvalue={ caption }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t}\n\t\t\t\t\t// Deselect the selected table cell when the caption is focused.\n\t\t\t\t\tunstableOnFocus={ () => setSelectedCell() }\n\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\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{ isEmpty && (\n\t\t\t\t<Placeholder\n\t\t\t\t\tlabel={ __( 'Table' ) }\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\tinstructions={ __( 'Insert a table for sharing data.' ) }\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tclassName=\"blocks-table__placeholder-form\"\n\t\t\t\t\t\tonSubmit={ onCreateTable }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Column count' ) }\n\t\t\t\t\t\t\tvalue={ initialColumnCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialColumnCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Row count' ) }\n\t\t\t\t\t\t\tvalue={ initialRowCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialRowCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-button\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create Table' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</form>\n\t\t\t\t</Placeholder>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n\nexport default TableEdit;\n"]}
|
package/build/table/index.js
CHANGED
|
@@ -82,6 +82,11 @@ const metadata = {
|
|
|
82
82
|
type: "string",
|
|
83
83
|
source: "attribute",
|
|
84
84
|
attribute: "colspan"
|
|
85
|
+
},
|
|
86
|
+
rowspan: {
|
|
87
|
+
type: "string",
|
|
88
|
+
source: "attribute",
|
|
89
|
+
attribute: "rowspan"
|
|
85
90
|
}
|
|
86
91
|
}
|
|
87
92
|
}
|
|
@@ -122,6 +127,11 @@ const metadata = {
|
|
|
122
127
|
type: "string",
|
|
123
128
|
source: "attribute",
|
|
124
129
|
attribute: "colspan"
|
|
130
|
+
},
|
|
131
|
+
rowspan: {
|
|
132
|
+
type: "string",
|
|
133
|
+
source: "attribute",
|
|
134
|
+
attribute: "rowspan"
|
|
125
135
|
}
|
|
126
136
|
}
|
|
127
137
|
}
|
|
@@ -162,6 +172,11 @@ const metadata = {
|
|
|
162
172
|
type: "string",
|
|
163
173
|
source: "attribute",
|
|
164
174
|
attribute: "colspan"
|
|
175
|
+
},
|
|
176
|
+
rowspan: {
|
|
177
|
+
type: "string",
|
|
178
|
+
source: "attribute",
|
|
179
|
+
attribute: "rowspan"
|
|
165
180
|
}
|
|
166
181
|
}
|
|
167
182
|
}
|
package/build/table/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/table/index.js"],"names":["name","metadata","settings","icon","example","attributes","head","cells","content","tag","body","viewportWidth","transforms","edit","save","deprecated","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table/index.js"],"names":["name","metadata","settings","icon","example","attributes","head","cells","content","tag","body","viewportWidth","transforms","edit","save","deprecated","init"],"mappings":";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CD,UAAAA,OAAO,EAAE,cADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SALM,EASN;AACCD,UAAAA,OAAO,EAAE,cAAI,mBAAJ,CADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SATM;AADR,OAjBK,EAiCL;AACCF,QAAAA,KAAK,EAAE,CACN;AACCC,UAAAA,OAAO,EAAE,KADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SADM,EAKN;AACCD,UAAAA,OAAO,EAAE,aADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SALM,EASN;AACCD,UAAAA,OAAO,EAAE,cAAI,kBAAJ,CADV;AAECC,UAAAA,GAAG,EAAE;AAFN,SATM;AADR,OAjCK;AAnBK,KADJ;AAuERE,IAAAA,aAAa,EAAE;AAvEP,GAFc;AA2EvBC,EAAAA,UAAU,EAAVA,mBA3EuB;AA4EvBC,EAAAA,IAAI,EAAJA,aA5EuB;AA6EvBC,EAAAA,IAAI,EAAJA,aA7EuB;AA8EvBC,EAAAA,UAAU,EAAVA;AA9EuB,CAAjB;;;AAiFA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEhB,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { blockTable as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\thead: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Version' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Jazz Musician' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Release Date' ),\n\t\t\t\t\t\t\ttag: 'th',\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\tbody: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.2',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Jaco Pastorius',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'May 7, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.1',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Betty Carter',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'February 21, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.0',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Bebo Valdés',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'December 6, 2018' ),\n\t\t\t\t\t\t\ttag: '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},\n\t\tviewportWidth: 450,\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
package/build/table/save.js
CHANGED
|
@@ -67,7 +67,8 @@ function save(_ref) {
|
|
|
67
67
|
tag,
|
|
68
68
|
scope,
|
|
69
69
|
align,
|
|
70
|
-
colspan
|
|
70
|
+
colspan,
|
|
71
|
+
rowspan
|
|
71
72
|
} = _ref4;
|
|
72
73
|
const cellClasses = (0, _classnames.default)({
|
|
73
74
|
[`has-text-align-${align}`]: align
|
|
@@ -79,7 +80,8 @@ function save(_ref) {
|
|
|
79
80
|
value: content,
|
|
80
81
|
key: cellIndex,
|
|
81
82
|
scope: tag === 'th' ? scope : undefined,
|
|
82
|
-
colSpan: colspan
|
|
83
|
+
colSpan: colspan,
|
|
84
|
+
rowSpan: rowspan
|
|
83
85
|
});
|
|
84
86
|
}));
|
|
85
87
|
}));
|
package/build/table/save.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/table/save.js"],"names":["save","attributes","hasFixedLayout","head","body","foot","caption","isEmpty","length","colorProps","borderProps","classes","className","hasCaption","RichText","Section","type","rows","Tag","map","rowIndex","cells","cellIndex","content","tag","scope","align","colspan","cellClasses","undefined","useBlockProps","style"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AASe,SAASA,IAAT,OAAgC;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AAC9C,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,IAAlB;AAAwBC,IAAAA,IAAxB;AAA8BC,IAAAA,IAA9B;AAAoCC,IAAAA;AAApC,MAAgDL,UAAtD;AACA,QAAMM,OAAO,GAAG,CAAEJ,IAAI,CAACK,MAAP,IAAiB,CAAEJ,IAAI,CAACI,MAAxB,IAAkC,CAAEH,IAAI,CAACG,MAAzD;;AAEA,MAAKD,OAAL,EAAe;AACd,WAAO,IAAP;AACA;;AAED,QAAME,UAAU,GAAG,yDAA0BR,UAA1B,CAAnB;AACA,QAAMS,WAAW,GAAG,0DAA2BT,UAA3B,CAApB;AAEA,QAAMU,OAAO,GAAG,yBAAYF,UAAU,CAACG,SAAvB,EAAkCF,WAAW,CAACE,SAA9C,EAAyD;AACxE,wBAAoBV;AADoD,GAAzD,CAAhB;AAIA,QAAMW,UAAU,GAAG,CAAEC,sBAASP,OAAT,CAAkBD,OAAlB,CAArB;;AAEA,QAAMS,OAAO,GAAG,SAAsB;AAAA,QAApB;AAAEC,MAAAA,IAAF;AAAQC,MAAAA;AAAR,KAAoB;;AACrC,QAAK,CAAEA,IAAI,CAACT,MAAZ,EAAqB;AACpB,aAAO,IAAP;AACA;;AAED,UAAMU,GAAG,GAAI,IAAIF,IAAM,EAAvB;AAEA,WACC,4BAAC,GAAD,QACGC,IAAI,CAACE,GAAL,CAAU,QAAaC,QAAb;AAAA,UAAE;AAAEC,QAAAA;AAAF,OAAF;AAAA,aACX;AAAI,QAAA,GAAG,EAAGD;AAAV,SACGC,KAAK,CAACF,GAAN,CACD,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table/save.js"],"names":["save","attributes","hasFixedLayout","head","body","foot","caption","isEmpty","length","colorProps","borderProps","classes","className","hasCaption","RichText","Section","type","rows","Tag","map","rowIndex","cells","cellIndex","content","tag","scope","align","colspan","rowspan","cellClasses","undefined","useBlockProps","style"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AASe,SAASA,IAAT,OAAgC;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AAC9C,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,IAAlB;AAAwBC,IAAAA,IAAxB;AAA8BC,IAAAA,IAA9B;A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AOC,UAAA,OAAO,EAAGF,GAPX;AAQC,UAAA,KAAK,EAAGD,OART;AASC,UAAA,GAAG,EAAGD,SATP;AAUC,UAAA,KAAK,EACJE,GAAG,KAAK,IAAR,GAAeC,KAAf,GAAuBK,SAXzB;AAaC,UAAA,OAAO,EAAGH,OAbX;AAcC,UAAA,OAAO,EAAGC;AAdX,UADD;AAkBA,OAlCA,CADH,CADW;AAAA,KAAV,CADH,CADD;AA4CA,GAnDD;;AAqDA,SACC,sCAAaG,2BAAc/B,IAAd,EAAb,EACC;AACC,IAAA,SAAS,EAAGW,OAAO,KAAK,EAAZ,GAAiBmB,SAAjB,GAA6BnB,OAD1C;AAEC,IAAA,KAAK,EAAG,EAAE,GAAGF,UAAU,CAACuB,KAAhB;AAAuB,SAAGtB,WAAW,CAACsB;AAAtC;AAFT,KAIC,4BAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,IAAA,IAAI,EAAG7B;AAA5B,IAJD,EAKC,4BAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,IAAA,IAAI,EAAGC;AAA5B,IALD,EAMC,4BAAC,OAAD;AAAS,IAAA,IAAI,EAAC,MAAd;AAAqB,IAAA,IAAI,EAAGC;AAA5B,IAND,CADD,EASGQ,UAAU,IACX,4BAAC,qBAAD,CAAU,OAAV;AACC,IAAA,OAAO,EAAC,YADT;AAEC,IAAA,KAAK,EAAGP,OAFT;AAGC,IAAA,SAAS,EAAG,oDAAmC,SAAnC;AAHb,IAVF,CADD;AAmBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n\t__experimentalGetElementClassName,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { hasFixedLayout, head, body, foot, caption } = attributes;\n\tconst isEmpty = ! head.length && ! body.length && ! foot.length;\n\n\tif ( isEmpty ) {\n\t\treturn null;\n\t}\n\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\n\tconst classes = classnames( colorProps.className, borderProps.className, {\n\t\t'has-fixed-layout': hasFixedLayout,\n\t} );\n\n\tconst hasCaption = ! RichText.isEmpty( caption );\n\n\tconst Section = ( { type, rows } ) => {\n\t\tif ( ! rows.length ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst Tag = `t${ type }`;\n\n\t\treturn (\n\t\t\t<Tag>\n\t\t\t\t{ rows.map( ( { cells }, rowIndex ) => (\n\t\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t\t{ cells.map(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcontent,\n\t\t\t\t\t\t\t\t\ttag,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\t\t\tcolspan,\n\t\t\t\t\t\t\t\t\trowspan,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tcellIndex\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tconst cellClasses = classnames( {\n\t\t\t\t\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<RichText.Content\n\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\tcellClasses\n\t\t\t\t\t\t\t\t\t\t\t\t? cellClasses\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdata-align={ align }\n\t\t\t\t\t\t\t\t\t\ttagName={ tag }\n\t\t\t\t\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\t\t\t\t\tkey={ cellIndex }\n\t\t\t\t\t\t\t\t\t\tscope={\n\t\t\t\t\t\t\t\t\t\t\ttag === 'th' ? scope : undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcolSpan={ colspan }\n\t\t\t\t\t\t\t\t\t\trowSpan={ rowspan }\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</tr>\n\t\t\t\t) ) }\n\t\t\t</Tag>\n\t\t);\n\t};\n\n\treturn (\n\t\t<figure { ...useBlockProps.save() }>\n\t\t\t<table\n\t\t\t\tclassName={ classes === '' ? undefined : classes }\n\t\t\t\tstyle={ { ...colorProps.style, ...borderProps.style } }\n\t\t\t>\n\t\t\t\t<Section type=\"head\" rows={ head } />\n\t\t\t\t<Section type=\"body\" rows={ body } />\n\t\t\t\t<Section type=\"foot\" rows={ foot } />\n\t\t\t</table>\n\t\t\t{ hasCaption && (\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\tvalue={ caption }\n\t\t\t\t\tclassName={ __experimentalGetElementClassName( 'caption' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n"]}
|
package/build/table/state.js
CHANGED
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","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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":["/**\n * External dependencies\n */\nimport { get, mapValues } from 'lodash';\n\nconst 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} 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 get( state, [\n\t\tsectionName,\n\t\trowIndex,\n\t\t'cells',\n\t\tcolumnIndex,\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 mapValues( tableSections, ( section, sectionName ) => {\n\t\tif ( selectionSectionName && selectionSectionName !== sectionName ) {\n\t\t\treturn section;\n\t\t}\n\n\t\treturn section.map( ( row, rowIndex ) => {\n\t\t\tif ( selectionRowIndex && selectionRowIndex !== rowIndex ) {\n\t\t\t\treturn row;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcells: row.cells.map( ( cellAttributes, columnIndex ) => {\n\t\t\t\t\tconst cellLocation = {\n\t\t\t\t\t\tsectionName,\n\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\trowIndex,\n\t\t\t\t\t};\n\n\t\t\t\t\tif ( ! isCellSelected( cellLocation, selection ) ) {\n\t\t\t\t\t\treturn cellAttributes;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn updateCell( cellAttributes );\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\n\t\t\t? get( firstRow, [ 'cells', 'length' ] )\n\t\t\t: 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 = get(\n\t\t\t\t\t\t\tfirstRow,\n\t\t\t\t\t\t\t[ 'cells', index ],\n\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t);\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 mapValues( tableSections, ( section, sectionName ) => {\n\t\t// Bail early if the table section is empty.\n\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\treturn section;\n\t\t}\n\n\t\treturn section.map( ( row ) => {\n\t\t\t// Bail early if the row is empty or it's an attempt to insert past\n\t\t\t// the last possible index of the array.\n\t\t\tif ( isEmptyRow( row ) || row.cells.length < columnIndex ) {\n\t\t\t\treturn row;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcells: [\n\t\t\t\t\t...row.cells.slice( 0, columnIndex ),\n\t\t\t\t\t{\n\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t},\n\t\t\t\t\t...row.cells.slice( columnIndex ),\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 mapValues( tableSections, ( section ) => {\n\t\t// Bail early if the table section is empty.\n\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\treturn section;\n\t\t}\n\n\t\treturn section\n\t\t\t.map( ( row ) => ( {\n\t\t\t\tcells:\n\t\t\t\t\trow.cells.length >= columnIndex\n\t\t\t\t\t\t? row.cells.filter(\n\t\t\t\t\t\t\t\t( cell, index ) => index !== columnIndex\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: row.cells,\n\t\t\t} ) )\n\t\t\t.filter( ( row ) => row.cells.length );\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 = get( 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":";;;;;;;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,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,KAA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,GAJkD,CAMnD;;;AACA,QAAMjB,WAAW,GAAG,iBAAKU,KAAL,EAAY,CAAE,MAAF,EAAU,CAAV,EAAa,OAAb,EAAsB,QAAtB,CAAZ,EAA8C,CAA9C,CAApB,CAPmD,CASnD;;AACA,SAAO2B,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":["/**\n * External dependencies\n */\nimport { get, mapValues } from 'lodash';\n\nconst 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 get( state, [\n\t\tsectionName,\n\t\trowIndex,\n\t\t'cells',\n\t\tcolumnIndex,\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 mapValues( tableSections, ( section, sectionName ) => {\n\t\tif ( selectionSectionName && selectionSectionName !== sectionName ) {\n\t\t\treturn section;\n\t\t}\n\n\t\treturn section.map( ( row, rowIndex ) => {\n\t\t\tif ( selectionRowIndex && selectionRowIndex !== rowIndex ) {\n\t\t\t\treturn row;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcells: row.cells.map( ( cellAttributes, columnIndex ) => {\n\t\t\t\t\tconst cellLocation = {\n\t\t\t\t\t\tsectionName,\n\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\trowIndex,\n\t\t\t\t\t};\n\n\t\t\t\t\tif ( ! isCellSelected( cellLocation, selection ) ) {\n\t\t\t\t\t\treturn cellAttributes;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn updateCell( cellAttributes );\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\n\t\t\t? get( firstRow, [ 'cells', 'length' ] )\n\t\t\t: 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 = get(\n\t\t\t\t\t\t\tfirstRow,\n\t\t\t\t\t\t\t[ 'cells', index ],\n\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t);\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 mapValues( tableSections, ( section, sectionName ) => {\n\t\t// Bail early if the table section is empty.\n\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\treturn section;\n\t\t}\n\n\t\treturn section.map( ( row ) => {\n\t\t\t// Bail early if the row is empty or it's an attempt to insert past\n\t\t\t// the last possible index of the array.\n\t\t\tif ( isEmptyRow( row ) || row.cells.length < columnIndex ) {\n\t\t\t\treturn row;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcells: [\n\t\t\t\t\t...row.cells.slice( 0, columnIndex ),\n\t\t\t\t\t{\n\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t},\n\t\t\t\t\t...row.cells.slice( columnIndex ),\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 mapValues( tableSections, ( section ) => {\n\t\t// Bail early if the table section is empty.\n\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\treturn section;\n\t\t}\n\n\t\treturn section\n\t\t\t.map( ( row ) => ( {\n\t\t\t\tcells:\n\t\t\t\t\trow.cells.length >= columnIndex\n\t\t\t\t\t\t? row.cells.filter(\n\t\t\t\t\t\t\t\t( cell, index ) => index !== columnIndex\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: row.cells,\n\t\t\t} ) )\n\t\t\t.filter( ( row ) => row.cells.length );\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 = get( 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"]}
|
|
@@ -5,6 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
+
var _blocks = require("@wordpress/blocks");
|
|
9
|
+
|
|
10
|
+
var _utils = require("./utils");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
8
19
|
const tableContentPasteSchema = _ref => {
|
|
9
20
|
let {
|
|
10
21
|
phrasingContentSchema
|
|
@@ -16,12 +27,12 @@ const tableContentPasteSchema = _ref => {
|
|
|
16
27
|
th: {
|
|
17
28
|
allowEmpty: true,
|
|
18
29
|
children: phrasingContentSchema,
|
|
19
|
-
attributes: ['scope', 'colspan']
|
|
30
|
+
attributes: ['scope', 'colspan', 'rowspan']
|
|
20
31
|
},
|
|
21
32
|
td: {
|
|
22
33
|
allowEmpty: true,
|
|
23
34
|
children: phrasingContentSchema,
|
|
24
|
-
attributes: ['colspan']
|
|
35
|
+
attributes: ['colspan', 'rowspan']
|
|
25
36
|
}
|
|
26
37
|
}
|
|
27
38
|
}
|
|
@@ -51,7 +62,40 @@ const transforms = {
|
|
|
51
62
|
from: [{
|
|
52
63
|
type: 'raw',
|
|
53
64
|
selector: 'table',
|
|
54
|
-
schema: tablePasteSchema
|
|
65
|
+
schema: tablePasteSchema,
|
|
66
|
+
transform: node => {
|
|
67
|
+
const attributes = Array.from(node.children).reduce((sectionAcc, section) => {
|
|
68
|
+
if (!section.children.length) {
|
|
69
|
+
return sectionAcc;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const sectionName = section.nodeName.toLowerCase().slice(1);
|
|
73
|
+
const sectionAttributes = Array.from(section.children).reduce((rowAcc, row) => {
|
|
74
|
+
if (!row.children.length) {
|
|
75
|
+
return rowAcc;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const rowAttributes = Array.from(row.children).reduce((colAcc, col) => {
|
|
79
|
+
const rowspan = (0, _utils.normalizeRowColSpan)(col.getAttribute('rowspan'));
|
|
80
|
+
const colspan = (0, _utils.normalizeRowColSpan)(col.getAttribute('colspan'));
|
|
81
|
+
colAcc.push({
|
|
82
|
+
tag: col.nodeName.toLowerCase(),
|
|
83
|
+
content: col.innerHTML,
|
|
84
|
+
rowspan,
|
|
85
|
+
colspan
|
|
86
|
+
});
|
|
87
|
+
return colAcc;
|
|
88
|
+
}, []);
|
|
89
|
+
rowAcc.push({
|
|
90
|
+
cells: rowAttributes
|
|
91
|
+
});
|
|
92
|
+
return rowAcc;
|
|
93
|
+
}, []);
|
|
94
|
+
sectionAcc[sectionName] = sectionAttributes;
|
|
95
|
+
return sectionAcc;
|
|
96
|
+
}, {});
|
|
97
|
+
return (0, _blocks.createBlock)('core/table', attributes);
|
|
98
|
+
}
|
|
55
99
|
}]
|
|
56
100
|
};
|
|
57
101
|
var _default = transforms;
|
|
@@ -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"],"mappings":";;;;;;;
|
|
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;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SAAmC;AAClEC,IAAAA,EAAE,EAAE;AACHC,MAAAA,UAAU,EAAE,IADT;AAEHC,MAAAA,QAAQ,EAAE;AACTC,QAAAA,EAAE,EAAE;AACHF,UAAAA,UAAU,EAAE,IADT;AAEHC,UAAAA,QAAQ,EAAEH,qBAFP;AAGHK,UAAAA,UAAU,EAAE,CAAE,OAAF,EAAW,SAAX,EAAsB,SAAtB;AAHT,SADK;AAMTC,QAAAA,EAAE,EAAE;AACHJ,UAAAA,UAAU,EAAE,IADT;AAEHC,UAAAA,QAAQ,EAAEH,qBAFP;AAGHK,UAAAA,UAAU,EAAE,CAAE,SAAF,EAAa,SAAb;AAHT;AANK;AAFP;AAD8D,GAAnC;AAAA,CAAhC;;AAkBA,MAAME,gBAAgB,GAAKC,IAAF,KAAc;AACtCC,EAAAA,KAAK,EAAE;AACNN,IAAAA,QAAQ,EAAE;AACTO,MAAAA,KAAK,EAAE;AACNR,QAAAA,UAAU,EAAE,IADN;AAENC,QAAAA,QAAQ,EAAEJ,uBAAuB,CAAES,IAAF;AAF3B,OADE;AAKTG,MAAAA,KAAK,EAAE;AACNT,QAAAA,UAAU,EAAE,IADN;AAENC,QAAAA,QAAQ,EAAEJ,uBAAuB,CAAES,IAAF;AAF3B,OALE;AASTI,MAAAA,KAAK,EAAE;AACNV,QAAAA,UAAU,EAAE,IADN;AAENC,QAAAA,QAAQ,EAAEJ,uBAAuB,CAAES,IAAF;AAF3B;AATE;AADJ;AAD+B,CAAd,CAAzB;;AAmBA,MAAMK,UAAU,GAAG;AAClBC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B;AAoBAH,UAAAA,MAAM,CAACQ,IAAP,CAAa;AACZI,YAAAA,KAAK,EAAEV;AADK,WAAb;AAIA,iBAAOF,MAAP;AACA,SAhCyB,EAgCvB,EAhCuB,CAA1B;AAkCAR,QAAAA,UAAU,CAAEG,WAAF,CAAV,GAA4BI,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"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.normalizeRowColSpan = normalizeRowColSpan;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Normalize the rowspan/colspan value.
|
|
10
|
+
* Returns undefined if the parameter is not a positive number
|
|
11
|
+
* or the default value (1) for rowspan/colspan.
|
|
12
|
+
*
|
|
13
|
+
* @param {number|undefined} rowColSpan rowspan/colspan value.
|
|
14
|
+
*
|
|
15
|
+
* @return {string|undefined} normalized rowspan/colspan value.
|
|
16
|
+
*/
|
|
17
|
+
function normalizeRowColSpan(rowColSpan) {
|
|
18
|
+
const parsedValue = parseInt(rowColSpan, 10);
|
|
19
|
+
|
|
20
|
+
if (!Number.isInteger(parsedValue)) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return parsedValue < 0 || parsedValue === 1 ? undefined : parsedValue.toString();
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/table/utils.js"],"names":["normalizeRowColSpan","rowColSpan","parsedValue","parseInt","Number","isInteger","undefined","toString"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAT,CAA8BC,UAA9B,EAA2C;AACjD,QAAMC,WAAW,GAAGC,QAAQ,CAAEF,UAAF,EAAc,EAAd,CAA5B;;AACA,MAAK,CAAEG,MAAM,CAACC,SAAP,CAAkBH,WAAlB,CAAP,EAAyC;AACxC,WAAOI,SAAP;AACA;;AACD,SAAOJ,WAAW,GAAG,CAAd,IAAmBA,WAAW,KAAK,CAAnC,GACJI,SADI,GAEJJ,WAAW,CAACK,QAAZ,EAFH;AAGA","sourcesContent":["/**\n * Normalize the rowspan/colspan value.\n * Returns undefined if the parameter is not a positive number\n * or the default value (1) for rowspan/colspan.\n *\n * @param {number|undefined} rowColSpan rowspan/colspan value.\n *\n * @return {string|undefined} normalized rowspan/colspan value.\n */\nexport function normalizeRowColSpan( rowColSpan ) {\n\tconst parsedValue = parseInt( rowColSpan, 10 );\n\tif ( ! Number.isInteger( parsedValue ) ) {\n\t\treturn undefined;\n\t}\n\treturn parsedValue < 0 || parsedValue === 1\n\t\t? undefined\n\t\t: parsedValue.toString();\n}\n"]}
|
package/build/tag-cloud/edit.js
CHANGED
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
12
|
var _components = require("@wordpress/components");
|
|
15
13
|
|
|
16
14
|
var _data = require("@wordpress/data");
|
|
@@ -23,10 +21,6 @@ var _serverSideRender = _interopRequireDefault(require("@wordpress/server-side-r
|
|
|
23
21
|
|
|
24
22
|
var _coreData = require("@wordpress/core-data");
|
|
25
23
|
|
|
26
|
-
/**
|
|
27
|
-
* External dependencies
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
24
|
/**
|
|
31
25
|
* WordPress dependencies
|
|
32
26
|
*/
|
|
@@ -70,7 +64,7 @@ function TagCloudEdit(_ref) {
|
|
|
70
64
|
value: '',
|
|
71
65
|
disabled: true
|
|
72
66
|
};
|
|
73
|
-
const taxonomyOptions = (
|
|
67
|
+
const taxonomyOptions = (taxonomies !== null && taxonomies !== void 0 ? taxonomies : []).filter(tax => !!tax.show_cloud).map(item => {
|
|
74
68
|
return {
|
|
75
69
|
value: item.slug,
|
|
76
70
|
label: item.name
|
|
@@ -155,11 +149,11 @@ function TagCloudEdit(_ref) {
|
|
|
155
149
|
min: MIN_FONT_SIZE,
|
|
156
150
|
max: MAX_FONT_SIZE
|
|
157
151
|
})))));
|
|
158
|
-
return (0, _element.createElement)(_element.Fragment, null, inspectorControls, (0, _element.createElement)("div", (0, _blockEditor.useBlockProps)(), (0, _element.createElement)(_serverSideRender.default, {
|
|
152
|
+
return (0, _element.createElement)(_element.Fragment, null, inspectorControls, (0, _element.createElement)("div", (0, _blockEditor.useBlockProps)(), (0, _element.createElement)(_components.Disabled, null, (0, _element.createElement)(_serverSideRender.default, {
|
|
159
153
|
skipBlockSupportAttributes: true,
|
|
160
154
|
block: "core/tag-cloud",
|
|
161
155
|
attributes: attributes
|
|
162
|
-
})));
|
|
156
|
+
}))));
|
|
163
157
|
}
|
|
164
158
|
|
|
165
159
|
var _default = (0, _data.withSelect)(select => {
|