-
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
[Editor]: Handle title
display and selection in outline
#48124
Conversation
Size Change: +65 B (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
Flaky tests detected in 564ed10. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4192954208
|
Thank you for the PR! I have found that in the non-iframe editor when I switch to preview, the anchor no longer works because the ID of the title changes. Can we give a fixed id to the post title? Or is there a way to keep the instanceID? 23284ea2283a9fb9c67a7b22ffad60cd.mp4 |
const titleNode = document.querySelector( '.editor-post-title__input' ); | ||
const titleNode = | ||
document.querySelector( '.editor-post-title__input' ) || | ||
window.frames[ 'editor-canvas' ]?.document.querySelector( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like this. :) Could we call onSelect
for the PostTitle
, which is in this package? I guess we'd have to move the local state to the package store first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by state
? And which part exactly you don't like? I mean querying for nodes is bad, but I don't think I deviated here from the existing document.querySelector( '.editor-post-title__input' )
. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that state is the isSelected that the PostTitle
component has. This would mean that the code would be something like the following? 🤔
const { selectPostTitle } = useDispatch( editorStore );
const isPostTypeSelected = useSelect(
( select ) => {
return select( editorStore ).isPostTitleSelected();
},
[]
);
If so, I think the problem with #48189 may be resolved.
@t-hamano that seems to be the case for every block in classic and hybrid themes as well, since when we iframed the previews. In these themes we don't iframe initially(desktop) but then iframe the previews resulting in different Opened a new issue about this: #48189 |
What?
Part of: #47624
If the editor content is an iframe, the title area will not be displayed. And if the post editor is not iframed, the title is not selected when we click it.
Testing Instructions
outline
click the title and should be selected