-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Add ability to focus on editing a page's content vs the page's template #50857
Conversation
I just need to redo the breadcrumb component (up top) and content list component (in the sidebar) and then this should be ready. |
Size Change: +2.1 kB (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
Thank you for working on this! As stated before, I think this can have a huge potential to not just impact the site editor but also allow for previewing the template in the post editor. I took this PR in its current form for a spin and found have some things I noticed:
CleanShot.2023-05-23.at.09.03.30.mp4
Also even with jumping to the template it somehow still didn't quite register what template exactly I was currently editing and therefore which areas of my site would be affected by the change.
|
packages/edit-site/src/components/sidebar-edit-mode/settings-header/index.js
Show resolved
Hide resolved
Small observation as well, but really only partially related to what this PR achieves. It might seem weird to users that the blocks are called Post Title, Post Featured Image and Post Content when they're editing a Page. That's our implementation leaking into the user's experience. A lot of beginner users won't know that a page is a type of post. |
Flaky tests detected in 46c4074. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5140210441
|
…page's template (WordPress#50857) * Add ability to prevent editing blocks using useBlockEditingMode() * Make useBlockEditingMode use context * Remove rootBlockEditingMode setting * Fix private createRegistrySelector selectors * Consolidate templateLock=contentOnly logic into getBlockEditingMode * Hide disabled blocks from List View * Hide disabled blocks from breadcrumbs * Add doc comments * Add unit tests * Use @typedef to document mode param * Restore packages/components/package.json from trunk * Restore packages/block-library/src/post-title/edit.js from trunk * Move BlockListBlockContext out of block.js so that it exists on mobile platforms * Site Editor: Add ability to focus on editing a page's content vs the page's template * Show page information in DocumentActions * Implement Content panel * Prevent block overlay on disabled blocks * Fix Navigation block being selectable * Show 'Page' in breadcrumbs when focused on editing page * Update post title, post featured image, and post content blocks to say 'Page' instead of 'Post' * toolbar title styling * Remove removePostFromContentBlockLabels for now * Fix being able to select text within disabled blocks * Hide BlockAppender when block is disabled * Fix comments block in non-post templates * Update template card selector in E2E tests * Fix 'Add submenu' button in Navigation block * Remove unhelpful comments * Remove more unnecessary comments * Use constant for block types array * Use BEMish selectors * Be explicit that we're switching away from the page lock * Update removePageFromBlockContext() test * Fix post context from appearing in Edit Template preview We have to set postId and postType to null for the preview and omit them in the editor. No point having helper methods, therefore. * Clear block selection when switching from template focus to page focus * Prevent insertion into a disabled block * Don't allow removing and moving children of disabled blocks * Work around @wordpress/data bug by not using createRegistrySelector() for now * Fix typo * Fix select() mock * Fix block-editor selector tests * Revert block-editor changes * Improve useDisableNonContentBlocks performance * Fix performance tests --------- Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com> Co-authored-by: ramon <ramonjd@gmail.com>
I look forward to trying the feature directly in the Gutenberg plugin. One major confusion is the editing of the Front Page template vs editing the single Front page. |
What do you think about these ideas for a visual template and post-type editor inside the site editor? I think it could solve many problems non devs/designers have with the editor giving marketers and normal users the option to work from a higher level. |
…page's template (WordPress#50857) * Add ability to prevent editing blocks using useBlockEditingMode() * Make useBlockEditingMode use context * Remove rootBlockEditingMode setting * Fix private createRegistrySelector selectors * Consolidate templateLock=contentOnly logic into getBlockEditingMode * Hide disabled blocks from List View * Hide disabled blocks from breadcrumbs * Add doc comments * Add unit tests * Use @typedef to document mode param * Restore packages/components/package.json from trunk * Restore packages/block-library/src/post-title/edit.js from trunk * Move BlockListBlockContext out of block.js so that it exists on mobile platforms * Site Editor: Add ability to focus on editing a page's content vs the page's template * Show page information in DocumentActions * Implement Content panel * Prevent block overlay on disabled blocks * Fix Navigation block being selectable * Show 'Page' in breadcrumbs when focused on editing page * Update post title, post featured image, and post content blocks to say 'Page' instead of 'Post' * toolbar title styling * Remove removePostFromContentBlockLabels for now * Fix being able to select text within disabled blocks * Hide BlockAppender when block is disabled * Fix comments block in non-post templates * Update template card selector in E2E tests * Fix 'Add submenu' button in Navigation block * Remove unhelpful comments * Remove more unnecessary comments * Use constant for block types array * Use BEMish selectors * Be explicit that we're switching away from the page lock * Update removePageFromBlockContext() test * Fix post context from appearing in Edit Template preview We have to set postId and postType to null for the preview and omit them in the editor. No point having helper methods, therefore. * Clear block selection when switching from template focus to page focus * Prevent insertion into a disabled block * Don't allow removing and moving children of disabled blocks * Work around @wordpress/data bug by not using createRegistrySelector() for now * Fix typo * Fix select() mock * Fix block-editor selector tests * Revert block-editor changes * Improve useDisableNonContentBlocks performance * Fix performance tests --------- Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com> Co-authored-by: ramon <ramonjd@gmail.com>
What?
Second attempt at #49980. The key difference is that it's based on #50643 instead of #50082.
Requires #50643.
Part of #49404 and #44461.
Adds functionality to the Site Editor that lets you, when editing a page, switch between focusing on editing the page's content versus editing the page's template.
Why?
Adding some separation helps to prevent a very common point of frustration encountered when a user attempts to change something on a specific page but the change is made everywhere.
How?
wp-edit-site
that lets the user toggle between focusing on editing the template and focusing on editing the page.useBlockEditingMode()
hook added in Add ability to prevent editing blocks using useBlockEditingMode() #50643 to prevent editing blocks that aren't the Post Title, Post Featured Image and Post Content block.Testing Instructions
Screenshots or screencast
Kapture.2023-04-21.at.16.14.44.mp4
Follow up tasks
post
instead ofpage
.ContentBlocksList
andBlockInspectorLockedBlocks
.useBlockEditingMode()
available for extenders. (Mark it public, add docs, add dev note.)__unstable
contentOnly
methods. (Not really related but using this list as my todo list now 😂)select()
hack fromgetBlockEditingMode
when Fix private registry selectors #50985 is fixed.