Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site Editor: Merge the post only mode and the post editor #56671

Merged
merged 9 commits into from
Dec 5, 2023

Conversation

youknowriad
Copy link
Contributor

Related #52632
Alternative to #56542 and #56586 and #56631

What?

This PR merges the "canvas" of both the site editor and post editor under a unique component, and also makes the "post-only" mode of the site editor strictly equivalent to the default mode of the post editor as well.

Only potential downside of this PR is that we had some logic in the "post-only" mode of the site editor where we try to guess which "post content block" to render based on the template. This PR removes that and just applies the post editor logic (render post title and post content). I think the advantages of this PR greatly outweigh the potential downsides of this removal. (see the three linked alternative PRs that tried to do the same while keeping the template logic) .

For example this PR brings some niceties of the post editor to the site editor post only mode like hitting "Enter" from the post title to go to the post content.

Testing Instructions

1- Test the post editor: creating, saving posts, switching to template mode...
2- Test the site editor: especially the "post-only" mode (disabling template preview)

@youknowriad youknowriad added [Type] Enhancement A suggestion for improvement. Framework Issues related to broader framework topics, especially as it relates to javascript [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Nov 30, 2023
@youknowriad youknowriad self-assigned this Nov 30, 2023
return false;
}

export default function EditorCanvas( {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been mostly copied from the "VisualEditor" component of edit-post. The ultimate goal is to replace it entirely and also replace "SiteEditorCanvas" from edit-site but there are more steps to be done before being able to do that. For now, it only renders the "BlockList" basically and the "PostTitle" component if needed.

Copy link

github-actions bot commented Nov 30, 2023

Size Change: +1.75 kB (0%)

Total Size: 1.72 MB

Filename Size Change
build/block-editor/index.min.js 248 kB -283 B (0%)
build/block-editor/style-rtl.css 15.7 kB -45 B (0%)
build/block-editor/style.css 15.7 kB -48 B (0%)
build/block-library/blocks/social-links/style-rtl.css 1.49 kB +22 B (+1%)
build/block-library/blocks/social-links/style.css 1.49 kB +22 B (+2%)
build/block-library/index.min.js 213 kB +238 B (0%)
build/block-library/style-rtl.css 14.7 kB +16 B (0%)
build/block-library/style.css 14.7 kB +15 B (0%)
build/blocks/index.min.js 51.1 kB +38 B (0%)
build/components/index.min.js 256 kB +17 B (0%)
build/compose/index.min.js 12.8 kB +47 B (0%)
build/core-commands/index.min.js 2.73 kB +3 B (0%)
build/core-data/index.min.js 72.6 kB -35 B (0%)
build/customize-widgets/index.min.js 12.1 kB +6 B (0%)
build/edit-post/index.min.js 34.8 kB -965 B (-3%)
build/edit-post/style-rtl.css 7.56 kB -41 B (-1%)
build/edit-post/style.css 7.55 kB -43 B (-1%)
build/edit-site/index.min.js 210 kB +1.1 kB (+1%)
build/edit-site/style-rtl.css 14.6 kB +30 B (0%)
build/edit-site/style.css 14.6 kB +26 B (0%)
build/edit-widgets/index.min.js 17.2 kB +10 B (0%)
build/edit-widgets/style-rtl.css 4.65 kB -1 B (0%)
build/edit-widgets/style.css 4.64 kB -3 B (0%)
build/editor/index.min.js 48.6 kB +1.18 kB (+2%)
build/patterns/index.min.js 5.28 kB +440 B (+9%) 🔍
build/private-apis/index.min.js 994 B +6 B (+1%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 964 B
build/annotations/index.min.js 2.71 kB
build/api-fetch/index.min.js 2.29 kB
build/autop/index.min.js 2.11 kB
build/blob/index.min.js 590 B
build/block-directory/index.min.js 7.25 kB
build/block-directory/style-rtl.css 1.04 kB
build/block-directory/style.css 1.04 kB
build/block-editor/content-rtl.css 4.29 kB
build/block-editor/content.css 4.28 kB
build/block-editor/default-editor-styles-rtl.css 403 B
build/block-editor/default-editor-styles.css 403 B
build/block-library/blocks/archives/editor-rtl.css 61 B
build/block-library/blocks/archives/editor.css 60 B
build/block-library/blocks/archives/style-rtl.css 90 B
build/block-library/blocks/archives/style.css 90 B
build/block-library/blocks/audio/editor-rtl.css 150 B
build/block-library/blocks/audio/editor.css 150 B
build/block-library/blocks/audio/style-rtl.css 122 B
build/block-library/blocks/audio/style.css 122 B
build/block-library/blocks/audio/theme-rtl.css 138 B
build/block-library/blocks/audio/theme.css 138 B
build/block-library/blocks/avatar/editor-rtl.css 116 B
build/block-library/blocks/avatar/editor.css 116 B
build/block-library/blocks/avatar/style-rtl.css 104 B
build/block-library/blocks/avatar/style.css 104 B
build/block-library/blocks/block/editor-rtl.css 305 B
build/block-library/blocks/block/editor.css 305 B
build/block-library/blocks/button/editor-rtl.css 587 B
build/block-library/blocks/button/editor.css 587 B
build/block-library/blocks/button/style-rtl.css 633 B
build/block-library/blocks/button/style.css 632 B
build/block-library/blocks/buttons/editor-rtl.css 337 B
build/block-library/blocks/buttons/editor.css 337 B
build/block-library/blocks/buttons/style-rtl.css 332 B
build/block-library/blocks/buttons/style.css 332 B
build/block-library/blocks/calendar/style-rtl.css 239 B
build/block-library/blocks/calendar/style.css 239 B
build/block-library/blocks/categories/editor-rtl.css 113 B
build/block-library/blocks/categories/editor.css 112 B
build/block-library/blocks/categories/style-rtl.css 124 B
build/block-library/blocks/categories/style.css 124 B
build/block-library/blocks/code/editor-rtl.css 53 B
build/block-library/blocks/code/editor.css 53 B
build/block-library/blocks/code/style-rtl.css 121 B
build/block-library/blocks/code/style.css 121 B
build/block-library/blocks/code/theme-rtl.css 124 B
build/block-library/blocks/code/theme.css 124 B
build/block-library/blocks/columns/editor-rtl.css 108 B
build/block-library/blocks/columns/editor.css 108 B
build/block-library/blocks/columns/style-rtl.css 421 B
build/block-library/blocks/columns/style.css 421 B
build/block-library/blocks/comment-author-avatar/editor-rtl.css 125 B
build/block-library/blocks/comment-author-avatar/editor.css 125 B
build/block-library/blocks/comment-content/style-rtl.css 92 B
build/block-library/blocks/comment-content/style.css 92 B
build/block-library/blocks/comment-template/style-rtl.css 199 B
build/block-library/blocks/comment-template/style.css 198 B
build/block-library/blocks/comments-pagination-numbers/editor-rtl.css 123 B
build/block-library/blocks/comments-pagination-numbers/editor.css 121 B
build/block-library/blocks/comments-pagination/editor-rtl.css 222 B
build/block-library/blocks/comments-pagination/editor.css 209 B
build/block-library/blocks/comments-pagination/style-rtl.css 235 B
build/block-library/blocks/comments-pagination/style.css 231 B
build/block-library/blocks/comments-title/editor-rtl.css 75 B
build/block-library/blocks/comments-title/editor.css 75 B
build/block-library/blocks/comments/editor-rtl.css 840 B
build/block-library/blocks/comments/editor.css 839 B
build/block-library/blocks/comments/style-rtl.css 637 B
build/block-library/blocks/comments/style.css 636 B
build/block-library/blocks/cover/editor-rtl.css 647 B
build/block-library/blocks/cover/editor.css 650 B
build/block-library/blocks/cover/style-rtl.css 1.7 kB
build/block-library/blocks/cover/style.css 1.69 kB
build/block-library/blocks/details/editor-rtl.css 65 B
build/block-library/blocks/details/editor.css 65 B
build/block-library/blocks/details/style-rtl.css 98 B
build/block-library/blocks/details/style.css 98 B
build/block-library/blocks/embed/editor-rtl.css 293 B
build/block-library/blocks/embed/editor.css 293 B
build/block-library/blocks/embed/style-rtl.css 410 B
build/block-library/blocks/embed/style.css 410 B
build/block-library/blocks/embed/theme-rtl.css 138 B
build/block-library/blocks/embed/theme.css 138 B
build/block-library/blocks/file/editor-rtl.css 316 B
build/block-library/blocks/file/editor.css 316 B
build/block-library/blocks/file/style-rtl.css 280 B
build/block-library/blocks/file/style.css 281 B
build/block-library/blocks/file/view.min.js 322 B
build/block-library/blocks/footnotes/style-rtl.css 201 B
build/block-library/blocks/footnotes/style.css 199 B
build/block-library/blocks/form-input/editor-rtl.css 229 B
build/block-library/blocks/form-input/editor.css 228 B
build/block-library/blocks/form-input/style-rtl.css 343 B
build/block-library/blocks/form-input/style.css 343 B
build/block-library/blocks/form-submission-notification/editor-rtl.css 343 B
build/block-library/blocks/form-submission-notification/editor.css 342 B
build/block-library/blocks/form-submit-button/style-rtl.css 69 B
build/block-library/blocks/form-submit-button/style.css 69 B
build/block-library/blocks/form/view.min.js 452 B
build/block-library/blocks/freeform/editor-rtl.css 2.61 kB
build/block-library/blocks/freeform/editor.css 2.61 kB
build/block-library/blocks/gallery/editor-rtl.css 957 B
build/block-library/blocks/gallery/editor.css 962 B
build/block-library/blocks/gallery/style-rtl.css 1.75 kB
build/block-library/blocks/gallery/style.css 1.75 kB
build/block-library/blocks/gallery/theme-rtl.css 122 B
build/block-library/blocks/gallery/theme.css 122 B
build/block-library/blocks/group/editor-rtl.css 654 B
build/block-library/blocks/group/editor.css 654 B
build/block-library/blocks/group/style-rtl.css 57 B
build/block-library/blocks/group/style.css 57 B
build/block-library/blocks/group/theme-rtl.css 78 B
build/block-library/blocks/group/theme.css 78 B
build/block-library/blocks/heading/style-rtl.css 189 B
build/block-library/blocks/heading/style.css 189 B
build/block-library/blocks/html/editor-rtl.css 340 B
build/block-library/blocks/html/editor.css 341 B
build/block-library/blocks/image/editor-rtl.css 834 B
build/block-library/blocks/image/editor.css 833 B
build/block-library/blocks/image/style-rtl.css 1.61 kB
build/block-library/blocks/image/style.css 1.6 kB
build/block-library/blocks/image/theme-rtl.css 137 B
build/block-library/blocks/image/theme.css 137 B
build/block-library/blocks/image/view.min.js 2.02 kB
build/block-library/blocks/latest-comments/style-rtl.css 357 B
build/block-library/blocks/latest-comments/style.css 357 B
build/block-library/blocks/latest-posts/editor-rtl.css 213 B
build/block-library/blocks/latest-posts/editor.css 212 B
build/block-library/blocks/latest-posts/style-rtl.css 478 B
build/block-library/blocks/latest-posts/style.css 478 B
build/block-library/blocks/list/style-rtl.css 88 B
build/block-library/blocks/list/style.css 88 B
build/block-library/blocks/media-text/editor-rtl.css 266 B
build/block-library/blocks/media-text/editor.css 263 B
build/block-library/blocks/media-text/style-rtl.css 505 B
build/block-library/blocks/media-text/style.css 503 B
build/block-library/blocks/more/editor-rtl.css 431 B
build/block-library/blocks/more/editor.css 431 B
build/block-library/blocks/navigation-link/editor-rtl.css 671 B
build/block-library/blocks/navigation-link/editor.css 672 B
build/block-library/blocks/navigation-link/style-rtl.css 103 B
build/block-library/blocks/navigation-link/style.css 103 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 299 B
build/block-library/blocks/navigation-submenu/editor.css 299 B
build/block-library/blocks/navigation/editor-rtl.css 2.26 kB
build/block-library/blocks/navigation/editor.css 2.26 kB
build/block-library/blocks/navigation/style-rtl.css 2.27 kB
build/block-library/blocks/navigation/style.css 2.26 kB
build/block-library/blocks/navigation/view.min.js 1.04 kB
build/block-library/blocks/nextpage/editor-rtl.css 395 B
build/block-library/blocks/nextpage/editor.css 395 B
build/block-library/blocks/page-list/editor-rtl.css 401 B
build/block-library/blocks/page-list/editor.css 401 B
build/block-library/blocks/page-list/style-rtl.css 175 B
build/block-library/blocks/page-list/style.css 175 B
build/block-library/blocks/paragraph/editor-rtl.css 235 B
build/block-library/blocks/paragraph/editor.css 235 B
build/block-library/blocks/paragraph/style-rtl.css 335 B
build/block-library/blocks/paragraph/style.css 335 B
build/block-library/blocks/post-author/style-rtl.css 175 B
build/block-library/blocks/post-author/style.css 176 B
build/block-library/blocks/post-comments-form/editor-rtl.css 96 B
build/block-library/blocks/post-comments-form/editor.css 96 B
build/block-library/blocks/post-comments-form/style-rtl.css 508 B
build/block-library/blocks/post-comments-form/style.css 508 B
build/block-library/blocks/post-date/style-rtl.css 61 B
build/block-library/blocks/post-date/style.css 61 B
build/block-library/blocks/post-excerpt/editor-rtl.css 71 B
build/block-library/blocks/post-excerpt/editor.css 71 B
build/block-library/blocks/post-excerpt/style-rtl.css 141 B
build/block-library/blocks/post-excerpt/style.css 141 B
build/block-library/blocks/post-featured-image/editor-rtl.css 666 B
build/block-library/blocks/post-featured-image/editor.css 662 B
build/block-library/blocks/post-featured-image/style-rtl.css 345 B
build/block-library/blocks/post-featured-image/style.css 345 B
build/block-library/blocks/post-navigation-link/style-rtl.css 215 B
build/block-library/blocks/post-navigation-link/style.css 214 B
build/block-library/blocks/post-template/editor-rtl.css 99 B
build/block-library/blocks/post-template/editor.css 98 B
build/block-library/blocks/post-template/style-rtl.css 409 B
build/block-library/blocks/post-template/style.css 408 B
build/block-library/blocks/post-terms/style-rtl.css 96 B
build/block-library/blocks/post-terms/style.css 96 B
build/block-library/blocks/post-time-to-read/style-rtl.css 69 B
build/block-library/blocks/post-time-to-read/style.css 69 B
build/block-library/blocks/post-title/style-rtl.css 100 B
build/block-library/blocks/post-title/style.css 100 B
build/block-library/blocks/preformatted/style-rtl.css 125 B
build/block-library/blocks/preformatted/style.css 125 B
build/block-library/blocks/pullquote/editor-rtl.css 135 B
build/block-library/blocks/pullquote/editor.css 135 B
build/block-library/blocks/pullquote/style-rtl.css 335 B
build/block-library/blocks/pullquote/style.css 335 B
build/block-library/blocks/pullquote/theme-rtl.css 168 B
build/block-library/blocks/pullquote/theme.css 168 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B
build/block-library/blocks/query-pagination/editor-rtl.css 221 B
build/block-library/blocks/query-pagination/editor.css 211 B
build/block-library/blocks/query-pagination/style-rtl.css 288 B
build/block-library/blocks/query-pagination/style.css 284 B
build/block-library/blocks/query-title/style-rtl.css 63 B
build/block-library/blocks/query-title/style.css 63 B
build/block-library/blocks/query/editor-rtl.css 486 B
build/block-library/blocks/query/editor.css 486 B
build/block-library/blocks/query/style-rtl.css 312 B
build/block-library/blocks/query/style.css 308 B
build/block-library/blocks/query/view.min.js 647 B
build/block-library/blocks/quote/style-rtl.css 237 B
build/block-library/blocks/quote/style.css 237 B
build/block-library/blocks/quote/theme-rtl.css 223 B
build/block-library/blocks/quote/theme.css 226 B
build/block-library/blocks/read-more/style-rtl.css 140 B
build/block-library/blocks/read-more/style.css 140 B
build/block-library/blocks/rss/editor-rtl.css 149 B
build/block-library/blocks/rss/editor.css 149 B
build/block-library/blocks/rss/style-rtl.css 289 B
build/block-library/blocks/rss/style.css 288 B
build/block-library/blocks/search/editor-rtl.css 184 B
build/block-library/blocks/search/editor.css 184 B
build/block-library/blocks/search/style-rtl.css 613 B
build/block-library/blocks/search/style.css 613 B
build/block-library/blocks/search/theme-rtl.css 114 B
build/block-library/blocks/search/theme.css 114 B
build/block-library/blocks/search/view.min.js 475 B
build/block-library/blocks/separator/editor-rtl.css 146 B
build/block-library/blocks/separator/editor.css 146 B
build/block-library/blocks/separator/style-rtl.css 234 B
build/block-library/blocks/separator/style.css 234 B
build/block-library/blocks/separator/theme-rtl.css 194 B
build/block-library/blocks/separator/theme.css 194 B
build/block-library/blocks/shortcode/editor-rtl.css 329 B
build/block-library/blocks/shortcode/editor.css 329 B
build/block-library/blocks/site-logo/editor-rtl.css 760 B
build/block-library/blocks/site-logo/editor.css 760 B
build/block-library/blocks/site-logo/style-rtl.css 204 B
build/block-library/blocks/site-logo/style.css 204 B
build/block-library/blocks/site-tagline/editor-rtl.css 86 B
build/block-library/blocks/site-tagline/editor.css 86 B
build/block-library/blocks/site-title/editor-rtl.css 116 B
build/block-library/blocks/site-title/editor.css 116 B
build/block-library/blocks/site-title/style-rtl.css 57 B
build/block-library/blocks/site-title/style.css 57 B
build/block-library/blocks/social-link/editor-rtl.css 184 B
build/block-library/blocks/social-link/editor.css 184 B
build/block-library/blocks/social-links/editor-rtl.css 682 B
build/block-library/blocks/social-links/editor.css 681 B
build/block-library/blocks/spacer/editor-rtl.css 359 B
build/block-library/blocks/spacer/editor.css 359 B
build/block-library/blocks/spacer/style-rtl.css 48 B
build/block-library/blocks/spacer/style.css 48 B
build/block-library/blocks/table/editor-rtl.css 432 B
build/block-library/blocks/table/editor.css 432 B
build/block-library/blocks/table/style-rtl.css 646 B
build/block-library/blocks/table/style.css 645 B
build/block-library/blocks/table/theme-rtl.css 157 B
build/block-library/blocks/table/theme.css 157 B
build/block-library/blocks/tag-cloud/style-rtl.css 251 B
build/block-library/blocks/tag-cloud/style.css 253 B
build/block-library/blocks/template-part/editor-rtl.css 403 B
build/block-library/blocks/template-part/editor.css 403 B
build/block-library/blocks/template-part/theme-rtl.css 101 B
build/block-library/blocks/template-part/theme.css 101 B
build/block-library/blocks/term-description/style-rtl.css 111 B
build/block-library/blocks/term-description/style.css 111 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B
build/block-library/blocks/text-columns/editor.css 95 B
build/block-library/blocks/text-columns/style-rtl.css 166 B
build/block-library/blocks/text-columns/style.css 166 B
build/block-library/blocks/verse/style-rtl.css 99 B
build/block-library/blocks/verse/style.css 99 B
build/block-library/blocks/video/editor-rtl.css 552 B
build/block-library/blocks/video/editor.css 555 B
build/block-library/blocks/video/style-rtl.css 191 B
build/block-library/blocks/video/style.css 191 B
build/block-library/blocks/video/theme-rtl.css 139 B
build/block-library/blocks/video/theme.css 139 B
build/block-library/classic-rtl.css 179 B
build/block-library/classic.css 179 B
build/block-library/common-rtl.css 1.11 kB
build/block-library/common.css 1.11 kB
build/block-library/editor-elements-rtl.css 75 B
build/block-library/editor-elements.css 75 B
build/block-library/editor-rtl.css 12.5 kB
build/block-library/editor.css 12.4 kB
build/block-library/elements-rtl.css 54 B
build/block-library/elements.css 54 B
build/block-library/reset-rtl.css 472 B
build/block-library/reset.css 472 B
build/block-library/theme-rtl.css 700 B
build/block-library/theme.css 705 B
build/block-serialization-default-parser/index.min.js 1.13 kB
build/block-serialization-spec-parser/index.min.js 2.87 kB
build/commands/index.min.js 15.5 kB
build/commands/style-rtl.css 947 B
build/commands/style.css 942 B
build/components/style-rtl.css 12.1 kB
build/components/style.css 12.1 kB
build/customize-widgets/style-rtl.css 1.43 kB
build/customize-widgets/style.css 1.43 kB
build/data-controls/index.min.js 651 B
build/data/index.min.js 8.87 kB
build/date/index.min.js 17.9 kB
build/deprecated/index.min.js 462 B
build/dom-ready/index.min.js 336 B
build/dom/index.min.js 4.68 kB
build/edit-post/classic-rtl.css 571 B
build/edit-post/classic.css 571 B
build/editor/style-rtl.css 3.74 kB
build/editor/style.css 3.73 kB
build/element/index.min.js 4.87 kB
build/escape-html/index.min.js 548 B
build/format-library/index.min.js 7.76 kB
build/format-library/style-rtl.css 577 B
build/format-library/style.css 577 B
build/hooks/index.min.js 1.57 kB
build/html-entities/index.min.js 454 B
build/i18n/index.min.js 3.61 kB
build/interactivity/file.min.js 442 B
build/interactivity/image.min.js 2.15 kB
build/interactivity/index.min.js 12.5 kB
build/interactivity/navigation.min.js 1.16 kB
build/interactivity/query.min.js 791 B
build/interactivity/search.min.js 610 B
build/is-shallow-equal/index.min.js 535 B
build/keyboard-shortcuts/index.min.js 1.76 kB
build/keycodes/index.min.js 1.9 kB
build/list-reusable-blocks/index.min.js 2.11 kB
build/list-reusable-blocks/style-rtl.css 865 B
build/list-reusable-blocks/style.css 865 B
build/media-utils/index.min.js 2.92 kB
build/modules/importmap-polyfill.min.js 12.2 kB
build/notices/index.min.js 964 B
build/nux/index.min.js 2.01 kB
build/nux/style-rtl.css 775 B
build/nux/style.css 771 B
build/patterns/style-rtl.css 564 B
build/patterns/style.css 564 B
build/plugins/index.min.js 1.81 kB
build/preferences-persistence/index.min.js 1.85 kB
build/preferences/index.min.js 1.26 kB
build/primitives/index.min.js 994 B
build/priority-queue/index.min.js 1.52 kB
build/react-i18n/index.min.js 631 B
build/react-refresh-entry/index.min.js 9.46 kB
build/react-refresh-runtime/index.min.js 6.78 kB
build/redux-routine/index.min.js 2.71 kB
build/reusable-blocks/index.min.js 2.74 kB
build/reusable-blocks/style-rtl.css 265 B
build/reusable-blocks/style.css 265 B
build/rich-text/index.min.js 9.98 kB
build/router/index.min.js 1.79 kB
build/server-side-render/index.min.js 1.96 kB
build/shortcode/index.min.js 1.4 kB
build/style-engine/index.min.js 1.98 kB
build/token-list/index.min.js 587 B
build/url/index.min.js 3.83 kB
build/vendors/inert-polyfill.min.js 2.48 kB
build/vendors/react-dom.min.js 41.8 kB
build/vendors/react.min.js 4.02 kB
build/viewport/index.min.js 967 B
build/warning/index.min.js 259 B
build/widgets/index.min.js 7.18 kB
build/widgets/style-rtl.css 1.18 kB
build/widgets/style.css 1.18 kB
build/wordcount/index.min.js 1.03 kB

compressed-size-action

Copy link

Flaky tests detected in bafdc95.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7044584156
📝 Reported issues:

Comment on lines +272 to +280
<>
<LayoutStyle
selector=".editor-editor-canvas__post-title-wrapper"
layout={ fallbackLayout }
/>
<LayoutStyle
selector=".block-editor-block-list__layout.is-root-container"
layout={ postEditorLayout }
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I'm wondering is whether it makes sense to use two different layouts for "post-content" and "post-title". It seems like "post-title" here is always using the default layout from theme.json while for "post-content" we try to guess the layout from the block. I'm wondering whether that makes sense, if these two things are different (which can be in some cases), it would result in some weird alignment in the post editor.

I wonder if we should always use the "post content" one for both.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post Title doesn't have layout itself, so we can't guess at its exact placement on the page. We did at one point try using Post Content layout for it, but that caused problems as reported in #48579, so it was switched back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that issue doesn't really say why it was "bad". For me it seems just like a different random choice.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't seem to be intentional, just a side-effect of #46698, which was only trying to add padding to the title. Yes it's random in the sense that there are no documented decisions around how it should work, so changes have mostly been made reactively based on feedback.

I'm not saying Post Title absolutely shouldn't have the same layout as Post Content, but if it does we should be aware of all the possible implications and probably note somewhere that it's a deliberate design decision.

@mcsf
Copy link
Contributor

mcsf commented Nov 30, 2023

In my testing I found two issues. I don't know if they are specific to this PR, but I had never seen them before:

  • In the beginning of the video, notice how toggling Template preview in the Site Editor causes the title to break. I also saw some other strange skips, but I wasn't recording (e.g. the post content rendering differently before correcting).
  • At 00:29, notice the strange bolder rendering of the title in the Post Editor.
testing-merge-canvases-site-and-post.mov

@fabiankaegy
Copy link
Member

Hey @youknowriad 👋

Thanks for working on this! I'm wondering whether you could clear up some things for me :)

  1. If my testing and parsing of the code here is correct this does not impact the logic for whether the post editor renders the editor canvas in an iframe or not. That logic remains the same?

  2. From your experience with this part of the codebase here, how possible do you think it would be to follow up this work with bringing the "Preview Template" option to the post editor also? (Post editor: Provide a way to view the template while editing a post #27847)

@youknowriad
Copy link
Contributor Author

If my testing and parsing of the code here is correct this does not impact the logic for whether the post editor renders the editor canvas in an iframe or not. That logic remains the same?

Yes, no impact, in fact I don't think this PR impacts the post editor at all (or at least it shouldn't unless I did some mistake)

From your experience with this part of the codebase here, how possible do you think it would be to follow up this work with bringing the "Preview Template" option to the post editor also? (#27847)

Preview option is actually already in the post editor (different UI slightly, you click the template on the sidebar and click "edit template"), but yes, my goal is to unify that mode with the site editor. Maybe the starting point will be different between post and site editors but the capabilities and the code base will be exactly the same.

@ramonjd
Copy link
Member

ramonjd commented Dec 1, 2023

Working nicely for me. 👏🏻

  • Editing posts/pages in post/site editors works as expected. ✅
  • Also swapping between edit template modes ✅
  • I logged in as Author to make sure I couldn't edit a post's template from the post editor ✅

One thing about the site editor Template preview mode:

also makes the "post-only" mode of the site editor strictly equivalent to the default mode of the post editor as well.

Trunk

2023-12-01.12.25.33.mp4

This PR

2023-12-01.12.25.52.mp4

Following on from this discussion: #56000 (comment)

Would this be classed as a regression? Just checking that it's intended to change the way the page's block order is rendered in the site editor.

I know the goal is to unify components, but it might be good to get UX/design input to confirm if it departs from #41717

For the record, I'm fine with either. A follow up to this PR however might be to reconsider how we load pages in the site editor so that there difference in functionality between it and the post editor is more discernible , e.g., load the page in its template first, then the toggle could be "Edit page" instead of "Template preview".

Not sure 🤷🏻

@ramonjd
Copy link
Member

ramonjd commented Dec 1, 2023

I think the advantages of this PR greatly outweigh the potential downsides of this removal. (see the three linked alternative PRs that tried to do the same while keeping the template logic)

100% - and I appreciate the huge effort to consolidate this stuff. 🙇🏻

I think what I was rambling about above what more about the messaging.

I think it's just "Template preview" that's catching me off guard. 😄 If we're going to remove the guesswork of 1:1 post and template content in the site editor, then maybe the site editor could have the same UI as the post editor, but with "Edit page".

Screenshot 2023-12-01 at 1 11 37 pm

cc @SaxonF

@andrewserong
Copy link
Contributor

andrewserong commented Dec 1, 2023

Thanks for persisting across all these different PRs, it does feel like we're inching toward a better solution all around!

For example this PR brings some niceties of the post editor to the site editor post only mode like hitting "Enter" from the post title to go to the post content.

Good point, it is really nice being able able to hit enter to move from the post title to the post content. I also like that while editing in the post only mode, the list view displays the blocks within post content at the root level rather than being nested within a "content" block 👍

Styling-wise, the main issue I ran into so far is that the root padding rules don't appear to be output within the site editor's post only mode, this means text bumps up against the edges of the editor canvas. In the below screengrab, on the left is the site editor with template preview switched off, and on the right is the page editor with the same page (running TwentyTwentyFour theme):

image

Another visual difference is that in the page editor, if the template sets a custom content/wide size, that's respected in the editor, but that doesn't appear to be the case in the site editor's post only mode. Below, the left is the site editor, the right is the page editor:

image

I can give the PR some more detailed testing next week!

@youknowriad
Copy link
Contributor Author

I think it's just "Template preview" that's catching me off guard. 😄 If we're going to remove the guesswork of 1:1 post and template content in the site editor, then maybe the site editor could have the same UI as the post editor, but with "Edit page".

It is definitely my goal to have the same UI but we can't have the same UI before having the same code controlling it because the UI is just going to change "mode". I don't want to duplicate the UI component.

Styling-wise, the main issue I ran into so far is that the root padding rules don't appear to be output within the site editor's post only mode, this means text bumps up against the edges of the editor canvas

I'm really surprised about this, I'll debug.

@youknowriad
Copy link
Contributor Author

@mcsf I'm not able to reproduce any of your issues. Can you give more instructions about the theme, the page you're editing...

@youknowriad
Copy link
Contributor Author

@andrewserong The issue was that neither supportsTemplateMode or postContentAttributes are defined in the site editor on the server like the post editor. Fix was simple: if you're on the site editor, it means supportsTemplateMode should be true, so I forced that one, for the second one, if you're on the site editor it means you don't need these attributes from the server, you can always use the template as you have the rights to retrieve it.

Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @youknowriad, the styling is all looking good to me now!

✅ Layout from the post content block is now reflected properly when template preview is switched off, along with padding rules
✅ Tested that the post and page editors still reflect server-loaded post content attributes, and work with custom layout content sizes when editing posts and pages via an Author role

This PR's looking in quite good shape. A couple of other minor things I noticed in re-testing:

image

  • When template preview mode is toggled off, and the list view now lists everything within post content at the root level (just like in the post editor), the Content panel on the right hand side is a bit noisy, as it too lists everything. I think that panel was only meant to be there so that folks could easily click between the content blocks (e.g. featured image, title, content), so should we hide this if template preview mode is disabled?
  • When template preview mode is toggled off, there is no way to update the featured image for the page. I imagine this is likely not a blocker, and given the discussion surrounding further consolidation in follow-ups, perhaps we could pull over the featured image UI from the post / page editor if need be in a follow-up?

We might want to confirm with @mcsf if the issues encountered during testing can be reproduced still? I wasn't able to reproduce those locally in TT4, but could have missed something.

Otherwise, this is all looking good pretty good to me! Just left a question about the classname change for the post title, wrapper, too, as I'm wondering if that'll be a breaking change for some themes 🤔

{ renderingMode === 'post-only' && (
<div
className={ classnames(
'editor-editor-canvas__post-title-wrapper',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking: is this a potentially breaking change? I'm wondering if Classic themes or other themes in general have been using the existing classname for different purposes. There seems to be a few results searching for this classname across the theme directory: https://wpdirectory.net/search/01HGSH721NFYVA5XKZ4KAGYCT7

Clicking through from there, I can see that Blocksy theme for example seems to set the post title font size based on the wrapper classname 🤔

Would it be worth making the classname here configurable? I.e. could the instance of <EditorCanvas> used in the post editor pass down a classname to use for backcompat?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we state in our docs and guidelines that "classnames" for components are not public APIs and that people shouldn't rely on them too much. That said, for this particular case, it's a bit sensitive so I agree with you.

I don't think making the classname configurable is worth it but good point, I'll keep the old class name to avoid breaking changes.

@youknowriad
Copy link
Contributor Author

When template preview mode is toggled off, and the list view now lists everything within post content at the root level (just like in the post editor), the Content panel on the right hand side is a bit noisy, as it too lists everything. I think that panel was only meant to be there so that folks could easily click between the content blocks (e.g. featured image, title, content), so should we hide this if template preview mode is disabled?

I think it makes sense to hide that panel yeah in that mode yes.

When template preview mode is toggled off, there is no way to update the featured image for the page. I imagine this is likely not a blocker, and given the discussion surrounding further consolidation in follow-ups, perhaps we could pull over the featured image UI from the post / page editor if need be in a follow-up?

yes, my goal is to have the exact same UI for both post and site editor, sidebar, top bar, everything. So yeah, this is going to be one of the follow-ups.

@youknowriad
Copy link
Contributor Author

This should be ready for ✅

@mcsf
Copy link
Contributor

mcsf commented Dec 4, 2023

@mcsf I'm not able to reproduce any of your issues. Can you give more instructions about the theme, the page you're editing...

I was on standard TT4 and just editing a custom page using the site editor's navigation. Maybe it was a fluke.

Copy link
Contributor

@mcsf mcsf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, and I don't see any issues anymore. The only thing I saw again was the font gaining weight, but I think that's Safari being weird and is totally unrelated to this. Nice work.

Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the follow-ups @youknowriad!

This is testing well for me, tested with a variety of blocks and classic themes, and I didn't run into any blockers.

Left a tiny note about a difference in top margin between em and rem units, but from my perspective, this PR is in good shape now, and I think it'll be easier to do subsequent tweaks in follow-ups.

Great work again on all the consolidation efforts, there's a lot of complexity to untangle in all of this, and with this work it feels like we're heading in a better direction code-wise, which will improve and unlock further progress 👍

LGTM! ✨

<div
className={ classnames(
'editor-editor-canvas__post-title-wrapper',
// The following class is only hear for backward comapatibility
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiniest of nits 🙂

Suggested change
// The following class is only hear for backward comapatibility
// The following class is only here for backward comapatibility

style={ {
// This is using inline styles
// so it's applied for both iframed and non iframed editors.
marginTop: '4em',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the post editor, on trunk this is 4rem instead of 4em, so in testing manually there is a slight yet subtle difference. Not a blocker at all, just thought I'd mention it in case it's something you wanted to tweak in a follow-up (I'm not sure which one's preferred).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I had to guess, I'd say rem is preferred because it's relative to :root and not influenced by the element's parent(s)? Normally it scales more uniformly with rem units.

@youknowriad youknowriad enabled auto-merge (squash) December 5, 2023 06:39
@youknowriad youknowriad merged commit 338ae24 into trunk Dec 5, 2023
52 checks passed
@youknowriad youknowriad deleted the update/sync-post-site-editor-post-only-mode branch December 5, 2023 07:10
@github-actions github-actions bot added this to the Gutenberg 17.3 milestone Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Framework Issues related to broader framework topics, especially as it relates to javascript [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants